Skip to content

Split table index on non-int clustered index should not be allowed #47350

@pcqz

Description

@pcqz

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

mysql> CREATE TABLE `test` (`id` varchar(10) NOT NULL, primary key (`id`) /*T![clustered_index] CLUSTERED */ );
Query OK, 0 rows affected (0.08 sec)

mysql> split table test index `primary` between (0) and (1000) regions 2;
+--------------------+----------------------+
| TOTAL_SPLIT_REGION | SCATTER_FINISH_RATIO |
+--------------------+----------------------+
|                  2 |                    1 |
+--------------------+----------------------+
1 row in set (0.21 sec)

mysql> show table test regions;
+-----------+------------------------------+------------------------------+-----------+-----------------+-------+------------+---------------+------------+----------------------+------------------+------------------------+------------------+
| REGION_ID | START_KEY                    | END_KEY                      | LEADER_ID | LEADER_STORE_ID | PEERS | SCATTERING | WRITTEN_BYTES | READ_BYTES | APPROXIMATE_SIZE(MB) | APPROXIMATE_KEYS | SCHEDULING_CONSTRAINTS | SCHEDULING_STATE |
+-----------+------------------------------+------------------------------+-----------+-----------------+-------+------------+---------------+------------+----------------------+------------------+------------------------+------------------+
|        14 | t_110_i_2_                   | t_281474976710649_           |        15 |               1 | 15    |          0 |           217 |          0 |                    1 |                0 |                        |                  |
|       664 | t_110_                       | t_110_i_1_013098181800000000 |       665 |               1 | 665   |          0 |             0 |          0 |                    1 |                0 |                        |                  |
|       666 | t_110_i_1_013098181800000000 | t_110_i_2_                   |       667 |               1 | 667   |          0 |             0 |          0 |                    1 |                0 |                        |                  |
+-----------+------------------------------+------------------------------+-----------+-----------------+-------+------------+---------------+------------+----------------------+------------------+------------------------+------------------+
3 rows in set (0.01 sec)

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

The error "ERROR 1176 (42000): Key 'primary' doesn't exist in table 'test'" should be reported like int type clustered index.

3. What did you see instead (Required)

Split table index is executed without error.

4. What is your TiDB version? (Required)

v7.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    affects-5.3This bug affects 5.3.x versions.affects-5.4This bug affects the 5.4.x(LTS) versions.affects-6.1This bug affects the 6.1.x(LTS) versions.affects-6.5This bug affects the 6.5.x(LTS) versions.affects-7.1This bug affects the 7.1.x(LTS) versions.component/ddlThis issue is related to DDL of TiDB.found/gsfound by gsseverity/majortype/bugThe issue is confirmed as a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions