Skip to content

Commit 6761fc9

Browse files
committed
Replace assert in EndTransaction with reporting error
1 parent 744e089 commit 6761fc9

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

contrib/mmts/multimaster.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,9 +1110,14 @@ MtmEndTransaction(MtmCurrentTrans* x, bool commit)
11101110
}
11111111
if (ts != NULL) {
11121112
if (commit) {
1113-
/* Assert(ts->status == TRANSACTION_STATUS_UNKNOWN); */
1114-
Assert(ts->status == TRANSACTION_STATUS_UNKNOWN
1115-
|| (ts->status == TRANSACTION_STATUS_IN_PROGRESS && Mtm->status == MTM_RECOVERY)); /* ??? Why there is commit without prepare */
1113+
if (!(ts->status == TRANSACTION_STATUS_UNKNOWN
1114+
|| (ts->status == TRANSACTION_STATUS_IN_PROGRESS && Mtm->status == MTM_RECOVERY)))
1115+
{
1116+
elog(ERROR, "Attempt to commit %s transaction %d (%s)",
1117+
ts->status == TRANSACTION_STATUS_ABORTED ? "aborted"
1118+
: ts->status == TRANSACTION_STATUS_COMMITTED ? "committed" : "not prepared",
1119+
ts->xid, ts->gid);
1120+
}
11161121
if (x->csn > ts->csn || Mtm->status == MTM_RECOVERY) {
11171122
ts->csn = x->csn;
11181123
MtmSyncClock(ts->csn);

0 commit comments

Comments
 (0)