Skip to content

Commit 439df38

Browse files
committed
Merge branch 'master' of github.com:postgrespro/postgres_cluster
2 parents e57ee93 + 2151bff commit 439df38

File tree

2 files changed

+28
-13
lines changed

2 files changed

+28
-13
lines changed

contrib/mmts/multimaster.c

Lines changed: 23 additions & 8 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 {
@@ -3782,6 +3783,16 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
37823783
MTM_LOG3("%d: Process utility statement %s", MyProcPid, queryString);
37833784
switch (nodeTag(parsetree))
37843785
{
3786+
case T_IndexStmt:
3787+
{
3788+
IndexStmt* stmt = (IndexStmt*) parsetree;
3789+
if (stmt->concurrent) {
3790+
stmt->concurrent = false;
3791+
elog(WARNING, "Disable concurrent option for index creation");
3792+
}
3793+
break;
3794+
}
3795+
37853796
case T_TransactionStmt:
37863797
{
37873798
TransactionStmt *stmt = (TransactionStmt *) parsetree;
@@ -3797,7 +3808,7 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
37973808
}
37983809
break;
37993810
case TRANS_STMT_PREPARE:
3800-
elog(ERROR, "Two phase commit is not supported by multimaster");
3811+
//elog(ERROR, "Two phase commit is not supported by multimaster");
38013812
break;
38023813
case TRANS_STMT_COMMIT_PREPARED:
38033814
case TRANS_STMT_ROLLBACK_PREPARED:
@@ -3957,7 +3968,11 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
39573968
standard_ProcessUtility(parsetree, queryString, context,
39583969
params, dest, completionTag);
39593970
}
3960-
3971+
3972+
if (MtmTx.isDistributed && XactIsoLevel != XACT_REPEATABLE_READ) {
3973+
elog(ERROR, "Isolation level %s is not supported by multimaster", isoLevelStr[XactIsoLevel]);
3974+
}
3975+
39613976
if (MyXactAccessedTempRel)
39623977
{
39633978
MTM_LOG1("Xact accessed temp table, stopping replication");

regress.sql

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
create extension multimaster;
2-
ALTER DATABASE "postgres" SET lc_messages TO 'C';
3-
ALTER DATABASE "postgres" SET lc_monetary TO 'C';
4-
ALTER DATABASE "postgres" SET lc_numeric TO 'C';
5-
ALTER DATABASE "postgres" SET lc_time TO 'C';
6-
ALTER DATABASE "postgres" SET timezone_abbreviations TO 'Default';
2+
ALTER DATABASE "regression" SET lc_messages TO 'C';
3+
ALTER DATABASE "regression" SET lc_monetary TO 'C';
4+
ALTER DATABASE "regression" SET lc_numeric TO 'C';
5+
ALTER DATABASE "regression" SET lc_time TO 'C';
6+
ALTER DATABASE "regression" SET timezone_abbreviations TO 'Default';
77

0 commit comments

Comments
 (0)