aboutsummaryrefslogtreecommitdiff
path: root/src/backend/replication/slot.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/replication/slot.c')
-rw-r--r--src/backend/replication/slot.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/backend/replication/slot.c b/src/backend/replication/slot.c
index 233652b4799..033b4ce0971 100644
--- a/src/backend/replication/slot.c
+++ b/src/backend/replication/slot.c
@@ -1252,6 +1252,20 @@ restart:
* concurrently being dropped by a backend connected to another DB.
*
* That's fairly unlikely in practice, so we'll just bail out.
+ *
+ * The slot sync worker holds a shared lock on the database before
+ * operating on synced logical slots to avoid conflict with the drop
+ * happening here. The persistent synced slots are thus safe but there
+ * is a possibility that the slot sync worker has created a temporary
+ * slot (which stays active even on release) and we are trying to drop
+ * that here. In practice, the chances of hitting this scenario are
+ * less as during slot synchronization, the temporary slot is
+ * immediately converted to persistent and thus is safe due to the
+ * shared lock taken on the database. So, we'll just bail out in such
+ * a case.
+ *
+ * XXX: We can consider shutting down the slot sync worker before
+ * trying to drop synced temporary slots here.
*/
if (active_pid)
ereport(ERROR,