diff options
Diffstat (limited to 'src/backend/replication/logical/snapbuild.c')
-rw-r--r-- | src/backend/replication/logical/snapbuild.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index 4f8c00f717a..9d8700147ca 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -1296,6 +1296,8 @@ SnapBuildProcessRunningXacts(SnapBuild *builder, XLogRecPtr lsn, xl_running_xact static bool SnapBuildFindSnapshot(SnapBuild *builder, XLogRecPtr lsn, xl_running_xacts *running) { + LogicalDecodingContext *ctx = (LogicalDecodingContext *) builder->reorder->private_data; + /* --- * Build catalog decoding snapshot incrementally using information about * the currently running transactions. There are several ways to do that: @@ -1305,10 +1307,12 @@ SnapBuildFindSnapshot(SnapBuild *builder, XLogRecPtr lsn, xl_running_xacts *runn * state while waiting on c)'s sub-states. * * b) This (in a previous run) or another decoding slot serialized a - * snapshot to disk that we can use. Can't use this method for the - * initial snapshot when slot is being created and needs full snapshot - * for export or direct use, as that snapshot will only contain catalog - * modifying transactions. + * snapshot to disk that we can use. Can't use this method while finding + * the start point for decoding changes as the restart LSN would be an + * arbitrary LSN but we need to find the start point to extract changes + * where we won't see the data for partial transactions. Also, we cannot + * use this method when a slot needs a full snapshot for export or direct + * use, as that snapshot will only contain catalog modifying transactions. * * c) First incrementally build a snapshot for catalog tuples * (BUILDING_SNAPSHOT), that requires all, already in-progress, @@ -1373,8 +1377,13 @@ SnapBuildFindSnapshot(SnapBuild *builder, XLogRecPtr lsn, xl_running_xacts *runn return false; } - /* b) valid on disk state and not building full snapshot */ + + /* + * b) valid on disk state and while neither building full snapshot nor + * creating a slot. + */ else if (!builder->building_full_snapshot && + !ctx->in_create && SnapBuildRestore(builder, lsn)) { int nxacts = running->subxcnt + running->xcnt; |