-
Notifications
You must be signed in to change notification settings - Fork 455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[dbnode] Fix index flush recovery when previous flush attempts have failed #1574
[dbnode] Fix index flush recovery when previous flush attempts have failed #1574
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1574 +/- ##
======================================
Coverage 71.8% 71.8%
======================================
Files 946 946
Lines 78002 78002
======================================
Hits 56015 56015
Misses 18343 18343
Partials 3644 3644
Continue to review full report at Codecov.
|
// fileset files has a checkpoint file. | ||
func (f FileSetFile) HasCheckpointFile() bool { | ||
func (f FileSetFile) HasCompleteCheckpointFile() bool { | ||
for _, fileName := range f.AbsoluteFilepaths { | ||
if strings.Contains(fileName, checkpointFileSuffix) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably don't need this line anymore since CompleteCheckpointFileExists
does this already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True but that will cause an "Invariant error" to be allocated which I'd like to avoid in the case that we're scanning a lot of files.
… of github.com:m3db/m3 into r/fix-index-flush-not-overwriting-half-persisted-files
… of github.com:m3db/m3 into r/fix-index-flush-not-overwriting-half-persisted-files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with nits
src/dbnode/persist/fs/files.go
Outdated
type LazyEvalBool uint8 | ||
|
||
const ( | ||
// EvalNone indicated the boolean has not been evaluated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indicates
src/dbnode/persist/fs/files.go
Outdated
@@ -73,14 +73,27 @@ var ( | |||
|
|||
type fileOpener func(filePath string) (*os.File, error) | |||
|
|||
// LazyEvalBool is a boolean is lazily evaluated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
boolean that is
Prior to this change if an index flush failed to complete and write out a checkpoint file, it would leave dirty files that would never be able to be overwritten.
This changes the behavior to only check that the checkpoint file does not exist and is valid, rather than check if a segment file exists or not before writing it.
It also updates all call sites to correctly always validate a checkpoint file rather than just check for existence in other parts of the
persist/fs
package.