mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17:42:29 +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:
@@ -47,6 +47,7 @@
|
||||
#include "pgstat.h"
|
||||
#include "replication/logical.h"
|
||||
#include "replication/logicallauncher.h"
|
||||
#include "replication/logicalworker.h"
|
||||
#include "replication/origin.h"
|
||||
#include "replication/snapbuild.h"
|
||||
#include "replication/syncrep.h"
|
||||
@@ -2360,6 +2361,7 @@ CommitTransaction(void)
|
||||
AtEOXact_PgStat(true, is_parallel_worker);
|
||||
AtEOXact_Snapshot(true, false);
|
||||
AtEOXact_ApplyLauncher(true);
|
||||
AtEOXact_LogicalRepWorkers(true);
|
||||
pgstat_report_xact_timestamp(0);
|
||||
|
||||
CurrentResourceOwner = NULL;
|
||||
@@ -2647,6 +2649,9 @@ PrepareTransaction(void)
|
||||
AtEOXact_HashTables(true);
|
||||
/* don't call AtEOXact_PgStat here; we fixed pgstat state above */
|
||||
AtEOXact_Snapshot(true, true);
|
||||
/* we treat PREPARE as ROLLBACK so far as waking workers goes */
|
||||
AtEOXact_ApplyLauncher(false);
|
||||
AtEOXact_LogicalRepWorkers(false);
|
||||
pgstat_report_xact_timestamp(0);
|
||||
|
||||
CurrentResourceOwner = NULL;
|
||||
@@ -2860,6 +2865,7 @@ AbortTransaction(void)
|
||||
AtEOXact_HashTables(false);
|
||||
AtEOXact_PgStat(false, is_parallel_worker);
|
||||
AtEOXact_ApplyLauncher(false);
|
||||
AtEOXact_LogicalRepWorkers(false);
|
||||
pgstat_report_xact_timestamp(0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user