-
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: restore portable backup error #20115
Conversation
2a56a3a
to
69e2054
Compare
Hi @rickif thanks for the contribution! While we review, could you push an update to the |
69e2054
to
8f961fa
Compare
@danxmoran OK, the |
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.
@rickif this change makes sense to me in theory from reading the docs on Read
and ReadFull
, but I'm not sure what to expect in practice from the use-case you mention (restoring on a high-latency network). In situations where Read
used to return "early", will ReadFull
now sit and wait for more data? Or will it still result in an error, but the error will be easier to understand?
Do you feel up to try adding tests to services/snapshotter/service.go
? The 2 cases I'd ideally want covered are:
conn
closes beforeReadFull
reads enough bytes to filltyp[:]
conn
doesn't "contain" enough bytes to filltyp[:]
whenReadFull
is called, but more data arrives afterwards
409486a
to
e7ef85d
Compare
@danxmoran I agree with u and have added some test codes .But I have doubt about the cases you mentioned.
|
A test case covering only a call to That said, I don't want to gatekeep your contribution for too long. If setting up test cases is going to take a significant amount of mocking & other test machinery, I'm ok merging without additional tests. In that case, could you add a comment above each of the |
It sounds like this will be more trouble than it's worth, I wouldn't spend more time on it. Thanks for investigating! |
This change is not aiming at providing a more clear explanation, but is mainly to solve the problem that the |
43a6e42
to
ce0d052
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 @rickif, one suggestion to curate the CHANGELOG, and some questions in the new test code.
} | ||
|
||
c := snapshotter.NewClient(l.Addr().String()) | ||
if _, err := c.UpdateMeta(req, bytes.NewReader(metaBytes)); 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.
Is there anything useful we could assert about the success case 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.
Yeah, I've add some codes to cover the success case
af50c02
to
1336bc0
Compare
@danxmoran Thanks for suggestions. The PR has been updated! |
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!
@danxmoran Hi, the PR has been pending for a long time. Is there any problem? |
2e38acd
to
67bb4d3
Compare
@dgnorton Hi, would you please do review for this PR? |
67bb4d3
to
671aaa7
Compare
df29ce3
to
1aa3707
Compare
@rickif very sorry for the delay, I'm not sure how I lost track of this one. I'll do a final review pass now. |
that would very nice. |
Re-opened this PR as #21991 so that I can update the changelog, otherwise it is good. |
This PR is to solve restore problem in influxdb 1.x
influxd restore -portable -host [host] -db [db] -newdb [newdb] [backup_path]
Restoring portable backup with this command may get error as below
Accordingly, the influxdb error log is as below
This problem happens at random, but more frequently in network with high latency. The
net.func (*TCPConn) Read
dose not promise that exactly len(buf) bytes is read when the call is returned, which leading this problem. Replacing thenet.func (*TCPConn) Read
withio.ReadFull
could fix this.