mirror of
https://github.com/neondatabase/neon.git
synced 2026-05-27 10:00:38 +00:00
Fix truncateLsn bug
This commit is contained in:
@@ -16,7 +16,7 @@ use safekeeper::{
|
||||
timeline::TimelineError,
|
||||
SafeKeeperConf,
|
||||
};
|
||||
use tracing::debug;
|
||||
use tracing::{debug, info_span};
|
||||
use utils::{
|
||||
id::{NodeId, TenantId, TenantTimelineId, TimelineId},
|
||||
lsn::Lsn,
|
||||
@@ -147,7 +147,8 @@ impl GlobalMap {
|
||||
}
|
||||
|
||||
pub fn run_server(os: NodeOs, disk: Arc<Disk>) -> Result<()> {
|
||||
debug!("started server {}", os.id());
|
||||
let _enter = info_span!("safekeeper", id = os.id()).entered();
|
||||
debug!("started server");
|
||||
let conf = SafeKeeperConf {
|
||||
workdir: PathBuf::from("."),
|
||||
my_id: NodeId(os.id() as u64),
|
||||
|
||||
@@ -191,7 +191,7 @@ fn test_one_schedule() -> anyhow::Result<()> {
|
||||
// test.run_schedule(&schedule)?;
|
||||
// test.world.stop_all();
|
||||
|
||||
let seed = 14035854184686918762;
|
||||
let seed = 16600359418126807633;
|
||||
let test = config.start(seed);
|
||||
warn!("Running test with seed {}", seed);
|
||||
|
||||
|
||||
@@ -81,6 +81,7 @@ void MyContextInit() {
|
||||
exit(1);
|
||||
|
||||
log_min_messages = FATAL;
|
||||
// log_min_messages = LOG;
|
||||
Log_line_prefix = "[%p] ";
|
||||
|
||||
InitializeMaxBackends();
|
||||
|
||||
@@ -1505,6 +1505,17 @@ DetermineEpochStartLsn(void)
|
||||
walprop_log(LOG, "bumped epochStartLsn to the first record %X/%X", LSN_FORMAT_ARGS(propEpochStartLsn));
|
||||
}
|
||||
|
||||
if (truncateLsn == InvalidXLogRecPtr && timelineStartLsn == propEpochStartLsn)
|
||||
{
|
||||
/*
|
||||
* If truncateLsn is 0 everywhere, we are bootstrapping -- nothing was
|
||||
* committed yet. But if timelineStartLsn is not 0, we already know
|
||||
* the first record location, so we can bump truncateLsn to it.
|
||||
*/
|
||||
truncateLsn = timelineStartLsn;
|
||||
walprop_log(LOG, "bumped truncateLsn to timelineStartLsn %X/%X", LSN_FORMAT_ARGS(truncateLsn));
|
||||
}
|
||||
|
||||
/*
|
||||
* If propEpochStartLsn is not 0, at least one msg with WAL was sent to
|
||||
* some connected safekeeper; it must have carried truncateLsn pointing to
|
||||
|
||||
Reference in New Issue
Block a user