mirror of
https://github.com/MariaDB/server.git
synced 2025-01-30 10:31:54 +01:00
XtraDB/InnoDB crash with autoinc, vcol and online alter
Fix the doubly questional fix for MySQL Bug#17250787: * it detected autoinc index by looking for the first index that starts from autoinc column. never mind one column can be part of many indexes. * it used autoinc_field->field_index to look up into internal innodb dictionary. But field_index accounts for virtual columns too, while innodb dictionary ignores them. Find the index by its name, like elsewhere in ha_innobase.
This commit is contained in:
parent
2c79f57530
commit
1fc6e297f2
4 changed files with 33 additions and 4 deletions
16
mysql-test/suite/vcol/r/innodb_autoinc_vcol.result
Normal file
16
mysql-test/suite/vcol/r/innodb_autoinc_vcol.result
Normal file
|
@ -0,0 +1,16 @@
|
|||
create table t1 (c2 int as (-c1), c1 int primary key auto_increment) engine=innodb;
|
||||
insert into t1(c1) values (null),(null),(null);
|
||||
select * from t1;
|
||||
c2 c1
|
||||
-1 1
|
||||
-2 2
|
||||
-3 3
|
||||
alter table t1 auto_increment = 3;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c2` int(11) AS (-c1) VIRTUAL,
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
9
mysql-test/suite/vcol/t/innodb_autoinc_vcol.test
Normal file
9
mysql-test/suite/vcol/t/innodb_autoinc_vcol.test
Normal file
|
@ -0,0 +1,9 @@
|
|||
--source include/have_innodb.inc
|
||||
|
||||
create table t1 (c2 int as (-c1), c1 int primary key auto_increment) engine=innodb;
|
||||
insert into t1(c1) values (null),(null),(null);
|
||||
select * from t1;
|
||||
alter table t1 auto_increment = 3;
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
|
|
@ -4736,9 +4736,11 @@ commit_get_autoinc(
|
|||
|
||||
Field* autoinc_field =
|
||||
old_table->found_next_number_field;
|
||||
KEY* autoinc_key =
|
||||
old_table->key_info + old_table->s->next_number_index;
|
||||
|
||||
dict_index_t* index = dict_table_get_index_on_first_col(
|
||||
ctx->old_table, autoinc_field->field_index);
|
||||
dict_index_t* index = dict_table_get_index_on_name(
|
||||
ctx->old_table, autoinc_key->name);
|
||||
|
||||
max_autoinc = ha_alter_info->create_info->auto_increment_value;
|
||||
|
||||
|
|
|
@ -4743,9 +4743,11 @@ commit_get_autoinc(
|
|||
|
||||
Field* autoinc_field =
|
||||
old_table->found_next_number_field;
|
||||
KEY* autoinc_key =
|
||||
old_table->key_info + old_table->s->next_number_index;
|
||||
|
||||
dict_index_t* index = dict_table_get_index_on_first_col(
|
||||
ctx->old_table, autoinc_field->field_index);
|
||||
dict_index_t* index = dict_table_get_index_on_name(
|
||||
ctx->old_table, autoinc_key->name);
|
||||
|
||||
max_autoinc = ha_alter_info->create_info->auto_increment_value;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue