mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-21 00:54:19 +01:00
Merge 'bench/insert: use PRAGMA synchronous=full' from Jussi Saurio
synchronous=FULL means WAL is fsynced on every commit, which is what we also do. however we do not do the padding to sector alignment that sqlite does (see #2450), which makes sqlite do more work than we do. Closes #2485
This commit is contained in:
@@ -545,9 +545,25 @@ fn bench_insert_rows(criterion: &mut Criterion) {
|
||||
let temp_dir = tempfile::tempdir().unwrap();
|
||||
let db_path = temp_dir.path().join("bench.db");
|
||||
let sqlite_conn = rusqlite::Connection::open(db_path).unwrap();
|
||||
sqlite_conn
|
||||
.pragma_update(None, "synchronous", "FULL")
|
||||
.unwrap();
|
||||
sqlite_conn
|
||||
.pragma_update(None, "journal_mode", "WAL")
|
||||
.unwrap();
|
||||
let journal_mode = sqlite_conn
|
||||
.pragma_query_value(None, "journal_mode", |row| row.get::<_, String>(0))
|
||||
.unwrap();
|
||||
assert_eq!(journal_mode.to_lowercase(), "wal");
|
||||
let synchronous = sqlite_conn
|
||||
.pragma_query_value(None, "synchronous", |row| row.get::<_, String>(0))
|
||||
.unwrap();
|
||||
assert_eq!(synchronous.to_lowercase(), "full");
|
||||
|
||||
// Create test table
|
||||
sqlite_conn
|
||||
.execute("CREATE TABLE test (id INTEGER, value TEXT)", [])
|
||||
.unwrap();
|
||||
sqlite_conn
|
||||
.pragma_update(None, "locking_mode", "EXCLUSIVE")
|
||||
.unwrap();
|
||||
|
||||
Reference in New Issue
Block a user