Skip to content

Commit

Permalink
MDEV-11750 Assertion `vfield' failed in TABLE::update_virtual_fields …
Browse files Browse the repository at this point in the history
…after crash recovery on corrupted MyISAM table

Adjust the length of the BIT field
(same as in _mi_put_key_in_record())
  • Loading branch information
vuvova committed Feb 13, 2017
1 parent 29ed440 commit b6a3917
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
10 changes: 10 additions & 0 deletions mysql-test/suite/vcol/r/vcol_keys_myisam.result
Original file line number Diff line number Diff line change
Expand Up @@ -365,3 +365,13 @@ ALTER TABLE t1 ADD INDEX(col_enum,vcol_int);
SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
ALTER TABLE t1 ADD INDEX(col_year);
DROP TABLE t1;
create table t1 (
pk int primary key auto_increment,
b bit default null,
key(b)
) engine=myisam;
insert into t1 values (null, 0);
repair table t1 extended;
Table Op Msg_type Msg_text
test.t1 repair status OK
drop table t1;
13 changes: 13 additions & 0 deletions mysql-test/suite/vcol/t/vcol_keys_myisam.test
Original file line number Diff line number Diff line change
Expand Up @@ -249,3 +249,16 @@ SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
ALTER TABLE t1 ADD INDEX(col_year);
--enable_warnings
DROP TABLE t1;

#
# MDEV-11750 Assertion `vfield' failed in TABLE::update_virtual_fields after crash recovery on corrupted MyISAM table
#
create table t1 (
pk int primary key auto_increment,
b bit default null,
key(b)
) engine=myisam;

insert into t1 values (null, 0);
repair table t1 extended;
drop table t1;
2 changes: 2 additions & 0 deletions storage/myisam/mi_open.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,8 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
{
uint real_length= pos->flag & HA_BLOB_PART ? pos->bit_start
: pos->length;
if (pos->type == HA_KEYTYPE_BIT && pos->bit_length)
real_length--;
set_if_bigger(share->vreclength, pos->start + real_length);
}
}
Expand Down

0 comments on commit b6a3917

Please sign in to comment.