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

Commit 9914ce5

Browse files
knizhnikkelvich
authored andcommitted
Check for unsupported isolation level
1 parent 18001c1 commit 9914ce5

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

multimaster.c

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

0 commit comments

Comments
 (0)