pingcap / tiflash

The analytical engine for TiDB and TiDB Cloud. Try free: https://tidbcloud.com/free-trial
https://docs.pingcap.com/tidb/stable/tiflash-overview
Apache License 2.0
943 stars 410 forks source link

Rename partitioned table may leave some partition on the old database #9132

Closed JaySon-Huang closed 2 months ago

JaySon-Huang commented 3 months ago

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

minimal reproduce step

CREATE TABLE employees (
    id INT NOT NULL,
    store_id INT NOT NULL
)PARTITION BY RANGE (store_id) (
    PARTITION p0 VALUES LESS THAN (6),
    PARTITION p1 VALUES LESS THAN (11),
    PARTITION p2 VALUES LESS THAN (16),
    PARTITION p3 VALUES LESS THAN (21)
);
alter table employees set tiflash replica 2;

-- (1,1),(2,2),(3,3) => p0
-- p1 is empty
-- (11,11) => p2
-- (16,16) => p3
insert into employees(id, store_id) values(1,1),(2,2),(3,3),(11,11),(16,16);
rename test.employees to mytest.employees;

original post on https://asktug.com/t/topic/1026991/34

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

All partitions are renamed to the new database and tiflash run normally

3. What did you see instead (Required)

Some partition is not renamed to the new database. If the schema of partition table changed, tiflash may fail to restart.

4. What is your TiFlash version? (Required)

v7.5.2