MDEV-18486 Database crash on a table with indexed virtual column
don't do anything special for stored generated columns in MyISAM repair code. add an assert that if there are virtual indexed columns, they _must_ be beyond the file->s->base.reclength boundary
This commit is contained in:
parent
6793736009
commit
4ca2079142
@ -375,3 +375,11 @@ repair table t1 extended;
|
|||||||
Table Op Msg_type Msg_text
|
Table Op Msg_type Msg_text
|
||||||
test.t1 repair status OK
|
test.t1 repair status OK
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
create table t1 ( id int primary key,
|
||||||
|
hexid varchar(10) generated always as (hex(id)) stored,
|
||||||
|
key (hexid)) engine=myisam;
|
||||||
|
insert into t1 (id) select 100;
|
||||||
|
select * from t1;
|
||||||
|
id hexid
|
||||||
|
100 64
|
||||||
|
drop table t1;
|
||||||
|
@ -262,3 +262,13 @@ create table t1 (
|
|||||||
insert into t1 values (null, 0);
|
insert into t1 values (null, 0);
|
||||||
repair table t1 extended;
|
repair table t1 extended;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# MDEV-18486 Database crash on a table with indexed virtual column
|
||||||
|
#
|
||||||
|
create table t1 ( id int primary key,
|
||||||
|
hexid varchar(10) generated always as (hex(id)) stored,
|
||||||
|
key (hexid)) engine=myisam;
|
||||||
|
insert into t1 (id) select 100;
|
||||||
|
select * from t1;
|
||||||
|
drop table t1;
|
||||||
|
@ -933,15 +933,19 @@ void ha_myisam::setup_vcols_for_repair(HA_CHECK *param)
|
|||||||
bool indexed_vcols= false;
|
bool indexed_vcols= false;
|
||||||
ulong new_vreclength= file->s->vreclength;
|
ulong new_vreclength= file->s->vreclength;
|
||||||
for (Field **vf= table->vfield; *vf; vf++)
|
for (Field **vf= table->vfield; *vf; vf++)
|
||||||
|
{
|
||||||
|
if (!(*vf)->stored_in_db())
|
||||||
{
|
{
|
||||||
uint vf_end= (*vf)->offset(table->record[0]) + (*vf)->pack_length_in_rec();
|
uint vf_end= (*vf)->offset(table->record[0]) + (*vf)->pack_length_in_rec();
|
||||||
set_if_bigger(new_vreclength, vf_end);
|
set_if_bigger(new_vreclength, vf_end);
|
||||||
indexed_vcols|= (*vf)->flags & PART_KEY_FLAG;
|
indexed_vcols|= (*vf)->flags & PART_KEY_FLAG;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (!indexed_vcols)
|
if (!indexed_vcols)
|
||||||
return;
|
return;
|
||||||
file->s->vreclength= new_vreclength;
|
file->s->vreclength= new_vreclength;
|
||||||
}
|
}
|
||||||
|
DBUG_ASSERT(file->s->base.reclength < file->s->vreclength);
|
||||||
param->fix_record= compute_vcols;
|
param->fix_record= compute_vcols;
|
||||||
table->use_all_columns();
|
table->use_all_columns();
|
||||||
table->vcol_set= &table->s->all_set;
|
table->vcol_set= &table->s->all_set;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user