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

The region info returned by querying tikv_region_status using table_id and table_name is inconsistent #57477

Open
circle006 opened this issue Nov 19, 2024 · 0 comments
Labels
type/bug The issue is confirmed as a bug.

Comments

@circle006
Copy link

Bug Report

The test found that when the table does not involve indexes, the results obtained by querying table_name and table_id are consistent:

mysql> select * from information_schema.tikv_region_status where table_id='1141';
+-----------+--------------------------------------------------------+--------------------------------------------------------+----------+---------+------------+----------+----------+------------+----------------+---------------+---------------+------------+------------------+------------------+-------------------------+---------------------------+
| REGION_ID | START_KEY                                              | END_KEY                                                | TABLE_ID | DB_NAME | TABLE_NAME | IS_INDEX | INDEX_ID | INDEX_NAME | EPOCH_CONF_VER | EPOCH_VERSION | WRITTEN_BYTES | READ_BYTES | APPROXIMATE_SIZE | APPROXIMATE_KEYS | REPLICATIONSTATUS_STATE | REPLICATIONSTATUS_STATEID |
+-----------+--------------------------------------------------------+--------------------------------------------------------+----------+---------+------------+----------+----------+------------+----------------+---------------+---------------+------------+------------------+------------------+-------------------------+---------------------------+
|     59291 | 7480000000000004FF7500000000000000F8                   | 7480000000000004FF755F728000000000FF1283300000000000FA |     1141 | test    | x          |        0 |     NULL | NULL       |         160712 |          1077 |            39 |          0 |                1 |                0 | NULL                    |                      NULL |
|     59259 | 7480000000000004FF755F728000000000FF1283300000000000FA | 748000FFFFFFFFFFFFFE00000000000000F8                   |     1141 | test    | x          |        0 |     NULL | NULL       |         160712 |          1077 |     105064549 |   10752681 |               81 |           205299 | NULL                    |                      NULL |
+-----------+--------------------------------------------------------+--------------------------------------------------------+----------+---------+------------+----------+----------+------------+----------------+---------------+---------------+------------+------------------+------------------+-------------------------+---------------------------+
2 rows in set (0.01 sec)
mysql> select * from information_schema.tikv_region_status where table_name='x';
+-----------+--------------------------------------------------------+--------------------------------------------------------+----------+---------+------------+----------+----------+------------+----------------+---------------+---------------+------------+------------------+------------------+-------------------------+---------------------------+
| REGION_ID | START_KEY                                              | END_KEY                                                | TABLE_ID | DB_NAME | TABLE_NAME | IS_INDEX | INDEX_ID | INDEX_NAME | EPOCH_CONF_VER | EPOCH_VERSION | WRITTEN_BYTES | READ_BYTES | APPROXIMATE_SIZE | APPROXIMATE_KEYS | REPLICATIONSTATUS_STATE | REPLICATIONSTATUS_STATEID |
+-----------+--------------------------------------------------------+--------------------------------------------------------+----------+---------+------------+----------+----------+------------+----------------+---------------+---------------+------------+------------------+------------------+-------------------------+---------------------------+
|     59259 | 7480000000000004FF755F728000000000FF1283300000000000FA | 748000FFFFFFFFFFFFFE00000000000000F8                   |     1141 | test    | x          |        0 |     NULL | NULL       |         160712 |          1077 |     105064549 |   10752681 |               81 |           205299 | NULL                    |                      NULL |
|     59291 | 7480000000000004FF7500000000000000F8                   | 7480000000000004FF755F728000000000FF1283300000000000FA |     1141 | test    | x          |        0 |     NULL | NULL       |         160712 |          1077 |            39 |          0 |                1 |                0 | NULL                    |                      NULL |
+-----------+--------------------------------------------------------+--------------------------------------------------------+----------+---------+------------+----------+----------+------------+----------------+---------------+---------------+------------+------------------+------------------+-------------------------+---------------------------+
2 rows in set (0.01 sec) 

