mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-06 21:12:55 +00:00
Remove primary_is_running (#8162)
This was a half-finished mechanism to allow a replica to enter hot standby mode sooner, without waiting for a running-xacts record. It had issues, and we are working on a better mechanism to replace it. The control plane might still set the flag in the spec file, but compute_ctl will simply ignore it.
This commit is contained in:
committed by
GitHub
parent
9b623d3a2c
commit
fdadd6a152
@@ -83,12 +83,6 @@ pub fn write_postgres_conf(
|
|||||||
ComputeMode::Replica => {
|
ComputeMode::Replica => {
|
||||||
// hot_standby is 'on' by default, but let's be explicit
|
// hot_standby is 'on' by default, but let's be explicit
|
||||||
writeln!(file, "hot_standby=on")?;
|
writeln!(file, "hot_standby=on")?;
|
||||||
|
|
||||||
// Inform the replica about the primary state
|
|
||||||
// Default is 'false'
|
|
||||||
if let Some(primary_is_running) = spec.primary_is_running {
|
|
||||||
writeln!(file, "neon.primary_is_running={}", primary_is_running)?;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -592,7 +592,6 @@ impl Endpoint {
|
|||||||
remote_extensions,
|
remote_extensions,
|
||||||
pgbouncer_settings: None,
|
pgbouncer_settings: None,
|
||||||
shard_stripe_size: Some(shard_stripe_size),
|
shard_stripe_size: Some(shard_stripe_size),
|
||||||
primary_is_running: None,
|
|
||||||
};
|
};
|
||||||
let spec_path = self.endpoint_path().join("spec.json");
|
let spec_path = self.endpoint_path().join("spec.json");
|
||||||
std::fs::write(spec_path, serde_json::to_string_pretty(&spec)?)?;
|
std::fs::write(spec_path, serde_json::to_string_pretty(&spec)?)?;
|
||||||
|
|||||||
@@ -96,12 +96,6 @@ pub struct ComputeSpec {
|
|||||||
// Stripe size for pageserver sharding, in pages
|
// Stripe size for pageserver sharding, in pages
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub shard_stripe_size: Option<usize>,
|
pub shard_stripe_size: Option<usize>,
|
||||||
|
|
||||||
// When we are starting a new replica in hot standby mode,
|
|
||||||
// we need to know if the primary is running.
|
|
||||||
// This is used to determine if replica should wait for
|
|
||||||
// RUNNING_XACTS from primary or not.
|
|
||||||
pub primary_is_running: Option<bool>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Feature flag to signal `compute_ctl` to enable certain experimental functionality.
|
/// Feature flag to signal `compute_ctl` to enable certain experimental functionality.
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ PG_MODULE_MAGIC;
|
|||||||
void _PG_init(void);
|
void _PG_init(void);
|
||||||
|
|
||||||
static int logical_replication_max_snap_files = 300;
|
static int logical_replication_max_snap_files = 300;
|
||||||
bool primary_is_running = false;
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
InitLogicalReplicationMonitor(void)
|
InitLogicalReplicationMonitor(void)
|
||||||
@@ -289,15 +288,6 @@ _PG_init(void)
|
|||||||
|
|
||||||
pg_init_extension_server();
|
pg_init_extension_server();
|
||||||
|
|
||||||
DefineCustomBoolVariable(
|
|
||||||
"neon.primary_is_running",
|
|
||||||
"true if the primary was running at replica startup. false otherwise",
|
|
||||||
NULL,
|
|
||||||
&primary_is_running,
|
|
||||||
false,
|
|
||||||
PGC_POSTMASTER,
|
|
||||||
0,
|
|
||||||
NULL, NULL, NULL);
|
|
||||||
/*
|
/*
|
||||||
* Important: This must happen after other parts of the extension are
|
* Important: This must happen after other parts of the extension are
|
||||||
* loaded, otherwise any settings to GUCs that were set before the
|
* loaded, otherwise any settings to GUCs that were set before the
|
||||||
|
|||||||
@@ -3539,7 +3539,6 @@ class Endpoint(PgProtocol, LogUtils):
|
|||||||
# and make tests more stable.
|
# and make tests more stable.
|
||||||
config_lines = ["max_replication_write_lag=15MB"] + config_lines
|
config_lines = ["max_replication_write_lag=15MB"] + config_lines
|
||||||
|
|
||||||
config_lines = ["neon.primary_is_running=on"] + config_lines
|
|
||||||
self.config(config_lines)
|
self.config(config_lines)
|
||||||
|
|
||||||
return self
|
return self
|
||||||
|
|||||||
Reference in New Issue
Block a user