-
Notifications
You must be signed in to change notification settings - Fork 6.1k
*: ref all the jobs before sending to jobToWorkerCh #64767
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
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: wjhuang2016 <[email protected]>
33bc0c8 to
a261346
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #64767 +/- ##
================================================
+ Coverage 72.6813% 74.1059% +1.4246%
================================================
Files 1866 1889 +23
Lines 506188 525035 +18847
================================================
+ Hits 367904 389082 +21178
+ Misses 115892 112156 -3736
- Partials 22392 23797 +1405
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
/retest |
Signed-off-by: wjhuang2016 <[email protected]>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Signed-off-by: wjhuang2016 <[email protected]>
Signed-off-by: wjhuang2016 <[email protected]>
|
/retest |
Signed-off-by: wjhuang2016 <[email protected]>
|
@wjhuang2016: 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. |
|
@wjhuang2016: The following tests 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. |
What problem does this PR solve?
Issue Number: close #64666
Problem Summary:
In the generateAndSendJob function, we previously referenced one region job at a time and immediately sent it to jobToWorkerCh. If a job (especially an empty job) finished before the next job was referenced, the reference count could drop to 0, causing memoryIngestData to be cleaned unexpectedly. This prevented other jobs still being processed from accessing the data, leading to data inconsistency.
In tidb-x scenarios, where region sizes are larger than the configured SplitRegionSize, some regions' jobs are empty. These empty jobs are processed quickly, which makes this issue more likely to occur.
What changed and how does it work?
We modified the logic in generateAndSendJob to reference all jobs before sending them to jobToWorkerCh. Specifically, we first call job.ref(jobWg) for all generated jobs in a loop, and then send them to the channel one by one in a separate loop.
This ensures all jobs have their reference counts incremented before any of them are sent to the channel. Even if some jobs (like empty jobs) finish quickly and call done(), as long as other jobs still hold references, ingestData will not be cleaned prematurely. Only when all jobs complete and call done() will the reference count reach 0, at which point ingestData can be safely cleaned, preventing data inconsistency issues.
Check List
Tests
Pass the tidb-x HA add index test
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.