Merge 'core: Enforce shared database object per database file' from Pekka Enberg

We need to ensures that there is a single, shared `Database` object per
a database file. We need because it is not safe to have multiple
independent WAL files open because coordination happens at process-level
POSIX file advisory locks.
Fixes #2267

Reviewed-by: Pere Diaz Bou <pere-altea@homail.com>

Closes #2299
This commit is contained in:
Pekka Enberg
2025-07-28 19:34:35 +03:00
5 changed files with 95 additions and 31 deletions

View File

@@ -355,6 +355,7 @@ mod tests {
),
SQLITE_OK
);
assert_eq!(sqlite3_close(db), SQLITE_OK);
}
let mut wal_path = temp_file.path().to_path_buf();
assert!(wal_path.set_extension("db-wal"));
@@ -380,6 +381,7 @@ mod tests {
assert_eq!(sqlite3_step(stmt), SQLITE_DONE);
assert_eq!(sqlite3_finalize(stmt), SQLITE_OK);
}
assert_eq!(sqlite3_close(db), SQLITE_OK);
}
}
@@ -459,6 +461,7 @@ mod tests {
),
SQLITE_OK
);
assert_eq!(sqlite3_close(db), SQLITE_OK);
}
let mut wal_path = temp_file.path().to_path_buf();
assert!(wal_path.set_extension("db-wal"));
@@ -483,6 +486,7 @@ mod tests {
assert_eq!(sqlite3_step(stmt), SQLITE_DONE);
assert_eq!(sqlite3_finalize(stmt), SQLITE_OK);
}
assert_eq!(sqlite3_close(db), SQLITE_OK);
}
}