tidb_decode_key解析不了key?

lindoubled
Thu, 11 Aug 2022 07:22:14 +0000

最简单的复现方式：
1、创建一个表t11

 CREATE TABLE `t11` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(10) DEFAULT NULL,
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin AUTO_INCREMENT=30001

2、插入一条数据：

insert into t11(name) values('1')

3、查看t11的key范围：

MySQL [test]> select * from information_schema.tikv_region_status where table_name='t11'\G;
*************************** 1. row ***************************
                REGION_ID: 261077209
                START_KEY: 7480000000000020FF0E00000000000000F8
                  END_KEY: 7480000000000020FF1000000000000000F8
                 TABLE_ID: 8206
                  DB_NAME: test
               TABLE_NAME: t11
                 IS_INDEX: 0
                 INDEX_ID: NULL
               INDEX_NAME: NULL
           EPOCH_CONF_VER: 9410
            EPOCH_VERSION: 4764
            WRITTEN_BYTES: 0
               READ_BYTES: 0
         APPROXIMATE_SIZE: 1
         APPROXIMATE_KEYS: 1
  REPLICATIONSTATUS_STATE: NULL
REPLICATIONSTATUS_STATEID: NULL

4、用tidb_decode_key解析不了

MySQL [test]> select tidb_decode_key('7480000000000020FF0E00000000000000F8');
+---------------------------------------------------------+
| tidb_decode_key('7480000000000020FF0E00000000000000F8') |
+---------------------------------------------------------+
| 7480000000000020FF0E00000000000000F8                    |
+---------------------------------------------------------+
1 row in set, 1 warning (0.00 sec)

MySQL [test]> show warnings;
+---------+------+----------------------------------------------+
| Level   | Code | Message                                      |
+---------+------+----------------------------------------------+
| Warning | 1105 | invalid record/index key: 74800000000000200E |
+---------+------+----------------------------------------------+
1 row in set (0.00 sec)

阅读完整话题