Skip to content

Commit b243021

Browse files
knizhnikkelvich
authored andcommitted
Close relation before processing of DDL messages
1 parent 6a3ebc6 commit b243021

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

multimaster.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1276,7 +1276,7 @@ MtmPostPrepareTransaction(MtmCurrentTrans* x)
12761276
MtmUnlock();
12771277
if (x->isTwoPhase) {
12781278
if (x->status == TRANSACTION_STATUS_ABORTED) {
1279-
MTM_ELOG(ERROR, "Prepare of user's 2PC transaction %s (%llu) is aborted by DTM", x->gid, (long64)x->xid);
1279+
MTM_ELOG(WARNING, "Prepare of user's 2PC transaction %s (%llu) is aborted by DTM", x->gid, (long64)x->xid);
12801280
}
12811281
MtmResetTransaction();
12821282
}
@@ -3412,7 +3412,7 @@ void MtmFinishPreparedTransaction(MtmTransState* ts, bool commit)
34123412
MtmTx.isActive = true;
34133413
FinishPreparedTransaction(ts->gid, commit);
34143414
if (commit) {
3415-
MTM_LOG1("Distributed transaction %s (%lld) is committed at %lld with LSN=%lld", ts->gid, (long64)ts->xid, MtmGetCurrentTime(), (long64)GetXLogInsertRecPtr());
3415+
MTM_LOG2("Distributed transaction %s (%lld) is committed at %lld with LSN=%lld", ts->gid, (long64)ts->xid, MtmGetCurrentTime(), (long64)GetXLogInsertRecPtr());
34163416
}
34173417
if (!insideTransaction) {
34183418
CommitTransactionCommand();
@@ -4600,7 +4600,7 @@ static bool MtmTwoPhaseCommit(MtmCurrentTrans* x)
46004600
MTM_ELOG(ERROR, "Transaction %s (%llu) is aborted by DTM", x->gid, (long64)x->xid);
46014601
} else {
46024602
FinishPreparedTransaction(x->gid, true);
4603-
MTM_LOG1("Distributed transaction %s (%lld) is committed at %lld with LSN=%lld", x->gid, (long64)x->xid, MtmGetCurrentTime(), (long64)GetXLogInsertRecPtr());
4603+
MTM_LOG2("Distributed transaction %s (%lld) is committed at %lld with LSN=%lld", x->gid, (long64)x->xid, MtmGetCurrentTime(), (long64)GetXLogInsertRecPtr());
46044604
}
46054605
}
46064606
}
@@ -4868,7 +4868,6 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
48684868
case TRANS_STMT_ROLLBACK_PREPARED:
48694869
Assert(!MtmTx.isTwoPhase);
48704870
strcpy(MtmTx.gid, stmt->gid);
4871-
//MtmTx.isTwoPhase = true;
48724871
break;
48734872
default:
48744873
break;

pglogical_apply.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,6 +1150,8 @@ void MtmExecutor(void* work, size_t size)
11501150
}
11511151
case 'M':
11521152
{
1153+
close_rel(rel);
1154+
rel = NULL;
11531155
inside_transaction = !process_remote_message(&s);
11541156
break;
11551157
}

pglogical_proto.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ static void
171171
pglogical_write_message(StringInfo out,
172172
const char *prefix, Size sz, const char *message)
173173
{
174+
MtmLastRelId = InvalidOid;
174175
switch (*prefix) {
175176
case 'L':
176177
if (MtmIsRecoveredNode(MtmReplicationNodeId)) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy