From 2a7baf771f161a165907b7f8038aed6d12e3cc36 Mon Sep 17 00:00:00 2001 From: Tomas Vondra Date: Fri, 27 Dec 2019 23:46:15 +0100 Subject: [PATCH 09/17] fixup: get rid of is_schema_sent entirely We'll do this in the pgoutput.c code directly, not in reorderbuffer. --- .../replication/logical/reorderbuffer.c | 26 ++----------------- src/include/replication/reorderbuffer.h | 5 ---- 2 files changed, 2 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c index 0ab319182a..85db15ea3b 100644 --- a/src/backend/replication/logical/reorderbuffer.c +++ b/src/backend/replication/logical/reorderbuffer.c @@ -2229,7 +2229,6 @@ ReorderBufferCommit(ReorderBuffer *rb, TransactionId xid, * about the message itself? */ LocalExecuteInvalidationMessage(&change->data.inval.msg); - txn->is_schema_sent = false; break; case REORDER_BUFFER_CHANGE_INTERNAL_TUPLECID: @@ -2729,9 +2728,6 @@ ReorderBufferExecuteInvalidations(ReorderBuffer *rb, ReorderBufferTXN *txn) for (i = 0; i < txn->ninvalidations; i++) LocalExecuteInvalidationMessage(&txn->invalidations[i]); - - /* Invalidate current schema as well */ - txn->is_schema_sent = false; } /* @@ -2747,22 +2743,12 @@ ReorderBufferXidSetCatalogChanges(ReorderBuffer *rb, TransactionId xid, txn->txn_flags |= RBTXN_HAS_CATALOG_CHANGES; - /* - * We read catalog changes from WAL, which are not yet sent, so - * invalidate current schema in order output plugin can resend - * schema again. - */ - txn->is_schema_sent = false; - /* * TOCHECK: Mark toplevel transaction as having catalog changes too * if one of its children has. */ if (txn->toptxn != NULL) - { txn->toptxn->txn_flags |= RBTXN_HAS_CATALOG_CHANGES; - txn->toptxn->is_schema_sent = false; - } } /* @@ -3345,9 +3331,8 @@ ReorderBufferStreamTXN(ReorderBuffer *rb, ReorderBufferTXN *txn) * TOCHECK: We have to rebuild historic snapshot to be sure it includes all * information about subtransactions, which could arrive after streaming start. */ - if (!txn->is_schema_sent) - snapshot_now = ReorderBufferCopySnap(rb, txn->base_snapshot, - txn, command_id); + snapshot_now = ReorderBufferCopySnap(rb, txn->base_snapshot, + txn, command_id); } /* @@ -3602,12 +3587,6 @@ ReorderBufferStreamTXN(ReorderBuffer *rb, ReorderBufferTXN *txn) snapshot_now = change->data.snapshot; } - /* - * TOCHECK: Snapshot changed, then invalidate current schema to reflect - * possible catalog changes. - */ - txn->is_schema_sent = false; - /* and continue with the new one */ SetupHistoricSnapshot(snapshot_now, txn->tuplecid_hash, txn->xid); @@ -3646,7 +3625,6 @@ ReorderBufferStreamTXN(ReorderBuffer *rb, ReorderBufferTXN *txn) * about the message itself? */ LocalExecuteInvalidationMessage(&change->data.inval.msg); - txn->is_schema_sent = false; break; case REORDER_BUFFER_CHANGE_INTERNAL_TUPLECID: diff --git a/src/include/replication/reorderbuffer.h b/src/include/replication/reorderbuffer.h index 7d08e2fd39..e2b8db0ff1 100644 --- a/src/include/replication/reorderbuffer.h +++ b/src/include/replication/reorderbuffer.h @@ -236,11 +236,6 @@ typedef struct ReorderBufferTXN */ XLogRecPtr final_lsn; - /* - * Do we need to send schema for this transaction in output plugin? - */ - bool is_schema_sent; - /* * Toplevel transaction for this subxact (NULL for top-level). */ -- 2.21.0