We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Please answer these questions before submitting your issue. Thanks!
select TIDB_DECODE_KEY from information_schema.tikv_region_status
TIDB_DECODE_KEY
information_schema.tikv_region_status
SELECT START_KEY, TIDB_DECODE_KEY(START_KEY) FROM information_schema.tikv_region_status WHERE table_name='stock' AND REGION_ID=49103157; +--------------------------------------------------------------------------+----------------------------------------------+ | START_KEY | TIDB_DECODE_KEY(START_KEY) | +--------------------------------------------------------------------------+----------------------------------------------+ | 748000000000035BFFA25F720380000000FF00001F3303800000FF0000011723000000FC | {"handle":"{7987, 71459}","table_id":220066} | | 748000000000035BFFA25F720380000000FF00001F3303800000FF0000011723000000FC | {"handle":"{7987, 71459}","table_id":220066} | | 748000000000035BFFA25F720380000000FF00001F3303800000FF0000011723000000FC | {"handle":"{7987, 71459}","table_id":220066} | | 748000000000035BFFA25F720380000000FF00001F3303800000FF0000011723000000FC | {"handle":"{7987, 71459}","table_id":220066} | +--------------------------------------------------------------------------+----------------------------------------------+
When we check the table, there's no table with id 220066 The real id for such table is 212078 instead
220066
212078
mysql> select tidb_table_id from information_schema.tables where table_name = 'stock'; +---------------+ | tidb_table_id | +---------------+ | 212078 | +---------------+ 1 row in set (0.94 sec)
We found stock table is partitioned and the table id in the key is actually partition id
stock
mysql> select * from partitions where TIDB_PARTITION_ID = 220066; +---------------+-----------------+------------+----------------+-------------------+----------------------------+-------------------------------+------------------+---------------------+----------------------+-------------------------+-----------------------+------------+----------------+-------------+-----------------+--------------+-----------+---------------------+-------------+------------+----------+-------------------+-----------+-----------------+-------------------+----------------------------+ | TABLE_CATALOG | TABLE_SCHEMA | TABLE_NAME | PARTITION_NAME | SUBPARTITION_NAME | PARTITION_ORDINAL_POSITION | SUBPARTITION_ORDINAL_POSITION | PARTITION_METHOD | SUBPARTITION_METHOD | PARTITION_EXPRESSION | SUBPARTITION_EXPRESSION | PARTITION_DESCRIPTION | TABLE_ROWS | AVG_ROW_LENGTH | DATA_LENGTH | MAX_DATA_LENGTH | INDEX_LENGTH | DATA_FREE | CREATE_TIME | UPDATE_TIME | CHECK_TIME | CHECKSUM | PARTITION_COMMENT | NODEGROUP | TABLESPACE_NAME | TIDB_PARTITION_ID | TIDB_PLACEMENT_POLICY_NAME | +---------------+-----------------+------------+----------------+-------------------+----------------------------+-------------------------------+------------------+---------------------+----------------------+-------------------------+-----------------------+------------+----------------+-------------+-----------------+--------------+-----------+---------------------+-------------+------------+----------+-------------------+-----------+-----------------+-------------------+----------------------------+ | def | tpcc_load_test1 | stock | p7987 | NULL | 7988 | NULL | HASH | NULL | `s_w_id` | NULL | | 0 | 0 | 0 | 0 | 0 | 0 | 2022-11-12 02:28:31 | NULL | NULL | NULL | | NULL | NULL | 220066 | NULL | +---------------+-----------------+------------+----------------+-------------------+----------------------------+-------------------------------+------------------+---------------------+----------------------+-------------------------+-----------------------+------------+----------------+-------------+-----------------+--------------+-----------+---------------------+-------------+------------+----------+-------------------+-----------+-----------------+-------------------+----------------------------+ 1 row in set (1.01 sec)
We expect TIDB_DECODE_KEY provides proper table id 212078 instead of 220066 which is the partition id of this table.
Partition id 220066 is shown as table id in TIDB_DECODE_KEY We found the current tidb_decode_key function is using partition id instead of table id.
tidb/planner/core/expression_rewriter.go
Line 2144 in e48f357
v6.1.0
The text was updated successfully, but these errors were encountered:
tidb_decode_key
*: fix tidb_decode_key with partition table (#39312)
8fc4535
close #39304
Defined2014
Successfully merging a pull request may close this issue.
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
select
TIDB_DECODE_KEY
frominformation_schema.tikv_region_status
When we check the table, there's no table with id
220066
The real id for such table is
212078
insteadWe found
stock
table is partitioned and the table id in the key is actually partition id2. What did you expect to see? (Required)
We expect TIDB_DECODE_KEY provides proper table id
212078
instead of220066
which is the partition id of this table.3. What did you see instead (Required)
Partition id
220066
is shown as table id in TIDB_DECODE_KEYWe found the current tidb_decode_key function is using partition id instead of table id.
tidb/planner/core/expression_rewriter.go
Line 2144 in e48f357
4. What is your TiDB version? (Required)
v6.1.0
The text was updated successfully, but these errors were encountered: