-
Notifications
You must be signed in to change notification settings - Fork 454
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
Improve commitlog bootstrapping reliability in the face of sudden failures #1065
Conversation
richardartoul
commented
Oct 10, 2018
•
edited
Loading
edited
- Prevent commit log reader from deadlocking when faced with certain types of commit log file corruption
- Add regression property test to verify that the commit log reader never deadlocks or gets stuck regardless of any kind of random corruption
Codecov Report
@@ Coverage Diff @@
## master #1065 +/- ##
==========================================
+ Coverage 77.35% 77.37% +0.02%
==========================================
Files 541 541
Lines 45917 45924 +7
==========================================
+ Hits 35518 35534 +16
+ Misses 8142 8137 -5
+ Partials 2257 2253 -4
Continue to review full report at Codecov.
|
src/dbnode/persist/fs/types.go
Outdated
@@ -460,3 +460,13 @@ type BlockRetrieverOptions interface { | |||
// IdentifierPool returns the identifierPool | |||
IdentifierPool() ident.Pool | |||
} | |||
|
|||
// FD is the interface implemented by *os.File. | |||
type FD interface { |
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.
nit: move this to m3/src/x/os
and call it File
instead of FD
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.
good call
@@ -80,6 +80,13 @@ type commitLogWriter interface { | |||
Close() error | |||
} | |||
|
|||
type chunkWriterIface interface { | |||
reset(f fs.FD) |
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.
nit: use uniform casing in method names
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.
Some have to be public to implement other interfaces, other methods should probably just be private...but I guess its a private interface so I guess it doesnt matter
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.
embed the interface's rather than copying methods if you can help it.
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.
that worked actually, cheers
@@ -80,6 +80,13 @@ type commitLogWriter interface { | |||
Close() error | |||
} | |||
|
|||
type chunkWriterIface interface { |
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.
naming nit: not a fan of the Iface
- how about calling the interface chunkWriter
and the usual struct fsChunkWriter
?
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.
yeah sure, I didn't like this either
@@ -122,12 +124,25 @@ func TestCommitLogReadWrite(t *testing.T) { | |||
} | |||
|
|||
func TestCommitLogPropTest(t *testing.T) { | |||
// Temporarily reduce size of buffered channels to increase change of |
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.
s/change/chance/
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