1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

When one does 'REPAIR TABLE', update uuid() to the current system

mysql-test/suite/maria/maria-autozerofill.result:
  Updated result
mysql-test/suite/maria/maria-autozerofill.test:
  Added test that zerofilled table should not give any warnings when table is used
mysql-test/suite/maria/maria-recovery2.result:
  More tests to make it easier to find bugs
mysql-test/suite/maria/maria-recovery2.test:
  More tests to make it easier to find bugs
storage/maria/ha_maria.cc:
  Set create_trid after repair (needed if table was moved from another system)
  Set uuid after repair (needed if table was moved from another system)
storage/maria/maria_chk.c:
  Reset share->state.create_trid if we reset share->state.create_rename_lsn.
  Make the table moveable
This commit is contained in:
Michael Widenius
2013-05-14 18:32:16 +03:00
parent 97463576ad
commit d0265a632f
6 changed files with 51 additions and 7 deletions

View File

@ -12,6 +12,8 @@ create table t4 (a int) engine=aria;
INSERT INTO t4 VALUES (1),(2);
create table t5 (a int) engine=aria;
INSERT INTO t5 VALUES (1),(2);
create table t6 (a int) engine=aria;
INSERT INTO t6 VALUES (1),(2);
flush tables;
create_rename_lsn has non-magic value
* shut down mysqld, removed logs, restarted it
@ -25,6 +27,10 @@ Status: changed,sorted index pages,zerofilled
insert into t1 values(2);
flush table t1;
create_rename_lsn has non-magic value
#
# BUG#44422 "mysql_upgrade destroys Maria tables?"
# Check repair and optimize of moved table
#
check table t2;
Table Op Msg_type Msg_text
mysqltest.t2 check error Table is from another system and must be zerofilled or repaired to be usable on this system
@ -59,4 +65,11 @@ mysqltest.t5 repair status OK
check table t5;
Table Op Msg_type Msg_text
mysqltest.t5 check status OK
select * from t6;
a
1
2
check table t6;
Table Op Msg_type Msg_text
mysqltest.t6 check status OK
drop database mysqltest;

View File

@ -33,11 +33,13 @@ create table t4 (a int) engine=aria;
INSERT INTO t4 VALUES (1),(2);
create table t5 (a int) engine=aria;
INSERT INTO t5 VALUES (1),(2);
create table t6 (a int) engine=aria;
INSERT INTO t6 VALUES (1),(2);
flush tables;
# Check that table is not zerofilled, not movable
let $MYSQLD_DATADIR= `select @@datadir`;
--exec $MARIA_CHK -dv $MYSQLD_DATADIR/mysqltest/t1 >$MYSQLTEST_VARDIR/tmp/ariachk.txt
--exec $MARIA_CHK -dv --ignore-control-file $MYSQLD_DATADIR/mysqltest/t1 >$MYSQLTEST_VARDIR/tmp/ariachk.txt
perl;
use strict;
use warnings;
@ -62,7 +64,7 @@ enable_ps_protocol;
flush table t1;
# Check that table is auto-zerofilled, movable
--exec $MARIA_CHK -dv $MYSQLD_DATADIR/mysqltest/t1 >$MYSQLTEST_VARDIR/tmp/ariachk.txt
--exec $MARIA_CHK -dv --ignore-control-file $MYSQLD_DATADIR/mysqltest/t1 >$MYSQLTEST_VARDIR/tmp/ariachk.txt
perl;
use strict;
use warnings;
@ -79,7 +81,7 @@ insert into t1 values(2);
flush table t1;
# Check that table is not zerofilled, not movable
--exec $MARIA_CHK -dv $MYSQLD_DATADIR/mysqltest/t1 >$MYSQLTEST_VARDIR/tmp/ariachk.txt
--exec $MARIA_CHK -dv --ignore-control-file $MYSQLD_DATADIR/mysqltest/t1 >$MYSQLTEST_VARDIR/tmp/ariachk.txt
perl;
use strict;
use warnings;
@ -91,10 +93,13 @@ perl;
close FILE;
EOF
#
# BUG#44422 "mysql_upgrade destroys Maria tables?"
# Check repair and optimize of moved table
#
--echo #
--echo # BUG#44422 "mysql_upgrade destroys Maria tables?"
--echo # Check repair and optimize of moved table
--echo #
# Table t2 is regarded as it would be from another server as we removed
# the aria control file earlier
check table t2;
check table t2;
repair table t2;
@ -108,4 +113,10 @@ check table t5;
repair table t5;
check table t5;
# Check that if we zerofill with aria_chk, we should not get any warnings when
# accessing the table
--exec $MARIA_CHK --zerofill $MYSQLD_DATADIR/mysqltest/t6 >$MYSQLTEST_VARDIR/tmp/ariachk.txt
select * from t6;
check table t6;
drop database mysqltest;

View File

@ -107,6 +107,9 @@ flush table t1;
* copied t1 for comparison
lock tables t1 write, t2 read;
delete from t1 limit 1;
select count(*) from t1;
count(*)
0
insert into t1 select * from t2;
SET SESSION debug_dbug="+d,maria_flush_whole_log,maria_flush_whole_page_cache,maria_crash";
* crashing mysqld intentionally
@ -123,6 +126,9 @@ use mysqltest;
show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 a 1 a A 1 NULL NULL YES BTREE
select count(*) from t1;
count(*)
1
drop table t1;
* TEST of recovery when OPTIMIZE has replaced the index file and crash
create table t_corrupted1 (a varchar(100), key(a)) engine=aria;

View File

@ -130,9 +130,11 @@ insert into t1 values(30);
lock tables t1 write, t2 read;
delete from t1 limit 1;
# 127 rows in t2, >100, so this will use repair-at-end
select count(*) from t1;
insert into t1 select * from t2;
-- source include/maria_verify_recovery.inc
show keys from t1; # should be enabled
select count(*) from t1;
drop table t1;
--echo * TEST of recovery when OPTIMIZE has replaced the index file and crash