From 80476b3069f2cd460f368e10b4b2ef51f7608077 Mon Sep 17 00:00:00 2001 From: Nikita Sivukhin Date: Tue, 12 Aug 2025 23:34:01 +0400 Subject: [PATCH] bypass database registry for all dbs which path starts with :memory: prefix - sync engine create pair of databases and they must be isolated but live in the same MemoryIO - the problem can happen if there will be 2 sync engines with MemoryIO storage layer - as they all will create :memory:-draft and :memory:-synced DBs --- core/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/lib.rs b/core/lib.rs index 0f0e9f618..c260694cf 100644 --- a/core/lib.rs +++ b/core/lib.rs @@ -255,8 +255,8 @@ impl Database { enable_indexes: bool, enable_views: bool, ) -> Result> { - if path == ":memory:" { - return Self::do_open_with_flags( + if path.starts_with(":memory:") { + return Self::open_with_flags_bypass_registry( io, path, db_file, @@ -277,7 +277,7 @@ impl Database { if let Some(db) = registry.get(&canonical_path).and_then(Weak::upgrade) { return Ok(db); } - let db = Self::do_open_with_flags( + let db = Self::open_with_flags_bypass_registry( io, path, db_file, @@ -291,7 +291,7 @@ impl Database { } #[allow(clippy::arc_with_non_send_sync)] - fn do_open_with_flags( + fn open_with_flags_bypass_registry( io: Arc, path: &str, db_file: Arc,