Skip to content

Conversation

D3Hunter
Copy link
Contributor

What problem does this PR solve?

Issue Number: ref #59640

Problem Summary:

What changed and how does it work?

  • add extra_params field to task system tables to store extra params used by the framework
  • add ManualRecovery, when enabled, the task will move to awaiting-resolution state when some subtask fail

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

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 release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Feb 19, 2025
Copy link

tiprow bot commented Feb 19, 2025

Hi @D3Hunter. 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-sigs/prow repository.

Copy link

codecov bot commented Feb 19, 2025

Codecov Report

Attention: Patch coverage is 77.02703% with 17 lines in your changes missing coverage. Please review.

Project coverage is 74.8973%. Comparing base (b45a9e8) to head (27e3283).
Report is 18 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #59641        +/-   ##
================================================
+ Coverage   72.9779%   74.8973%   +1.9194%     
================================================
  Files          1694       1744        +50     
  Lines        468758     480723     +11965     
================================================
+ Hits         342090     360049     +17959     
+ Misses       105596      98140      -7456     
- Partials      21072      22534      +1462     
Flag Coverage Δ
integration 48.7935% <0.0000%> (?)
unit 72.2672% <77.0270%> (+0.0913%) ⬆️

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

Components Coverage Δ
dumpling 52.6910% <ø> (ø)
parser ∅ <ø> (∅)
br 61.1746% <ø> (+16.0970%) ⬆️

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Feb 20, 2025
@D3Hunter
Copy link
Contributor Author

@lance6716 ptal

@lance6716 lance6716 requested a review from Copilot February 24, 2025 02:29
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 7 out of 22 changed files in this pull request and generated 2 comments.

Files not reviewed (15)
  • pkg/disttask/framework/integrationtests/BUILD.bazel: Language not supported
  • pkg/disttask/framework/storage/task_state_test.go: Evaluated as low risk
  • pkg/disttask/framework/taskexecutor/task_executor_testkit_test.go: Evaluated as low risk
  • pkg/disttask/importinto/job_testkit_test.go: Evaluated as low risk
  • pkg/disttask/framework/scheduler/scheduler_manager_test.go: Evaluated as low risk
  • pkg/disttask/framework/scheduler/interface.go: Evaluated as low risk
  • pkg/ddl/backfilling_dist_scheduler_test.go: Evaluated as low risk
  • pkg/disttask/framework/handle/handle.go: Evaluated as low risk
  • pkg/disttask/framework/scheduler/scheduler_test.go: Evaluated as low risk
  • pkg/disttask/framework/storage/task_table.go: Evaluated as low risk
  • pkg/disttask/framework/planner/planner.go: Evaluated as low risk
  • pkg/disttask/framework/storage/table_test.go: Evaluated as low risk
  • pkg/disttask/framework/storage/task_state.go: Evaluated as low risk
  • pkg/disttask/framework/testutil/disttest_util.go: Evaluated as low risk
  • pkg/disttask/framework/doc.go: Evaluated as low risk

Comment on lines +85 to +86
tk.MustExec(fmt.Sprintf("update mysql.tidb_background_subtask set state='pending' where state='failed' and task_key= %d", taskID))
tk.MustExec(fmt.Sprintf("update mysql.tidb_global_task set state='running' where id = %d", taskID))
Copy link
Preview

Copilot AI Feb 24, 2025

Choose a reason for hiding this comment

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

The task key is being used directly in the SQL query, which could lead to SQL injection vulnerabilities. Use parameterized queries to avoid potential issues.

Suggested change
tk.MustExec(fmt.Sprintf("update mysql.tidb_background_subtask set state='pending' where state='failed' and task_key= %d", taskID))
tk.MustExec(fmt.Sprintf("update mysql.tidb_global_task set state='running' where id = %d", taskID))
tk.MustExec("update mysql.tidb_background_subtask set state='pending' where state='failed' and task_key=?", taskID)
tk.MustExec("update mysql.tidb_global_task set state='running' where id=?", taskID)

Copilot uses AI. Check for mistakes.

Comment on lines +85 to +86
tk.MustExec(fmt.Sprintf("update mysql.tidb_background_subtask set state='pending' where state='failed' and task_key= %d", taskID))
tk.MustExec(fmt.Sprintf("update mysql.tidb_global_task set state='running' where id = %d", taskID))
Copy link
Preview

Copilot AI Feb 24, 2025

Choose a reason for hiding this comment

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

The task ID is being used directly in the SQL query, which could lead to SQL injection vulnerabilities. Use parameterized queries to avoid potential issues.

Suggested change
tk.MustExec(fmt.Sprintf("update mysql.tidb_background_subtask set state='pending' where state='failed' and task_key= %d", taskID))
tk.MustExec(fmt.Sprintf("update mysql.tidb_global_task set state='running' where id = %d", taskID))
tk.MustExec("update mysql.tidb_background_subtask set state='pending' where state='failed' and task_key= ?", taskID)
tk.MustExec("update mysql.tidb_global_task set state='running' where id = ?", taskID)

Copilot uses AI. Check for mistakes.

Copy link
Contributor

@lance6716 lance6716 left a comment

Choose a reason for hiding this comment

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

/hold
free to unhold

@ti-chi-bot ti-chi-bot bot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Feb 24, 2025
Copy link

ti-chi-bot bot commented Feb 24, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-02-20 06:36:33.758211771 +0000 UTC m=+1116036.154433833: ☑️ agreed by tangenta.
  • 2025-02-24 02:37:45.128758867 +0000 UTC m=+237013.081917128: ☑️ agreed by lance6716.

@D3Hunter
Copy link
Contributor Author

/unhold

@ti-chi-bot ti-chi-bot bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 24, 2025
Copy link

ti-chi-bot bot commented Feb 24, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lance6716, tangenta, yudongusa

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 the approved label Feb 24, 2025
@D3Hunter
Copy link
Contributor Author

/retest

Copy link

tiprow bot commented Feb 24, 2025

@D3Hunter: 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-sigs/prow repository.

@D3Hunter
Copy link
Contributor Author

/retest

Copy link

tiprow bot commented Feb 24, 2025

@D3Hunter: 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-sigs/prow repository.

@D3Hunter
Copy link
Contributor Author

/retest

Copy link

tiprow bot commented Feb 24, 2025

@D3Hunter: 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-sigs/prow repository.

@D3Hunter
Copy link
Contributor Author

/retest

Copy link

tiprow bot commented Feb 24, 2025

@D3Hunter: 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-sigs/prow repository.

@ti-chi-bot ti-chi-bot bot merged commit 246a241 into pingcap:master Feb 24, 2025
25 checks passed
@D3Hunter D3Hunter deleted the dxf-manual-resolve branch February 24, 2025 09:44
zeminzhou pushed a commit to zeminzhou/tidb that referenced this pull request May 6, 2025
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/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants