mirror of
https://github.com/neondatabase/neon.git
synced 2026-05-22 15:41:15 +00:00
Run sync several times
This commit is contained in:
@@ -20,5 +20,7 @@ void RunClientC(uint32_t serverId);
|
||||
|
||||
void WalProposerRust();
|
||||
|
||||
void WalProposerCleanup();
|
||||
|
||||
// Initialize global variables before calling any Postgres C code.
|
||||
void MyContextInit();
|
||||
|
||||
@@ -108,6 +108,7 @@ fn main() -> anyhow::Result<()> {
|
||||
.allowlist_function("RunClientC")
|
||||
.allowlist_function("WalProposerRust")
|
||||
.allowlist_function("MyContextInit")
|
||||
.allowlist_function("WalProposerCleanup")
|
||||
.allowlist_var("wal_acceptors_list")
|
||||
.allowlist_var("wal_acceptor_reconnect_timeout")
|
||||
.allowlist_var("wal_acceptor_connection_timeout")
|
||||
|
||||
@@ -10,7 +10,7 @@ use utils::{id::TenantTimelineId, logging, lsn::Lsn};
|
||||
use crate::{
|
||||
bindings::{
|
||||
neon_tenant_walproposer, neon_timeline_walproposer, wal_acceptor_connection_timeout,
|
||||
wal_acceptor_reconnect_timeout, wal_acceptors_list, WalProposerRust,
|
||||
wal_acceptor_reconnect_timeout, wal_acceptors_list, WalProposerRust, WalProposerCleanup,
|
||||
},
|
||||
c_context,
|
||||
simtest::safekeeper::run_server,
|
||||
@@ -94,6 +94,8 @@ impl Test {
|
||||
let list = CString::new(guc).unwrap();
|
||||
|
||||
unsafe {
|
||||
WalProposerCleanup();
|
||||
|
||||
wal_acceptors_list = list.into_raw();
|
||||
wal_acceptor_reconnect_timeout = 1000;
|
||||
wal_acceptor_connection_timeout = 5000;
|
||||
@@ -134,4 +136,9 @@ fn sync_empty_safekeepers() {
|
||||
|
||||
let lsn = test.sync_safekeepers().unwrap();
|
||||
assert_eq!(lsn, Lsn(0));
|
||||
println!("Sucessfully synced empty safekeepers at 0/0");
|
||||
|
||||
let lsn = test.sync_safekeepers().unwrap();
|
||||
assert_eq!(lsn, Lsn(0));
|
||||
println!("Sucessfully synced empty safekeepers at 0/0");
|
||||
}
|
||||
|
||||
@@ -321,6 +321,33 @@ nwp_shmem_startup_hook(void)
|
||||
WalproposerShmemInit();
|
||||
}
|
||||
|
||||
void WalProposerCleanup()
|
||||
{
|
||||
n_safekeepers = 0;
|
||||
quorum = 0;
|
||||
lastSentCommitLsn = 0;
|
||||
availableLsn = 0;
|
||||
lastSentCommitLsn = 0;
|
||||
truncateLsn = 0;
|
||||
propTerm = 0;
|
||||
propTermHistory.entries = NULL;
|
||||
propTermHistory.n_entries = 0;
|
||||
propEpochStartLsn = 0;
|
||||
donorEpoch = 0;
|
||||
donor = 0;
|
||||
timelineStartLsn = 0;
|
||||
n_votes = 0;
|
||||
n_connected = 0;
|
||||
last_reconnect_attempt = 0;
|
||||
|
||||
if (walprop_shared != NULL)
|
||||
{
|
||||
memset(walprop_shared, 0, WalproposerShmemSize());
|
||||
SpinLockInit(&walprop_shared->mutex);
|
||||
pg_atomic_init_u64(&walprop_shared->backpressureThrottlingTime, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void WalProposerRust()
|
||||
{
|
||||
walprop_log(LOG, "WalProposerRust");
|
||||
|
||||
@@ -51,9 +51,6 @@ extern int wal_acceptor_reconnect_timeout;
|
||||
extern int wal_acceptor_connection_timeout;
|
||||
extern bool am_wal_proposer;
|
||||
|
||||
/* If true, we're exiting. */
|
||||
extern bool walproposer_exited;
|
||||
|
||||
struct WalProposerConn; /* Defined in libpqwalproposer */
|
||||
typedef struct WalProposerConn WalProposerConn;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user