fix(record-store): ensure record sync before marking as stored #2591
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.
Record Store Sync Improvements
Problem
The
can_store_after_restart
test was failing because records were not being properly synced to disk before being marked as stored. This could lead to potential data loss in case of system crashes or unexpected restarts.Solution
sync_all()
Result
chain usingand_then
AddLocalRecordAsStored
command after both operations succeedTesting
can_store_after_restart
testImpact
This change improves data reliability by ensuring that records are properly synced to disk before being marked as stored. This prevents potential data loss in scenarios where the system crashes or restarts unexpectedly after a write but before the data is fully synced to disk.