1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

OPFS VFS: translate createSyncAccessHandle() exceptions which appear to be locking violations to SQLITE_BUSY. This seems to improve concurrency considerably even with a reduced retry count of 5 (was 6).

FossilOrigin-Name: 0d36021d107d3afca190ad61c3380536ad0cc2d493d345d48f9f9c1191741128
This commit is contained in:
stephan
2022-12-02 18:06:26 +00:00
parent d2603adf46
commit 95bc4d67bb
5 changed files with 35 additions and 29 deletions

View File

@@ -277,7 +277,7 @@ const installOpfsVfs = function callee(options){
of this value is also used for determining how long to wait on
lock contention to free up.
*/
state.asyncIdleWaitTime = 100;
state.asyncIdleWaitTime = 150;
/**
Whether the async counterpart should log exceptions to
the serialization channel. That produces a great deal of
@@ -636,6 +636,12 @@ const installOpfsVfs = function callee(options){
a[i] = f._chars[ndx];
}
return a.join("");
/*
An alternative impl. with an unpredictable length
but much simpler:
Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(36)
*/
};
/**
@@ -1159,7 +1165,7 @@ const installOpfsVfs = function callee(options){
"pragma journal_mode=persist;",
/* Set a default busy-timeout handler to help OPFS dbs
deal with multi-tab/multi-worker contention. */
"pragma busy_timeout=3000;",
"pragma busy_timeout=5000;",
/*
This vfs benefits hugely from cache on moderate/large
speedtest1 --size 50 and --size 100 workloads. We currently