Skip to content
New issue

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

reorganize partition can not concurrent run ddl with other ddl #42442

Closed
aytrack opened this issue Mar 21, 2023 · 1 comment · Fixed by #42490
Closed

reorganize partition can not concurrent run ddl with other ddl #42442

aytrack opened this issue Mar 21, 2023 · 1 comment · Fixed by #42490
Assignees
Labels
affects-7.0 component/tablepartition This issue is related to Table Partition of TiDB. severity/major sig/sql-infra SIG: SQL Infra type/bug This issue is a bug.

Comments

@aytrack
Copy link
Contributor

aytrack commented Mar 21, 2023

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

  1. session 1
create database db1;
CREATE TABLE `t1` (
    `id` bigint(20) NOT NULL AUTO_INCREMENT,
    `k` int(11) NOT NULL DEFAULT '0',
    `c` char(120) NOT NULL DEFAULT '',
    `pad` char(60) NOT NULL DEFAULT '',
    PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */,
    KEY `k_1` (`k`)
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
  PARTITION BY RANGE (`id`)
  (PARTITION `p0` VALUES LESS THAN (2000000),
   PARTITION `p1` VALUES LESS THAN (4000000),
   PARTITION `p2` VALUES LESS THAN (6000000),
   PARTITION `p3` VALUES LESS THAN (8000000),
   PARTITION `p4` VALUES LESS THAN (10000000),
   PARTITION `p5` VALUES LESS THAN (MAXVALUE));
insert into t1(k, c, pad) values (1, 'a', 'beijing'), (2, 'b', 'chengdu');
insert into t1(k, c, pad) select k, c, pad from t1 limit 2000000; -- some times
alter table t1 reorganize partition p0, p1, p2, p3, p4 into( partition pnew values less than (10000000));
  1. session 2
create database db2;
use db2;
create table t01(a int, b int);

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

session 2 create table t01 will not be blocked by reorganize partition

3. What did you see instead (Required)

create table ddl was blocked by reorganize partition
图片

4. What is your TiDB version? (Required)

partitioninsert_1647963896275> select tidb_version();
+-----------------------------------------------------------+
| tidb_version()                                            |
+-----------------------------------------------------------+
| Release Version: v7.0.0                                   |
| Edition: Community                                        |
| Git Commit Hash: fc166ffae8576ac3efb2f5abac848d5edbaf2657 |
| Git Branch: heads/refs/tags/v7.0.0                        |
| UTC Build Time: 2023-03-20 07:08:59                       |
| GoVersion: go1.20.2                                       |
| Race Enabled: false                                       |
| TiKV Min Version: 6.2.0-alpha                             |
| Check Table Before Drop: false                            |
| Store: tikv                                               |
+-----------------------------------------------------------+
@aytrack aytrack added type/bug This issue is a bug. sig/sql-infra SIG: SQL Infra severity/major component/tablepartition This issue is related to Table Partition of TiDB. labels Mar 21, 2023
@ti-chi-bot ti-chi-bot added may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 labels Mar 21, 2023
@bb7133 bb7133 self-assigned this Mar 22, 2023
@bb7133
Copy link
Member

bb7133 commented Mar 22, 2023

The root cause is that we didn't mark "reorganize partition" as "need backfill" so it is scheduled as the 'general job', and the 'general job' is scheduled in serial(always block each others).

@bb7133 bb7133 added affects-7.0 and removed may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-6.1 may-affects-6.5 labels Mar 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-7.0 component/tablepartition This issue is related to Table Partition of TiDB. severity/major sig/sql-infra SIG: SQL Infra type/bug This issue is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants