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

ddl: Increase ddl unit test speed #41034

Merged
merged 15 commits into from
Mar 7, 2023

Conversation

blacktear23
Copy link
Contributor

@blacktear23 blacktear23 commented Feb 3, 2023

What problem does this PR solve?

Issue Number: close #41216

Problem Summary:
make test or make ut is too slow, sometimes timeout after 10min

What is changed and how it works?

Update some ticker and wait time to shorten the wait time for unit test.

  1. domain.Reload should notify mdlCheckLoop
  2. DDL's job dispatch loop should decrease sleep time when owner or waiting check. (In test case, isOwner will return false sometimes after create the testkit.)

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
Copy link
Member

ti-chi-bot commented Feb 3, 2023

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • hawkingrei
  • tangenta

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

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

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added do-not-merge/needs-linked-issue 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. needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. labels Feb 3, 2023
@ti-chi-bot
Copy link
Member

Hi @blacktear23. Thanks for your PR.

I'm waiting for a pingcap member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@bb7133
Copy link
Member

bb7133 commented Feb 7, 2023

PTAL @wjhuang2016 @zimulala

@hawkingrei
Copy link
Member

/check-issue-triage-complete

ddl/ddl_worker.go Outdated Show resolved Hide resolved
@hawkingrei
Copy link
Member

/ok-to-test

@ti-chi-bot ti-chi-bot added ok-to-test Indicates a PR is ready to be tested. and removed needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. labels Feb 18, 2023
@blacktear23
Copy link
Contributor Author

/ok-to-test

@hawkingrei
Copy link
Member

/ok-to-test

It is unnecessary for you. It is for pingcap's staff members to allow contributors to run CI tasks for safety factors. Now you can run tasks by yourself.

@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 19, 2023
@hawkingrei
Copy link
Member

/retest

1 similar comment
@hawkingrei
Copy link
Member

/retest

domain/domain.go Outdated
@@ -711,78 +712,86 @@ func (do *Domain) refreshMDLCheckTableInfo() {
}

func (do *Domain) mdlCheckLoop() {
ticker := time.Tick(time.Millisecond * 50)
var ticker <-chan time.Time
if intest.InTest {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we provide a notify after MDL updated is change the tick duration in test required? @hawkingrei

Copy link
Member

Choose a reason for hiding this comment

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

I think it is possible to implement it.

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Feb 27, 2023
@hawkingrei
Copy link
Member

/retest

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Feb 27, 2023
@hawkingrei
Copy link
Member

PTAL @wjhuang2016 @zimulala

ddl/job_table.go Outdated
@@ -174,15 +175,24 @@ func (d *ddl) startDispatchLoop() {
if d.etcdCli != nil {
notifyDDLJobByEtcdCh = d.etcdCli.Watch(d.ctx, addingDDLJobConcurrent)
}
ticker := time.NewTicker(1 * time.Second)
var ticker *time.Ticker
if intest.InTest {
Copy link
Contributor

Choose a reason for hiding this comment

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

Personally, I think it is ugly to introduce inTest into the code, should it be directly used as a variable, such as xxxInterval, and then directly change this variable for testing, rather than into the real code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. And by the way, why sleep for 1 second? Why not some formula with some variables like nn * TTL

Copy link
Contributor

Choose a reason for hiding this comment

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

The original code is https://github.com/pingcap/tidb/blob/release-6.4/ddl/ddl_worker.go#L182. Fine-tuning may have been done to support parallel DDL. I think it should be similar to the original logic implementation, which has some association with TTL (lease).

Copy link
Contributor

Choose a reason for hiding this comment

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

If there is any suggestion, can you propose a new PR?

domain/domain.go Outdated Show resolved Hide resolved
@blacktear23
Copy link
Contributor Author

/retest

@blacktear23
Copy link
Contributor Author

Is anyone has any idea about why the unit-test always fail?

@hawkingrei
Copy link
Member

/retest

ddl/job_table.go Outdated Show resolved Hide resolved
@hawkingrei
Copy link
Member

/retest

@hawkingrei
Copy link
Member

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: c8132d0

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Mar 6, 2023
@hawkingrei
Copy link
Member

/retest

@hawkingrei
Copy link
Member

/test

@ti-chi-bot
Copy link
Member

@hawkingrei: The /test command needs one or more targets.
The following commands are available to trigger required jobs:

  • /test build
  • /test check-dev
  • /test check-dev2
  • /test mysql-test
  • /test unit-test

Use /test all to run all jobs.

In response to this:

/test

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

@ti-chi-bot ti-chi-bot merged commit 29adb0a into pingcap:master Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ok-to-test Indicates a PR is ready to be tested. 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. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ddl: run unit test is too slow
6 participants