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

Commit 80b437f

Browse files
committed
add some asserts and logs to simplify debugging
1 parent e6715cd commit 80b437f

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

arbiter.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,6 +1022,7 @@ void MtmReceiver(Datum arg)
10221022
continue;
10231023
case MSG_POLL_STATUS:
10241024
Assert(*msg->gid);
1025+
MTM_LOG1("Got response for transaction %s -> %s", msg->gid, MtmTxnStatusMnem[msg->status]);
10251026
tm = (MtmTransMap*)hash_search(MtmGid2State, msg->gid, HASH_FIND, NULL);
10261027
if (tm == NULL || tm->state == NULL) {
10271028
MTM_ELOG(WARNING, "Response for non-existing transaction %s from node %d", msg->gid, node);

multimaster.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,6 +1248,8 @@ MtmVotingCompleted(MtmTransState* ts)
12481248
{
12491249
nodemask_t liveNodesMask = (((nodemask_t)1 << Mtm->nAllNodes) - 1) & ~Mtm->disabledNodeMask & ~((nodemask_t)1 << (MtmNodeId-1));
12501250

1251+
Assert(ts->gtid.node == MtmNodeId);
1252+
12511253
if (ts->nConfigChanges != Mtm->nConfigChanges)
12521254
{
12531255
if (MtmGetCurrentStatus() == MTM_ONLINE)
@@ -1273,6 +1275,7 @@ MtmVotingCompleted(MtmTransState* ts)
12731275
&& (ts->participantsMask & ~Mtm->disabledNodeMask & ~ts->votedMask) == 0) /* all live participants voted */
12741276
{
12751277
if (ts->isPrepared) {
1278+
Assert(ts->isTwoPhase || !MtmUseDtm);
12761279
ts->csn = MtmAssignCSN();
12771280
ts->votingCompleted = true;
12781281
ts->status = TRANSACTION_STATUS_UNKNOWN;
@@ -1282,6 +1285,7 @@ MtmVotingCompleted(MtmTransState* ts)
12821285
ts->gid, MtmTxnStatusMnem[ts->status], ts->participantsMask, Mtm->disabledNodeMask, ts->votedMask);
12831286
ts->isPrepared = true;
12841287
if (ts->isTwoPhase) {
1288+
Assert(false);
12851289
ts->votingCompleted = true;
12861290
return true;
12871291
} else if (MtmUseDtm) {
@@ -2110,16 +2114,12 @@ MtmPollStatusOfPreparedTransactions(bool majorMode)
21102114
{
21112115
MtmTransState *ts = MtmGetActiveTransaction(cur);
21122116

2113-
MTM_LOG1("X_MtmPollStatusOfPreparedTransactions %s, major=%d, status=%d, isPrepared=%d, valid=%d, completed=%d", ts->gid, majorMode, ts->status, ts->isPrepared, TransactionIdIsValid(ts->gtid.xid), ts->votingCompleted);
2114-
21152117
if (TransactionIdIsValid(ts->gtid.xid)
21162118
&& ts->votingCompleted /* If voting is not yet completed, then there is some backend coordinating this transaction */
21172119
&& (ts->status == TRANSACTION_STATUS_UNKNOWN || ts->status == TRANSACTION_STATUS_IN_PROGRESS))
21182120
{
21192121
Assert(ts->gid[0]);
21202122

2121-
MTM_LOG1("MtmPollStatusOfPreparedTransactions %s, major=%d, status=%d, isPrepared=%d", ts->gid, majorMode, ts->status, ts->isPrepared);
2122-
21232123
if (majorMode)
21242124
{
21252125
MtmFinishPreparedTransaction(ts, ts->status == TRANSACTION_STATUS_UNKNOWN);

pglogical_apply.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,11 @@ process_remote_message(StringInfo s)
578578
MTM_LOG1("Ignore rollback of transaction %s from node %d because it's LSN %llx <= %llx",
579579
msg->gid, origin_node, msg->origin_lsn, Mtm->nodes[origin_node-1].restartLSN);
580580
}
581+
else
582+
{
583+
MTM_LOG1("Ignore rollback of transaction %s from node %d because it's LSN is invalid",
584+
msg->gid, origin_node);
585+
}
581586
}
582587
standalone = true;
583588
break;

0 commit comments

Comments
 (0)