Add comments to clarify current behaviour

This commit is contained in:
Diego Reis
2025-06-18 18:47:10 -03:00
parent 6ae196d7b3
commit 1921fcb943
2 changed files with 5 additions and 0 deletions

View File

@@ -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()?;

View File

@@ -564,6 +564,8 @@ impl Pager {
#[inline(always)]
pub fn begin_write_tx(&self) -> Result<LimboResult> {
// 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()?;