mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
MDEV-30796 Auto_increment values not updated after bulk insert operation
- InnoDB fails to update the autoinc persistently after bulk insert operation. row_merge_bulk_t::write_to_index(): Update the autoinc value persistently
This commit is contained in:
@@ -28,3 +28,17 @@ DROP DATABASE db1;
|
||||
#
|
||||
# End of 10.6 tests
|
||||
#
|
||||
#
|
||||
# MDEV-30796 Auto_increment values not updated after bulk
|
||||
# insert operation
|
||||
#
|
||||
CREATE TABLE t1(f1 INT NOT NULL AUTO_INCREMENT,
|
||||
f2 INT NOT NULL, PRIMARY KEY(f1))ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES(1, 2), (25, 3), (2, 4);
|
||||
# restart
|
||||
INSERT INTO t1(f2) VALUES(5);
|
||||
SELECT max(f1) FROM t1;
|
||||
max(f1)
|
||||
26
|
||||
DROP TABLE t1;
|
||||
# End of 10.9 tests
|
||||
|
@@ -41,3 +41,17 @@ DROP DATABASE db1;
|
||||
--echo #
|
||||
--echo # End of 10.6 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-30796 Auto_increment values not updated after bulk
|
||||
--echo # insert operation
|
||||
--echo #
|
||||
CREATE TABLE t1(f1 INT NOT NULL AUTO_INCREMENT,
|
||||
f2 INT NOT NULL, PRIMARY KEY(f1))ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES(1, 2), (25, 3), (2, 4);
|
||||
--source include/restart_mysqld.inc
|
||||
INSERT INTO t1(f2) VALUES(5);
|
||||
SELECT max(f1) FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo # End of 10.9 tests
|
||||
|
@@ -5336,6 +5336,8 @@ dberr_t row_merge_bulk_t::write_to_index(ulint index_no, trx_t *trx)
|
||||
func_exit:
|
||||
if (err != DB_SUCCESS)
|
||||
trx->error_info= index;
|
||||
else if (index->is_primary() && table->persistent_autoinc)
|
||||
btr_write_autoinc(index, table->autoinc);
|
||||
err= btr_bulk.finish(err);
|
||||
return err;
|
||||
}
|
||||
|
Reference in New Issue
Block a user