diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index cdf4aa01e92..4c951678c0a 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -343,6 +343,9 @@ AllocateSnapshotBuilder(ReorderBuffer *reorder, MemoryContextSwitchTo(oldcontext); + /* The initial running transactions array must be empty. */ + Assert(NInitialRunningXacts == 0 && InitialRunningXacts == NULL); + return builder; } @@ -363,6 +366,10 @@ FreeSnapshotBuilder(SnapBuild *builder) /* other resources are deallocated via memory context reset */ MemoryContextDelete(context); + + /* InitialRunningXacts is freed along with the context */ + NInitialRunningXacts = 0; + InitialRunningXacts = NULL; } /*