From 54b1647148962f99c02f06c0f7ec98a56aa8b406 Mon Sep 17 00:00:00 2001 From: Pere Diaz Bou Date: Sat, 24 May 2025 11:59:54 +0200 Subject: [PATCH] set non-shared cache by default Shared cache requires more locking mechasnisms. We still have multi threading issues not related to shared cache so it is wise to first fix those and then once they are fixed, we can incrementally add shared cache back with locking in place. --- core/lib.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/core/lib.rs b/core/lib.rs index 9d7858c39..4aa24f22d 100644 --- a/core/lib.rs +++ b/core/lib.rs @@ -101,7 +101,7 @@ pub struct Database { page_size: u32, // Shared structures of a Database are the parts that are common to multiple threads that might // create DB connections. - shared_page_cache: Arc>, + _shared_page_cache: Arc>, shared_wal: Arc>, open_flags: OpenFlags, } @@ -174,7 +174,7 @@ impl Database { mv_store, schema: schema.clone(), header: db_header.clone(), - shared_page_cache: shared_page_cache.clone(), + _shared_page_cache: shared_page_cache.clone(), shared_wal: shared_wal.clone(), db_file, io: io.clone(), @@ -210,12 +210,13 @@ impl Database { self.shared_wal.clone(), buffer_pool.clone(), ))); + // For now let's open database without shared cache by default. let pager = Rc::new(Pager::finish_open( self.header.clone(), self.db_file.clone(), Some(wal), self.io.clone(), - self.shared_page_cache.clone(), + Arc::new(RwLock::new(DumbLruPageCache::default())), buffer_pool, )?); let conn = Rc::new(Connection { @@ -230,6 +231,7 @@ impl Database { last_change: Cell::new(0), syms: RefCell::new(SymbolTable::new()), total_changes: Cell::new(0), + _shared_cache: false, }); if let Err(e) = conn.register_builtins() { return Err(LimboError::ExtensionError(e)); @@ -327,6 +329,7 @@ pub struct Connection { last_change: Cell, total_changes: Cell, syms: RefCell, + _shared_cache: bool, } impl Connection {