read from database file only if max_frame_read_lock_index is 0 and max_frame > min_frame

- transaction which was started with max_frame = 0 and max_frame_read_lock_index = 0
  can write to the WAL and in this case it needs to read data back from WAL
- without cache spilling its hard to reproduce this issue for the turso-db now,
  but I stumbled into this issue with sync-engine which do weird stuff with the WAL
  which "simulates" cache spilling behaviour to some extent
This commit is contained in:
Nikita Sivukhin
2025-08-22 17:16:39 +04:00
parent 78295e3b4c
commit c62b87d9b6
4 changed files with 99 additions and 22 deletions

View File

@@ -284,6 +284,7 @@ fn test_wal_checkpoint() -> anyhow::Result<()> {
let conn = tmp_db.connect_limbo();
for i in 0..iterations {
log::info!("iteration #{}", i);
let insert_query = format!("INSERT INTO test VALUES ({i})");
do_flush(&conn, &tmp_db)?;
conn.checkpoint(CheckpointMode::Passive {
@@ -823,7 +824,7 @@ pub fn run_query_core(
on_row(row)
}
}
_ => unreachable!(),
r => panic!("unexpected step result: {r:?}"),
}
}
};