-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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: fix a data race on localRowCntListener Written() #54484
Conversation
Hi @River2000i. 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 Once the patch is verified, the new status will be reflected by the 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. |
Hi @River2000i. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with 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. |
/ok-to-test |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #54484 +/- ##
=================================================
- Coverage 72.9116% 56.5274% -16.3842%
=================================================
Files 1542 1674 +132
Lines 435991 622710 +186719
=================================================
+ Hits 317888 352002 +34114
- Misses 98569 247050 +148481
- Partials 19534 23658 +4124
Flags with carried forward coverage won't be shown. Click here to find out more.
|
pkg/ddl/backfilling.go
Outdated
@@ -752,8 +752,8 @@ type localRowCntListener struct { | |||
} | |||
|
|||
func (s *localRowCntListener) Written(rowCnt int) { | |||
s.curPhysicalRowCnt += int64(rowCnt) | |||
s.reorgCtx.setRowCount(s.prevPhysicalRowCnt + s.curPhysicalRowCnt) | |||
newCurPhysicalRowCnt := atomic.AddInt64(&s.curPhysicalRowCnt, int64(rowCnt)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The root cause is concurrent calling of Written
, although we make s.curPhysicalRowCnt
concurrent-safe, below setRowCount
may set to the smaller newCurPhysicalRowCnt
value of multiple concurrent calls.
Maybe add a lock? /cc @tangenta
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree. actually i am a little bit confuse the usage of curPhysicalRowCnt
, since there is no initialization and other reference, just equal to rowCnt
.
Maybe it can simplify to s.reorgCtx.setRowCount(s.prevPhysicalRowCnt + int64(rowCnt))
?
@lance6716 @tangenta PTAL~ |
@River2000i: The following test failed, say
Full PR test history. Your PR dashboard. 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. I understand the commands that are listed here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Benjamin2037, lance6716 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 |
[LGTM Timeline notifier]Timeline:
|
* upstream/master: (93 commits) disjoinset: add generic impl (pingcap#54917) planner: derive index filters for mv index paths (pingcap#54877) br: cli refactor backup error handling logic (pingcap#54697) expression: fix infinity loop in `timestampadd` (pingcap#54916) planner: import more expand test. (pingcap#54962) planner: use code-gen to generate CloneForPlanCache method for some operators (pingcap#54957) test: fix flaky test TestFailSchemaSyncer (pingcap#54958) planner: move logical show into logicalop pkg. (pingcap#54928) privilege: Remove TestAbnormalMySQLTable (pingcap#54925) resource_control: support unlimited keyword when setting the resource group (pingcap#54704) ddl: fix a data race on localRowCntListener Written() (pingcap#54484) lightning: fix SET SESSION on connection pool (pingcap#54927) planner: move logical mem-table to logicalop pkg. (pingcap#54903) table: Add `CachedTableSupport` and `TemporaryTableSupport` for `MutateContext` (pingcap#54900) executor: fix index_hash_join hang when context canceled (pingcap#54855) statistics: add metrics for unneeded analyze table (pingcap#54822) *: refine pipelined dml benchmarks (pingcap#54844) ddl: assign table IDs for jobs submitted to queue (pingcap#54880) *: avoid using Tables field of model.DBInfo, use API instead (pingcap#52302) planner: remove useless check (pingcap#54907) ...
What problem does this PR solve?
Issue Number: close #54373
Problem Summary:
What changed and how does it work?
localRowCntListener
can create tasks byHandleTask()
, which can be read/writecurPhysicalRowCnt
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.