-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
query results of information_schema.tables not accurate #55803
Comments
debug PR: #55789 |
Test logs:
As you can see, the key point is: The row count is 0. // GetTableRows gets the count of table rows.
func (c *StatsTableRowCache) GetTableRows(id int64) uint64 {
c.mu.RLock()
defer c.mu.RUnlock()
return c.tableRows[id]
} So the problem is that StatsTableRowCache doesn't cache the row count correctly. |
In fact, |
I have identified the root cause of the problem. This issue comes from the When we attempt to retrieve the |
I have fixed it in my debug pull request in a very messy way to demonstrate the root cause: See: #55789 The test result: mysql> select table_name, avg_row_length, max_data_length, data_length, table_rows from information_schema.tables where table_schema = 'uds500k';
+-------------+----------------+-----------------+-------------+------------+
| table_name | avg_row_length | max_data_length | data_length | table_rows |
+-------------+----------------+-----------------+-------------+------------+
| Data1 | 24 | 0 | 12000000 | 500000 |
| index_Data4 | 135 | 0 | 67991573 | 500000 |
| index_Data1 | 136 | 0 | 68002490 | 500000 |
| Data4 | 24 | 0 | 12000000 | 500000 |
| Data2 | 24 | 0 | 12000000 | 500000 |
| Data3 | 24 | 0 | 12000000 | 500000 |
| index_Data3 | 136 | 0 | 68001335 | 500000 |
| index_Data2 | 136 | 0 | 68003939 | 500000 |
| index_Data5 | 136 | 0 | 68004062 | 500000 |
| Data5 | 24 | 0 | 12000000 | 500000 |
+-------------+----------------+-----------------+-------------+------------+
10 rows in set (0.05 sec) |
I will find a more reasonable way to fix it. |
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
select table_name, avg_row_length, max_data_length, data_length, table_rows from information_schema.tables where table_schema = 'db500k';
2. What did you expect to see? (Required)
The table information should be accurate.
3. What did you see instead (Required)
The query results not accurate, there is no max_data_length . and some tables has no results.
Also, run the query multple times, result might be different.
4. What is your TiDB version? (Required)
Master
Edition: Community
Git Commit Hash: 94666a2
The text was updated successfully, but these errors were encountered: