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

table/tables: fix a DATA RACE in TestHashPartitionAddRecord #53798

Merged
merged 8 commits into from
Jul 18, 2024

Conversation

tiancaiamao
Copy link
Contributor

What problem does this PR solve?

Issue Number: close #53678

Problem Summary:

What changed and how does it work?

After a add a table.Table to cache, it should be read-only and immutable.
But currently the Cols() function use lazy-initialization, it initialize (write) some fields and cause read-write confliction, and the data race.

This change avoid the lazy-initialization way, initialize all the fields when creating table.Table.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
cd pkg/table/tables/test/partition/
go test -race -tags intest -c
./partition.test -test.run ^TestHashPartitionAddRecord$

DATA RACE is not easy to reproduce stability.

  • 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-triage-completed 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. labels Jun 4, 2024
Copy link

tiprow bot commented Jun 4, 2024

Hi @tiancaiamao. 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 Jun 4, 2024

Codecov Report

Attention: Patch coverage is 91.66667% with 2 lines in your changes missing coverage. Please review.

Project coverage is 56.1044%. Comparing base (a48a4a2) to head (a77598d).
Report is 11 commits behind head on master.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #53798         +/-   ##
=================================================
- Coverage   72.6973%   56.1044%   -16.5929%     
=================================================
  Files          1551       1673        +122     
  Lines        437184     611205     +174021     
=================================================
+ Hits         317821     342913      +25092     
- Misses        99756     244984     +145228     
- Partials      19607      23308       +3701     
Flag Coverage Δ
integration 37.2774% <91.6666%> (?)
unit 71.8352% <91.6666%> (+0.1255%) ⬆️

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

Components Coverage Δ
dumpling 52.9656% <ø> (ø)
parser ∅ <ø> (∅)
br 52.5212% <ø> (+6.6807%) ⬆️

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Jun 4, 2024
@hawkingrei
Copy link
Member

/ok-to-test

@ti-chi-bot ti-chi-bot bot added the ok-to-test Indicates a PR is ready to be tested. label Jun 4, 2024
@tiancaiamao
Copy link
Contributor Author

/test check-dev2

Copy link

tiprow bot commented Jun 4, 2024

@tiancaiamao: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test fast_test_tiprow
  • /test tidb_parser_test

Use /test all to run all jobs.

In response to this:

/test check-dev2

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.

@tiancaiamao
Copy link
Contributor Author

/test unit-test

Copy link

tiprow bot commented Jun 5, 2024

@tiancaiamao: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test fast_test_tiprow
  • /test tidb_parser_test

Use /test all to run all jobs.

In response to this:

/test unit-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-sigs/prow repository.

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jun 7, 2024
@tangenta tangenta requested a review from zimulala June 19, 2024 06:12
pkg/table/tables/tables.go Outdated Show resolved Hide resolved
@ti-chi-bot ti-chi-bot bot removed the lgtm label Jul 3, 2024
@hawkingrei
Copy link
Member

/test all

@tiancaiamao
Copy link
Contributor Author

close #54651

@D3Hunter
Copy link
Contributor

/hold

need fix comments

@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 Jul 16, 2024
@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jul 17, 2024
@River2000i
Copy link
Contributor

close #54377

@tiancaiamao
Copy link
Contributor Author

Updated and remove the unnecessary old syn.Once
PTAL @zimulala @D3Hunter

@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jul 17, 2024
@tiancaiamao
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 Jul 18, 2024
@tiancaiamao tiancaiamao removed the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Jul 18, 2024
@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Jul 18, 2024
Copy link

ti-chi-bot bot commented Jul 18, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hawkingrei, xhebox, zimulala

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

ti-chi-bot bot commented Jul 18, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-06-04 10:04:26.115328015 +0000 UTC m=+3375619.872463585: ☑️ agreed by hawkingrei.
  • 2024-06-07 07:47:04.348291218 +0000 UTC m=+105178.401603143: ☑️ agreed by xhebox.
  • 2024-07-03 08:17:55.265739566 +0000 UTC m=+1398801.751228398: ✖️🔁 reset by zimulala.
  • 2024-07-17 06:12:19.55621778 +0000 UTC m=+420761.547159241: ☑️ agreed by zimulala.
  • 2024-07-18 06:32:55.868229455 +0000 UTC m=+508397.859170925: ☑️ agreed by hawkingrei.

@tiancaiamao
Copy link
Contributor Author

/retest

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/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DATA RACE in the TestHashPartitionAddRecord
7 participants