Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/backend/replication/logical/launcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ int max_logical_replication_workers = 4;
int max_sync_workers_per_subscription = 2;
int max_parallel_apply_workers_per_subscription = 2;

bool disable_logical_replication_subscribers = false; /* NEON: GUC is defined in neon extension */

LogicalRepWorker *MyLogicalRepWorker = NULL;

typedef struct LogicalRepCtxStruct
Expand Down Expand Up @@ -333,6 +335,15 @@ logicalrep_worker_launch(LogicalRepWorkerType wtype,
(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
errmsg("cannot start logical replication workers when max_replication_slots = 0")));

/* NEON GUC that allows to control logical replication without postgres restart */
if (disable_logical_replication_subscribers)
{
ereport(WARNING,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("cannot start logical replication workers when disable_logical_replication_subscribers=true")));
return false;
}

/*
* We need to do the modification of the shared memory under lock so that
* we have consistent view.
Expand Down
2 changes: 2 additions & 0 deletions src/include/replication/logicallauncher.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ extern PGDLLIMPORT int max_logical_replication_workers;
extern PGDLLIMPORT int max_sync_workers_per_subscription;
extern PGDLLIMPORT int max_parallel_apply_workers_per_subscription;

extern PGDLLIMPORT bool disable_logical_replication_subscribers;

extern void ApplyLauncherRegister(void);
extern void ApplyLauncherMain(Datum main_arg);

Expand Down