Skip to content

Commit ac34bd8

Browse files
knizhnikkelvich
authored andcommitted
Replace assert in EndTransaction with reporting error
1 parent 9b896e6 commit ac34bd8

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

multimaster.c

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

0 commit comments

Comments
 (0)