-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
br/lightning: add range properties codec and kv/stats reader #45796
Conversation
Hi @tangenta. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/hold wait for #45724. |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #45796 +/- ##
================================================
+ Coverage 73.3404% 73.3916% +0.0512%
================================================
Files 1274 1280 +6
Lines 393217 394448 +1231
================================================
+ Hits 288387 289492 +1105
- Misses 86445 86522 +77
- Partials 18385 18434 +49
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
||
func (r *kvReader) nextKV() (key, val []byte, err error) { | ||
if r.byteReader.eof() { | ||
return nil, nil, nil |
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.
can we return the error directly to caller?
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.
Sure. Let me remove the eof flag.
} | ||
propLen := int(binary.BigEndian.Uint32(*lenBytes)) | ||
if cap(r.propBytes) < propLen { | ||
r.propBytes = make([]byte, propLen) |
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.
r.propBytes is not used?
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.
Removed.
} | ||
r.byteReader.reset() | ||
lenBytes, err := r.byteReader.readNBytes(4) | ||
if err != nil { |
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 may return EOF here.
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.
should convert to UnexpectedEOF except for the first readNBytes
/unhold |
// noEOF converts the EOF error to io.ErrUnexpectedEOF. | ||
func noEOF(err error) error { | ||
if err == io.EOF { | ||
return io.ErrUnexpectedEOF |
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.
The error is not traced
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.
I don't think we can have more clues when this is reported(even if it is traced).
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.
At least we can know the stack.
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.
Update.
sr, err := openStoreReaderAndSeek(ctx, store, name, 0) | ||
if err != nil { | ||
return nil, err | ||
} | ||
br, err := newByteReader(ctx, sr, bufSize) | ||
if err != nil { | ||
return nil, 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.
Same with kv_reader.go: 30-34
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.
initFileOffset
is different. I think it is simple enough.
}, nil | ||
} | ||
|
||
func (r *kvReader) nextKV() (key, val []byte, err error) { |
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.
kvReader and statReader's only have different nextxxx function, can we merge the code into one? just pass a function into the next function.
var k, v
next(func() {
k, v =
})
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.
Merging them into one is a bad idea because one may mistakenly call nextProps()
after nextKV()
, which is nonsense.
/lgtm |
@lance6716: Your lgtm message is repeated, so it is ignored. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: lance6716, wjhuang2016 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
What problem does this PR solve?
Issue Number: ref #45719
Problem Summary:
What is changed and how it works?
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.