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>
This commit is contained in:
parent
76b11e8a43
commit
8dc7c33812
@ -796,7 +796,7 @@ LogicalRepSyncTableStart(XLogRecPtr *origin_startpos)
|
|||||||
StartTransactionCommand();
|
StartTransactionCommand();
|
||||||
relstate = GetSubscriptionRelState(MyLogicalRepWorker->subid,
|
relstate = GetSubscriptionRelState(MyLogicalRepWorker->subid,
|
||||||
MyLogicalRepWorker->relid,
|
MyLogicalRepWorker->relid,
|
||||||
&relstate_lsn, false);
|
&relstate_lsn, true);
|
||||||
CommitTransactionCommand();
|
CommitTransactionCommand();
|
||||||
|
|
||||||
SpinLockAcquire(&MyLogicalRepWorker->relmutex);
|
SpinLockAcquire(&MyLogicalRepWorker->relmutex);
|
||||||
@ -942,7 +942,10 @@ LogicalRepSyncTableStart(XLogRecPtr *origin_startpos)
|
|||||||
}
|
}
|
||||||
case SUBREL_STATE_SYNCDONE:
|
case SUBREL_STATE_SYNCDONE:
|
||||||
case SUBREL_STATE_READY:
|
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();
|
finish_sync_worker();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user