aboutsummaryrefslogtreecommitdiff
path: root/ext/wasm/tester1.c-pp.js
diff options
context:
space:
mode:
authorstephan <stephan@noemail.net>2024-07-22 20:58:51 +0000
committerstephan <stephan@noemail.net>2024-07-22 20:58:51 +0000
commit71e2bdb2b45c03d4ed5b8cfe3998a18881afbd76 (patch)
treea3e18f9db811dc6c9af702ab1348945ebebfd160 /ext/wasm/tester1.c-pp.js
parent04416ddc519d89ca6263f269dbb3c3944a40ed3f (diff)
downloadsqlite-71e2bdb2b45c03d4ed5b8cfe3998a18881afbd76.tar.gz
sqlite-71e2bdb2b45c03d4ed5b8cfe3998a18881afbd76.zip
OPFS VFSes: remove the on-open() pragma calls, as those (A) already reflected the build-time default settings and (B) they made it illegal to run locking_mode=exclusive, which is a requirement for WAL mode without shared memory. Modify part of the test suite to demonstrate that the SAHPool VFS can run in WAL mode so long as locking_mode=exclusive is used.
FossilOrigin-Name: 19cd8e2b056d7842ee39afb7160c901c9dc55a5bac8049cb0b5246210f6b920d
Diffstat (limited to 'ext/wasm/tester1.c-pp.js')
-rw-r--r--ext/wasm/tester1.c-pp.js19
1 files changed, 17 insertions, 2 deletions
diff --git a/ext/wasm/tester1.c-pp.js b/ext/wasm/tester1.c-pp.js
index d99d56fa9..b5125b0d8 100644
--- a/ext/wasm/tester1.c-pp.js
+++ b/ext/wasm/tester1.c-pp.js
@@ -3113,11 +3113,25 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
T.assert(db instanceof sqlite3.oo1.DB)
.assert(1 === u1.getFileCount());
db.exec([
+ 'pragma locking_mode=exclusive;',
+ 'pragma journal_mode=wal;'
+ /* WAL mode only works in this VFS if locking_mode=exclusive
+ is invoked prior to the first db access, as this build
+ does not have the shared-memory APIs needed for WAL without
+ exclusive-mode locking. See:
+
+ https://sqlite.org/wal.html#use_of_wal_without_shared_memory
+
+ Note that WAL mode here DOES NOT add any concurrency capabilities
+ to this VFS, but it MAY provide slightly improved performance
+ over the other journaling modes.
+ */,
'create table t(a);',
'insert into t(a) values(1),(2),(3)'
]);
- T.assert(1 === u1.getFileCount());
- T.assert(3 === db.selectValue('select count(*) from t'));
+ T.assert(2 === u1.getFileCount() /* one is the journal file */)
+ .assert(3 === db.selectValue('select count(*) from t'))
+ .assert('wal'===db.selectValue('pragma journal_mode'));
db.close();
T.assert(1 === u1.getFileCount());
db = new u2.OpfsSAHPoolDb(dbName);
@@ -3137,6 +3151,7 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
.assert( dbytes.byteLength == nWrote );
let db2 = new u1.OpfsSAHPoolDb(dbName2);
T.assert(db2 instanceof sqlite3.oo1.DB)
+ //.assert('wal' == db2.selectValue("pragma journal_mode=WAL"))
.assert(3 === db2.selectValue('select count(*) from t'));
db2.close();
T.assert(true === u1.unlink(dbName2))