diff --git a/core/storage/pager.rs b/core/storage/pager.rs index dc1b92d7b..c982acb7c 100644 --- a/core/storage/pager.rs +++ b/core/storage/pager.rs @@ -602,12 +602,16 @@ impl Pager { #[inline(always)] pub fn begin_read_tx(&self) -> Result { + // We allocate the first page lazily in the first transaction + if self.is_empty.load(Ordering::SeqCst) { + self.allocate_page1()?; + } self.wal.borrow_mut().begin_read_tx() } #[inline(always)] pub fn begin_write_tx(&self) -> Result { - // We allocate the first page lazily in the *first* write transaction + // We allocate the first page lazily in the first transaction if self.is_empty.load(Ordering::SeqCst) { self.allocate_page1()?; }