Skip to content
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: check kill signal against 0 (#50029) #50168

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion store/copr/batch_coprocessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,12 @@
case resp, ok = <-b.respChan:
return
case <-ticker.C:
if atomic.LoadUint32(b.vars.Killed) == 1 {
killed := atomic.LoadUint32(b.vars.Killed)
if killed != 0 {
logutil.Logger(ctx).Info(
"a killed signal is received",
zap.Uint32("signal", killed),
)

Check warning on line 1048 in store/copr/batch_coprocessor.go

View check run for this annotation

Codecov / codecov/patch

store/copr/batch_coprocessor.go#L1045-L1048

Added lines #L1045 - L1048 were not covered by tests
resp = &batchCopResponse{err: derr.ErrQueryInterrupted}
ok = true
return
Expand Down
18 changes: 15 additions & 3 deletions store/copr/coprocessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,12 @@
exit = true
return
case <-ticker.C:
if atomic.LoadUint32(it.vars.Killed) == 1 {
killed := atomic.LoadUint32(it.vars.Killed)
if killed != 0 {
logutil.Logger(ctx).Info(
"a killed signal is received",
zap.Uint32("signal", killed),
)

Check warning on line 929 in store/copr/coprocessor.go

View check run for this annotation

Codecov / codecov/patch

store/copr/coprocessor.go#L926-L929

Added lines #L926 - L929 were not covered by tests
resp = &copResponse{err: derr.ErrQueryInterrupted}
ok = true
return
Expand Down Expand Up @@ -1812,8 +1817,15 @@

// finished checks the flags and finished channel, it tells whether the worker is finished.
func (worker *copIteratorWorker) finished() bool {
if worker.vars != nil && worker.vars.Killed != nil && atomic.LoadUint32(worker.vars.Killed) == 1 {
return true
if worker.vars != nil && worker.vars.Killed != nil {
killed := atomic.LoadUint32(worker.vars.Killed)
if killed != 0 {
logutil.BgLogger().Info(
"a killed signal is received in copIteratorWorker",
zap.Uint32("signal", killed),
)
return true
}
}
select {
case <-worker.finishCh:
Expand Down