Commit 2beede9b authored by Nayuta Yanagisawa's avatar Nayuta Yanagisawa

MDEV-29636 Assertion `part_share->auto_inc_initialized ||...

MDEV-29636 Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()' failed in ha_partition::set_auto_increment_if_higher upon REPLACE with partition pruning

The bug is caused by a similar mechanism as MDEV-21027.

The function, check_insert_or_replace_autoincrement, failed to open
all the partitions on REPLACE SELECT statements and it results in the
assertion error.
parent a59dffb0
......@@ -873,6 +873,19 @@ eval CREATE OR REPLACE TABLE t1 (pk INT AUTO_INCREMENT, a INT, KEY(pk)) ENGINE=$
INSERT INTO t1 VALUES (1,1),(2,2);
UPDATE t1 SET pk = 0;
DROP TABLE t1;
--echo #
--echo # MDEV-29636 Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()'
--echo # failed in ha_partition::set_auto_increment_if_higher upon REPLACE
--echo # with partition pruning
--echo #
eval CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) ENGINE=$engine
PARTITION BY RANGE (a) (
PARTITION p0 VALUES LESS THAN (10),
PARTITION pn VALUES LESS THAN MAXVALUE
);
REPLACE INTO t1 PARTITION (p0) SELECT 1;
DROP TABLE t1;
}
if (!$skip_delete)
......
......@@ -704,6 +704,18 @@ INSERT INTO t1 VALUES (1,1),(2,2);
UPDATE t1 SET pk = 0;
DROP TABLE t1;
#
# MDEV-29636 Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()'
# failed in ha_partition::set_auto_increment_if_higher upon REPLACE
# with partition pruning
#
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) ENGINE='Blackhole'
PARTITION BY RANGE (a) (
PARTITION p0 VALUES LESS THAN (10),
PARTITION pn VALUES LESS THAN MAXVALUE
);
REPLACE INTO t1 PARTITION (p0) SELECT 1;
DROP TABLE t1;
#
# MDEV-21027 Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()'
# ha_partition::set_auto_increment_if_higher
#
......
......@@ -1111,6 +1111,18 @@ INSERT INTO t1 VALUES (1,1),(2,2);
UPDATE t1 SET pk = 0;
DROP TABLE t1;
#
# MDEV-29636 Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()'
# failed in ha_partition::set_auto_increment_if_higher upon REPLACE
# with partition pruning
#
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) ENGINE='InnoDB'
PARTITION BY RANGE (a) (
PARTITION p0 VALUES LESS THAN (10),
PARTITION pn VALUES LESS THAN MAXVALUE
);
REPLACE INTO t1 PARTITION (p0) SELECT 1;
DROP TABLE t1;
#
# MDEV-21027 Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()'
# ha_partition::set_auto_increment_if_higher
#
......
......@@ -1158,6 +1158,18 @@ INSERT INTO t1 VALUES (1,1),(2,2);
UPDATE t1 SET pk = 0;
DROP TABLE t1;
#
# MDEV-29636 Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()'
# failed in ha_partition::set_auto_increment_if_higher upon REPLACE
# with partition pruning
#
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) ENGINE='Aria'
PARTITION BY RANGE (a) (
PARTITION p0 VALUES LESS THAN (10),
PARTITION pn VALUES LESS THAN MAXVALUE
);
REPLACE INTO t1 PARTITION (p0) SELECT 1;
DROP TABLE t1;
#
# MDEV-21027 Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()'
# ha_partition::set_auto_increment_if_higher
#
......
......@@ -1139,6 +1139,18 @@ INSERT INTO t1 VALUES (1,1),(2,2);
UPDATE t1 SET pk = 0;
DROP TABLE t1;
#
# MDEV-29636 Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()'
# failed in ha_partition::set_auto_increment_if_higher upon REPLACE
# with partition pruning
#
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) ENGINE='Memory'
PARTITION BY RANGE (a) (
PARTITION p0 VALUES LESS THAN (10),
PARTITION pn VALUES LESS THAN MAXVALUE
);
REPLACE INTO t1 PARTITION (p0) SELECT 1;
DROP TABLE t1;
#
# MDEV-21027 Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()'
# ha_partition::set_auto_increment_if_higher
#
......
......@@ -1158,6 +1158,18 @@ INSERT INTO t1 VALUES (1,1),(2,2);
UPDATE t1 SET pk = 0;
DROP TABLE t1;
#
# MDEV-29636 Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()'
# failed in ha_partition::set_auto_increment_if_higher upon REPLACE
# with partition pruning
#
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) ENGINE='MyISAM'
PARTITION BY RANGE (a) (
PARTITION p0 VALUES LESS THAN (10),
PARTITION pn VALUES LESS THAN MAXVALUE
);
REPLACE INTO t1 PARTITION (p0) SELECT 1;
DROP TABLE t1;
#
# MDEV-21027 Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()'
# ha_partition::set_auto_increment_if_higher
#
......
......@@ -1410,7 +1410,8 @@ class ha_partition :public handler
if (!part_share->auto_inc_initialized &&
(ha_thd()->lex->sql_command == SQLCOM_INSERT ||
ha_thd()->lex->sql_command == SQLCOM_INSERT_SELECT ||
ha_thd()->lex->sql_command == SQLCOM_REPLACE) &&
ha_thd()->lex->sql_command == SQLCOM_REPLACE ||
ha_thd()->lex->sql_command == SQLCOM_REPLACE_SELECT) &&
table->found_next_number_field)
bitmap_set_all(&m_part_info->read_partitions);
}
......
......@@ -1125,6 +1125,18 @@ INSERT INTO t1 VALUES (1,1),(2,2);
UPDATE t1 SET pk = 0;
DROP TABLE t1;
#
# MDEV-29636 Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()'
# failed in ha_partition::set_auto_increment_if_higher upon REPLACE
# with partition pruning
#
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) ENGINE='TokuDB'
PARTITION BY RANGE (a) (
PARTITION p0 VALUES LESS THAN (10),
PARTITION pn VALUES LESS THAN MAXVALUE
);
REPLACE INTO t1 PARTITION (p0) SELECT 1;
DROP TABLE t1;
#
# MDEV-21027 Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()'
# ha_partition::set_auto_increment_if_higher
#
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment