Ensure that auto_increment fields are marked properly on update

MDEV-19622 Assertion failures in
ha_partition::set_auto_increment_if_higher upon UPDATE on Aria
table
This commit is contained in:
Monty 2020-05-13 23:30:34 +03:00
parent 6bc4444d7c
commit edbf124515
6 changed files with 49 additions and 0 deletions

View file

@ -861,6 +861,17 @@ SELECT * FROM t1;
DROP TABLE t1;
}
if (!$skip_update)
{
--echo #
--echo # MDEV-19622 Assertion failures in
--echo # ha_partition::set_auto_increment_if_higher upon UPDATE on Aria table
--echo #
CREATE OR REPLACE TABLE t1 (pk INT AUTO_INCREMENT, a INT, KEY(pk)) ENGINE=myisam PARTITION BY HASH(a);
INSERT INTO t1 VALUES (1,1),(2,2);
UPDATE t1 SET pk = 0;
DROP TABLE t1;
}
--echo ##############################################################################
}

View file

@ -1101,4 +1101,12 @@ SELECT * FROM t1;
a
0
DROP TABLE t1;
#
# MDEV-19622 Assertion failures in
# ha_partition::set_auto_increment_if_higher upon UPDATE on Aria table
#
CREATE OR REPLACE TABLE t1 (pk INT AUTO_INCREMENT, a INT, KEY(pk)) ENGINE=myisam PARTITION BY HASH(a);
INSERT INTO t1 VALUES (1,1),(2,2);
UPDATE t1 SET pk = 0;
DROP TABLE t1;
##############################################################################

View file

@ -1148,4 +1148,12 @@ SELECT * FROM t1;
a
0
DROP TABLE t1;
#
# MDEV-19622 Assertion failures in
# ha_partition::set_auto_increment_if_higher upon UPDATE on Aria table
#
CREATE OR REPLACE TABLE t1 (pk INT AUTO_INCREMENT, a INT, KEY(pk)) ENGINE=myisam PARTITION BY HASH(a);
INSERT INTO t1 VALUES (1,1),(2,2);
UPDATE t1 SET pk = 0;
DROP TABLE t1;
##############################################################################

View file

@ -1129,4 +1129,12 @@ SELECT * FROM t1;
a
0
DROP TABLE t1;
#
# MDEV-19622 Assertion failures in
# ha_partition::set_auto_increment_if_higher upon UPDATE on Aria table
#
CREATE OR REPLACE TABLE t1 (pk INT AUTO_INCREMENT, a INT, KEY(pk)) ENGINE=myisam PARTITION BY HASH(a);
INSERT INTO t1 VALUES (1,1),(2,2);
UPDATE t1 SET pk = 0;
DROP TABLE t1;
##############################################################################

View file

@ -1148,4 +1148,12 @@ SELECT * FROM t1;
a
0
DROP TABLE t1;
#
# MDEV-19622 Assertion failures in
# ha_partition::set_auto_increment_if_higher upon UPDATE on Aria table
#
CREATE OR REPLACE TABLE t1 (pk INT AUTO_INCREMENT, a INT, KEY(pk)) ENGINE=myisam PARTITION BY HASH(a);
INSERT INTO t1 VALUES (1,1),(2,2);
UPDATE t1 SET pk = 0;
DROP TABLE t1;
##############################################################################

View file

@ -6470,6 +6470,12 @@ void TABLE::mark_columns_needed_for_update()
}
need_signal= true;
}
else
{
if (found_next_number_field)
mark_auto_increment_column();
}
if (file->ha_table_flags() & HA_PRIMARY_KEY_REQUIRED_FOR_DELETE)
{
/*