Skip to content

Commit 1794b3f

Browse files
committed
extra check to skip replication after logical message was written to WAL
1 parent 1e3bdee commit 1794b3f

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

multimaster.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1659,7 +1659,7 @@ bool MtmRefreshClusterStatus(bool nowait, int testNodeId)
16591659
/* Interrupt voting for active transaction and abort them */
16601660
for (ts = Mtm->transListHead; ts != NULL; ts = ts->next) {
16611661
MTM_LOG3("Active transaction gid='%s', coordinator=%d, xid=%d, status=%d, gtid.xid=%d",
1662-
ts->gid, ts->gtid.nхode, ts->xid, ts->status, ts->gtid.xid);
1662+
ts->gid, ts->gtid.node, ts->xid, ts->status, ts->gtid.xid);
16631663
if (MtmIsCoordinator(ts)) {
16641664
if (!ts->votingCompleted && disabled != 0 && ts->status != TRANSACTION_STATUS_ABORTED) {
16651665
MtmAbortTransaction(ts);
@@ -3825,6 +3825,7 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
38253825
{
38263826
MTM_LOG1("Xact accessed temp table, stopping replication");
38273827
MtmTx.isDistributed = false; /* Skip */
3828+
MtmTx.snapshot = INVALID_CSN;
38283829
}
38293830

38303831
}

pglogical_proto.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,14 @@ pglogical_write_begin(StringInfo out, PGLogicalOutputData *data,
112112

113113
if (!isRecovery && csn == INVALID_CSN) {
114114
MtmIsFilteredTxn = true;
115-
} else {
115+
MTM_LOG3("%d: pglogical_write_begin XID=%d filtered", MyProcPid, txn->xid);
116+
} else {
117+
MTM_LOG3("%d: pglogical_write_begin XID=%d sent", MyProcPid, txn->xid);
118+
MtmIsFilteredTxn = false;
116119
pq_sendbyte(out, 'B'); /* BEGIN */
117120
pq_sendint(out, MtmNodeId, 4);
118121
pq_sendint(out, isRecovery ? InvalidTransactionId : txn->xid, 4);
119122
pq_sendint64(out, csn);
120-
MtmIsFilteredTxn = false;
121123
MtmTransactionRecords = 0;
122124
}
123125
}
@@ -126,6 +128,12 @@ static void
126128
pglogical_write_message(StringInfo out,
127129
const char *prefix, Size sz, const char *message)
128130
{
131+
if (MtmIsFilteredTxn)
132+
{
133+
MTM_LOG3("%d: pglogical_write_message filtered", MyProcPid);
134+
return;
135+
}
136+
129137
pq_sendbyte(out, 'G');
130138
pq_sendbytes(out, message, sz);
131139
pq_sendbyte(out, '\0');

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