From: stephan Date: Mon, 24 Nov 2025 20:43:14 +0000 (+0000) Subject: Do not allow the kvvfs transient flag to flag a previously-non-transient storage... X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b7ed25a86fdde1c6f583513c378a451ed92e3451;p=thirdparty%2Fsqlite.git Do not allow the kvvfs transient flag to flag a previously-non-transient storage as transient. i.e. only applies when first opening a db. Rename the transient flag to delete-on-close to avoid confusion with other meanings of transient in that context. FossilOrigin-Name: 46d6b636307d98d17344d995afd99204e16eb06b6b19021a824dab95267d5377 --- diff --git a/ext/wasm/api/sqlite3-vfs-kvvfs.c-pp.js b/ext/wasm/api/sqlite3-vfs-kvvfs.c-pp.js index eaf548b5b5..ffd9057da5 100644 --- a/ext/wasm/api/sqlite3-vfs-kvvfs.c-pp.js +++ b/ext/wasm/api/sqlite3-vfs-kvvfs.c-pp.js @@ -196,11 +196,11 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ */ refc: 1, /** - isTransient objects will be removed by xClose() when refc + deleteAtRefc0 objects will be removed by xClose() when refc reaches 0. The others will persist, to give the illusion of real back-end storage. Managed by xOpen(). */ - isTransient: false, + deleteAtRefc0: false, /** The backing store. Must implement the Storage interface. */ @@ -588,11 +588,11 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ const rc = originalMethods.vfs.xOpen(pProtoVfs, zName, pProtoFile, flags, pOutFlags); if( rc ) return rc; - let transient = false; + let deleteAt0 = false; if(n && wasm.isPtr(zName)){ - if(capi.sqlite3_uri_boolean(zName, "transient", 0)){ - transient = true; - //warn("transient=",transient); + if(capi.sqlite3_uri_boolean(zName, "delete-on-close", 0)){ + deleteAt0 = true; + //warn("transient=",deleteAt0); } if(capi.sqlite3_uri_boolean(zName, "wipe-before-open", 0)){ // TODO @@ -604,7 +604,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ //debug("xOpen", jzClass, s); if( s ){ ++s.refc; - if( true===transient ) s.isTransient = true; + //no if( true===deleteAt0 ) s.deleteAtRefc0 = true; s.files.push(f); }else{ /* TODO: a url flag which tells it to keep the storage @@ -621,7 +621,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ = cache.storagePool[other] = newStorageObj(jzClass); s.files.push(f); - s.isTransient = transient; + s.deleteAtRefc0 = deleteAt0; debug("xOpen installed storage handles [", jzClass, other,"]", s); } @@ -737,7 +737,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ pFileHandles.delete(pFile); const s = storageForZClass(h.jzClass); s.files = s.files.filter((v)=>v!==h.file); - if( --s.refc<=0 && s.isTransient ){ + if( --s.refc<=0 && s.deleteAtRefc0 ){ const other = h.file.$isJournal ? h.jzClass.replace(cache.rxJournalSuffix,'') : h.jzClass+'-journal'; diff --git a/ext/wasm/tester1.c-pp.js b/ext/wasm/tester1.c-pp.js index dddcfbf0ba..6499bfab83 100644 --- a/ext/wasm/tester1.c-pp.js +++ b/ext/wasm/tester1.c-pp.js @@ -2956,11 +2956,14 @@ globalThis.sqlite3InitModule = sqlite3InitModule; console.debug("kvvfs to Object:",exp); close(); - const dbFileRaw = 'file:new-storage?vfs=kvvfs&transient=1'; - db = new DB(dbFileRaw); + const dbFileRaw = 'file:new-storage?vfs=kvvfs&delete-on-close=1'; + db = new DB({ + filename: dbFileRaw, + //flags: 'ct' + }); db.exec(sqlSetup); const dbFilename = db.dbFilename(); - console.warn("db.dbFilename() =",dbFilename); + //console.warn("db.dbFilename() =",dbFilename); T.assert(3 === db.selectValue('select count(*) from kvvfs')); console.debug("kvvfs to Object:",exportDb(dbFilename)); const n = capi.sqlite3_js_kvvfs_size( dbFilename ); @@ -3004,7 +3007,7 @@ globalThis.sqlite3InitModule = sqlite3InitModule; const sqlCount = 'select count(*) from kvvfs'; try { const exportDb = capi.sqlite3_js_kvvfs_export_storage; - const dbFileRaw = 'file:'+filename+'?vfs=kvvfs&transient=1'; + const dbFileRaw = 'file:'+filename+'?vfs=kvvfs&delete-on-close=1'; db = new DB(dbFileRaw); capi.sqlite3_js_kvvfs_clear(filename); db.exec(sqlSetup); diff --git a/manifest b/manifest index 170c240324..77876626c6 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\ssqlite3_db_filename()\sto\sthe\ssqlite3.oo1.DB\stracing\soutput.\sDocument\san\sunfortunate\sdesign\schoice\swhich\swas\sonly\srecently\srecognized\sas\ssuch. -D 2025-11-24T20:36:49.964 +C Do\snot\sallow\sthe\skvvfs\stransient\sflag\sto\sflag\sa\spreviously-non-transient\sstorage\sas\stransient.\si.e.\sonly\sapplies\swhen\sfirst\sopening\sa\sdb.\sRename\sthe\stransient\sflag\sto\sdelete-on-close\sto\savoid\sconfusion\swith\sother\smeanings\sof\stransient\sin\sthat\scontext. +D 2025-11-24T20:43:14.574 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -600,7 +600,7 @@ F ext/wasm/api/sqlite3-api-worker1.c-pp.js 1041dd645e8e821c082b628cd8d9acf70c667 F ext/wasm/api/sqlite3-license-version-header.js 0c807a421f0187e778dc1078f10d2994b915123c1223fe752b60afdcd1263f89 F ext/wasm/api/sqlite3-opfs-async-proxy.js 9654b565b346dc609b75d15337f20acfa7af7d9d558da1afeb9b6d8eaa404966 F ext/wasm/api/sqlite3-vfs-helper.c-pp.js 3f828cc66758acb40e9c5b4dcfd87fd478a14c8fb7f0630264e6c7fa0e57515d -F ext/wasm/api/sqlite3-vfs-kvvfs.c-pp.js 6a85c98875479f8630bede48c9f5fd1e23e2a073b4d00b968c77ae2b3ac98887 +F ext/wasm/api/sqlite3-vfs-kvvfs.c-pp.js dc3e2df2a09136665c0a4f2c9e1c834fdde04e935dc29805d5f07bd81891de9e F ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js 26cb41d5a62f46a106b6371eb00fef02de3cdbfaa51338ba087a45f53028e0d0 F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js 88ce2078267a2d1af57525a32d896295f4a8db7664de0e17e82dc9ff006ed8d3 F ext/wasm/api/sqlite3-vtab-helper.c-pp.js 9097074724172e31e56ce20ccd7482259cf72a76124213cbc9469d757676da86 @@ -647,7 +647,7 @@ F ext/wasm/test-opfs-vfs.html 1f2d672f3f3fce810dfd48a8d56914aba22e45c6834e262555 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 c864070e09a140576ef96ab92117f152e167ea1fdb58da2a561fb2ecd2c5957f +F ext/wasm/tester1.c-pp.js 640e0e237d138ea571a025002576296f2cebc0c191b543e04ccbc65364cf2e85 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 @@ -2178,8 +2178,8 @@ F tool/version-info.c 33d0390ef484b3b1cb685d59362be891ea162123cea181cb8e6d2cf6dd F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh d924598cf2f55a4ecbc2aeb055c10bd5f48114793e7ba25f9585435da29e7e98 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P c6183261be77d03451aed563a5e4c19aa69706aa311cfdaf5db5e9b0a167d814 -R 1fdf36f4eda0e81a637497d307d7010d +P dec0c6073cc130ba445ec68bc49a410001d778c4aa21624dcb0a68b88fce251f +R 81f5c383db853c7093b30afaf52a3ca2 U stephan -Z 66d0275d0c479728ebca5605986b9fb1 +Z bbb5685fa2e259323cd967bbaccb09e4 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 127d1571c1..06c0c9f7de 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -dec0c6073cc130ba445ec68bc49a410001d778c4aa21624dcb0a68b88fce251f +46d6b636307d98d17344d995afd99204e16eb06b6b19021a824dab95267d5377