Skip to content

Commit

Permalink
Remove primary_is_running
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
hlinnaka committed Jun 25, 2024
1 parent d502313 commit c21cea0
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 24 deletions.
6 changes: 0 additions & 6 deletions compute_tools/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,6 @@ pub fn write_postgres_conf(
ComputeMode::Replica => {
// hot_standby is 'on' by default, but let's be explicit
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)?;
}
}
}

Expand Down
1 change: 0 additions & 1 deletion control_plane/src/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,6 @@ impl Endpoint {
remote_extensions,
pgbouncer_settings: None,
shard_stripe_size: Some(shard_stripe_size),
primary_is_running: None,
};
let spec_path = self.endpoint_path().join("spec.json");
std::fs::write(spec_path, serde_json::to_string_pretty(&spec)?)?;
Expand Down
6 changes: 0 additions & 6 deletions libs/compute_api/src/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,6 @@ pub struct ComputeSpec {
// Stripe size for pageserver sharding, in pages
#[serde(default)]
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.
Expand Down
10 changes: 0 additions & 10 deletions pgxn/neon/neon.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ PG_MODULE_MAGIC;
void _PG_init(void);

static int logical_replication_max_snap_files = 300;
bool primary_is_running = false;

static void
InitLogicalReplicationMonitor(void)
Expand Down Expand Up @@ -289,15 +288,6 @@ _PG_init(void)

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
* loaded, otherwise any settings to GUCs that were set before the
Expand Down
1 change: 0 additions & 1 deletion test_runner/fixtures/neon_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -3541,7 +3541,6 @@ def create(
# and make tests more stable.
config_lines = ["max_replication_write_lag=15MB"] + config_lines

config_lines = ["neon.primary_is_running=on"] + config_lines
self.config(config_lines)

return self
Expand Down

0 comments on commit c21cea0

Please sign in to comment.