'insert into kvvfs(a) values(1),(2),(3)'
];
try {
+ T.assert( 0===db.storageSize(), "expecting 0 storage size" );
db.clearStorage(/*must not throw*/);
+ T.assert( 0===db.storageSize(), "expecting 0 storage size" );
db.exec(sqlSetup);
+ T.assert( 0<db.storageSize(), "expecting non-0 db size" );
+ db.clearStorage(/*wiping everything out from under it*/);
+ T.assert( 0===db.storageSize(), "expecting 0 storage size" );
+ db.exec(sqlSetup/*that actually worked*/);
+ T.assert( 0<db.storageSize(), "expecting non-0 db size" );
const close = ()=>{
db.close();
db = undefined;
db = new JDb(filename);
db.exec('insert into kvvfs(a) values(4),(5),(6)');
T.assert(6 === db.selectValue('select count(*) from kvvfs'));
- console.debug("kvvfs to Object:",db.exportToObject(true));
+ const exp = db.exportToObject(true);
+ T.assert( filename===exp.name, "Broken export filename" )
+ .assert( exp?.data?.['kvvfs-sz'] > 0, "Missing kvvfs-sz" );
+ console.debug("kvvfs to Object:",exp);
close();
db = new JDb('new-storage');
be semi-persistent (until the page is reloaded).
*/
let ddb = new JDb('new-storage');
- try{
- ddb.selectValue('select a from kvvfs');
- }finally{
- ddb.close();
- }
+ try{ddb.selectValue('select a from kvvfs')}
+ finally{ddb.close()}
}, /.*no such table: kvvfs.*/);
}finally{
if( db ) db.close();
}
}
}/*transient kvvfs*/)
+ .t({
+ name: 'concurrent transient kvvfs',
+ //predicate: ()=>false,
+ test: function(sqlite3){
+ const filename = 'my';
+ const JDb = sqlite3.oo1.JsStorageDb;
+ let db;
+ let duo;
+ const sqlSetup = [
+ 'create table kvvfs(a);',
+ 'insert into kvvfs(a) values(1),(2),(3)'
+ ];
+ try {
+ db = new JDb(filename);
+ db.clearStorage(/*must not throw*/);
+ db.exec(sqlSetup);
+ const close = ()=>{
+ db.close();
+ db = undefined;
+ };
+ T.assert(3 === db.selectValue('select count(*) from kvvfs'));
+
+ const duo = new JDb(filename);
+ duo.exec('insert into kvvfs(a) values(4),(5),(6)');
+ T.assert(6 === db.selectValue('select count(*) from kvvfs'));
+ console.debug("duo.exportToObject()",duo.exportToObject(false));
+ close();
+ T.assert(6 === duo.selectValue('select count(*) from kvvfs'));
+ duo.close();
+ T.mustThrowMatching(function(){
+ let ddb = new JDb(filename);
+ try{ddb.selectValue('select a from kvvfs')}
+ finally{ddb.close()}
+ }, /.*no such table: kvvfs.*/);
+
+ /*
+ TODO: more advanced concurrent use tests, e.g. looping
+ over a query in one connection while writing from
+ another. Currently that will probably corrupt the db, and
+ kvvfs's journaling does not support multiple journals per
+ storage unit. We need to test the locking and fix it as
+ appropriate.
+ */
+ }finally{
+ if( db ) db.close();
+ if( duo ) duo.close();
+ }
+ }
+ }/*transient kvvfs*/)
//#if enable-see
.t({
name: 'kvvfs with SEE encryption',
-C Bump\skvvfs's\ssqlite3_vfs::iVersion\sto\s2\sso\sthat\sits\sxCurrentTimeInt64()\scan\sbe\sused.\sAdd\sJsStorageDb.exportToObject()\sto\sserialize\sa\skvvfs\sto\sa\sJSON-friendly\sform.
-D 2025-11-23T12:14:18.400
+C Add\stests\sdemonstrating\sbasic\sconcurrent\suse\sof\skvvfs\sstorage\sand\sthat\skvvfs\sstill\sworks\safter\swiping\sthe\sstorage\sout\sfrom\sunder\sit).
+D 2025-11-23T13:33:56.502
F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F ext/wasm/test-opfs-vfs.js 1618670e466f424aa289859fe0ec8ded223e42e9e69b5c851f809baaaca1a00c
F ext/wasm/tester1-worker.c-pp.html 0e432ec2c0d99cd470484337066e8d27e7aee4641d97115338f7d962bf7b081a
F ext/wasm/tester1.c-pp.html 52d88fe2c6f21a046030a36410b4839b632f4424028197a45a3d5669ea724ddb
-F ext/wasm/tester1.c-pp.js a0f3b0c36503440d5488a40c22bfeb633d8011a94db0403a8e22a1a22c801c43
+F ext/wasm/tester1.c-pp.js 003a04f00b5e485055c368aa780a9e3cf6af69ff584bb76c7b68f4ebee1b4dca
F ext/wasm/tests/opfs/concurrency/index.html 657578a6e9ce1e9b8be951549ed93a6a471f4520a99e5b545928668f4285fb5e
F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65ad09f510589c779b7cc6a803a88
F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2
F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
F tool/warnings.sh d924598cf2f55a4ecbc2aeb055c10bd5f48114793e7ba25f9585435da29e7e98
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 66fb9978f0a63887d214e895343adedfa46ee7aefccb8389d6d3af727e0a65ea
-R b2359aa56435f6b00b3674071d34a67b
+P 393c1beee00ec3b3e98eb385cae0abeb1b34475140c0e8c3d57541d349904436
+R cf7b7a0fd852f7fd31d9360f143096e9
U stephan
-Z 40d9eaa6863aa6db1ffa4d5313d4844e
+Z 284788218e69c476d1bbab2a25fe74dd
# Remove this line to create a well-formed Fossil manifest.