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

tables info not updated for a long time #51942

Closed
aytrack opened this issue Mar 20, 2024 · 7 comments · Fixed by #51980
Closed

tables info not updated for a long time #51942

aytrack opened this issue Mar 20, 2024 · 7 comments · Fixed by #51980
Assignees
Labels
affects-8.0 component/ddl This issue is related to DDL of TiDB. severity/critical type/bug This issue is a bug. type/regression

Comments

@aytrack
Copy link
Contributor

aytrack commented Mar 20, 2024

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

CREATE TABLE t (a int, b int, c varchar(5), primary key(a), index idx(c)) PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (6), PARTITION p1 VALUES LESS THAN (11), PARTITION p2 VALUES LESS THAN (16));
insert into t(a, b, c) values(1, 2, 'c'), (7, 3, 'd'), (12, 4, 'e');
-- wait 20 * 3 to query the stats info 
select table_rows, avg_row_length, data_length, index_length from information_schema.tables where table_name='t' AND TABLE_SCHEMA='tibug_187_test';
-- wait 20 * 3 * 6 to query the stats info
select table_rows, avg_row_length, data_length, index_length from information_schema.tables where table_name='t' AND TABLE_SCHEMA='tibug_187_test';

2. What did you expect to see? (Required)

get the correct stats info

3. What did you see instead (Required)

maybe introducted by #50874
no data

4. What is your TiDB version? (Required)

v8.0.0-pre

@kennedy8312
Copy link

kennedy8312 commented Mar 20, 2024

Regression Analysis
The issue happened on nightly instead of v7.6.0.

-----------------Regression Test Result on v7.6.0-----------------
Server on v7.6.0 started.
Validation passed. v7.6.0 is a good label
-----------------Test Case-----------------
mysql -h 127.0.0.1 -P 4000 -u root -D test --local-infile=true < issue51942_testcase.sql
issue51942_testcase.sql:
drop table if exists t;

CREATE TABLE t (a int, b int, c varchar(5), primary key(a), index idx(c)) PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (6), PARTITION p1 VALUES LESS THAN (11), PARTITION p2 VALUES LESS THAN (16));
insert into t(a, b, c) values(1, 2, 'c'), (7, 3, 'd'), (12, 4, 'e');
-- wait 20 * 3 to query the stats info
-- SELECT SLEEP(60);
analyze table t;
select table_rows, avg_row_length, data_length, index_length from information_schema.tables where table_name='t' AND TABLE_SCHEMA='test';
-----------------Test Result-----------------
Result :
table_rows avg_row_length data_length index_length
3 18 54 6
-----------------TiDB Version-----------------
tidb_version()
Release Version: v7.6.0
Edition: Community
Git Commit Hash: 52794d9
Git Branch: heads/refs/tags/v7.6.0
UTC Build Time: 2024-01-22 14:13:53
GoVersion: go1.21.5
Race Enabled: false
Check Table Before Drop: false
Store: tikv

-----------------End of regression test on v7.6.0-----------------
-----------------Regression Test Result on nightly-----------------
Server on nightly started.
Validation failed at run 1. nightly is a bad label.
Expected:
table_rows avg_row_length data_length index_length
3 18 54 6
Actual:
table_rows avg_row_length data_length index_length
0 0 0 0
-----------------Test Case-----------------
mysql -h 127.0.0.1 -P 4000 -u root -D test --local-infile=true < issue51942_testcase.sql
issue51942_testcase.sql:
drop table if exists t;

CREATE TABLE t (a int, b int, c varchar(5), primary key(a), index idx(c)) PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (6), PARTITION p1 VALUES LESS THAN (11), PARTITION p2 VALUES LESS THAN (16));
insert into t(a, b, c) values(1, 2, 'c'), (7, 3, 'd'), (12, 4, 'e');
-- wait 20 * 3 to query the stats info
-- SELECT SLEEP(60);
analyze table t;
select table_rows, avg_row_length, data_length, index_length from information_schema.tables where table_name='t' AND TABLE_SCHEMA='test';
-----------------Test Result-----------------
Result :
table_rows avg_row_length data_length index_length
0 0 0 0
-----------------TiDB Version-----------------
tidb_version()
Release Version: v8.0.0-alpha-363-g9b42b9f5a0
Edition: Community
Git Commit Hash: 9b42b9f
Git Branch: HEAD
UTC Build Time: 2024-03-01 06:59:26
GoVersion: go1.21.6
Race Enabled: false
Check Table Before Drop: false
Store: tikv

-----------------End of regression test on nightly-----------------

@kennedy8312
Copy link

Regression Analysis
PR caused this regression: #50874

Commit 6701bf1 : Success
Commit c3c067e : Success
Commit a8a9a04 : Failure
Commit a59551b : Failure
Commit 1678c4f : Success
Commit 0df9170 : Failure
Commit 6af4bba : Success
Commit f4e758a : Success
Commit 3c3ba00 : Success
Commit 801de42 : Success

@kennedy8312
Copy link

/sig ddl

Copy link

ti-chi-bot bot commented Mar 20, 2024

@kennedy8312: The label(s) sig/ddl cannot be applied, because the repository doesn't have them.

In response to this:

/sig ddl

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 ti-community-infra/tichi repository.

@kennedy8312
Copy link

/component ddl

@ti-chi-bot ti-chi-bot bot added the component/ddl This issue is related to DDL of TiDB. label Mar 20, 2024
@ywqzzy ywqzzy changed the title tables info not updated for a lang time tables info not updated for a long time Mar 20, 2024
@ywqzzy ywqzzy removed their assignment Mar 20, 2024
@ywqzzy ywqzzy removed component/ddl This issue is related to DDL of TiDB. sig/sql-infra SIG: SQL Infra labels Mar 20, 2024
@ywqzzy
Copy link
Contributor

ywqzzy commented Mar 20, 2024

Test on my local machine, the row count updated after 110s

@kennedy8312
Copy link

Test on my local machine, the row count updated after 110s

This might be another issue. Please try the testcase as follows:
echo ''>test.log
for i in {1..100}; do
mysql --comments --host 127.0.0.1 --port 4000 -u root test < issue51942_testcase.sql >> test.log
done

issue51942_testcase.txt

In test.log with commit 0df9170, there are always "0 0 0 0" (usually 3 times) in the result.
However, in the test.log with the commit 801de42 which is one commit prior to 0df9170, there is no "0 0 0 0" in the result.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-8.0 component/ddl This issue is related to DDL of TiDB. severity/critical type/bug This issue is a bug. type/regression
Projects
None yet
4 participants