1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-6245 Certain compressed tables with myisampack are corrupted by "CHECK TABLE"

- Fixed bug that we where using wrong checksum algorithm when using VARCHAR with fixed lenth rows
- Ensure in myisampack that HA_OPTION_NULL_FIELDS is set for tables with null fields.

mysql-test/r/myisampack.result:
  Updated results
mysql-test/t/myisampack.test:
  Added more tests
storage/myisam/mi_open.c:
  Use correct checksum algorithm when we have VARCHAR fields with fixed length records
storage/myisam/myisampack.c:
  Ensure HA_OPTION_NULL_FIELDS is set for tables with null fields.
  (This was not set by default for not compressed tables without checksums to keep MyISAM tables compatible with MySQL)
This commit is contained in:
Michael Widenius
2014-05-17 10:42:59 +03:00
parent f6524e4963
commit a55c159424
4 changed files with 113 additions and 6 deletions

View File

@ -150,3 +150,57 @@ CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
create table `t1` (`id` varchar(15) DEFAULT NULL) ENGINE=MyISAM ROW_FORMAT=FIXED;
insert into t1 values ('aaa'),('bbb'),('ccc'),('ddd'),('eee');
insert into t1 (select * from t1);
insert into t1 (select * from t1);
insert into t1 (select * from t1);
insert into t1 (select * from t1);
checksum table t1;
Table Checksum
test.t1 2696656816
insert into t1 values(NULL);
checksum table t1;
Table Checksum
test.t1 2679879600
flush table t1;
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
checksum table t1;
Table Checksum
test.t1 2679879600
alter table t1 checksum=1 row_format=fixed;
checksum table t1;
Table Checksum
test.t1 2679879600
flush table t1;
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
checksum table t1;
Table Checksum
test.t1 2679879600
alter table t1 row_format=dynamic checksum=0;
checksum table t1;
Table Checksum
test.t1 2330021136
flush table t1;
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
checksum table t1;
Table Checksum
test.t1 2330021136
alter table t1 checksum=1 row_format=dynamic;
checksum table t1;
Table Checksum
test.t1 2330021136
flush table t1;
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
checksum table t1;
Table Checksum
test.t1 2330021136
drop table t1;

View File

@ -267,3 +267,50 @@ FLUSH TABLE t1;
--exec $MYISAMCHK -soq $MYSQLD_DATADIR/test/t1
CHECK TABLE t1;
DROP TABLE t1;
#
# MDEV-6245 Certain compressed tables with myisampack are corrupted by
# "CHECK TABLE"
#
# Issue was that checksum failed for tables with NULL and VARCHAR fields
#
create table `t1` (`id` varchar(15) DEFAULT NULL) ENGINE=MyISAM ROW_FORMAT=FIXED;
insert into t1 values ('aaa'),('bbb'),('ccc'),('ddd'),('eee');
insert into t1 (select * from t1);
insert into t1 (select * from t1);
insert into t1 (select * from t1);
insert into t1 (select * from t1);
checksum table t1;
insert into t1 values(NULL);
checksum table t1;
flush table t1;
--exec $MYISAMPACK -sf $MYSQLD_DATADIR/test/t1
--exec $MYISAMCHK -srnq $MYSQLD_DATADIR/test/t1
check table t1;
checksum table t1;
alter table t1 checksum=1 row_format=fixed;
checksum table t1;
flush table t1;
--exec $MYISAMPACK -sf $MYSQLD_DATADIR/test/t1
--exec $MYISAMCHK -srnq $MYSQLD_DATADIR/test/t1
check table t1;
checksum table t1;
# Testing with row_format=dynamic
alter table t1 row_format=dynamic checksum=0;
checksum table t1;
flush table t1;
--exec $MYISAMPACK -sf $MYSQLD_DATADIR/test/t1
--exec $MYISAMCHK -srnq $MYSQLD_DATADIR/test/t1
check table t1;
checksum table t1;
alter table t1 checksum=1 row_format=dynamic;
checksum table t1;
flush table t1;
--exec $MYISAMPACK -sf $MYSQLD_DATADIR/test/t1
--exec $MYISAMCHK -srnq $MYSQLD_DATADIR/test/t1
check table t1;
checksum table t1;
drop table t1;