mirror of
https://github.com/postgres/postgres.git
synced 2025-06-13 07:41:39 +03:00
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
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user