8000 Fix compile bug in MtmJoinTransaction · postgrespro/postgres_cluster@02f8431 · GitHub
[go: up one dir, main page]

Skip to content

Commit 02f8431

Browse files
committed
Fix compile bug in MtmJoinTransaction
1 parent 1ae3274 commit 02f8431

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

contrib/mmts/multimaster.c

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ void MtmJoinTransaction(GlobalTransactionId* gtid, csn_t globalSnapshot)
879879
if (!TransactionIdIsValid(gtid->xid)) {
880880
/* In case of recovery InvalidTransactionId is passed */
881881
if (Mtm->status != MTM_RECOVERY) {
882-
elog(PANIC, "Node %d tries to recover node %d which is in %s mode", MtmReplicationNode, MtmNodeId, MtmNodeStatusMnem[Mtm->status]);
882+
elog(PANIC, "Node %d tries to recover node %d which is in %s mode", MtmReplicationNodeId, MtmNodeId, MtmNodeStatusMnem[Mtm->status]);
883883
}
884884
} else if (Mtm->status == MTM_RECOVERY) {
885885
/* When recovery is completed we get normal transaction ID and switch to normal mode */
@@ -2165,20 +2165,21 @@ Datum mtm_dump_lock_graph(PG_FUNCTION_ARGS)
21652165
{
21662166
size_t size;
21672167
char *data = RaftableGet(psprintf("lock-graph-%d", i+1), &size, NULL, true);
2168-
if (!data) continue;
2169-
GlobalTransactionId *gtid = (GlobalTransactionId *)data;
2170-
GlobalTransactionId *last = (GlobalTransactionId *)(data + size);
2171-
appendStringInfo(s, "node-%d lock graph: ", i+1);
2172-
while (gtid != last) {
2173-
GlobalTransactionId *src = gtid++;
2174-
appendStringInfo(s, "%d:%d -> ", src->node, src->xid);
2175-
while (gtid->node != 0) {
2176-
GlobalTransactionId *dst = gtid++;
2177-
appendStringInfo(s, "%d:%d, ", dst->node, dst->xid);
2168+
if (data) {
2169+
GlobalTransactionId *gtid = (GlobalTransactionId *)data;
2170+
GlobalTransactionId *last = (GlobalTransactionId *)(data + size);
2171+
appendStringInfo(s, "node-%d lock graph: ", i+1);
2172+
while (gtid != last) {
2173+
GlobalTransactionId *src = gtid++;
2174+
appendStringInfo(s, "%d:%d -> ", src->node, src->xid);
2175+
while (gtid->node != 0) {
2176+
GlobalTransactionId *dst = gtid++;
2177+
appendStringInfo(s, "%d:%d, ", dst->node, dst->xid);
2178+
}
2179+
gtid += 1;
21782180
}
2179-
gtid += 1;
2181+
appendStringInfo(s, "\n");
21802182
}
2181-
appendStringInfo(s, "\n");
21822183
}
21832184
return CStringGetTextDatum(s->data);
21842185
}

0 commit comments

Comments
 (0)
0