Skip to content

Commit 8dc7c33

Browse files
committed
Improve tablesync behavior with concurrent changes
When a table is removed from a subscription before the tablesync worker could start, this would previously result in an error when reading pg_subscription_rel. Now we just ignore this. Author: Masahiko Sawada <sawada.mshk@gmail.com>
1 parent 76b11e8 commit 8dc7c33

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/backend/replication/logical/tablesync.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,7 @@ LogicalRepSyncTableStart(XLogRecPtr *origin_startpos)
796796
StartTransactionCommand();
797797
relstate = GetSubscriptionRelState(MyLogicalRepWorker->subid,
798798
MyLogicalRepWorker->relid,
799-
&relstate_lsn, false);
799+
&relstate_lsn, true);
800800
CommitTransactionCommand();
801801

802802
SpinLockAcquire(&MyLogicalRepWorker->relmutex);
@@ -942,7 +942,10 @@ LogicalRepSyncTableStart(XLogRecPtr *origin_startpos)
942942
}
943943
case SUBREL_STATE_SYNCDONE:
944944
case SUBREL_STATE_READY:
945-
/* Nothing to do here but finish. */
945+
case SUBREL_STATE_UNKNOWN:
946+
/* Nothing to do here but finish. (UNKNOWN means the relation was
947+
* removed from pg_subscription_rel before the sync worker could
948+
* start.) */
946949
finish_sync_worker();
947950
break;
948951
default:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy