small fixes

This commit is contained in:
Nikita Sivukhin
2025-08-04 17:02:53 +04:00
parent 2e23230e79
commit 76bdf0c1ab
4 changed files with 11 additions and 2 deletions

View File

@@ -1141,6 +1141,8 @@ impl Connection {
Ok(())
}
/// Try to read page with given ID with fixed WAL watermark position
/// This method return false if page is not found (so, this is probably new page created after watermark position which wasn't checkpointed to the DB file yet)
#[cfg(all(feature = "fs", feature = "conn_raw_api"))]
pub fn try_wal_watermark_read_page(
&self,
@@ -1161,6 +1163,8 @@ impl Connection {
Ok(true)
}
/// Return unique set of page numbers changes after WAL watermark position in the current WAL session
/// (so, if concurrent connection wrote something to the WAL - this method will not see this change)
#[cfg(all(feature = "fs", feature = "conn_raw_api"))]
pub fn wal_changed_pages_after(&self, frame_watermark: u64) -> Result<Vec<u32>> {
self.pager.borrow().wal_changed_pages_after(frame_watermark)

View File

@@ -929,7 +929,7 @@ impl Pager {
Ok(())
}
/// Reads a page from disk bypassing page-cache
/// Reads a page from disk (either WAL or DB file) bypassing page-cache
#[tracing::instrument(skip_all, level = Level::DEBUG)]
pub fn read_page_no_cache(
&self,

View File

@@ -860,6 +860,11 @@ impl Wal for WalFile {
"unexpected use of frame_watermark optional argument"
);
turso_assert!(
frame_watermark.unwrap_or(0) <= self.max_frame,
"frame_watermark must be <= than current WAL max_frame value"
);
// if we are holding read_lock 0, skip and read right from db file.
if self.max_frame_read_lock_index.get() == 0 {
return Ok(None);

View File

@@ -393,7 +393,7 @@ fn revert_to(conn: &Arc<turso_core::Connection>, frame_watermark: u64) -> turso_
if !has_page {
continue;
}
frames.push((page_id, frame.clone()));
frames.push((page_id, frame));
}
let mut frame_no = conn.wal_frame_count().unwrap();