Skip to content

Commit

Permalink
Merge pull request #839 from minggr/fix-auto-inc
Browse files Browse the repository at this point in the history
MDEV-16703: update AUTO_INCREMENT in the UPDATE statement
  • Loading branch information
spetrunia committed Aug 24, 2018
2 parents 9c5a038 + f715424 commit 7f73f5e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion storage/rocksdb/ha_rocksdb.cc
Expand Up @@ -9553,7 +9553,7 @@ int ha_rocksdb::update_pk(const Rdb_key_def &kd,
}
}

if (table->next_number_field) {
if (table->found_next_number_field) {
update_auto_incr_val_from_field();
}

Expand Down
8 changes: 8 additions & 0 deletions storage/rocksdb/mysql-test/rocksdb/r/autoinc_vars.result
Expand Up @@ -150,3 +150,11 @@ CREATE TABLE t0(c0 BLOB) ENGINE=ROCKSDB;
INSERT INTO t0 VALUES(0);
ALTER TABLE t0 AUTO_INCREMENT=0;
DROP TABLE t0;
#---------------------------------------------------------------
# MDEV-16703 Assertion failed in load_auto_incr_value_from_index
#---------------------------------------------------------------
CREATE TABLE t1 (pk INT AUTO_INCREMENT, a INT, PRIMARY KEY(pk)) ENGINE=RocksDB;
INSERT INTO t1 (a) VALUES (1);
UPDATE t1 SET pk = 3;
ALTER TABLE t1 AUTO_INCREMENT 2;
DROP TABLE t1;
10 changes: 10 additions & 0 deletions storage/rocksdb/mysql-test/rocksdb/t/autoinc_vars.test
Expand Up @@ -116,3 +116,13 @@ CREATE TABLE t0(c0 BLOB) ENGINE=ROCKSDB;
INSERT INTO t0 VALUES(0);
ALTER TABLE t0 AUTO_INCREMENT=0;
DROP TABLE t0;

--echo #---------------------------------------------------------------
--echo # MDEV-16703 Assertion failed in load_auto_incr_value_from_index
--echo #---------------------------------------------------------------

CREATE TABLE t1 (pk INT AUTO_INCREMENT, a INT, PRIMARY KEY(pk)) ENGINE=RocksDB;
INSERT INTO t1 (a) VALUES (1);
UPDATE t1 SET pk = 3;
ALTER TABLE t1 AUTO_INCREMENT 2;
DROP TABLE t1;

0 comments on commit 7f73f5e

Please sign in to comment.