Ensure external streams checkpoint on commit#2652
Merged
Conversation
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.
Replacement for #2641
This pull request introduces improvements to how LiteDB handles checkpointing when using external streams, particularly ensuring data durability and correct restoration of checkpoint settings. It also adds new tests to verify these behaviors. The most important changes are grouped below.
Checkpointing Behavior Improvements:
LiteDatabaseconstructor, when using an external data stream without a dedicated log stream and the stream is writable, the database now forces checkpointing by setting thePragmas.CHECKPOINTvalue to1to ensure commits are flushed to the data stream. The original checkpoint value is saved for later restoration.LiteDatabaseinstance, if the checkpoint value was overridden, it is restored to its original value to avoid side effects in subsequent uses.Testing Enhancements:
IssueCheckpointFlush_Testswith tests verifying that:Internal Structure:
_checkpointOverrideinLiteDatabaseto track any temporary changes to the checkpoint setting.