diff --git a/core/lib.rs b/core/lib.rs index b747301b7..527e0c3ee 100644 --- a/core/lib.rs +++ b/core/lib.rs @@ -51,6 +51,7 @@ pub use io::{ use limbo_sqlite3_parser::{ast, ast::Cmd, lexer::sql::Parser}; use parking_lot::RwLock; use schema::Schema; +use std::sync::atomic::Ordering; use std::{ borrow::Cow, cell::{Cell, RefCell, UnsafeCell}, @@ -175,6 +176,8 @@ impl Database { open_flags: flags, }; let db = Arc::new(db); + + // Check: https://github.com/tursodatabase/limbo/pull/1761#discussion_r2154013123 if db_size > 0 || wal_has_frames { // parse schema let conn = db.connect()?; diff --git a/core/storage/pager.rs b/core/storage/pager.rs index eee94045c..7e64b4bd9 100644 --- a/core/storage/pager.rs +++ b/core/storage/pager.rs @@ -564,6 +564,8 @@ impl Pager { #[inline(always)] pub fn begin_write_tx(&self) -> Result { + // TODO(Diego): The only possibly allocate page1 here is because OpenEphemeral needs a write transaction + // we should have a unique API to begin transactions, something like sqlite3BtreeBeginTrans while self.is_empty.load(Ordering::SeqCst) { let _lock = self.init_lock.lock().unwrap(); self.allocate_page1()?;