aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/subscriptioncmds.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2023-01-06 16:08:20 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2023-01-06 17:27:58 -0500
commitc6e1f62e2cee817cad58cccc1dd685e908678241 (patch)
tree0b84de1562ac2702f372a86705d8374d77e1eb42 /src/backend/commands/subscriptioncmds.c
parent4c032dd8046b145a25032643f536aab83deb19e3 (diff)
downloadpostgresql-c6e1f62e2cee817cad58cccc1dd685e908678241.tar.gz
postgresql-c6e1f62e2cee817cad58cccc1dd685e908678241.zip
Wake up a subscription's replication worker processes after DDL.
Waken related worker processes immediately at commit of a transaction that has performed ALTER SUBSCRIPTION (including the RENAME and OWNER variants). This reduces the response time for such operations. In the real world that might not be worth much, but it shaves several seconds off the runtime for the subscription test suite. In the case of PREPARE, we just throw away this notification state; it doesn't seem worth the work to preserve it. The workers will still react after the eventual COMMIT PREPARED, but not as quickly. Nathan Bossart Discussion: https://postgr.es/m/20221122004119.GA132961@nathanxps13
Diffstat (limited to 'src/backend/commands/subscriptioncmds.c')
-rw-r--r--src/backend/commands/subscriptioncmds.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/backend/commands/subscriptioncmds.c b/src/backend/commands/subscriptioncmds.c
index b9c5df796fc..f15a332bae3 100644
--- a/src/backend/commands/subscriptioncmds.c
+++ b/src/backend/commands/subscriptioncmds.c
@@ -34,6 +34,7 @@
#include "nodes/makefuncs.h"
#include "pgstat.h"
#include "replication/logicallauncher.h"
+#include "replication/logicalworker.h"
#include "replication/origin.h"
#include "replication/slot.h"
#include "replication/walreceiver.h"
@@ -1362,6 +1363,9 @@ AlterSubscription(ParseState *pstate, AlterSubscriptionStmt *stmt,
InvokeObjectPostAlterHook(SubscriptionRelationId, subid, 0);
+ /* Wake up related replication workers to handle this change quickly. */
+ LogicalRepWorkersWakeupAtCommit(subid);
+
return myself;
}
@@ -1732,7 +1736,9 @@ AlterSubscriptionOwner_internal(Relation rel, HeapTuple tup, Oid newOwnerId)
InvokeObjectPostAlterHook(SubscriptionRelationId,
form->oid, 0);
+ /* Wake up related background processes to handle this change quickly. */
ApplyLauncherWakeupAtCommit();
+ LogicalRepWorkersWakeupAtCommit(form->oid);
}
/*