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

Commit 2ef8627

Browse files
committed
Log "E" message after receiving DDL to properly reset DDLInProgress in decoder
1 parent 464df6d commit 2ef8627

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

src/ddl.c

+4
Original file line numberDiff line numberDiff line change
@@ -1146,6 +1146,10 @@ MtmApplyDDLMessage(const char *messageBody, bool transactional)
11461146
if (ActiveSnapshotSet())
11471147
PopActiveSnapshot();
11481148

1149+
/* Log "E" message to reset DDLInProgress in decoder */
1150+
if (transactional)
1151+
MtmFinishDDLCommand();
1152+
11491153
debug_query_string = NULL;
11501154
}
11511155

src/include/logger.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ typedef enum MtmLogTag
5555

5656
/* walsender's proto */
5757
ProtoTraceFilter = DEBUG1,
58-
ProtoTraceTx = DEBUG1,
58+
ProtoTraceSender = DEBUG2,
5959
ProtoTraceMode = LOG,
6060
ProtoTraceMessage = LOG,
6161
ProtoTraceState = LOG,

src/pglogical_proto.c

+11-2
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ pglogical_write_begin(StringInfo out, PGLogicalOutputData *data,
164164

165165
MtmTransactionRecords = 0;
166166

167-
mtm_log(ProtoTraceTx, "pglogical_write_begin xid=" XID_FMT " sent",
168-
txn->xid);
167+
mtm_log(ProtoTraceSender, "pglogical_write_begin xid=" XID_FMT " gid=%s",
168+
txn->xid, txn->gid);
169169
}
170170

171171
static void pglogical_seq_nextval(StringInfo out, LogicalDecodingContext *ctx, MtmSeqPosition* pos)
@@ -288,6 +288,10 @@ static void
288288
pglogical_write_insert(StringInfo out, PGLogicalOutputData *data,
289289
Relation rel, HeapTuple newtuple)
290290
{
291+
292+
elog(ProtoTraceSender, "pglogical_write_insert %d %d",
293+
MtmIsFilteredTxn, DDLInProgress);
294+
291295
if (MtmIsFilteredTxn)
292296
{
293297
mtm_log(ProtoTraceFilter, "pglogical_write_insert filtered");
@@ -405,6 +409,9 @@ pglogical_write_prepare(StringInfo out, PGLogicalOutputData *data,
405409
{
406410
uint8 event = *txn->state_3pc ? PGLOGICAL_PRECOMMIT_PREPARED : PGLOGICAL_PREPARE;
407411

412+
/* Ensure that we reset DDLInProgress */
413+
Assert(!DDLInProgress);
414+
408415
/* COMMIT and PREPARE are preceded by BEGIN, which set MtmIsFilteredTxn flag */
409416
if (MtmIsFilteredTxn && event == PGLOGICAL_PREPARE)
410417
return;
@@ -423,6 +430,8 @@ pglogical_write_prepare(StringInfo out, PGLogicalOutputData *data,
423430
pq_sendint64(out, txn->origin_lsn);
424431

425432
pq_sendstring(out, txn->gid);
433+
434+
mtm_log(ProtoTraceSender, "XXX: pglogical_write_prepare %s", txn->gid);
426435
}
427436

428437
/*

0 commit comments

Comments
 (0)