When there is an index in the table and the index involves multiple regions, only one region of the index is displayed by querying the table_id:

mysql> select * from information_schema.tikv_region_status where table_id='1141';
+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------+----------+---------+------------+----------+----------+------------+----------------+---------------+---------------+------------+------------------+------------------+-------------------------+---------------------------+
| REGION_ID | START_KEY                                                                                                                                                                                                                | END_KEY                                                | TABLE_ID | DB_NAME | TABLE_NAME | IS_INDEX | INDEX_ID | INDEX_NAME | EPOCH_CONF_VER | EPOCH_VERSION | WRITTEN_BYTES | READ_BYTES | APPROXIMATE_SIZE | APPROXIMATE_KEYS | REPLICATIONSTATUS_STATE | REPLICATIONSTATUS_STATEID |
+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------+----------+---------+------------+----------+----------+------------+----------------+---------------+---------------+------------+------------------+------------------+-------------------------+---------------------------+
|     59295 | 7480000000000004FF755F728000000000FF00A5780000000000FA                                                                                                                                                                   | 7480000000000004FF755F728000000000FF097D9E0000000000FA |     1141 | test    | x          |        0 |     NULL | NULL       |         160712 |          1079 |             0 |          0 |              141 |          1424262 | NULL                    |                      NULL |
|     59291 | 7480000000000004FF755F728000000000FF097D9E0000000000FA                                                                                                                                                                   | 7480000000000004FF755F728000000000FF1283300000000000FA |     1141 | test    | x          |        0 |     NULL | NULL       |         160712 |          1078 |            42 |          0 |               91 |           985496 | NULL                    |                      NULL |
|     59259 | 7480000000000004FF755F728000000000FF1283300000000000FA                                                                                                                                                                   | 748000FFFFFFFFFFFFFE00000000000000F8                   |     1141 | test    | x          |        0 |     NULL | NULL       |         160712 |          1077 |            42 |       2220 |               77 |           845152 | NULL                    |                      NULL |
|     59299 | 7480000000000004FF755F698000000000FF0000010177657975FF67776679FF637664FF7363686462FF7375FF616369617573FF64FF67667561766375FFFF6473677961616464FFFF64646464646464FF64FF646464646400FF0000FC0380000000FF0004C37800000000FB | 7480000000000004FF755F728000000000FF00A5780000000000FA |     1141 | test    | x          |        1 |        1 | idx_name   |         160712 |          1080 |             0 |          0 |              120 |           676522 | NULL                    |                      NULL |
|     59299 | 7480000000000004FF755F698000000000FF0000010177657975FF67776679FF637664FF7363686462FF7375FF616369617573FF64FF67667561766375FFFF6473677961616464FFFF64646464646464FF64FF646464646400FF0000FC0380000000FF0004C37800000000FB | 7480000000000004FF755F728000000000FF00A5780000000000FA |     1141 | test    | x          |        0 |     NULL | NULL       |         160712 |          1080 |             0 |          0 |              120 |           676522 | NULL                    |                      NULL |
+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------+----------+---------+------------+----------+----------+------------+----------------+---------------+---------------+------------+------------------+------------------+-------------------------+---------------------------+
5 rows in set (0.00 sec)
mysql> select * from information_schema.tikv_region_status where table_name='x';
+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------+---------+------------+----------+----------+------------+----------------+---------------+---------------+------------+------------------+------------------+-------------------------+---------------------------+
| REGION_ID | START_KEY                                                                                                                                                                                                                | END_KEY                                                                                                                                                                                                                  | TABLE_ID | DB_NAME | TABLE_NAME | IS_INDEX | INDEX_ID | INDEX_NAME | EPOCH_CONF_VER | EPOCH_VERSION | WRITTEN_BYTES | READ_BYTES | APPROXIMATE_SIZE | APPROXIMATE_KEYS | REPLICATIONSTATUS_STATE | REPLICATIONSTATUS_STATEID |
+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------+---------+------------+----------+----------+------------+----------------+---------------+---------------+------------+------------------+------------------+-------------------------+---------------------------+
|     59299 | 7480000000000004FF755F698000000000FF0000010177657975FF67776679FF637664FF7363686462FF7375FF616369617573FF64FF67667561766375FFFF6473677961616464FFFF64646464646464FF64FF646464646400FF0000FC0380000000FF0004C37800000000FB | 7480000000000004FF755F728000000000FF00A5780000000000FA                                                                                                                                                                   |     1141 | test    | x          |        1 |        1 | idx_name   |         160712 |          1080 |             0 |          0 |              120 |           676522 | NULL                    |                      NULL |
|     59299 | 7480000000000004FF755F698000000000FF0000010177657975FF67776679FF637664FF7363686462FF7375FF616369617573FF64FF67667561766375FFFF6473677961616464FFFF64646464646464FF64FF646464646400FF0000FC0380000000FF0004C37800000000FB | 7480000000000004FF755F728000000000FF00A5780000000000FA                                                                                                                                                                   |     1141 | test    | x          |        0 |     NULL | NULL       |         160712 |          1080 |             0 |          0 |              120 |           676522 | NULL                    |                      NULL |
|     59303 | 7480000000000004FF755F698000000000FF0000010161736A64FF68757368FF667564FF7373737373FF7373FF737373737373FF73FF73737373617765FFFF7777777777777777FFFF77000000000000FF00F8038000000000FF1421C10000000000FA                   | 7480000000000004FF755F698000000000FF0000010177657975FF67776679FF637664FF7363686462FF7375FF616369617573FF64FF67667561766375FFFF6473677961616464FFFF64646464646464FF64FF646464646400FF0000FC0380000000FF0004C37800000000FB |     1141 | test    | x          |        1 |        1 | idx_name   |         160712 |          1081 |             0 |          0 |               48 |           277365 | NULL                    |                      NULL |
|     59259 | 7480000000000004FF755F728000000000FF1283300000000000FA                                                                                                                                                                   | 748000FFFFFFFFFFFFFE00000000000000F8                                                                                                                                                                                     |     1141 | test    | x          |        0 |     NULL | NULL       |         160712 |          1077 |            42 |       2220 |               77 |           845152 | NULL                    |                      NULL |
|     59291 | 7480000000000004FF755F728000000000FF097D9E0000000000FA                                                                                                                                                                   | 7480000000000004FF755F728000000000FF1283300000000000FA                                                                                                                                                                   |     1141 | test    | x          |        0 |     NULL | NULL       |         160712 |          1078 |            42 |          0 |               91 |           985496 | NULL                    |                      NULL |
|     59307 | 7480000000000004FF7500000000000000F8                                                                                                                                                                                     | 7480000000000004FF755F698000000000FF0000010161736A64FF68757368FF667564FF7373737373FF7373FF737373737373FF73FF73737373617765FFFF7777777777777777FFFF77000000000000FF00F8038000000000FF1421C10000000000FA                   |     1141 | test    | x          |        1 |        1 | idx_name   |         160712 |          1081 |             0 |          0 |              105 |           647421 | NULL                    |                      NULL |
|     59295 | 7480000000000004FF755F728000000000FF00A5780000000000FA                                                                                                                                                                   | 7480000000000004FF755F728000000000FF097D9E0000000000FA                                                                                                                                                                   |     1141 | test    | x          |        0 |     NULL | NULL       |         160712 |          1079 |             0 |          0 |              141 |          1424262 | NULL                    |                      NULL |
+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------+---------+------------+----------+----------+------------+----------------+---------------+---------------+------------+------------------+------------------+-------------------------+---------------------------+
7 rows in set (0.00 sec) 

What did you expect to see? (Required)
The result is the same

What is your TiDB version? (Required)
v6.5

@circle006 circle006 added the type/bug The issue is confirmed as a bug. label Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

1 participant