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

Commit cf55766

Browse files
committed
Show error when user tries to use wrong database
1 parent af8b8d1 commit cf55766

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

multimaster.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ char const* const MtmTxnStatusMnem[] =
218218
bool MtmDoReplication;
219219
char* MtmDatabaseName;
220220
char* MtmDatabaseUser;
221+
Oid MtmDatabaseId;
221222

222223
int MtmNodes;
223224
int MtmNodeId;
@@ -938,6 +939,12 @@ MtmPrePrepareTransaction(MtmCurrentTrans* x)
938939
bool found;
939940
MTM_TXTRACE(x, "PrePrepareTransaction Start");
940941

942+
if (!MtmDatabaseId)
943+
MtmDatabaseId = get_database_oid(MtmDatabaseName, false);
944+
945+
if (MtmDatabaseId != MyDatabaseId)
946+
MTM_ELOG(ERROR, "Refusing to work. Multimaster configured to work with database '%s'", MtmDatabaseName);
947+
941948
if (!x->isDistributed) {
942949
return;
943950
}

0 commit comments

Comments
 (0)