-
Notifications
You must be signed in to change notification settings - Fork 288
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
sorter: fix Unified Sorter error handling & add more unit test cases #1619
sorter: fix Unified Sorter error handling & add more unit test cases #1619
Conversation
/run-all-tests |
Codecov Report
@@ Coverage Diff @@
## master #1619 +/- ##
================================================
+ Coverage 52.9231% 53.0445% +0.1213%
================================================
Files 152 152
Lines 16027 16045 +18
================================================
+ Hits 8482 8511 +29
+ Misses 6646 6641 -5
+ Partials 899 893 -6 |
/run-all-tests |
cdc/puller/sorter/heap_sorter.go
Outdated
dataSize int64 | ||
lastTs uint64 // for debugging TODO remove | ||
canceller *asyncCanceller | ||
|
||
isEmpty bool // ready only field |
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 ready only
be read only
?
cdc/puller/sorter/unified_sorter.go
Outdated
@@ -223,6 +224,11 @@ func (s *UnifiedSorter) Run(ctx context.Context) error { | |||
default: | |||
} | |||
err := sorter.poolHandle.AddEvent(subctx, event) | |||
if cerror.ErrWorkerPoolHandleCancelled.Equal(errors.Cause(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.
if cerror.ErrWorkerPoolHandleCancelled.Equal(errors.Cause(err)) { | |
if cerror.ErrWorkerPoolHandleCancelled.Equal(err) { |
Equal
will unwrap the err first
cdc/puller/sorter/unified_sorter.go
Outdated
@@ -240,6 +246,11 @@ func (s *UnifiedSorter) Run(ctx context.Context) error { | |||
default: | |||
err := heapSorters[targetID].poolHandle.AddEvent(subctx, event) | |||
if err != nil { | |||
if cerror.ErrWorkerPoolHandleCancelled.Equal(errors.Cause(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.
ditto
backEnd := task.GetBackEnd() | ||
if backEnd != nil { | ||
defer task.markDeallocated() |
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.
What happens if
- In L154-L155,
backEnd
is not nil - When calling
pool.dealloc(backEnd)
, task is marked as deallocated andtask.backend
becomes nil, throughbackEnd
is not 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.
dealloc
will not race with itself, because dealloc
calls from different goroutines are always synchronized by a write to finished
channel.
…d-sorter-error-report-fix
/run-all-tests |
/lgtm |
/lgtm |
[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 writing |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 988c07c
|
unit tests are still unstable, PTAL @liuzix |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 1dd20c4
|
/merge |
This pull request has been accepted and is ready to merge. Commit hash: e6c8a5a
|
cdc/puller/sorter/sorter_test.go
Outdated
err := testSorter(ctx, c, sorter, 10000000, true) | ||
c.Assert(err, check.ErrorMatches, ".*injected alloc 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.
The timeout still happens, can we decrease the count 10000000
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 156e52e
|
/run-integration-tests |
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
cherry pick to release-4.0 in PR #1677 |
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
cherry pick to release-5.0 in PR #1678 |
What problem does this PR solve?
ErrWorkerPoolHandleCancelled
for some IO errors.What is changed and how it works?
ErrWorkerPoolHandleCancelled
error.Check List
Tests
Related changes
Release note