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

disttask: update task in framework #46913

Merged
merged 13 commits into from
Sep 14, 2023
Merged

Conversation

ywqzzy
Copy link
Contributor

@ywqzzy ywqzzy commented Sep 12, 2023

What problem does this PR solve?

Issue Number: ref #46258

Problem Summary:
Framework should updateTask.

What is changed and how it works?

updateTask in framework only.
See comments newly added in task_table.go

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-tests-checked release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 12, 2023
@tiprow
Copy link

tiprow bot commented Sep 12, 2023

Hi @ywqzzy. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 12, 2023
@codecov
Copy link

codecov bot commented Sep 12, 2023

Codecov Report

Merging #46913 (32fb861) into master (2db6c0a) will decrease coverage by 0.5936%.
Report is 34 commits behind head on master.
The diff coverage is 48.8372%.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #46913        +/-   ##
================================================
- Coverage   73.2930%   72.6994%   -0.5936%     
================================================
  Files          1329       1353        +24     
  Lines        397364     403940      +6576     
================================================
+ Hits         291240     293662      +2422     
- Misses        87542      91629      +4087     
- Partials      18582      18649        +67     
Flag Coverage Δ
integration 28.7031% <0.0000%> (?)
unit 73.2452% <63.6363%> (-0.0478%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 54.0444% <ø> (ø)
parser 84.9803% <ø> (-0.0216%) ⬇️
br 48.5383% <ø> (-4.3934%) ⬇️

@@ -640,32 +640,39 @@ func (stm *TaskManager) UpdateGlobalTaskAndAddSubTasks(gTask *proto.Task, subtas
return err
}
if se.GetSessionVars().StmtCtx.AffectedRows() == 0 {
retryable = false
return errors.New("invalid task state transform, state already changed")
rs, err := ExecSQL(stm.ctx, se, "select id from mysql.tidb_global_task where id = %? and state = %?", gTask.ID, prevState)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe gtask has no update(currently add index/import into will always change gtask), we need to check if the task have changed its state by admin cancel.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why query it again when StmtCtx.AffectedRows() is 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why query it again when StmtCtx.AffectedRows() is 0?

If some onNextStage didn't update gtask, the affectedrows() return 0. But if the state didn't change by other admin command, it's safe to insert subtasks.
This case will not occurred for current add index and import into.

Copy link
Contributor

@D3Hunter D3Hunter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rest lgtm

@@ -640,32 +640,39 @@ func (stm *TaskManager) UpdateGlobalTaskAndAddSubTasks(gTask *proto.Task, subtas
return err
}
if se.GetSessionVars().StmtCtx.AffectedRows() == 0 {
retryable = false
return errors.New("invalid task state transform, state already changed")
rs, err := ExecSQL(stm.ctx, se, "select id from mysql.tidb_global_task where id = %? and state = %?", gTask.ID, prevState)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why query it again when StmtCtx.AffectedRows() is 0?

@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 14, 2023
@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Sep 14, 2023
@ti-chi-bot
Copy link

ti-chi-bot bot commented Sep 14, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: D3Hunter, tangenta

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Sep 14, 2023
@ti-chi-bot
Copy link

ti-chi-bot bot commented Sep 14, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-09-14 03:25:05.049435035 +0000 UTC m=+142271.017023066: ☑️ agreed by D3Hunter.
  • 2023-09-14 04:42:16.401863385 +0000 UTC m=+146902.369451436: ☑️ agreed by tangenta.

@ywqzzy
Copy link
Contributor Author

ywqzzy commented Sep 14, 2023

/retest

@tiprow
Copy link

tiprow bot commented Sep 14, 2023

@ywqzzy: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@hawkingrei
Copy link
Member

/retest

@hawkingrei
Copy link
Member

/test all

@ti-chi-bot ti-chi-bot bot merged commit f2cb16d into pingcap:master Sep 14, 2023
10 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants