Use neon.primary_is_running GUC for replica startup

This commit is contained in:
Konstantin Knizhnik
2024-02-11 09:04:16 +02:00
parent 32f4a56327
commit 0ae36c505a
6 changed files with 21 additions and 6 deletions

View File

@@ -307,6 +307,9 @@ impl Endpoint {
// Load the 'neon' extension
conf.append("shared_preload_libraries", "neon");
// It is only for testing, in real environment this GUC is passed by control plane
conf.append("neon.primary_is_running", "on");
conf.append_line("");
// Replication-related configurations, such as WAL sending
match &self.mode {

View File

@@ -30,6 +30,8 @@
PG_MODULE_MAGIC;
void _PG_init(void);
bool primary_is_running = false;
void
_PG_init(void)
{
@@ -48,6 +50,16 @@ _PG_init(void)
pg_init_extension_server();
DefineCustomBoolVariable(
"neon.primary_is_running",
"For replica it is true, if primary is running, false otherwise",
NULL,
&primary_is_running,
false,
PGC_POSTMASTER,
0,
NULL, NULL, NULL);
/*
* Important: This must happen after other parts of the extension are
* loaded, otherwise any settings to GUCs that were set before the

View File

@@ -1,5 +1,5 @@
{
"postgres-v16": "0d4eb408a1242f8564ba2bfa57a1ea601dc99a4c",
"postgres-v15": "d4d552ce42e40f29909f1c6613c57ecda6ea6933",
"postgres-v14": "23a19fe0a4f6e56f4540afabe6825281c9d02cd1"
"postgres-v16": "3f96a5b0c70e48b9142f0c9b496c7c04c93bec8b",
"postgres-v15": "e2a0a8aa75ff2fa70af87cb86ba6fb7f575e3155",
"postgres-v14": "7eb44da047e68cf6785d27388c482abd02fe2a2d"
}