Skip to content

Commit 2151bff

Browse files
committed
Check for unsupported isolation level
1 parent 7ede347 commit 2151bff

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

contrib/mmts/multimaster.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -755,9 +755,6 @@ MtmBeginTransaction(MtmCurrentTrans* x)
755755
MtmUnlock();
756756
elog(ERROR, "Multimaster node is not online: current status %s", MtmNodeStatusMnem[Mtm->status]);
757757
}
758-
if (x->isDistributed && XactIsoLevel != XACT_REPEATABLE_READ) {
759-
elog(LOG, "Isolation level %s is not supported by multimaster", isoLevelStr[XactIsoLevel]);
760-
}
761758
x->containsDML = false;
762759
x->snapshot = MtmAssignCSN();
763760
x->gtid.xid = InvalidTransactionId;
@@ -984,9 +981,13 @@ MtmAbortPreparedTransaction(MtmCurrentTrans* x)
984981
if (x->status != TRANSACTION_STATUS_ABORTED) {
985982
MtmLock(LW_EXCLUSIVE);
986983
tm = (MtmTransMap*)hash_search(MtmGid2State, x->gid, HASH_REMOVE, NULL);
987-
Assert(tm != NULL && tm->state != NULL);
988-
MTM_LOG1("Abort prepared transaction %d with gid='%s'", x->xid, x->gid);
989-
MtmAbortTransaction(tm->state);
984+
if (tm == NULL) {
985+
elog(WARNING, "Global transaciton ID %s is not found", x->gid);
986+
} else {
987+
Assert(tm->state != NULL);
988+
MTM_LOG1("Abort prepared transaction %d with gid='%s'", x->xid, x->gid);
989+
MtmAbortTransaction(tm->state);
990+
}
990991
MtmUnlock();
991992
x->status = TRANSACTION_STATUS_ABORTED;
992993
} else {
@@ -3938,7 +3939,11 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
39383939
standard_ProcessUtility(parsetree, queryString, context,
39393940
params, dest, completionTag);
39403941
}
3941-
3942+
3943+
if (MtmTx.isDistributed && XactIsoLevel != XACT_REPEATABLE_READ) {
3944+
elog(ERROR, "Isolation level %s is not supported by multimaster", isoLevelStr[XactIsoLevel]);
3945+
}
3946+
39423947
if (MyXactAccessedTempRel)
39433948
{
39443949
MTM_LOG1("Xact accessed temp table, stopping replication");

0 commit comments

Comments
 (0)