mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-08 18:54:21 +01:00
Merge 'Add assertion: we read a page with the correct id' from Jussi Saurio
Part of debugging #2746 , but a good sanity check in any case. Reviewed-by: Avinash Sajjanshetty (@avinassh) Closes #2802
This commit is contained in:
@@ -1125,9 +1125,19 @@ impl Pager {
|
||||
let page_key = PageCacheKey::new(page_idx);
|
||||
if let Some(page) = page_cache.get(&page_key)? {
|
||||
tracing::trace!("read_page(page_idx = {}) = cached", page_idx);
|
||||
turso_assert!(
|
||||
page_idx == page.get().id,
|
||||
"attempted to read page {page_idx} but got page {}",
|
||||
page.get().id
|
||||
);
|
||||
return Ok((page.clone(), None));
|
||||
}
|
||||
let (page, c) = self.read_page_no_cache(page_idx, None, false)?;
|
||||
turso_assert!(
|
||||
page_idx == page.get().id,
|
||||
"attempted to read page {page_idx} but got page {}",
|
||||
page.get().id
|
||||
);
|
||||
self.cache_insert(page_idx, page.clone(), &mut page_cache)?;
|
||||
Ok((page, Some(c)))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user