aboutsummaryrefslogtreecommitdiff
path: root/src/backend/replication/logical/tablesync.c
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2017-06-09 09:20:54 -0400
committerPeter Eisentraut <peter_e@gmx.net>2017-06-09 09:20:54 -0400
commit8dc7c338129d22a52d4afcf2f83a73041119efda (patch)
treeb36d59ec4de20a0c1291ba41530c3d424ba0a0e9 /src/backend/replication/logical/tablesync.c
parent76b11e8a43eca4612dfccfe7f3ebd293fb8a46ec (diff)
downloadpostgresql-8dc7c338129d22a52d4afcf2f83a73041119efda.tar.gz
postgresql-8dc7c338129d22a52d4afcf2f83a73041119efda.zip
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>
Diffstat (limited to 'src/backend/replication/logical/tablesync.c')
-rw-r--r--src/backend/replication/logical/tablesync.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/backend/replication/logical/tablesync.c b/src/backend/replication/logical/tablesync.c
index f57ae6ee2d5..7bfb7b1052c 100644
--- a/src/backend/replication/logical/tablesync.c
+++ b/src/backend/replication/logical/tablesync.c
@@ -796,7 +796,7 @@ LogicalRepSyncTableStart(XLogRecPtr *origin_startpos)
StartTransactionCommand();
relstate = GetSubscriptionRelState(MyLogicalRepWorker->subid,
MyLogicalRepWorker->relid,
- &relstate_lsn, false);
+ &relstate_lsn, true);
CommitTransactionCommand();
SpinLockAcquire(&MyLogicalRepWorker->relmutex);
@@ -942,7 +942,10 @@ LogicalRepSyncTableStart(XLogRecPtr *origin_startpos)
}
case SUBREL_STATE_SYNCDONE:
case SUBREL_STATE_READY:
- /* Nothing to do here but finish. */
+ case SUBREL_STATE_UNKNOWN:
+ /* Nothing to do here but finish. (UNKNOWN means the relation was
+ * removed from pg_subscription_rel before the sync worker could
+ * start.) */
finish_sync_worker();
break;
default: