Merge branch 'MMeent/test-endpoint-promo' of github.com:neondatabase/neon into MMeent/test-endpoint-promo

This commit is contained in:
Matthias van de Meent
2025-05-29 20:34:50 +02:00
10 changed files with 17 additions and 23 deletions

View File

@@ -439,6 +439,7 @@ pub fn empty_shmem() -> crate::bindings::WalproposerShmemState {
currentClusterSize: crate::bindings::pg_atomic_uint64 { value: 0 },
shard_ps_feedback: [empty_feedback; 128],
num_shards: 0,
replica_promote: false,
min_ps_feedback: empty_feedback,
}
}

View File

@@ -213,7 +213,6 @@ impl Wrapper {
safekeeper_connection_timeout: config.safekeeper_connection_timeout,
wal_segment_size: WAL_SEGMENT_SIZE as i32, // default 16MB
syncSafekeepers: config.sync_safekeepers,
replicaPromote: false,
systemId: 0,
pgTimeline: 1,
proto_version: 3,

View File

@@ -1380,7 +1380,7 @@ ProcessPropStartPos(WalProposer *wp)
* we must bail out, as clog and other non rel data is inconsistent.
*/
walprop_shared = wp->api.get_shmem_state(wp);
if (!wp->config->syncSafekeepers && !wp->config->replicaPromote)
if (!wp->config->syncSafekeepers && !walprop_shared->replica_promote)
{
/*
* Basebackup LSN always points to the beginning of the record (not

View File

@@ -391,6 +391,7 @@ typedef struct WalproposerShmemState
/* last feedback from each shard */
PageserverFeedback shard_ps_feedback[MAX_SHARDS];
int num_shards;
bool replica_promote;
/* aggregated feedback with min LSNs across shards */
PageserverFeedback min_ps_feedback;
@@ -739,11 +740,6 @@ typedef struct WalProposerConfig
*/
bool syncSafekeepers;
/*
* Replica is promoted to primary
*/
bool replicaPromote;
/* Will be passed to safekeepers in greet request. */
uint64 systemId;

View File

@@ -35,6 +35,7 @@
#include "storage/proc.h"
#include "storage/ipc.h"
#include "storage/lwlock.h"
#include "storage/pg_shmem.h"
#include "storage/shmem.h"
#include "storage/spin.h"
#include "tcop/tcopprot.h"
@@ -73,7 +74,6 @@ static XLogRecPtr sentPtr = InvalidXLogRecPtr;
static const walproposer_api walprop_pg;
static volatile sig_atomic_t got_SIGUSR2 = false;
static bool reported_sigusr2 = false;
static bool start_as_replica = false;
static XLogRecPtr standby_flush_lsn = InvalidXLogRecPtr;
static XLogRecPtr standby_apply_lsn = InvalidXLogRecPtr;
@@ -124,7 +124,6 @@ init_walprop_config(bool syncSafekeepers)
walprop_config.safekeeper_connection_timeout = wal_acceptor_connection_timeout;
walprop_config.wal_segment_size = wal_segment_size;
walprop_config.syncSafekeepers = syncSafekeepers;
walprop_config.replicaPromote = start_as_replica;
if (!syncSafekeepers)
walprop_config.systemId = GetSystemIdentifier();
else
@@ -151,8 +150,6 @@ WalProposerSync(int argc, char *argv[])
WalProposerStart(wp);
}
#define GUC_POLL_DELAY 100000L // 0.1 sec
/*
* WAL proposer bgworker entry point.
*/
@@ -163,7 +160,8 @@ WalProposerMain(Datum main_arg)
if (*wal_acceptors_list == '\0')
{
elog(PANIC, "Safekeepers list is empty");
wpg_log(WARNING, "Safekeepers list is empty");
return;
}
init_walprop_config(false);
@@ -310,8 +308,8 @@ assign_neon_safekeepers(const char *newval, void *extra)
char *newval_copy;
char *oldval;
if (newval && *newval == '\0')
start_as_replica = true;
if (newval && *newval != '\0' && UsedShmemSegAddr && walprop_shared && RecoveryInProgress())
walprop_shared->replica_promote = true;
if (!am_walproposer)
return;
@@ -519,6 +517,7 @@ walprop_register_bgworker(void)
bgw.bgw_restart_time = 1;
bgw.bgw_notify_pid = 0;
bgw.bgw_main_arg = (Datum) 0;
RegisterBackgroundWorker(&bgw);
}
@@ -2016,7 +2015,6 @@ walprop_pg_get_redo_start_lsn(WalProposer *wp)
return GetRedoStartLsn();
}
static bool
walprop_pg_strong_random(WalProposer *wp, void *buf, size_t len)
{

View File

@@ -1,18 +1,18 @@
{
"v17": [
"17.5",
"28b88cfedf9a6028cf7ea32a80ea15a9bf971803"
"32d704d965d8ad632c0ddef64b45a5ba95536442"
],
"v16": [
"16.9",
"3d6896afaa89c05b693e9a29275001b801b8b479"
"77c63bfebff5c833682cc2654e2191fec4d5b24e"
],
"v15": [
"15.13",
"f2cd31737536218c39c66f920ff62f72c51d0d61"
"20f8491225f86bdedbc986e9a69ebafb1c94aa99"
],
"v14": [
"14.18",
"78c1568afbbacc1604ac5e5cc2ebc9b7ed0cfde9"
"b6eece3f528fdc380e6e2c13381434470606787f"
]
}