perf(db): WAL checkpoint when closing the journal#10000
Conversation
SyncJournalDb::close commits the open transaction but does not checkpoint the WAL. The WAL file then keeps growing on subsequent opens until SQLite's automatic checkpoint heuristic kicks in. Add an explicit walCheckpoint() after commitTransaction() in close() so the WAL is folded back into the main database file when the client shuts down or unmounts an account. This keeps the on-disk WAL size bounded and improves startup time of the next session because there is less WAL replay work to do. Signed-off-by: Qoole <2862661+qoole@users.noreply.github.com>
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
Summary
SyncJournalDb::closecommits the open transaction but does not checkpoint the WAL. The WAL file then keeps growing on subsequent opens until SQLite's automatic checkpoint heuristic eventually folds it back, which can take a long time on quiet accounts.Added an explicit
walCheckpoint()(which already exists in this class) aftercommitTransaction()inclose(), so:One-line change. No behavioral risk:
walCheckpoint()is the same function the existing periodic-checkpoint logic invokes; the only difference is one additional call at the well-defined "we are about to close" boundary.Checklist
AI (if applicable)