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

Will lose rows after execute remove partitioning on a partition table with exchange partition #53385

Closed
Defined2014 opened this issue May 20, 2024 · 2 comments · Fixed by #53770
Assignees
Labels
affects-7.1 This bug affects the 7.1.x(LTS) versions. affects-7.5 This bug affects the 7.5.x(LTS) versions. affects-8.1 This bug affects the 8.1.x(LTS) versions. component/tablepartition This issue is related to Table Partition of TiDB. severity/major sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@Defined2014
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

create table t (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) );
create table t1(id int not null, store_id int not null);
insert into t values (1, 1);
insert into t values (2, 17);
insert into t1 values (0, 18);
alter table t exchange partition p3 with table t1;
alter table t remove partitioning;
select * from t;

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

mysql> select * from t;
+----+----------+
| id | store_id |
+----+----------+
|  1 |        1 |
|  0 |       18 |
+----+----------+
2 rows in set (0.00 sec)

3. What did you see instead (Required)

mysql> select * from t;
+----+----------+
| id | store_id |
+----+----------+
|  0 |       18 |
+----+----------+
1 row in set (0.01 sec)

4. What is your TiDB version? (Required)

mysql> select tidb_version();
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version()                                                                                                                                                                                                                                                           |
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v8.2.0-alpha-192-g397a460dd0
Edition: Community
Git Commit Hash: 397a460dd067986d585d71a729a51b9e77a4c7ac
Git Branch: master
UTC Build Time: 2024-05-20 06:27:50
GoVersion: go1.21.5
Race Enabled: false
Check Table Before Drop: false
Store: unistore |
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.04 sec)
@Defined2014 Defined2014 added type/bug The issue is confirmed as a bug. sig/sql-infra SIG: SQL Infra severity/major component/tablepartition This issue is related to Table Partition of TiDB. labels May 20, 2024
@Defined2014
Copy link
Contributor Author

The problem is caused by duplicate _tidb_rowid after exchange partition. We should seriously think about how to deal with this situation.

@mjonss mjonss added affects-7.5 This bug affects the 7.5.x(LTS) versions. affects-8.1 This bug affects the 8.1.x(LTS) versions. affects-7.1 This bug affects the 7.1.x(LTS) versions. and removed may-affects-7.5 may-affects-8.1 may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 may-affects-7.1 labels May 21, 2024
@mjonss
Copy link
Contributor

mjonss commented May 21, 2024

For v7.1 REMOVE PARTITTIONING is not supported, but REORGANIZE PARTITION is, so the bug is still affecting v7.1 with:

alter table t reorganize partition p0, p1, p2, p3 into (partition p3 values less than (21));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-7.1 This bug affects the 7.1.x(LTS) versions. affects-7.5 This bug affects the 7.5.x(LTS) versions. affects-8.1 This bug affects the 8.1.x(LTS) versions. component/tablepartition This issue is related to Table Partition of TiDB. severity/major sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants