Skip to content
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

refine the interaction between backups and main document connections #1461

Merged
merged 1 commit into from
Feb 20, 2025

Conversation

paulfitz
Copy link
Member

Context

Recently we changed backups to use the main document connection, when available, since then they can complete even while the document is changing constantly. The system making the backups and the system managing the document are quite loosely coupled, so the main document connection can get closed at any time, even during a backup. The backup process was written to expect this, but a problem appeared on the closing side: SQLite will refuse to close if a backup is in progress, and that error was entirely uncaught due to a missing await.

Proposed solution

This adds the needed await. It also adds some explicit robustness on both sides

Related issues

#1380
#1427

Has this been tested?

  • 👍 yes, I added tests to the test suite
  • 💭 no, because this PR is a draft and still needs work
  • 🙅 no, because this is not relevant here
  • 🙋 no, because I need help

Recently we changed to making backups using the main document
connection, when available. The system making the backups and
the system managing the document are quite loosely coupled, so
the main document connection can get closed at any time. The
backup process was written to expect this, but a problem appeared
on the closing side: SQLite will refuse to close if a backup is
in progress, and that error was entirely uncaught due to a missing
await.

This adds the needed await. It also adds some explicit robustness
on both sides so that it is easier to tell from local considerations
that shutdown should work.
@georgegevoian georgegevoian self-requested a review February 20, 2025 18:51
Copy link
Contributor

@georgegevoian georgegevoian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @paulfitz.

@paulfitz paulfitz merged commit 73d0b78 into main Feb 20, 2025
12 checks passed
@paulfitz paulfitz deleted the paulfitz/close-backup branch February 20, 2025 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants