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

test: fix flaky dispatch loop #50446

Merged
merged 5 commits into from
Jan 16, 2024
Merged

Conversation

ywqzzy
Copy link
Contributor

@ywqzzy ywqzzy commented Jan 16, 2024

What problem does this PR solve?

Issue Number: close #50409

Problem Summary:

What changed and how does it work?

Don't start scheduler if it start time(counter) > len(concurrencies)

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 do-not-merge/needs-tests-checked release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/needs-triage-completed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jan 16, 2024
Copy link

tiprow bot commented Jan 16, 2024

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.

@ywqzzy
Copy link
Contributor Author

ywqzzy commented Jan 16, 2024

/check-issue-triage-complete

Copy link

codecov bot commented Jan 16, 2024

Codecov Report

Merging #50446 (eaa93e5) into master (1ad36eb) will decrease coverage by 14.6655%.
Report is 31 commits behind head on master.
The diff coverage is n/a.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #50446         +/-   ##
=================================================
- Coverage   70.1114%   55.4459%   -14.6656%     
=================================================
  Files          1444       1556        +112     
  Lines        419923     587026     +167103     
=================================================
+ Hits         294414     325482      +31068     
- Misses       105281     238795     +133514     
- Partials      20228      22749       +2521     
Flag Coverage Δ
integration 36.6436% <ø> (?)
unit 69.9948% <ø> (-0.1167%) ⬇️

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

Components Coverage Δ
dumpling 54.0269% <ø> (ø)
parser ∅ <ø> (∅)
br 55.7295% <ø> (+5.9926%) ⬆️

@ywqzzy ywqzzy changed the title test: fix flaky dispatch loop [WIP]test: fix flaky dispatch loop Jan 16, 2024
@ti-chi-bot ti-chi-bot bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 16, 2024
@ywqzzy ywqzzy changed the title [WIP]test: fix flaky dispatch loop test: fix flaky dispatch loop Jan 16, 2024
@ti-chi-bot ti-chi-bot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 16, 2024
@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Jan 16, 2024
@@ -535,6 +535,9 @@ func TestManagerDispatchLoop(t *testing.T) {
scheduler.RegisterSchedulerFactory(proto.TaskTypeExample,
func(ctx context.Context, task *proto.Task, param scheduler.Param) scheduler.Scheduler {
idx := counter.Load()
if int(idx) > len(concurrencies) {
Copy link
Contributor

Choose a reason for hiding this comment

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

might panic again when return nil

Copy link
Contributor

Choose a reason for hiding this comment

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

we should add a check in mockScheduler.EXPECT().ScheduleTask().Do(func() {, when task already success, just return

@ywqzzy
Copy link
Contributor Author

ywqzzy commented Jan 16, 2024

/hold

@ti-chi-bot ti-chi-bot bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 16, 2024
@ti-chi-bot ti-chi-bot bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jan 16, 2024
})
mockScheduler.EXPECT().Close()
counter.Add(1)
waitChannels[task.Key] = make(chan struct{})
Copy link
Contributor

Choose a reason for hiding this comment

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

init this map before create task, else there might be data race

Copy link

ti-chi-bot bot commented Jan 16, 2024

[APPROVALNOTIFIER] This PR is APPROVED

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

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 approved lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jan 16, 2024
Copy link

ti-chi-bot bot commented Jan 16, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-01-16 03:25:32.746372795 +0000 UTC m=+239974.310670508: ☑️ agreed by hawkingrei.
  • 2024-01-16 06:01:20.18485981 +0000 UTC m=+249321.749157514: ☑️ agreed by D3Hunter.

@ywqzzy
Copy link
Contributor Author

ywqzzy commented Jan 16, 2024

/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 Jan 16, 2024
@ti-chi-bot ti-chi-bot bot merged commit 4d9c645 into pingcap:master Jan 16, 2024
22 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/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

panic in the TestManagerDispatchLoop
3 participants