Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 76c96f6

Browse files
committed
Add TXFINISH optional logs
1 parent 8a957a4 commit 76c96f6

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

arbiter.c

+2
Original file line numberDiff line numberDiff line change
@@ -987,6 +987,7 @@ static void MtmReceiver(Datum arg)
987987
msg->gid, MtmTxnStatusMnem[msg->status], node);
988988

989989
replorigin_session_origin = DoNotReplicateId;
990+
TXFINISH("%s ABORT, MSG_POLL_STATUS", msg->gid);
990991
MtmFinishPreparedTransaction(ts, false);
991992
replorigin_session_origin = InvalidRepOriginId;
992993
}
@@ -1000,6 +1001,7 @@ static void MtmReceiver(Datum arg)
10001001
MTM_ELOG(LOG, "Commit transaction %s because it is prepared at all live nodes", msg->gid);
10011002

10021003
replorigin_session_origin = DoNotReplicateId;
1004+
TXFINISH("%s COMMIT, MSG_POLL_STATUS", msg->gid);
10031005
MtmFinishPreparedTransaction(ts, true);
10041006
replorigin_session_origin = InvalidRepOriginId;
10051007
} else {

multimaster.c

+5
Original file line numberDiff line numberDiff line change
@@ -1974,10 +1974,12 @@ void MtmPollStatusOfPreparedTransactionsForDisabledNode(int disabledNodeId, bool
19741974
Assert(ts->gid[0]);
19751975
if (ts->status == TRANSACTION_STATUS_IN_PROGRESS) {
19761976
MTM_ELOG(LOG, "Abort transaction %s because its coordinator is disabled and it is not prepared at node %d", ts->gid, MtmNodeId);
1977+
TXFINISH("%s ABORT, PollStatusOfPrepared", ts->gid);
19771978
MtmFinishPreparedTransaction(ts, false);
19781979
} else {
19791980
if (commitPrecommited)
19801981
{
1982+
TXFINISH("%s COMMIT, PollStatusOfPrepared", ts->gid);
19811983
MtmFinishPreparedTransaction(ts, true);
19821984
}
19831985
else
@@ -3305,6 +3307,7 @@ void MtmRollbackPreparedTransaction(int nodeId, char const* gid)
33053307
StartTransactionCommand();
33063308
MtmBeginSession(nodeId);
33073309
MtmSetCurrentTransactionGID(gid);
3310+
TXFINISH("%s ABORT, MtmRollbackPrepared", gid);
33083311
FinishPreparedTransaction(gid, false);
33093312
MtmTx.isActive = true;
33103313
CommitTransactionCommand();
@@ -4588,9 +4591,11 @@ static bool MtmTwoPhaseCommit(MtmCurrentTrans* x)
45884591
ts = (MtmTransState*) hash_search(MtmXid2State, &(x->xid), HASH_FIND, NULL);
45894592
Assert(ts);
45904593

4594+
TXFINISH("%s ABORT, MtmTwoPhase", x->gid);
45914595
FinishPreparedTransaction(x->gid, false);
45924596
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);
45934597
} else {
4598+
TXFINISH("%s COMMIT, MtmTwoPhase", x->gid);
45944599
FinishPreparedTransaction(x->gid, true);
45954600
MTM_TXTRACE(x, "MtmTwoPhaseCommit Committed");
45964601
MTM_LOG2("Distributed transaction %s (%lld) is committed at %lld with LSN=%lld", x->gid, (long64)x->xid, MtmGetCurrentTime(), (long64)GetXLogInsertRecPtr());

multimaster.h

+8
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@
4141
#define MTM_LOG4(fmt, ...) fprintf(stderr, fmt "\n", ## __VA_ARGS__)
4242
#endif
4343

44+
// #define MTM_TXFINISH 1
45+
46+
#ifndef MTM_TXFINISH
47+
#define TXFINISH(fmt, ...)
48+
#else
49+
#define TXFINISH(fmt, ...) elog(LOG, MTM_TAG "[TXFINISH] " fmt, ## __VA_ARGS__)
50+
#endif
51+
4452
// #define MTM_TRACE 1
4553

4654
#ifndef MTM_TRACE

pglogical_apply.c

+2
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,7 @@ process_remote_commit(StringInfo in)
726726
MTM_LOG1("Perform delayed rollback of prepared global transaction %s", gid);
727727
StartTransactionCommand();
728728
MtmSetCurrentTransactionGID(gid);
729+
TXFINISH("%s ABORT, PGLOGICAL_PREPARE", gid);
729730
FinishPreparedTransaction(gid, false);
730731
CommitTransactionCommand();
731732
Assert(!MtmTransIsActive());
@@ -755,6 +756,7 @@ process_remote_commit(StringInfo in)
755756
else
756757
MtmSetCurrentTransactionCSN(csn);
757758
MtmSetCurrentTransactionGID(gid);
759+
TXFINISH("%s COMMIT, PGLOGICAL_COMMIT_PREPARED csn=%lld", gid, csn);
758760
FinishPreparedTransaction(gid, true);
759761
MTM_LOG2("Distributed transaction %s is committed", gid);
760762
CommitTransactionCommand();

0 commit comments

Comments
 (0)