From 8e26f5f06124aba8f12d89e549e47ada7aa6329e Mon Sep 17 00:00:00 2001 From: Hou Zhijie Date: Thu, 27 Feb 2025 16:06:11 +0800 Subject: [PATCH] add comments for txns without base snapshot --- src/backend/replication/logical/snapbuild.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index 1716340799b..6917ca27181 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -752,6 +752,15 @@ SnapBuildDistributeSnapshotAndInval(SnapBuild *builder, XLogRecPtr lsn, Transact * transaction which in turn implies we don't yet need a snapshot at * all. We'll add a snapshot when the first change gets queued. * + * Moreover, distributing invalidations to this transaction at this + * stage is unnecessary. Once a base snapshot is built, it will + * naturally include the xids of committed transactions that have + * modified the catalog, thus reflecting the new catalog contents. The + * existing catalog cache will have already been invalidated after + * processing the invalidations in the transaction that modified + * catalogs, ensuring that a fresh cache is constructed during + * decoding. + * * NB: This works correctly even for subtransactions because * ReorderBufferAssignChild() takes care to transfer the base snapshot * to the top-level transaction, and while iterating the changequeue -- 2.30.0.windows.2