-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
fix(tsm): should not check write-ahead-log size against default size #20585
Conversation
Thanks for the submission @foobar! Could you please:
|
d14466c
to
9cfeef7
Compare
done
added test case |
797ef38
to
c198f38
Compare
"cpu,host=C#!~#value": []tsm1.Value{tsm1.NewValue(1, 1.0)}, | ||
} | ||
if _, err := w.WriteMulti(values); err != nil { | ||
fatal(t, "write points", err) |
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.
Why not t.Fatalf
?
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.
it's just following the convention of other functions in this file. fatal() wraps Fatalf
|
||
encodeSize := int64(0) | ||
if files, err := ioutil.ReadDir(w.Path()); err != nil { | ||
fatal(t, "ReadDir", err) |
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.
Why not t.Fatalf
?
|
||
for i := 0; i < 100; i++ { | ||
if _, err := w.WriteMulti(values); err != nil { | ||
fatal(t, "write points", err) |
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.
t.Fatalf
?
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.
ditto
} | ||
files, err := ioutil.ReadDir(w.Path()) | ||
if err != nil { | ||
fatal(t, "ReadDir", err) |
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.
t.Fatalf
?
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.
ditto
fatal(t, "ReadDir", err) | ||
} | ||
for _, f := range files { | ||
if f.Size() > int64(segSize)+encodeSize { |
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.
if f.Size() > int64(segSize)+encodeSize { | |
if f.Size() > int64(segSize) + encodeSize { |
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.
gofmt doesn't add space here
tsdb/engine/tsm1/wal_test.go
Outdated
} else if len(files) != 1 { | ||
t.Fatalf("unexpected segments size %d", len(files)) | ||
} else { | ||
encodeSize = files[0].Size() |
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.
Style nit: I don't think this needs to be wrapped in the else
, since the other cases cause the test to bail out
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.
And if you move it out of the else
, you could remove encodeSize := int64(0)
above and define it a single time.
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.
done. thanks!
it should check against the local saved SegmentSize instead of the default const DefaultSegmentSize.
66f94ac
to
8a5a13e
Compare
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.
Thanks, LGTM! I'll wrangle it from here
it should check against the local saved SegmentSize instead of the
default const DefaultSegmentSize.