Skip to content

Commit 9a81a5b

Browse files
committed
Improve TXTRACE logs
1 parent 32380a1 commit 9a81a5b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

multimaster.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1414,6 +1414,8 @@ MtmPreCommitPreparedTransaction(MtmCurrentTrans* x)
14141414
MtmTransMap* tm;
14151415
MtmTransState* ts;
14161416

1417+
MTM_TXTRACE(x, "MtmPreCommitPreparedTransaction Start");
1418+
14171419
if (Mtm->status == MTM_RECOVERY || x->isReplicated || x->isPrepared) { /* Ignore auto-2PC originated by multimaster */
14181420
return;
14191421
}
@@ -1447,12 +1449,17 @@ MtmPreCommitPreparedTransaction(MtmCurrentTrans* x)
14471449
x->isPrepared = true;
14481450
}
14491451
MtmUnlock();
1452+
1453+
MTM_TXTRACE(x, "MtmPreCommitPreparedTransaction Finish");
14501454
}
14511455

14521456
static void
14531457
MtmAbortPreparedTransaction(MtmCurrentTrans* x)
14541458
{
14551459
MtmTransMap* tm;
1460+
1461+
MTM_TXTRACE(x, "MtmAbortPreparedTransaction Start");
1462+
14561463
if (x->status != TRANSACTION_STATUS_ABORTED) {
14571464
MtmLock(LW_EXCLUSIVE);
14581465
tm = (MtmTransMap*)hash_search(MtmGid2State, x->gid, HASH_FIND, NULL);
@@ -1472,6 +1479,8 @@ MtmAbortPreparedTransaction(MtmCurrentTrans* x)
14721479
} else {
14731480
MTM_LOG1("Transaction %s (%llu) is already aborted", x->gid, (long64)x->xid);
14741481
}
1482+
1483+
MTM_TXTRACE(x, "MtmAbortPreparedTransaction Finish");
14751484
}
14761485

14771486
static void
@@ -1495,6 +1504,8 @@ MtmEndTransaction(MtmCurrentTrans* x, bool commit)
14951504
MyProcPid, (long64)x->xid, x->isPrepared, x->isReplicated, x->isDistributed, x->isTwoPhase, x->gid, commit ? "commit" : "abort", (long64)GetXLogInsertRecPtr());
14961505
commit &= (x->status != TRANSACTION_STATUS_ABORTED);
14971506

1507+
MTM_TXTRACE(x, "MtmEndTransaction Start (c=%d)", commit);
1508+
14981509
MtmLock(LW_EXCLUSIVE);
14991510

15001511
MtmStopTransaction();
@@ -1591,6 +1602,8 @@ MtmEndTransaction(MtmCurrentTrans* x, bool commit)
15911602
}
15921603
MtmUnlock();
15931604

1605+
MTM_TXTRACE(x, "MtmEndTransaction Finish");
1606+
15941607
MtmResetTransaction();
15951608
if (MtmClusterLocked) {
15961609
MtmUnlockCluster();
@@ -4537,6 +4550,8 @@ MtmGenerateGid(char* gid)
45374550
*/
45384551
static bool MtmTwoPhaseCommit(MtmCurrentTrans* x)
45394552
{
4553+
MTM_TXTRACE(x, "MtmTwoPhaseCommit Start");
4554+
45404555
if (!x->isReplicated && x->isDistributed && x->containsDML) {
45414556
MtmGenerateGid(x->gid);
45424557
if (!x->isTransactionBlock) {
@@ -4564,6 +4579,7 @@ static bool MtmTwoPhaseCommit(MtmCurrentTrans* x)
45644579
MTM_ELOG(ERROR, "Transaction %s (%llu) is aborted on node %d. Check its log to see error details.", x->gid, (long64)x->xid, ts->abortedByNode);
45654580
} else {
45664581
FinishPreparedTransaction(x->gid, true);
4582+
MTM_TXTRACE(x, "MtmTwoPhaseCommit Committed");
45674583
MTM_LOG2("Distributed transaction %s (%lld) is committed at %lld with LSN=%lld", x->gid, (long64)x->xid, MtmGetCurrentTime(), (long64)GetXLogInsertRecPtr());
45684584
}
45694585
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy