Commit fb978872 authored by Marko Mäkelä's avatar Marko Mäkelä

btr_cur_instant_init_low(): Always initialize index->n_core_fields

parent 959ff093
...@@ -151,45 +151,6 @@ f3 f6 ...@@ -151,45 +151,6 @@ f3 f6
drop table t1; drop table t1;
create table t1(f1 int, f2 int not null) engine=innodb; create table t1(f1 int, f2 int not null) engine=innodb;
insert into t1(f1, f2) values(1, 2); insert into t1(f1, f2) values(1, 2);
select * from information_schema.innodb_sys_columns;
TABLE_ID NAME POS MTYPE PRTYPE LEN
11 ID 0 1 524292 0
11 FOR_NAME 1 1 524292 0
11 REF_NAME 2 1 524292 0
11 N_COLS 3 6 0 4
12 ID 0 1 524292 0
12 POS 1 6 0 4
12 FOR_COL_NAME 2 1 524292 0
12 REF_COL_NAME 3 1 524292 0
13 SPACE 0 6 0 4
13 NAME 1 1 524292 0
13 FLAGS 2 6 0 4
14 SPACE 0 6 0 4
14 PATH 1 1 524292 0
15 TABLE_ID 0 6 0 8
15 POS 1 6 0 4
15 BASE_POS 2 6 0 4
16 database_name 0 12 5439759 192
16 table_name 1 12 5439759 192
16 last_update 2 3 526087 4
16 n_rows 3 6 1800 8
16 clustered_index_size 4 6 1800 8
16 sum_of_other_index_sizes 5 6 1800 8
17 database_name 0 12 5439759 192
17 table_name 1 12 5439759 192
17 index_name 2 12 5439759 192
17 last_update 3 3 526087 4
17 stat_name 4 12 5439759 192
17 stat_value 5 6 1800 8
17 sample_size 6 6 1544 8
17 stat_description 7 12 5443855 3072
18 transaction_id 0 6 1800 8
18 commit_id 1 6 1800 8
18 begin_timestamp 2 3 526087 7
18 commit_timestamp 3 3 526087 7
18 isolation_level 4 6 1022 1
26 f1 0 6 1027 4
26 f2 1 6 1283 4
alter table t1 drop column f2, add column f4 varchar(100) default repeat('a', 20), add column f5 int default 10, algorithm=instant; alter table t1 drop column f2, add column f4 varchar(100) default repeat('a', 20), add column f5 int default 10, algorithm=instant;
select * from t1; select * from t1;
f1 f4 f5 f1 f4 f5
......
...@@ -76,7 +76,6 @@ drop table t1; ...@@ -76,7 +76,6 @@ drop table t1;
create table t1(f1 int, f2 int not null) engine=innodb; create table t1(f1 int, f2 int not null) engine=innodb;
insert into t1(f1, f2) values(1, 2); insert into t1(f1, f2) values(1, 2);
select * from information_schema.innodb_sys_columns;
alter table t1 drop column f2, add column f4 varchar(100) default repeat('a', 20), add column f5 int default 10, algorithm=instant; alter table t1 drop column f2, add column f4 varchar(100) default repeat('a', 20), add column f5 int default 10, algorithm=instant;
select * from t1; select * from t1;
show create table t1; show create table t1;
......
...@@ -392,9 +392,7 @@ when loading a table definition. ...@@ -392,9 +392,7 @@ when loading a table definition.
@return error code @return error code
@retval DB_SUCCESS if no error occurred @retval DB_SUCCESS if no error occurred
@retval DB_CORRUPTION if any corruption was noticed */ @retval DB_CORRUPTION if any corruption was noticed */
static static dberr_t btr_cur_instant_init_low(dict_index_t* index, mtr_t* mtr)
dberr_t
btr_cur_instant_init_low(dict_index_t* index, mtr_t* mtr)
{ {
ut_ad(index->is_primary()); ut_ad(index->is_primary());
ut_ad(index->n_core_null_bytes == dict_index_t::NO_CORE_NULL_BYTES); ut_ad(index->n_core_null_bytes == dict_index_t::NO_CORE_NULL_BYTES);
...@@ -655,6 +653,11 @@ btr_cur_instant_root_init(dict_index_t* index, const page_t* page) ...@@ -655,6 +653,11 @@ btr_cur_instant_root_init(dict_index_t* index, const page_t* page)
return true; return true;
} }
if (n > REC_MAX_N_FIELDS) {
return true;
}
index->n_core_fields = n;
const rec_t* infimum = page_get_infimum_rec(page); const rec_t* infimum = page_get_infimum_rec(page);
const rec_t* supremum = page_get_supremum_rec(page); const rec_t* supremum = page_get_supremum_rec(page);
...@@ -667,7 +670,6 @@ btr_cur_instant_root_init(dict_index_t* index, const page_t* page) ...@@ -667,7 +670,6 @@ btr_cur_instant_root_init(dict_index_t* index, const page_t* page)
return true; return true;
} }
index->n_core_fields = n;
ut_ad(!index->is_dummy); ut_ad(!index->is_dummy);
ut_d(index->is_dummy = true); ut_d(index->is_dummy = true);
index->n_core_null_bytes = UT_BITS_IN_BYTES( index->n_core_null_bytes = UT_BITS_IN_BYTES(
......
...@@ -1583,7 +1583,7 @@ bool dict_table_t::deserialise_columns(const byte* metadata, ulint len) ...@@ -1583,7 +1583,7 @@ bool dict_table_t::deserialise_columns(const byte* metadata, ulint len)
unsigned num_non_pk_fields = mach_read_from_4(metadata); unsigned num_non_pk_fields = mach_read_from_4(metadata);
metadata += 4; metadata += 4;
if (num_non_pk_fields >= REC_MAX_N_FIELDS) { if (num_non_pk_fields >= REC_MAX_N_FIELDS - 3) {
return true; return true;
} }
......
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