summaryrefslogtreecommitdiff
path: root/src/backend/commands
diff options
context:
space:
mode:
authorTom Lane2023-01-22 19:08:46 +0000
committerTom Lane2023-01-22 19:08:46 +0000
commit5a3a95385bd5a8f1a4fd50545b7efe9338581899 (patch)
tree9c90b781d4c5ccfdfe361e179c364b34c91137ac /src/backend/commands
parentc9f7f926484d69e2806e35343af7e472fadfede7 (diff)
Track logrep apply workers' last start times to avoid useless waits.
Enforce wal_retrieve_retry_interval on a per-subscription basis, rather than globally, and arrange to skip that delay in case of an intentional worker exit. This probably makes little difference in the field, where apply workers wouldn't be restarted often; but it has a significant impact on the runtime of our logical replication regression tests (even though those tests use artificially-small wal_retrieve_retry_interval settings already). Nathan Bossart, with mostly-cosmetic editorialization by me Discussion: https://postgr.es/m/20221122004119.GA132961@nathanxps13
Diffstat (limited to 'src/backend/commands')
-rw-r--r--src/backend/commands/subscriptioncmds.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/backend/commands/subscriptioncmds.c b/src/backend/commands/subscriptioncmds.c
index baff00dd74e..464db6d247f 100644
--- a/src/backend/commands/subscriptioncmds.c
+++ b/src/backend/commands/subscriptioncmds.c
@@ -1505,6 +1505,16 @@ DropSubscription(DropSubscriptionStmt *stmt, bool isTopLevel)
list_free(subworkers);
/*
+ * Remove the no-longer-useful entry in the launcher's table of apply
+ * worker start times.
+ *
+ * If this transaction rolls back, the launcher might restart a failed
+ * apply worker before wal_retrieve_retry_interval milliseconds have
+ * elapsed, but that's pretty harmless.
+ */
+ ApplyLauncherForgetWorkerStartTime(subid);
+
+ /*
* Cleanup of tablesync replication origins.
*
* Any READY-state relations would already have dealt with clean-ups.