mirror of
https://github.com/neondatabase/neon.git
synced 2025-12-27 16:12:56 +00:00
Updates storage components to edition 2024. We like to stay on the latest edition if possible. There is no functional changes, however some code changes had to be done to accommodate the edition's breaking changes. The PR has two commits: * the first commit updates storage crates to edition 2024 and appeases `cargo clippy` by changing code. i have accidentially ran the formatter on some files that had other edits. * the second commit performs a `cargo fmt` I would recommend a closer review of the first commit and a less close review of the second one (as it just runs `cargo fmt`). part of https://github.com/neondatabase/neon/issues/10918
47 lines
1.3 KiB
Rust
47 lines
1.3 KiB
Rust
use tracing::info;
|
|
use utils::lsn::Lsn;
|
|
|
|
use crate::walproposer_sim::log::init_logger;
|
|
use crate::walproposer_sim::simulation::TestConfig;
|
|
|
|
pub mod walproposer_sim;
|
|
|
|
// Check that first start of sync_safekeepers() returns 0/0 on empty safekeepers.
|
|
#[test]
|
|
fn sync_empty_safekeepers() {
|
|
let clock = init_logger();
|
|
let config = TestConfig::new(Some(clock));
|
|
let test = config.start(1337);
|
|
|
|
let lsn = test.sync_safekeepers().unwrap();
|
|
assert_eq!(lsn, Lsn(0));
|
|
info!("Sucessfully synced empty safekeepers at 0/0");
|
|
|
|
let lsn = test.sync_safekeepers().unwrap();
|
|
assert_eq!(lsn, Lsn(0));
|
|
info!("Sucessfully synced (again) empty safekeepers at 0/0");
|
|
}
|
|
|
|
// Check that there are no panics when we are writing and streaming WAL to safekeepers.
|
|
#[test]
|
|
fn run_walproposer_generate_wal() {
|
|
let clock = init_logger();
|
|
let config = TestConfig::new(Some(clock));
|
|
let test = config.start(1337);
|
|
|
|
let lsn = test.sync_safekeepers().unwrap();
|
|
assert_eq!(lsn, Lsn(0));
|
|
info!("Sucessfully synced empty safekeepers at 0/0");
|
|
|
|
let mut wp = test.launch_walproposer(lsn);
|
|
|
|
// wait for walproposer to start
|
|
test.poll_for_duration(30);
|
|
|
|
// just write some WAL
|
|
for _ in 0..100 {
|
|
wp.write_tx(1);
|
|
test.poll_for_duration(5);
|
|
}
|
|
}
|