Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.2(EOL), 10.3(EOL), 10.4(EOL)
-
None
Description
Reproduce
create or replace table t1 (pk int, x timestamp(6), primary key (pk, x)) engine innodb |
partition by key() partitions 2; |
 |
insert into t1 (pk, x) values (1, '2000-01-01 00:00'), (2, '2000-01-01 00:01'); |
alter table t1 drop primary key, drop column x, add primary key (pk); |
select * from t1 partition (p0); |
Result
+----+
|
| pk |
|
+----+
|
| 1 |
|
| 2 |
|
+----+
|
Both records are in p0 which is unacceptable for new partitioning expression.
Expected
Table is repartitioned by pk.
+----+
|
| pk |
|
+----+
|
| 1 |
|
+----+
|
Cause
Empty key() clause implies that key might be changed by ALTER, but inplace algorithm must not be used since repartitioning is required for a different key.
Fix
Prohibit inplace when there is DROP PRIMARY KEY and table is partitioned by key.
It seems same problem happens when we use UNIQUE instead of the PRIMARY KEY.
MariaDB [test]> create or replace table t1 (pk int not null, x timestamp(6), unique ux(pk, x)) engine innodb partition by key() partitions 2;
|
Query OK, 0 rows affected (0.69 sec)
|
MariaDB [test]> insert into t1 (pk, x) values (1, '2000-01-01 00:00'), (2, '2000-01-01 00:01'); Query OK, 2 rows affected (0.04 sec)
|
Records: 2 Duplicates: 0 Warnings: 0
|
MariaDB [test]> alter table t1 drop key ux, drop column x, add unique (pk); Query OK, 0 rows affected (1.28 sec)
|
Records: 0 Duplicates: 0 Warnings: 0
|
MariaDB [test]> select * from t1 partition (p0); +----+
|
| pk |
|
+----+
|
| 1 |
|
| 2 |
|
+----+
|
2 rows in set (0.00 sec)
|
Attachments
Issue Links
- causes
-
MDEV-18794 Assertion `!m_innodb' failed in ha_partition::cmp_ref upon SELECT from partitioned table
- Closed