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

[pick to 1.2] fix a bug that process's cancel not match to its context #17349

Merged
merged 2 commits into from
Jul 5, 2024
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
1 change: 1 addition & 0 deletions pkg/sql/compile/remoterunServer.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ func (receiver *messageReceiverOnServer) newCompile() (*Compile, error) {
cnInfo.hakeeper,
cnInfo.udfService,
cnInfo.aicm)
proc.Ctx = runningCtx
proc.Cancel = runningCancel
proc.UnixTime = pHelper.unixTime
proc.Id = pHelper.id
Expand Down
9 changes: 7 additions & 2 deletions pkg/vm/process/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,18 @@ func New(
hakeeper logservice.CNHAKeeperClient,
udfService udf.Service,
aicm *defines.AutoIncrCacheManager) *Process {

// process should always have a cancel context to help we close this query.
processCtx, processCancel := context.WithCancel(ctx)

return &Process{
mp: m,
Ctx: ctx,
Ctx: processCtx,
Cancel: processCancel,
TxnClient: txnClient,
TxnOperator: txnOperator,
FileService: fileService,
IncrService: incrservice.GetAutoIncrementService(ctx),
IncrService: incrservice.GetAutoIncrementService(processCtx),
UnixTime: time.Now().UnixNano(),
LastInsertID: new(uint64),
LockService: lockService,
Expand Down
Loading