change max_frame count only after wal sync in cacheflush

This commit is contained in:
pedrocarlo 2025-07-05 15:44:47 -03:00
parent 46f59e4f0f
commit 4639a4565f
2 changed files with 7 additions and 6 deletions

View file

@ -802,7 +802,6 @@ impl Pager {
let in_flight = *self.flush_info.borrow().in_flight_writes.borrow();
if in_flight == 0 {
self.flush_info.borrow_mut().state = FlushState::SyncWal;
self.wal.borrow_mut().finish_append_frames_commit()?;
} else {
return Ok(PagerCacheflushStatus::IO);
}
@ -812,6 +811,8 @@ impl Pager {
return Ok(PagerCacheflushStatus::IO);
}
// We should only signal that we finished appenind frames after wal sync to avoid inconsistencies when sync fails
self.wal.borrow_mut().finish_append_frames_commit()?;
if wal_checkpoint_disabled || !self.wal.borrow().should_checkpoint() {
self.flush_info.borrow_mut().state = FlushState::Start;
return Ok(PagerCacheflushStatus::Done(

View file

@ -523,15 +523,15 @@ fn assert_all_table_values(tables: &[String]) -> impl Iterator<Item = Interactio
distinct: Distinctness::All,
}));
let assertion = Interaction::Assertion(Assertion {
message: format!(
"table {} should contain all of its values",
table
),
message: format!("table {} should contain all of its values", table),
func: Box::new({
let table = table.clone();
move |stack: &Vec<ResultSet>, env: &mut SimulatorEnv| {
let table = env.tables.iter().find(|t| t.name == table).ok_or_else(|| {
LimboError::InternalError(format!("table {} should exist in simulator env", table))
LimboError::InternalError(format!(
"table {} should exist in simulator env",
table
))
})?;
let last = stack.last().unwrap();
match last {