TiDB 分区表添加分区很慢

[TiDB 版本] 5.1.1
CREATE TABLE inspector_batch_sessions (
session_id varchar(64) NOT NULL,
app_name varchar(64) NOT NULL,
dt timestamp NOT NULL COMMENT ‘对话日期’,
batch_id bigint(13) NOT NULL,
created_at datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT ‘创建时间’,
updated_at datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT ‘更新时间’,
PRIMARY KEY (dt,app_name,batch_id,session_id) /*T![clustered_index] NONCLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
PARTITION BY RANGE ( UNIX_TIMESTAMP(dt) ) (
PARTITION dt_20210823 VALUES LESS THAN (1629734400),
PARTITION dt_20210824 VALUES LESS THAN (1629820800),
PARTITION dt_20210825 VALUES LESS THAN (1629907200),
PARTITION dt_20210826 VALUES LESS THAN (1629993600),
PARTITION dt_20210827 VALUES LESS THAN (1630080000),
PARTITION dt_20210828 VALUES LESS THAN (1630166400),
PARTITION dt_20210829 VALUES LESS THAN (1630252800),
PARTITION dt_20210830 VALUES LESS THAN (1630339200),
PARTITION dt_20210831 VALUES LESS THAN (1630425600),
PARTITION dt_20210901 VALUES LESS THAN (1630512000),
PARTITION dt_20210902 VALUES LESS THAN (1630598400),
PARTITION dt_20210903 VALUES LESS THAN (1630684800),
PARTITION dt_20210904 VALUES LESS THAN (1630771200),
PARTITION dt_20210905 VALUES LESS THAN (1630857600),
PARTITION dt_20210906 VALUES LESS THAN (1630944000),
PARTITION dt_20210907 VALUES LESS THAN (1631030400),
PARTITION dt_20210908 VALUES LESS THAN (1631116800),
PARTITION dt_20210909 VALUES LESS THAN (1631203200),
PARTITION dt_20210910 VALUES LESS THAN (1631289600),
PARTITION dt_20210911 VALUES LESS THAN (1631376000),
PARTITION dt_20210912 VALUES LESS THAN (1631462400),
PARTITION dt_20210913 VALUES LESS THAN (1631548800),
PARTITION dt_20210914 VALUES LESS THAN (1631635200),
PARTITION dt_20210915 VALUES LESS THAN (1631721600),
PARTITION dt_20210916 VALUES LESS THAN (1631808000),
PARTITION dt_20210917 VALUES LESS THAN (1631894400),
PARTITION dt_20210918 VALUES LESS THAN (1631980800),
PARTITION dt_20210919 VALUES LESS THAN (1632067200),
PARTITION dt_20210920 VALUES LESS THAN (1632153600),
PARTITION dt_20210921 VALUES LESS THAN (1632240000),
PARTITION dt_20210922 VALUES LESS THAN (1632326400)
)

问题描述:
在将 tidb 版本升级到 5.1.1 的时候 给分区表添加分区就变的很困难
经常会中断然后显示分区添加上了

mysql>ALTER TABLE inspector_batch_sessions ADD PARTITION (PARTITION dt_20210922 VALUES LESS THAN (1632326400));
ERROR 1317 (70100): Query execution was interrupted

或者第一个分区3-4s添加上然后第二个就会沆住很久时间直至 执行中断

麻烦发一下 TiDB 的 Log 看一下哈。


这个是在dashbord 看的日志, 这些日志可以吗?

而且我这边测试 加tiflush 备份的表才会出现这种添加 分区慢的情况, 如果去除 tiflush 备份就会正常, 但是在升级tidb 5.1.1 之前就算是 tiflush 备份 也能很快添加分区的

还是发一下 tidb log 对应时间点的日志报错