Skip to content

partition: fix unstable test TestExchangePartitionStates#46816

Merged
ti-chi-bot[bot] merged 3 commits intopingcap:masterfrom
jiyfhust:fix_TestExchangePartitionStates
Sep 14, 2023
Merged

partition: fix unstable test TestExchangePartitionStates#46816
ti-chi-bot[bot] merged 3 commits intopingcap:masterfrom
jiyfhust:fix_TestExchangePartitionStates

Conversation

@jiyfhust
Copy link
Contributor

@jiyfhust jiyfhust commented Sep 10, 2023

What problem does this PR solve?

Issue Number: close #46815

Problem Summary:

What is changed and how it works?

Two ways to reproduce the error:

  1. run many times, let the competitive occur:
$ go test --tags=intest --run="TestExchangePartitionStates" 
  1. make the competitive easier to occur:
$ git diff
diff --git a/table/tables/test/partition/partition_test.go b/table/tables/test/partition/partition_test.go
index 2f218db..702a0d1 100644
--- a/table/tables/test/partition/partition_test.go
+++ b/table/tables/test/partition/partition_test.go
@@ -749,7 +749,7 @@ func TestExchangePartitionStates(t *testing.T) {
                                logutil.BgLogger().Info("Got state", zap.String("State", s))
                                break
                        }
-                       gotime.Sleep(50 * gotime.Millisecond)
+                       gotime.Sleep(1 * gotime.Millisecond)
                }
        }
        waitFor("t", "write only", 4)

$ go test --tags=intest --run="TestExchangePartitionStates" 

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 release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/needs-tests-checked do-not-merge/needs-triage-completed size/XS Denotes a PR that changes 0-9 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 Sep 10, 2023
@ti-chi-bot
Copy link

ti-chi-bot bot commented Sep 10, 2023

Hi @jiyfhust. 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.

Details

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.

@tiprow
Copy link

tiprow bot commented Sep 10, 2023

Hi @jiyfhust. 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.

Details

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

/ok-to-test

@ti-chi-bot ti-chi-bot 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 Sep 10, 2023
@codecov
Copy link

codecov bot commented Sep 10, 2023

Codecov Report

Merging #46816 (0db04a4) into master (d3d30f5) will increase coverage by 0.8197%.
Report is 80 commits behind head on master.
The diff coverage is n/a.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #46816        +/-   ##
================================================
+ Coverage   73.3326%   74.1524%   +0.8197%     
================================================
  Files          1322       1359        +37     
  Lines        396474     416782     +20308     
================================================
+ Hits         290745     309054     +18309     
- Misses        87208      89297      +2089     
+ Partials      18521      18431        -90     
Flag Coverage Δ
integration 29.9835% <ø> (?)
unit 74.7717% <ø> (+1.4390%) ⬆️

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

Components Coverage Δ
dumpling 54.4418% <ø> (+0.3973%) ⬆️
parser 85.6648% <ø> (+0.6931%) ⬆️
br 49.1636% <ø> (-3.4781%) ⬇️

@hawkingrei hawkingrei requested a review from mjonss September 10, 2023 03:47
res := tk4.MustQuery(`admin show ddl jobs where db_name = '` + strings.ToLower(dbName) + `' and table_name = '` + tableName + `' and job_type = 'exchange partition'`).Rows()
if len(res) == 1 && res[0][pos] == s {
logutil.BgLogger().Info("Got state", zap.String("State", s))
// Sleep 50ms to wait load InforSchema finish, issue #46815.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe adding a retry is better?

@hawkingrei
Copy link
Member

/check-issue-triage-complete

Copy link
Contributor

@mjonss mjonss left a comment

Choose a reason for hiding this comment

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

Seems like an improvement. Would it be possible to actually check and wait for the infoSchema update?

@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Sep 11, 2023
@jiyfhust
Copy link
Contributor Author

Seems like an improvement. Would it be possible to actually check and wait for the infoSchema update?

I did not find a method to check it properly.

@jiyfhust
Copy link
Contributor Author

PTAL @zimulala

Copy link
Contributor

@zimulala zimulala left a comment

Choose a reason for hiding this comment

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

LGTM

@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: mjonss, zimulala

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

The pull request process is described here

Details 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-11 13:44:15.933408373 +0000 UTC m=+276837.857964763: ☑️ agreed by mjonss.
  • 2023-09-14 06:20:36.893728644 +0000 UTC m=+152802.861316694: ☑️ agreed by zimulala.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved lgtm 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/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

unstable test TestExchangePartitionStates

4 participants