fix: sync to the filesystem when a transaction ends - #1066
Open
AntonOfTheWoods wants to merge 1 commit into
Open
fix: sync to the filesystem when a transaction ends#1066AntonOfTheWoods wants to merge 1 commit into
AntonOfTheWoods wants to merge 1 commit into
Conversation
AntonOfTheWoods
force-pushed
the
fix/transaction-end-sync
branch
from
July 21, 2026 01:41
6127fe5 to
ee8a022
Compare
Every top-level query/exec ends with syncToFs(), gated on not being inside a transaction — but transaction() executed its terminal COMMIT/ROLLBACK while #inTransaction still suppressed that gate and cleared the flag only afterwards. A resolved transaction() had therefore neither performed nor scheduled any filesystem sync: with relaxedDurability: false the awaited durability promise was silently broken, and with relaxedDurability: true no background sync was even scheduled until some later unrelated query ran. Clear the flag before the terminal statement so #runExec ends the transaction with the same synchronization as a top-level exec, and sync explicitly on the tx.rollback() path, which exits the wrapper without running a terminal statement. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
AntonOfTheWoods
force-pushed
the
fix/transaction-end-sync
branch
from
July 21, 2026 02:47
ee8a022 to
91bd413
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every top-level query/exec ends with syncToFs(), gated on not being inside a transaction — but transaction() executed its terminal COMMIT/ROLLBACK while #inTransaction still suppressed that gate and cleared the flag only afterwards. A resolved transaction() had therefore neither performed nor scheduled any filesystem sync: with
relaxedDurability: falsethe awaited durability promise was silently broken, and withrelaxedDurability: trueno background sync was even scheduled until some later unrelated query ran.Clear the flag before the terminal statement so
#runExecends the transaction with the same synchronization as a top-level exec, and sync explicitly on thetx.rollback()path, which exits the wrapper without running a terminal statement.Fixes: #1065