Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitca70781

Browse files
committed
Add TXFINISH optional logs
1 parentcef84ed commitca70781

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

‎contrib/mmts/arbiter.c

Lines changed: 2 additions & 0 deletions
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 {

‎contrib/mmts/multimaster.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1973,10 +1973,12 @@ void MtmPollStatusOfPreparedTransactionsForDisabledNode(int disabledNodeId, bool
19731973
Assert(ts->gid[0]);
19741974
if (ts->status==TRANSACTION_STATUS_IN_PROGRESS) {
19751975
MTM_ELOG(LOG,"Abort transaction %s because its coordinator is disabled and it is not prepared at node %d",ts->gid,MtmNodeId);
1976+
TXFINISH("%s ABORT, PollStatusOfPrepared",ts->gid);
19761977
MtmFinishPreparedTransaction(ts, false);
19771978
}else {
19781979
if (commitPrecommited)
19791980
{
1981+
TXFINISH("%s COMMIT, PollStatusOfPrepared",ts->gid);
19801982
MtmFinishPreparedTransaction(ts, true);
19811983
}
19821984
else
@@ -3309,6 +3311,7 @@ void MtmRollbackPreparedTransaction(int nodeId, char const* gid)
33093311
StartTransactionCommand();
33103312
MtmBeginSession(nodeId);
33113313
MtmSetCurrentTransactionGID(gid);
3314+
TXFINISH("%s ABORT, MtmRollbackPrepared",gid);
33123315
FinishPreparedTransaction(gid, false);
33133316
MtmTx.isActive= true;
33143317
CommitTransactionCommand();
@@ -4592,9 +4595,11 @@ static bool MtmTwoPhaseCommit(MtmCurrentTrans* x)
45924595
ts= (MtmTransState*)hash_search(MtmXid2State,&(x->xid),HASH_FIND,NULL);
45934596
Assert(ts);
45944597

4598+
TXFINISH("%s ABORT, MtmTwoPhase",x->gid);
45954599
FinishPreparedTransaction(x->gid, false);
45964600
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);
45974601
}else {
4602+
TXFINISH("%s COMMIT, MtmTwoPhase",x->gid);
45984603
FinishPreparedTransaction(x->gid, true);
45994604
MTM_TXTRACE(x,"MtmTwoPhaseCommit Committed");
46004605
MTM_LOG2("Distributed transaction %s (%lld) is committed at %lld with LSN=%lld",x->gid, (long64)x->xid,MtmGetCurrentTime(), (long64)GetXLogInsertRecPtr());

‎contrib/mmts/multimaster.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@
4141
#defineMTM_LOG4(fmt, ...) fprintf(stderr, fmt "\n", ## __VA_ARGS__)
4242
#endif
4343

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

4654
#ifndefMTM_TRACE

‎contrib/mmts/pglogical_apply.c

Lines changed: 2 additions & 0 deletions
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)

[8]ページ先頭

©2009-2025 Movatter.jp