Skip to content

add index row count is inaccurate in ADMIN SHOW #44044

@aytrack

Description

@aytrack

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

  1. deploy a cluster and create partition table
  2. add index with txn mode
  3. upgrade the cluster
  4. show ddl job info to check the rowcount

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

3. What did you see instead (Required)

  1. rowcount may be smaller than the previous view
MySQL [(none)]> admin show ddl jobs;
+--------+---------+----------------------+----------------------------------+----------------------+-----------+----------+-----------+---------------------+---------------------+---------------------+---------+
| JOB_ID | DB_NAME | TABLE_NAME           | JOB_TYPE                         | SCHEMA_STATE         | SCHEMA_ID | TABLE_ID | ROW_COUNT | CREATE_TIME         | START_TIME          | END_TIME            | STATE   |
+--------+---------+----------------------+----------------------------------+----------------------+-----------+----------+-----------+---------------------+---------------------+---------------------+---------+
|    224 | rtdb    | t                    | add index /* txn */              | write reorganization |        88 |      154 |    898319 | 2023-05-22 11:07:47 | 

MySQL [(none)]> admin show ddl jobs;
+--------+---------+----------------------+----------------------------------+----------------------+-----------+----------+-----------+---------------------+---------------------+---------------------+---------+
| JOB_ID | DB_NAME | TABLE_NAME           | JOB_TYPE                         | SCHEMA_STATE         | SCHEMA_ID | TABLE_ID | ROW_COUNT | CREATE_TIME         | START_TIME          | END_TIME            | STATE   |
+--------+---------+----------------------+----------------------------------+----------------------+-----------+----------+-----------+---------------------+---------------------+---------------------+---------+
|    224 | rtdb    | t                    | add index /* txn */              | write reorganization |        88 |      154 |    728796 | 2023-05-22 11:07:47 | 2023-05-22 11:07:47 | NULL                | running |


MySQL [(none)]> admin show ddl jobs;
+--------+---------+----------------------+----------------------------------+----------------------+-----------+----------+-----------+---------------------+---------------------+---------------------+---------+
| JOB_ID | DB_NAME | TABLE_NAME           | JOB_TYPE                         | SCHEMA_STATE         | SCHEMA_ID | TABLE_ID | ROW_COUNT | CREATE_TIME         | START_TIME          | END_TIME            | STATE   |
+--------+---------+----------------------+----------------------------------+----------------------+-----------+----------+-----------+---------------------+---------------------+---------------------+---------+
|    224 | rtdb    | t                    | add index /* txn */              | write reorganization |        88 |      154 |    806927 | 2023-05-22 11:07:47 | 2023-05-22 11:07:47 | NULL                | running |

MySQL [(none)]> admin show ddl jobs;
+--------+---------+----------------------+----------------------------------+----------------------+-----------+----------+-----------+---------------------+---------------------+---------------------+---------+
| JOB_ID | DB_NAME | TABLE_NAME           | JOB_TYPE                         | SCHEMA_STATE         | SCHEMA_ID | TABLE_ID | ROW_COUNT | CREATE_TIME         | START_TIME          | END_TIME            | STATE   |
+--------+---------+----------------------+----------------------------------+----------------------+-----------+----------+-----------+---------------------+---------------------+---------------------+---------+
|    224 | rtdb    | t                    | add index /* txn */              | write reorganization |        88 |      154 |    867855 | 2023-05-22 11:07:47 | 2023-05-22 11:07:47 | NULL                | running |

MySQL [(none)]> admin show ddl jobs;
+--------+---------+----------------------+----------------------------------+----------------------+-----------+----------+-----------+---------------------+---------------------+---------------------+---------+
| JOB_ID | DB_NAME | TABLE_NAME           | JOB_TYPE                         | SCHEMA_STATE         | SCHEMA_ID | TABLE_ID | ROW_COUNT | CREATE_TIME         | START_TIME          | END_TIME            | STATE   |
+--------+---------+----------------------+----------------------------------+----------------------+-----------+----------+-----------+---------------------+---------------------+---------------------+---------+
|    224 | rtdb    | t                    | add index /* txn */              | write reorganization |        88 |      154 |    672906 | 2023-05-22 11:07:47 | 2023-05-22 11:07:47 | NULL                | running |
  1. after index is added, the rowcount is different with actually row count.
MySQL [rtdb]> select count(1) from t;
+----------+
| count(1) |
+----------+
| 10000800 |
+----------+

MySQL [(none)]> admin show ddl jobs 50;
+--------+---------+------------------------------------------+----------------------------------+--------------+-----------+----------+-----------+---------------------+---------------------+---------------------+--------+
| JOB_ID | DB_NAME | TABLE_NAME                               | JOB_TYPE                         | SCHEMA_STATE | SCHEMA_ID | TABLE_ID | ROW_COUNT | CREATE_TIME         | START_TIME          | END_TIME            | STATE  |
+--------+---------+------------------------------------------+----------------------------------+--------------+-----------+----------+-----------+---------------------+---------------------+---------------------+--------+
|    224 | rtdb    | t                                        | add index /* txn */              | public       |        88 |      154 |    613382 | 2023-05-22 11:07:47 | 2023-05-22 11:07:47 | 2023-05-22 11:30:58 | synced |

4. What is your TiDB version? (Required)

55bac2963911af0fbd506f776a33e1d2337c7843

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions