-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mac os: leftover wal/shm files #9
Comments
dont have access to my mac till early january, will take a look then |
Interesting enough, seems that it doesn't remove wal even after checkpoint pragma. Remembered out discussion on zulip: https://memex.zulipchat.com/#narrow/stream/279601-hpi/topic/atomically.20copying.20sqlite.20databases/near/270451281 Checked |
Strange -- that is what I was expecting to be the issue I have noticed dbs on Mac tend to be held open much longer - the files are much larger (both the Safari db and imessage db when I'm copying from), but I'm not sure if that's something custom in apple source code, some SQLite custom build flag or something else |
updated the CI so at least it runs here, even if it fails: d2e4c41 |
hmm weird -- added macos/windows but it seems to pass on CI: https://github.com/seanbreckenridge/sqlite_backup/actions/runs/3723426152/jobs/6314926386 will give it a try locally when I have my mac machine on me |
Huh, interesting! I guess I'll play with it on CI in |
So looked a bit more. On my laptop, even something basic like this results in leftover WALs:
Whereas on CI there are no turds. Locally I have:
Interesting enough,
Also tried the brew version on CI
Same -- no turds. So I assume it's something with mac os rather than sqlite or its flag ( |
Played a bit more -- suspect it has to do with SQLITE_FCNTL_PERSIST_WAL. Looks like it's only exposed in C API via I tried alternative bindings which do expose it: https://github.com/rogerbinns/apsw
as expected, WAL is empty, so checkpoint worked
So I suspect it has something to do with this? Although it's weird that python bindings and Not sure what's the best thing to do -- doesn't look like python's bindings are configurable so maybe the only way is to just forcefully remote WAL/SHM file after closing the connection (+ assert that wal is empty). Would be nice to make it conditional -- not sure on what though. Maybe |
Alternatively :)
this passes all tests on my laptop -- not sure if there is any issue with that I don't see? Somewhat surprising, because from documentation it should be the default |
Ah thanks for investigating -- seems it was a flag, just not the one in familiar with Ideally could have that SQLite version on the ci but don't know how possible that is, don't need to worry about that for now Yeah I'd be fine with the pragma statement there Was talking about it at dinner and my brother @AndrewSB is insisting a commit after the backup would fix this -- if backing up to a file (not to memory), could try that |
Yeah, initially had no idea about the flag either -- reading wal.c from sqlite source code ended up way more fruitful than half an hour of googling haha |
Hmm -- doesn't look like I'm tempted to call it a day and just merge my fix -- my only concern is that I don't really understand it now
However I made a typo here -- makes more sense to use
, it cleans up the Either way, it works -- so not sure if it's worth overthinking it too much, especially considering it only applies to a temporary database (so can't really break anythingn). |
Yeah, Im happy to merge anyways, just add a link above the line to this issue |
Sadly this doesn't happen on github actions (perhaps because of different macos version), so can't cover with a test. Most likely caused by a different default for SQLITE_FCNTL_PERSIST_WAL flag. More context/discussion here: purarue#9
Can close this if you're satisfied |
also checked against browserexport, and no shmems anymore 🎉 |
Great, will publish a pip version and bump browserexport required version later tonight |
fixes a bug with leftover -wal files on mac see purarue/sqlite_backup#9
Been running browserexport and noticed that it was leaving some wal files in the backup directory.
Tried running sqlite_backup tests and some actually fail.
Will try to investigate and pehraps add a mac os CI pipeline, but for now just leaving it here
The text was updated successfully, but these errors were encountered: