Skip to content

sqlite: retry busy or locked backup steps - #66769

Open
lazerg wants to merge 2 commits into
nodejs:mainfrom
lazerg:fix/issue-66760-sqlite-backup-busy
Open

lazerg wants to merge 2 commits into
nodejs:mainfrom
lazerg:fix/issue-66760-sqlite-backup-busy

Conversation

@lazerg

@lazerg lazerg commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Fixes: #66760

When the first sqlite3_backup_step() call returns SQLITE_BUSY or SQLITE_LOCKED (for example because the source connection is inside a write transaction), sqlite3_backup_remaining() is still 0, so the job was not rescheduled. It then fell through to the SQLITE_DONE check and rejected with an error read from the destination connection: errcode 0, "not an error".

Both codes are retryable per the SQLite docs, so the job now reschedules the step whenever it gets one of them, whatever the remaining page count.

Signed-off-by: lazerg <lazerg2@gmail.com>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/sqlite

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. sqlite Issues and PRs related to the SQLite subsystem. labels Oct 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Caution

AgentScan found account activity patterns that may be consistent with automation. This is a heuristic, not proof that this pull request was opened by an agent or violates policy. AI-assisted contributions are permitted, but automated tooling must not open pull requests without advance approval, and contributors must personally understand, test, verify, and take responsibility for every submitted change. See the AgentScan analysis, AI use policy, and automation policy for additional context.

Signed-off-by: lazerg <lazerg2@gmail.com>
@codecov

codecov Bot commented Oct 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 90.49%. Comparing base (1c90519) to head (9aa10b5).

Files with missing lines Patch % Lines
src/node_sqlite.cc 66.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #66769      +/-   ##
==========================================
- Coverage   90.49%   90.49%   -0.01%     
==========================================
  Files         797      797              
  Lines      277598   277601       +3     
  Branches    53336    53332       -4     
==========================================
  Hits       251220   251220              
+ Misses      16790    16789       -1     
- Partials     9588     9592       +4     
Files with missing lines Coverage Δ
src/node_sqlite.cc 82.30% <66.66%> (-0.05%) ⬇️

... and 27 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agentscan:community-flagged c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. sqlite Issues and PRs related to the SQLite subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sqlite: backup() rejects with "not an error" when its first step returns SQLITE_BUSY or SQLITE_LOCKED

2 participants