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
client: fix Stream timeout logic #5551
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
Codecov ReportBase: 75.71% // Head: 75.68% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #5551 +/- ##
==========================================
- Coverage 75.71% 75.68% -0.03%
==========================================
Files 326 326
Lines 32239 32243 +4
==========================================
- Hits 24409 24403 -6
- Misses 5715 5725 +10
Partials 2115 2115
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
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.
Need to test.
client/client.go
Outdated
for i := 0; i < maxRetryTimes; i++ { | ||
c.updateMember() |
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.
Consider use ScheduleCheckLeader
when createTsoStream
met error.
@@ -347,6 +347,86 @@ func TestTSOFollowerProxy(t *testing.T) { | |||
wg.Wait() | |||
} | |||
|
|||
// TestUnavailableTimeAfterLeaderIsReady is used to test https://github.com/tikv/pd/issues/5207 | |||
func TestUnavailableTimeAfterLeaderIsReady(t *testing.T) { | |||
re := require.New(t) |
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.
How long does this test take to run?
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 will paste a test result
} | ||
} | ||
retryTimeConsuming = 0 |
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.
Will the new implementation timeout immediately when back to streamChoosingLoop?
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.
No, it will check whether stream is created. If created, it will not timeout
tests/client/client_test.go
Outdated
cluster.RunServers([]*tests.TestServer{leader}) | ||
}() | ||
wg.Wait() | ||
t.Log(maxUnavailableTime, leaderReadyTime) |
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.
Do we need to log it?
tests/client/client_test.go
Outdated
go func() { | ||
defer wg.Done() | ||
var lastTS uint64 | ||
for i := 0; i < tsoRequestRound; i++ { | ||
var physical, logical int64 | ||
var ts uint64 | ||
physical, logical, err = cli.GetTS(context.Background()) | ||
ts = tsoutil.ComposeTS(physical, logical) | ||
if err != nil { | ||
maxUnavailableTime = time.Now() | ||
continue | ||
} | ||
re.NoError(err) | ||
re.Less(lastTS, ts) | ||
lastTS = ts | ||
} | ||
}() |
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.
How about defining a function?
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
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
In response to a cherrypick label: new pull request created: #5580. |
In response to a cherrypick label: new pull request created: #5581. |
In response to a cherrypick label: new pull request created: #5582. |
close tikv#5207 Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
close tikv#5207 Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
close tikv#5207 Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
In response to a cherrypick label: new pull request created: #5583. |
close tikv#5207 Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
In response to a cherrypick label: new pull request could not be created: failed to create pull request against tikv/pd#release-6.1 from head ti-chi-bot:cherry-pick-5551-to-release-6.1: the GitHub API request returns a 403 error: {"message":"You have exceeded a secondary rate limit and have been temporarily blocked from content creation. Please retry your request again later.","documentation_url":"https://docs.github.com/rest/overview/resources-in-the-rest-api#secondary-rate-limits"} |
In response to a cherrypick label: new pull request created: #5584. |
close tikv#5207 Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
close tikv#5207 Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
close tikv#5207 Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
In response to a cherrypick label: new pull request created: #5599. |
Signed-off-by: Cabinfever_B cabinfeveroier@gmail.com
What problem does this PR solve?
Issue Number: Close #5207
What is changed and how does it work?
Check List
Tests
Side effects
Related changes
Release note