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: fix failed step is taken as success #49971

Merged
merged 8 commits into from
Jan 2, 2024

Conversation

D3Hunter
Copy link
Contributor

@D3Hunter D3Hunter commented Jan 2, 2024

What problem does this PR solve?

Issue Number: close #49950

Problem Summary:

What changed and how does it work?

  • see issue. also fix some flaky test

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 needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. 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 Jan 2, 2024
Copy link

tiprow bot commented Jan 2, 2024

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/test-infra repository.

Copy link

codecov bot commented Jan 2, 2024

Codecov Report

Merging #49971 (6d9a55a) into master (3d939d4) will decrease coverage by 3.1226%.
Report is 4 commits behind head on master.
The diff coverage is 0.0000%.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #49971        +/-   ##
================================================
- Coverage   71.9101%   68.7876%   -3.1226%     
================================================
  Files          1437       1439         +2     
  Lines        345691     407989     +62298     
================================================
+ Hits         248587     280646     +32059     
- Misses        76894     108352     +31458     
+ Partials      20210      18991      -1219     
Flag Coverage Δ
integration 44.0703% <0.0000%> (?)
unit 71.8851% <ø> (-0.0251%) ⬇️

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

Components Coverage Δ
dumpling 56.3129% <ø> (ø)
parser ∅ <ø> (∅)
br 43.8599% <ø> (-7.4403%) ⬇️

@@ -52,6 +53,8 @@ func TestHandle(t *testing.T) {
mgr := storage.NewTaskManager(pool)
storage.SetTaskManager(mgr)

testutil.WaitNodeRegistered(t, ctx)
Copy link
Contributor

Choose a reason for hiding this comment

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

also in planner_test

@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jan 2, 2024
Copy link
Member

@okJiang okJiang 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

@@ -0,0 +1,40 @@
// Copyright 2023 PingCAP, Inc.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// Copyright 2023 PingCAP, Inc.
// Copyright 2024 PingCAP, Inc.

@@ -59,7 +59,7 @@ type TaskManager interface {
// we only consider pending/running subtasks, subtasks related to revert are
// not considered.
GetUsedSlotsOnNodes(ctx context.Context) (map[string]int, error)
GetSubtaskInStatesCnt(ctx context.Context, taskID int64, states ...proto.SubtaskState) (int64, error)
GetSubtaskCntByStates(ctx context.Context, taskID int64, step proto.Step) (map[proto.SubtaskState]int64, error)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
GetSubtaskCntByStates(ctx context.Context, taskID int64, step proto.Step) (map[proto.SubtaskState]int64, error)
GetSubtaskCntByStep(ctx context.Context, taskID int64, step proto.Step) (map[proto.SubtaskState]int64, error)

Copy link
Contributor Author

@D3Hunter D3Hunter Jan 2, 2024

Choose a reason for hiding this comment

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

the ByStates means group by state. will change to OfStates to avoid conflict with normal ByXXX, will leave it, ByStates/OfStates/InStates makes no difference

Copy link
Member

Choose a reason for hiding this comment

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

Indeed exist confusion

conflict with normal ByXXX

Copy link
Contributor

Choose a reason for hiding this comment

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

GetSubtaskCntGroupByStates?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -240,12 +240,13 @@ func (s *BaseScheduler) onCancelling() error {
// handle task in pausing state, cancel all running subtasks.
func (s *BaseScheduler) onPausing() error {
logutil.Logger(s.logCtx).Info("on pausing state", zap.Stringer("state", s.Task.State), zap.Int64("step", int64(s.Task.Step)))
cnt, err := s.taskMgr.GetSubtaskInStatesCnt(s.ctx, s.Task.ID, proto.SubtaskStateRunning, proto.SubtaskStatePending)
cntByStates, err := s.taskMgr.GetSubtaskCntByStates(s.ctx, s.Task.ID, s.Task.Step)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
cntByStates, err := s.taskMgr.GetSubtaskCntByStates(s.ctx, s.Task.ID, s.Task.Step)
state2Cnt, err := s.taskMgr.GetSubtaskCntByStep(s.ctx, s.Task.ID, s.Task.Step)

pkg/disttask/framework/scheduler/scheduler.go Show resolved Hide resolved
@ti-chi-bot ti-chi-bot bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 2, 2024
@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jan 2, 2024
Copy link

ti-chi-bot bot commented Jan 2, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-01-02 08:09:32.924713828 +0000 UTC m=+2158063.961940747: ☑️ agreed by ywqzzy.
  • 2024-01-02 10:08:55.997581059 +0000 UTC m=+2165227.034807985: ☑️ agreed by tangenta.

Copy link

ti-chi-bot bot commented Jan 2, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: okJiang, tangenta, ywqzzy

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 merged commit 99f0349 into pingcap:master Jan 2, 2024
18 checks passed
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-7.5: #49982.

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Jan 2, 2024
@D3Hunter D3Hunter deleted the fix-task-schedule-check branch January 2, 2024 11:23
D3Hunter added a commit to ti-chi-bot/tidb that referenced this pull request Feb 7, 2024
ti-chi-bot bot pushed a commit that referenced this pull request Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. 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.

distask scheduler takes step success while it's failed actually
5 participants