diff --git a/src/backend/replication/logical/tablesync.c b/src/backend/replication/logical/tablesync.c index 108326b..73e8c42 100644 --- a/src/backend/replication/logical/tablesync.c +++ b/src/backend/replication/logical/tablesync.c @@ -705,17 +705,19 @@ LogicalRepSyncTableStart(XLogRecPtr *origin_startpos) { char *slotname; char *err; + char relstate; /* Check the state of the table synchronization. */ StartTransactionCommand(); + relstate = GetSubscriptionRelState(MyLogicalRepWorker->subid, + MyLogicalRepWorker->relid, + &MyLogicalRepWorker->relstate_lsn, + false); + CommitTransactionCommand(); + SpinLockAcquire(&MyLogicalRepWorker->relmutex); - MyLogicalRepWorker->relstate = - GetSubscriptionRelState(MyLogicalRepWorker->subid, - MyLogicalRepWorker->relid, - &MyLogicalRepWorker->relstate_lsn, - false); + MyLogicalRepWorker->relstate = relstate; SpinLockRelease(&MyLogicalRepWorker->relmutex); - CommitTransactionCommand(); /* * To build a slot name for the sync work, we are limited to NAMEDATALEN -