1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-27 20:41:58 +03:00

More tweaking of OPFS concurrency measures and the related test app.

FossilOrigin-Name: a8d4da1501d411085ec2fd48c4a056c8b1d97ef3c3203c5b403a854ac2864870
This commit is contained in:
stephan
2022-11-21 05:18:24 +00:00
parent 36d5554c9a
commit b38ac0986e
6 changed files with 68 additions and 44 deletions

View File

@ -220,22 +220,19 @@ class GetSyncHandleError extends Error {
}
};
GetSyncHandleError.convertRc = (e,rc)=>{
if(1){
/* This approach returns SQLITE_LOCKED to the C API
when getSyncHandle() fails but makes the very
wild assumption that such a failure _is_ a locking
error. In practice that appears to be the most
common error, by far, but we cannot unambiguously
if(0){
/* This approach makes the very wild assumption that such a
failure _is_ a locking error. In practice that appears to be
the most common error, by far, but we cannot unambiguously
distinguish that from other errors.
This approach demonstrably reduces concurrency-related
errors but is highly questionable.
This approach is highly questionable.
*/
return (e instanceof GetSyncHandleError)
? state.sq3Codes.SQLITE_LOCKED
? state.sq3Codes.SQLITE_IOERR_LOCK
: rc;
}else{
return ec;
return rc;
}
}
/**
@ -253,7 +250,7 @@ const getSyncHandle = async (fh)=>{
if(!fh.syncHandle){
const t = performance.now();
log("Acquiring sync handle for",fh.filenameAbs);
const maxTries = 4, msBase = 300;
const maxTries = 6, msBase = 300;
let i = 1, ms = msBase;
for(; true; ms = msBase * ++i){
try {
@ -271,7 +268,7 @@ const getSyncHandle = async (fh)=>{
}
warn("Error getting sync handle. Waiting",ms,
"ms and trying again.",fh.filenameAbs,e);
//await closeAutoLocks();
await closeAutoLocks();
Atomics.wait(state.sabOPView, state.opIds.retry, 0, ms);
}
}