-
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
statistics: fix a data race in auto-analyze #55501
statistics: fix a data race in auto-analyze #55501
Conversation
Signed-off-by: hi-rustin <[email protected]>
Signed-off-by: hi-rustin <[email protected]>
Signed-off-by: hi-rustin <[email protected]>
Signed-off-by: hi-rustin <[email protected]>
Signed-off-by: hi-rustin <[email protected]>
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 current implementation does not satisfy our new priority queue because it is not aware of the currently running table, and in the future we will need to skip updates to the running table. So we need to maintain at least the running tables ID.
Also the efficiency of this current implementation is determined by the slowest table every time, we should make the refresher ensure that there are always n tasks going on concurrently without creating unnecessary blocking of each other.
I will improve this when I implement the new priority queue.
🔢 Self-check (PR reviewed by myself and ready for feedback.)
[LGTM Timeline notifier]Timeline:
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #55501 +/- ##
================================================
+ Coverage 72.8872% 75.0103% +2.1231%
================================================
Files 1576 1581 +5
Lines 440796 455813 +15017
================================================
+ Hits 321284 341907 +20623
+ Misses 99789 93281 -6508
- Partials 19723 20625 +902
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Signed-off-by: hi-rustin <[email protected]>
Signed-off-by: hi-rustin <[email protected]>
For the validation, I tested it locally again: mysql> select @@tidb_auto_analyze_concurrency;
ERROR 2013 (HY000): Lost connection to MySQL server during query
No connection. Trying to reconnect...
Connection id: 2803892230
Current database: *** NONE ***
+---------------------------------+
| @@tidb_auto_analyze_concurrency |
+---------------------------------+
| |
+---------------------------------+
1 row in set (0.08 sec)
mysql> select @@tidb_auto_analyze_concurrency;
ERROR 2013 (HY000): Lost connection to MySQL server during query
No connection. Trying to reconnect...
Connection id: 2657091590
Current database: *** NONE ***
+---------------------------------+
| @@tidb_auto_analyze_concurrency |
+---------------------------------+
| 2 |
+---------------------------------+
1 row in set (0.03 sec)
mysql> set global tidb_enable_auto_analyze_priority_queue = OFF;
Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql> select @@tidb_enable_auto_analyze_priority_queue;
+-------------------------------------------+
| @@tidb_enable_auto_analyze_priority_queue |
+-------------------------------------------+
| 0 |
+-------------------------------------------+
1 row in set (0.00 sec)
mysql> set global tidb_auto_analyze_concurrency = 10;
ERROR 1105 (HY000): cannot set tidb_auto_analyze_concurrency: requires both tidb_enable_auto_analyze and tidb_enable_auto_analyze_priority_queue to be true. Current values: tidb_enable_auto_analyze=true, tidb_enable_auto_analyze_priority_queue=false
mysql> set global tidb_enable_auto_analyze_priority_queue = true;
Query OK, 0 rows affected, 1 warning (0.02 sec)
mysql> set global tidb_auto_analyze_concurrency = 10;
Query OK, 0 rows affected (0.03 sec)
mysql> select @@tidb_auto_analyze_concurrency;
+---------------------------------+
| @@tidb_auto_analyze_concurrency |
+---------------------------------+
| 10 |
+---------------------------------+
1 row in set (0.00 sec) |
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.
🔢 Self-check (PR reviewed by myself and ready for feedback.)
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: AilinKid, easonn7, hawkingrei 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 |
Signed-off-by: hi-rustin <[email protected]>
What problem does this PR solve?
Issue Number: ref #53460
Problem Summary:
I found some issues in the previous implementation.
What changed and how does it work?
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.