[dbnode] Filter out corrupt commit log files that were not present before the node started in the commit log bootstrapper #1581
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.
What this PR does / why we need it:
Currently the commit log bootstrapper will only attempt to read commit log files that were present on disk before the node started to prevent it from trying to read the files that are currently being written to.
In addition to this check, we also need to add a guard against identifying the active file as corrupt. If the active file appears corrupt it will trigger logic in the commit log bootstrapper that makes configurable decisions about whether the commit log bootstrap should fail or whether the corrupt file should be ignored.
The existing code allowed callers to pass a predicate to the commit log iterator which could be used to filter out files that were not present before the node started, however, this filter was not being applied to files that appeared corrupt. In some rare scenarios, the active commit log file will appear corrupt because it hasn't been flushed yet and the commit log bootstrapper will thus think its encountered a corrupt file when in fact it should have never tried to read that file in the first place.
This P.R changes the iterator such that the predicate can be applied to files identified as corrupt as well, and modifies the commit log bootstrapper to take advantage of this new feature.
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing and/or backwards incompatible change?:
Does this PR require updating code package or user-facing documentation?: