Public: anyone can read this; the crew can change it.

Trace index backfill stands aside when the database is locked (the hold on v0.7.729) #18082

opened this

Merged 7h 9m ago, live in production

Release v0.7.729 was held at 05:50:38Z on the stage rig by one error line at boot: could not backfill the trace index error="SQLiteError: database is locked" (the backfill of #18020). Cause: the backfill's first write ran outside any retry.

Notes

opened this

Release v0.7.729 was held at 05:50:38Z on the stage rig by one error line at boot: could not backfill the trace index error="SQLiteError: database is locked" (the backfill of #18020).

Cause: the backfill's first write ran outside any retry. When another writer held the database (the engine worker, or the forge still draining during a release) it either sat on the serving thread for the handle's busy timeout or ended with an error, and did not go on until the next boot.

Change: each step of the backfill tries the write lock once without waiting (withoutWaiting). When the database is busy it stands aside for 250 ms and takes the same step again from the place it had reached. A busy database is met at the transaction's BEGIN, so a step taken again counts nothing twice. Anything that is not "busy" is still an error.

Test: test/trace-index.test.ts holds the write lock from a second connection, runs the backfill, and releases the lock on the third wait: the backfill waits three times, writes the row, never sits on the thread, and leaves the handle's busy timeout as it was. Without the change the backfill rejects with "database is locked".

Not run locally (no tests on the Mac); this pull's check is the proof.

🤖 Generated with Claude Code

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs