summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorGuilhem Bichot <guilhem@mysql.com>2008-06-02 22:53:25 +0200
committerGuilhem Bichot <guilhem@mysql.com>2008-06-02 22:53:25 +0200
commita5bcb63f45f58f7c5f4f2387da521aa7a14b60be (patch)
tree7eaa8ccde458e0c059e01272c49894176fd01dba /mysql-test
parent2d64cd05e1b9cd3b76368af7db34335b88bea248 (diff)
downloadmariadb-git-a5bcb63f45f58f7c5f4f2387da521aa7a14b60be.tar.gz
WL#4374 "Maria - force start if Recovery fails multiple times"
http://forge.mysql.com/worklog/task.php?id=4374 new option --maria-force-start-after-recovery-failures=N; number of consecutive recovery failures (failures of log reading or recovery processing, anything in [translog_init(),maria_recovery_from_log()]) is stored in the control file; if at a Maria start they are more than N, logs are removed. This is for automated systems which have to run whatever happens. As tables risk staying corrupted, --maria-recover should also be used on them: this revision makes maria-recover work (it was disabled). Fixed bug in translog_is_log_files(). translog_init() now prints message to error log if failed. Removed \0 in the output of SHOW ENGINE MARIA LOGS; removed hard-coded engine name there. KNOWN_BUGS.txt: As option --maria-force-start-after-recovery-failures is added, it corresponds to the wish "we should fix that if this happens etc". LOAD INDEX is not ignored since a few weeks. Listed concurrency bugs have been fixed some time ago. Recovery of fulltext and GIS indexes works since a few weeks. mysql-test/include/maria_make_snapshot.inc: configurable prefix in table's name (so far 't' or 't_corrupted') mysql-test/include/maria_make_snapshot_for_comparison.inc: configurable prefix in table's name (so far 't' or 't_corrupted') mysql-test/include/maria_make_snapshot_for_feeding_recovery.inc: configurable prefix in table's name (so far 't' or 't_corrupted') mysql-test/include/maria_verify_recovery.inc: configurable prefix in table's name (so far 't' or 't_corrupted') mysql-test/lib/mtr_report.pl: new test maria-recover.test generates expected corruption warnings in the error log. maria-recovery.test's corrupted table is renamed to t_corrupted1 instead of t1. mysql-test/r/maria-preload.result: result update. maria_pagecache_read* values are similar to the previous version of this file, though a bit bigger because using the information_schema and the join leads to some internal maria temp table being used, and thus some blocks of it being read. mysql-test/r/maria-purge.result: engine's name in SHOW ENGINE MARIA LOGS changed. mysql-test/r/maria-recover.result: result for new test. We see corruption messages at first SELECT and then none at second SELECT, expected. mysql-test/r/maria-recovery.result: result update mysql-test/r/maria.result: new variables show up mysql-test/t/disabled.def: BUG#34911 is not fixed but the test had been made independent of the bug (workaround). A new bug (crash) has popped recently, so it has to stay disabled (BUG#35107). mysql-test/t/maria-preload.test: Work around BUG#34911 "FLUSH STATUS doesn't flush what it should": compute differences in status variables before and after relevant queries mysql-test/t/maria-recover-master.opt: test --maria-recover mysql-test/t/maria-recover.test: Test of the --maria-recover option (build a corrupted table and see if it is auto-repaired) mysql-test/t/maria-recovery-big.test: update for new API of include/maria*.inc mysql-test/t/maria-recovery-bitmap.test: update for new API of include/maria*.inc mysql-test/t/maria-recovery.test: update for new API of include/maria*.inc. Corrupted table t1 renamed to t_corrupted1, so that mtr_report.pl does not blindly remove all corruption messages for t1 which is a common name. storage/maria/ha_maria.cc: Enabling maria-recover. Adding option and global variable --maria_force_start_after_recovery_failures: ha_maria_init() calls mark_recovery_start() and mark_recovery_success() to keep track of failed consecutive recoveries and remove logs if needed. Removed \0 in the output of SHOW ENGINE MARIA LOGS; removed hard-coded engine name there. storage/maria/ma_checkpoint.c: new prototype storage/maria/ma_control_file.c: Storing in one byte in the control file, the number of consecutive recovery failures. storage/maria/ma_control_file.h: new prototype storage/maria/ma_init.c: new prototype storage/maria/ma_locking.c: Need to update open_count on disk at first write and close for transactional tables, like we already did for non-transactional tables, otherwise we cannot notice that the table is dubious. storage/maria/ma_loghandler.c: translog_is_log_files() is made more generic to serve either to search or to delete logs (the latter is for --maria-force-start-after-recovery-failures). It also had a bug (always returned FALSE). storage/maria/ma_loghandler.h: export function because ha_maria::mark_recovery_start() needs it storage/maria/ma_recovery.c: changing name of maria_recover() to distinguish from the maria-recover option. storage/maria/ma_recovery.h: changing name of maria_recover() to distinguish from the maria-recover option. storage/maria/ma_test_force_start.pl: Test of --maria-force-start-after-recovery-failures (and also, to be realistic, of --maria-recover). This is standalone because mysql-test-run does not support testing that multiple mysqld restarts expectedly failed. I'll have to run it on my machine and also on a Windows machine. storage/maria/unittest/ma_control_file-t.c: adding recovery_failures to the test storage/maria/unittest/ma_test_loghandler_multigroup-t.c: fix for compiler warning (unused variable in non-debug build)
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/include/maria_make_snapshot.inc27
-rw-r--r--mysql-test/include/maria_make_snapshot_for_comparison.inc7
-rw-r--r--mysql-test/include/maria_make_snapshot_for_feeding_recovery.inc6
-rw-r--r--mysql-test/include/maria_verify_recovery.inc9
-rw-r--r--mysql-test/lib/mtr_report.pl7
-rw-r--r--mysql-test/r/maria-preload.result124
-rw-r--r--mysql-test/r/maria-purge.result28
-rw-r--r--mysql-test/r/maria-recover.result35
-rw-r--r--mysql-test/r/maria-recovery.result18
-rw-r--r--mysql-test/r/maria.result2
-rw-r--r--mysql-test/t/disabled.def2
-rw-r--r--mysql-test/t/maria-preload.test39
-rw-r--r--mysql-test/t/maria-recover-master.opt1
-rw-r--r--mysql-test/t/maria-recover.test52
-rw-r--r--mysql-test/t/maria-recovery-big.test1
-rw-r--r--mysql-test/t/maria-recovery-bitmap.test1
-rw-r--r--mysql-test/t/maria-recovery-rtree-ft.test1
-rw-r--r--mysql-test/t/maria-recovery.test15
18 files changed, 247 insertions, 128 deletions
diff --git a/mysql-test/include/maria_make_snapshot.inc b/mysql-test/include/maria_make_snapshot.inc
index b457f3e1a68..679a65552c1 100644
--- a/mysql-test/include/maria_make_snapshot.inc
+++ b/mysql-test/include/maria_make_snapshot.inc
@@ -10,28 +10,29 @@
# $mms_copy : to copy table from database to spare directory
# $mms_reverse : to copy it back
# $mms_compare_physically : to compare both byte-for-byte
-# 2) set $mms_table_to_use to a number N: table will be mysqltest.tN
+# 2) set $mms_tname to a string and set $mms_table_to_use to a number: tables
+# will be mysqltest.$mms_tname$mms_table_to_use.
# 3) set $mms_purpose to say what this copy is for (influences the naming
# of the spare directory).
if ($mms_copy)
{
- --echo * copied t$mms_table_to_use for $mms_purpose
- copy_file $MYSQLTEST_VARDIR/master-data/mysqltest/t$mms_table_to_use.MAD $MYSQLTEST_VARDIR/master-data/mysqltest_for_$mms_purpose/t$mms_table_to_use.MAD;
- copy_file $MYSQLTEST_VARDIR/master-data/mysqltest/t$mms_table_to_use.MAI $MYSQLTEST_VARDIR/master-data/mysqltest_for_$mms_purpose/t$mms_table_to_use.MAI;
- copy_file $MYSQLTEST_VARDIR/master-data/mysqltest/t$mms_table_to_use.frm $MYSQLTEST_VARDIR/master-data/mysqltest_for_$mms_purpose/t$mms_table_to_use.frm;
+ --echo * copied $mms_tname$mms_table_to_use for $mms_purpose
+ copy_file $MYSQLTEST_VARDIR/master-data/mysqltest/$mms_tname$mms_table_to_use.MAD $MYSQLTEST_VARDIR/master-data/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.MAD;
+ copy_file $MYSQLTEST_VARDIR/master-data/mysqltest/$mms_tname$mms_table_to_use.MAI $MYSQLTEST_VARDIR/master-data/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.MAI;
+ copy_file $MYSQLTEST_VARDIR/master-data/mysqltest/$mms_tname$mms_table_to_use.frm $MYSQLTEST_VARDIR/master-data/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.frm;
}
if ($mms_reverse_copy)
{
# do not call this without flushing target table first!
- --echo * copied t$mms_table_to_use back for $mms_purpose
+ --echo * copied $mms_tname$mms_table_to_use back for $mms_purpose
-- error 0,1
- remove_file $MYSQLTEST_VARDIR/master-data/mysqltest/t$mms_table_to_use.MAD;
- copy_file $MYSQLTEST_VARDIR/master-data/mysqltest_for_$mms_purpose/t$mms_table_to_use.MAD $MYSQLTEST_VARDIR/master-data/mysqltest/t$mms_table_to_use.MAD;
+ remove_file $MYSQLTEST_VARDIR/master-data/mysqltest/$mms_tname$mms_table_to_use.MAD;
+ copy_file $MYSQLTEST_VARDIR/master-data/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.MAD $MYSQLTEST_VARDIR/master-data/mysqltest/$mms_tname$mms_table_to_use.MAD;
-- error 0,1
- remove_file $MYSQLTEST_VARDIR/master-data/mysqltest/t$mms_table_to_use.MAI;
- copy_file $MYSQLTEST_VARDIR/master-data/mysqltest_for_$mms_purpose/t$mms_table_to_use.MAI $MYSQLTEST_VARDIR/master-data/mysqltest/t$mms_table_to_use.MAI;
+ remove_file $MYSQLTEST_VARDIR/master-data/mysqltest/$mms_tname$mms_table_to_use.MAI;
+ copy_file $MYSQLTEST_VARDIR/master-data/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.MAI $MYSQLTEST_VARDIR/master-data/mysqltest/$mms_tname$mms_table_to_use.MAI;
}
if ($mms_compare_physically)
@@ -41,8 +42,8 @@ if ($mms_compare_physically)
# So, do this only when testing REDO phase.
# If UNDO phase, we nevertheless compare checksums
# (see maria_verify_recovery.inc).
- --echo * compared t$mms_table_to_use to old version
- diff_files $MYSQLTEST_VARDIR/master-data/mysqltest/t$mms_table_to_use.MAD $MYSQLTEST_VARDIR/master-data/mysqltest_for_$mms_purpose/t$mms_table_to_use.MAD;
+ --echo * compared $mms_tname$mms_table_to_use to old version
+ diff_files $MYSQLTEST_VARDIR/master-data/mysqltest/$mms_tname$mms_table_to_use.MAD $MYSQLTEST_VARDIR/master-data/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.MAD;
# index file not yet recovered
-# diff_files $MYSQLTEST_VARDIR/master-data/mysqltest/t$mms_table_to_use.MAI $MYSQLTEST_VARDIR/master-data/mysqltest_for_$mms_purpose/t$mms_table_to_use.MAI;
+# diff_files $MYSQLTEST_VARDIR/master-data/mysqltest/$mms_tname$mms_table_to_use.MAI $MYSQLTEST_VARDIR/master-data/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.MAI;
}
diff --git a/mysql-test/include/maria_make_snapshot_for_comparison.inc b/mysql-test/include/maria_make_snapshot_for_comparison.inc
index 71b821b5212..cb756f60527 100644
--- a/mysql-test/include/maria_make_snapshot_for_comparison.inc
+++ b/mysql-test/include/maria_make_snapshot_for_comparison.inc
@@ -1,10 +1,11 @@
# Maria helper script
# Copies clean tables' data and index file to other directory
-# Tables are t1...t[$mms_tables]
+# Tables are $mms_tname1...$mms_tname[$mms_tables]
# They are later used as a reference to see if recovery works.
# API:
-# set $mms_tables to N, the script will cover tables mysqltest.t1,...tN
+# set $mms_tname to a string, and $mms_tables to a number N, the script will
+# cover tables mysqltest.$mms_tname1,...$mms_tnameN
connection admin;
@@ -22,7 +23,7 @@ eval create database mysqltest_for_$mms_purpose;
while ($mms_table_to_use)
{
# to serve as a reference, table must be in a clean state
- eval flush table t$mms_table_to_use;
+ eval flush table $mms_tname$mms_table_to_use;
-- source include/maria_make_snapshot.inc
dec $mms_table_to_use;
}
diff --git a/mysql-test/include/maria_make_snapshot_for_feeding_recovery.inc b/mysql-test/include/maria_make_snapshot_for_feeding_recovery.inc
index 369f5eec927..879aa3ef182 100644
--- a/mysql-test/include/maria_make_snapshot_for_feeding_recovery.inc
+++ b/mysql-test/include/maria_make_snapshot_for_feeding_recovery.inc
@@ -1,12 +1,14 @@
# Maria helper script
# Copies tables' data and index file to other directory, and control file.
-# Tables are t1...t[$mms_tables].
+# Tables are $mms_tname1...$mms_tname[$mms_tables].
# Later, mysqld is shutdown, and that snapshot is put back into the
# datadir, control file too ("flashing recovery's brain"), and recovery is let
# to run on it (see maria_verify_recovery.inc).
# API:
-# set $mms_tables to N, the script will cover tables mysqltest.t1,...tN
+# set $mms_tname to a string, and $mms_tables to a number N, the script will
+# cover tables mysqltest.$mms_tname1,...$mms_tnameN
+
connection admin;
diff --git a/mysql-test/include/maria_verify_recovery.inc b/mysql-test/include/maria_verify_recovery.inc
index 867479ba127..becdfb5df86 100644
--- a/mysql-test/include/maria_verify_recovery.inc
+++ b/mysql-test/include/maria_verify_recovery.inc
@@ -2,7 +2,8 @@
# Runs recovery, compare with expected table data.
# API:
-# 1) set $mms_tables to N, the script will cover tables mysqltest.t1,...tN
+# 1) set $mms_tname to a string, and $mms_tables to a number N, the script
+# will cover tables mysqltest.$mms_tname1,...$mms_tnameN
# 2) set $mvr_debug_option to the crash way
# 3) set $mvr_crash_statement to the statement which will trigger a crash
# 4) set $mvr_restore_old_snapshot to 1 if you want recovery to run on
@@ -77,10 +78,10 @@ let $mms_purpose=comparison;
let $mms_compare_physically=$mms_compare_physically_save;
while ($mms_table_to_use)
{
- eval check table t$mms_table_to_use extended;
+ eval check table $mms_tname$mms_table_to_use extended;
--echo * testing that checksum after recovery is as expected
- let $new_checksum=`CHECKSUM TABLE t$mms_table_to_use`;
- let $old_checksum=`CHECKSUM TABLE mysqltest_for_$mms_purpose.t$mms_table_to_use`;
+ let $new_checksum=`CHECKSUM TABLE $mms_tname$mms_table_to_use`;
+ let $old_checksum=`CHECKSUM TABLE mysqltest_for_$mms_purpose.$mms_tname$mms_table_to_use`;
# the $ text variables above are of the form "db.tablename\tchecksum",
# as db differs, we use substring().
--disable_query_log
diff --git a/mysql-test/lib/mtr_report.pl b/mysql-test/lib/mtr_report.pl
index f4ee4dc7eed..4700ae05dde 100644
--- a/mysql-test/lib/mtr_report.pl
+++ b/mysql-test/lib/mtr_report.pl
@@ -405,7 +405,12 @@ sub mtr_report_stats ($) {
# maria-recovery.test has warning about missing log file
/File '.*maria_log.000.*' not found \(Errcode: 2\)/ or
# and about marked-corrupted table
- /Table '.\/mysqltest\/t1' is crashed, skipping it. Please repair it with maria_chk -r/
+ /Table '.\/mysqltest\/t_corrupted1' is crashed, skipping it. Please repair it with maria_chk -r/ or
+ # maria-recover.test corrupts tables on purpose
+ /Checking table: '.\/mysqltest\/t_corrupted2'/ or
+ /Recovering table: '.\/mysqltest\/t_corrupted2'/ or
+ /Table '.\/mysqltest\/t_corrupted2' is marked as crashed and should be repaired/ or
+ /Incorrect key file for table '.\/mysqltest\/t_corrupted2.MAI'; try to repair it/
)
{
next; # Skip these lines
diff --git a/mysql-test/r/maria-preload.result b/mysql-test/r/maria-preload.result
index b463c1b359b..bff6e25450f 100644
--- a/mysql-test/r/maria-preload.result
+++ b/mysql-test/r/maria-preload.result
@@ -1,4 +1,7 @@
drop table if exists t1, t2;
+create temporary table initial
+select variable_name,variable_value from
+information_schema.global_status where variable_name like "Maria_pagecache_read%";
create table t1 (
a int not null auto_increment,
b char(16) not null,
@@ -46,24 +49,24 @@ count(*)
20672
flush tables;
flush status;
-show status like "maria_pagecache_read%";
-Variable_name Value
-Maria_pagecache_read_requests 211388
-Maria_pagecache_reads 115
+select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
+variable_name g.variable_value-i.variable_value
+MARIA_PAGECACHE_READ_REQUESTS 211644
+MARIA_PAGECACHE_READS 3
select count(*) from t1 where b = 'test1';
count(*)
4181
-show status like "maria_pagecache_read%";
-Variable_name Value
-Maria_pagecache_read_requests 211414
-Maria_pagecache_reads 122
+select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
+variable_name g.variable_value-i.variable_value
+MARIA_PAGECACHE_READ_REQUESTS 211926
+MARIA_PAGECACHE_READS 11
select count(*) from t1 where b = 'test1';
count(*)
4181
-show status like "maria_pagecache_read%";
-Variable_name Value
-Maria_pagecache_read_requests 211440
-Maria_pagecache_reads 122
+select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
+variable_name g.variable_value-i.variable_value
+MARIA_PAGECACHE_READ_REQUESTS 212208
+MARIA_PAGECACHE_READS 12
flush tables;
flush status;
select @@preload_buffer_size;
@@ -72,23 +75,23 @@ select @@preload_buffer_size;
load index into cache t1;
Table Op Msg_type Msg_text
test.t1 preload_keys status OK
-show status like "maria_pagecache_read%";
-Variable_name Value
-Maria_pagecache_read_requests 211511
-Maria_pagecache_reads 193
+select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
+variable_name g.variable_value-i.variable_value
+MARIA_PAGECACHE_READ_REQUESTS 212535
+MARIA_PAGECACHE_READS 84
select count(*) from t1 where b = 'test1';
count(*)
4181
-show status like "maria_pagecache_read%";
-Variable_name Value
-Maria_pagecache_read_requests 211537
-Maria_pagecache_reads 193
+select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
+variable_name g.variable_value-i.variable_value
+MARIA_PAGECACHE_READ_REQUESTS 212817
+MARIA_PAGECACHE_READS 85
flush tables;
flush status;
-show status like "maria_pagecache_read%";
-Variable_name Value
-Maria_pagecache_read_requests 211537
-Maria_pagecache_reads 193
+select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
+variable_name g.variable_value-i.variable_value
+MARIA_PAGECACHE_READ_REQUESTS 213073
+MARIA_PAGECACHE_READS 86
set session preload_buffer_size=256*1024;
select @@preload_buffer_size;
@@preload_buffer_size
@@ -96,23 +99,23 @@ select @@preload_buffer_size;
load index into cache t1 ignore leaves;
Table Op Msg_type Msg_text
test.t1 preload_keys status OK
-show status like "maria_pagecache_read%";
-Variable_name Value
-Maria_pagecache_read_requests 211608
-Maria_pagecache_reads 264
+select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
+variable_name g.variable_value-i.variable_value
+MARIA_PAGECACHE_READ_REQUESTS 213400
+MARIA_PAGECACHE_READS 158
select count(*) from t1 where b = 'test1';
count(*)
4181
-show status like "maria_pagecache_read%";
-Variable_name Value
-Maria_pagecache_read_requests 211634
-Maria_pagecache_reads 270
+select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
+variable_name g.variable_value-i.variable_value
+MARIA_PAGECACHE_READ_REQUESTS 213682
+MARIA_PAGECACHE_READS 165
flush tables;
flush status;
-show status like "maria_pagecache_read%";
-Variable_name Value
-Maria_pagecache_read_requests 211634
-Maria_pagecache_reads 270
+select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
+variable_name g.variable_value-i.variable_value
+MARIA_PAGECACHE_READ_REQUESTS 213938
+MARIA_PAGECACHE_READS 166
set session preload_buffer_size=1*1024;
select @@preload_buffer_size;
@@preload_buffer_size
@@ -121,52 +124,53 @@ load index into cache t1, t2 key (primary,b) ignore leaves;
Table Op Msg_type Msg_text
test.t1 preload_keys status OK
test.t2 preload_keys status OK
-show status like "maria_pagecache_read%";
-Variable_name Value
-Maria_pagecache_read_requests 211748
-Maria_pagecache_reads 384
+select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
+variable_name g.variable_value-i.variable_value
+MARIA_PAGECACHE_READ_REQUESTS 214308
+MARIA_PAGECACHE_READS 281
select count(*) from t1 where b = 'test1';
count(*)
4181
select count(*) from t2 where b = 'test1';
count(*)
2584
-show status like "maria_pagecache_read%";
-Variable_name Value
-Maria_pagecache_read_requests 211788
-Maria_pagecache_reads 387
+select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
+variable_name g.variable_value-i.variable_value
+MARIA_PAGECACHE_READ_REQUESTS 214604
+MARIA_PAGECACHE_READS 285
flush tables;
flush status;
-show status like "maria_pagecache_read%";
-Variable_name Value
-Maria_pagecache_read_requests 211788
-Maria_pagecache_reads 387
+select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
+variable_name g.variable_value-i.variable_value
+MARIA_PAGECACHE_READ_REQUESTS 214860
+MARIA_PAGECACHE_READS 286
load index into cache t3, t2 key (primary,b) ;
Table Op Msg_type Msg_text
test.t3 preload_keys Error Table 'test.t3' doesn't exist
test.t3 preload_keys error Corrupt
test.t2 preload_keys status OK
-show status like "maria_pagecache_read%";
-Variable_name Value
-Maria_pagecache_read_requests 211831
-Maria_pagecache_reads 430
+select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
+variable_name g.variable_value-i.variable_value
+MARIA_PAGECACHE_READ_REQUESTS 215159
+MARIA_PAGECACHE_READS 330
flush tables;
flush status;
-show status like "maria_pagecache_read%";
-Variable_name Value
-Maria_pagecache_read_requests 211831
-Maria_pagecache_reads 430
+select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
+variable_name g.variable_value-i.variable_value
+MARIA_PAGECACHE_READ_REQUESTS 215415
+MARIA_PAGECACHE_READS 331
load index into cache t3 key (b), t2 key (c) ;
Table Op Msg_type Msg_text
test.t3 preload_keys Error Table 'test.t3' doesn't exist
test.t3 preload_keys error Corrupt
test.t2 preload_keys Error Key 'c' doesn't exist in table 't2'
test.t2 preload_keys status Operation failed
-show status like "maria_pagecache_read%";
-Variable_name Value
-Maria_pagecache_read_requests 211831
-Maria_pagecache_reads 430
+select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
+variable_name g.variable_value-i.variable_value
+MARIA_PAGECACHE_READ_REQUESTS 215671
+MARIA_PAGECACHE_READS 332
drop table t1, t2;
+drop temporary table initial;
show status like "key_read%";
Variable_name Value
Key_read_requests 0
diff --git a/mysql-test/r/maria-purge.result b/mysql-test/r/maria-purge.result
index 2ebfabaf074..8155bc6ef2a 100644
--- a/mysql-test/r/maria-purge.result
+++ b/mysql-test/r/maria-purge.result
@@ -37,13 +37,13 @@ set global maria_log_file_size=16777216;
set global maria_checkpoint_interval=30;
SHOW ENGINE maria logs;
Type Name Status
-maria master-data/maria_log.00000002 in use
+MARIA master-data/maria_log.00000002 in use
insert into t2 select * from t1;
insert into t1 select * from t2;
set global maria_checkpoint_interval=30;
SHOW ENGINE maria logs;
Type Name Status
-maria master-data/maria_log.00000004 in use
+MARIA master-data/maria_log.00000004 in use
set global maria_log_file_size=16777216;
select @@global.maria_log_file_size;
@@global.maria_log_file_size
@@ -51,7 +51,7 @@ select @@global.maria_log_file_size;
set global maria_checkpoint_interval=30;
SHOW ENGINE maria logs;
Type Name Status
-maria master-data/maria_log.00000004 in use
+MARIA master-data/maria_log.00000004 in use
set global maria_log_file_size=8388608;
select @@global.maria_log_file_size;
@@global.maria_log_file_size
@@ -61,32 +61,32 @@ insert into t1 select * from t2;
set global maria_checkpoint_interval=30;
SHOW ENGINE maria logs;
Type Name Status
-maria master-data/maria_log.00000004 free
-maria master-data/maria_log.00000005 free
-maria master-data/maria_log.00000006 free
-maria master-data/maria_log.00000007 free
-maria master-data/maria_log.00000008 in use
+MARIA master-data/maria_log.00000004 free
+MARIA master-data/maria_log.00000005 free
+MARIA master-data/maria_log.00000006 free
+MARIA master-data/maria_log.00000007 free
+MARIA master-data/maria_log.00000008 in use
flush logs;
SHOW ENGINE maria logs;
Type Name Status
-maria master-data/maria_log.00000008 in use
+MARIA master-data/maria_log.00000008 in use
set global maria_log_file_size=16777216;
set global maria_log_purge_type=external;
insert into t1 select * from t2;
set global maria_checkpoint_interval=30;
SHOW ENGINE maria logs;
Type Name Status
-maria master-data/maria_log.00000008 free
-maria master-data/maria_log.00000009 in use
+MARIA master-data/maria_log.00000008 free
+MARIA master-data/maria_log.00000009 in use
flush logs;
SHOW ENGINE maria logs;
Type Name Status
-maria master-data/maria_log.00000008 free
-maria master-data/maria_log.00000009 in use
+MARIA master-data/maria_log.00000008 free
+MARIA master-data/maria_log.00000009 in use
set global maria_log_purge_type=immediate;
insert into t1 select * from t2;
set global maria_checkpoint_interval=30;
SHOW ENGINE maria logs;
Type Name Status
-maria master-data/maria_log.00000011 in use
+MARIA master-data/maria_log.00000011 in use
drop table t1, t2;
diff --git a/mysql-test/r/maria-recover.result b/mysql-test/r/maria-recover.result
new file mode 100644
index 00000000000..9e0908b478a
--- /dev/null
+++ b/mysql-test/r/maria-recover.result
@@ -0,0 +1,35 @@
+select @@global.maria_recover;
+@@global.maria_recover
+BACKUP
+set global maria_recover=off;
+select @@global.maria_recover;
+@@global.maria_recover
+OFF
+set global maria_recover=default;
+select @@global.maria_recover;
+@@global.maria_recover
+OFF
+set global maria_recover=normal;
+select @@global.maria_recover;
+@@global.maria_recover
+NORMAL
+drop database if exists mysqltest;
+create database mysqltest;
+use mysqltest;
+create table t1 (a varchar(1000), index(a)) engine=maria;
+insert into t1 values("ThursdayMorningsMarket");
+flush table t1;
+insert into t1 select concat(a,'b') from t1 limit 1;
+select * from t_corrupted2;
+a
+ThursdayMorningsMarket
+Warnings:
+Error 145 Table './mysqltest/t_corrupted2' is marked as crashed and should be repaired
+Error 1194 Table 't_corrupted2' is marked as crashed and should be repaired
+Error 1034 1 client is using or hasn't closed the table properly
+Error 126 Incorrect key file for table './mysqltest/t_corrupted2.MAI'; try to repair it
+Error 1034 Wrong base information on indexpage at page: 1
+select * from t_corrupted2;
+a
+ThursdayMorningsMarket
+drop database mysqltest;
diff --git a/mysql-test/r/maria-recovery.result b/mysql-test/r/maria-recovery.result
index cfdaf4fb068..c137b2090b7 100644
--- a/mysql-test/r/maria-recovery.result
+++ b/mysql-test/r/maria-recovery.result
@@ -362,24 +362,24 @@ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_par
t1 1 a 1 a A 1 NULL NULL YES BTREE
drop table t1;
* TEST of recovery when OPTIMIZE has replaced the index file and crash
-create table t1 (a varchar(100), key(a)) engine=maria;
-insert into t1 select (rand()) from t2;
-flush table t1;
-* copied t1 for comparison
+create table t_corrupted1 (a varchar(100), key(a)) engine=maria;
+insert into t_corrupted1 select (rand()) from t2;
+flush table t_corrupted1;
+* copied t_corrupted1 for comparison
SET SESSION debug="+d,maria_flush_whole_log,maria_flush_whole_page_cache,maria_crash_sort_index";
* crashing mysqld intentionally
-optimize table t1;
+optimize table t_corrupted1;
ERROR HY000: Lost connection to MySQL server during query
* recovery happens
-check table t1 extended;
+check table t_corrupted1 extended;
Table Op Msg_type Msg_text
-mysqltest.t1 check warning Table is marked as crashed and last repair failed
-mysqltest.t1 check status OK
+mysqltest.t_corrupted1 check warning Table is marked as crashed and last repair failed
+mysqltest.t_corrupted1 check status OK
* testing that checksum after recovery is as expected
Checksum-check
ok
use mysqltest;
-drop table t1, t2;
+drop table t_corrupted1, t2;
drop database mysqltest_for_feeding_recovery;
drop database mysqltest_for_comparison;
drop database mysqltest;
diff --git a/mysql-test/r/maria.result b/mysql-test/r/maria.result
index a9f10a7ec4d..96fc4e25bc4 100644
--- a/mysql-test/r/maria.result
+++ b/mysql-test/r/maria.result
@@ -2121,6 +2121,7 @@ show variables like 'maria%';
Variable_name Value
maria_block_size 8192
maria_checkpoint_interval 30
+maria_force_start_after_recovery_failures 0
maria_log_file_size 4294959104
maria_log_purge_type immediate
maria_max_sort_file_size 9223372036854775807
@@ -2128,6 +2129,7 @@ maria_page_checksum OFF
maria_pagecache_age_threshold 300
maria_pagecache_buffer_size 8388600
maria_pagecache_division_limit 100
+maria_recover OFF
maria_repair_threads 1
maria_sort_buffer_size 8388608
maria_stats_method nulls_unequal
diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def
index 05c2670fc33..c944bf8d195 100644
--- a/mysql-test/t/disabled.def
+++ b/mysql-test/t/disabled.def
@@ -19,4 +19,4 @@ ctype_create : Bug#32965 main.ctype_create fails
status : Bug#32966 main.status fails
ps_ddl : Bug#12093 2007-12-14 pending WL#4165 / WL#4166
csv_alter_table : Bug#33696 2008-01-21 pcrews no .result file - bug allows NULL columns in CSV tables
-maria-preload : Bug#34911 unrepeatable output of SHOW STATUS
+maria-preload : Bug#35107 crashes
diff --git a/mysql-test/t/maria-preload.test b/mysql-test/t/maria-preload.test
index eff42890484..b6b39b92ac3 100644
--- a/mysql-test/t/maria-preload.test
+++ b/mysql-test/t/maria-preload.test
@@ -8,6 +8,11 @@
drop table if exists t1, t2;
--enable_warnings
+# Work around BUG#34911 "FLUSH STATUS doesn't flush what it should":
+# compute differences in status variables before and after relevant queries
+create temporary table initial
+select variable_name,variable_value from
+information_schema.global_status where variable_name like "Maria_pagecache_read%";
# we don't use block-format because we want page cache stats
# about indices and not data pages.
@@ -59,50 +64,50 @@ select count(*) from t1;
select count(*) from t2;
flush tables; flush status;
-show status like "maria_pagecache_read%";
-
+let $show_stat=select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
+eval $show_stat;
select count(*) from t1 where b = 'test1';
-show status like "maria_pagecache_read%";
+eval $show_stat;
select count(*) from t1 where b = 'test1';
-show status like "maria_pagecache_read%";
+eval $show_stat;
flush tables; flush status;
select @@preload_buffer_size;
load index into cache t1;
-show status like "maria_pagecache_read%";
+eval $show_stat;
select count(*) from t1 where b = 'test1';
-show status like "maria_pagecache_read%";
+eval $show_stat;
flush tables; flush status;
-show status like "maria_pagecache_read%";
+eval $show_stat;
set session preload_buffer_size=256*1024;
select @@preload_buffer_size;
load index into cache t1 ignore leaves;
-show status like "maria_pagecache_read%";
+eval $show_stat;
select count(*) from t1 where b = 'test1';
-show status like "maria_pagecache_read%";
+eval $show_stat;
flush tables; flush status;
-show status like "maria_pagecache_read%";
+eval $show_stat;
set session preload_buffer_size=1*1024;
select @@preload_buffer_size;
load index into cache t1, t2 key (primary,b) ignore leaves;
-show status like "maria_pagecache_read%";
+eval $show_stat;
select count(*) from t1 where b = 'test1';
select count(*) from t2 where b = 'test1';
-show status like "maria_pagecache_read%";
+eval $show_stat;
flush tables; flush status;
-show status like "maria_pagecache_read%";
+eval $show_stat;
load index into cache t3, t2 key (primary,b) ;
-show status like "maria_pagecache_read%";
-
+eval $show_stat;
flush tables; flush status;
-show status like "maria_pagecache_read%";
+eval $show_stat;
load index into cache t3 key (b), t2 key (c) ;
-show status like "maria_pagecache_read%";
+eval $show_stat;
drop table t1, t2;
+drop temporary table initial;
# check that Maria didn't use key cache
show status like "key_read%";
diff --git a/mysql-test/t/maria-recover-master.opt b/mysql-test/t/maria-recover-master.opt
new file mode 100644
index 00000000000..32af5433e03
--- /dev/null
+++ b/mysql-test/t/maria-recover-master.opt
@@ -0,0 +1 @@
+--maria-recover=backup --maria-log-dir-path=../tmp
diff --git a/mysql-test/t/maria-recover.test b/mysql-test/t/maria-recover.test
new file mode 100644
index 00000000000..924d573fe4e
--- /dev/null
+++ b/mysql-test/t/maria-recover.test
@@ -0,0 +1,52 @@
+# Test of the --maria-recover option.
+
+--source include/have_maria.inc
+
+select @@global.maria_recover;
+set global maria_recover=off;
+select @@global.maria_recover;
+set global maria_recover=default;
+select @@global.maria_recover;
+set global maria_recover=normal;
+select @@global.maria_recover;
+
+--disable_warnings
+drop database if exists mysqltest;
+--enable_warnings
+create database mysqltest;
+
+use mysqltest;
+
+create table t1 (a varchar(1000), index(a)) engine=maria;
+insert into t1 values("ThursdayMorningsMarket");
+
+flush table t1; # put index page on disk
+insert into t1 select concat(a,'b') from t1 limit 1;
+# now t1 has its open_count>0 and so will t2_corrupted.
+# It is not named t2 because the corruption messages which will be put
+# in the error log need to be detected in mtr_process.pl, and we want
+# a specific name to do specific detection (don't want to ignore
+# any corruption messages of other tests using "t2" as table).
+
+copy_file $MYSQLTEST_VARDIR/master-data/mysqltest/t1.frm $MYSQLTEST_VARDIR/master-data/mysqltest/t_corrupted2.frm;
+copy_file $MYSQLTEST_VARDIR/master-data/mysqltest/t1.MAD $MYSQLTEST_VARDIR/master-data/mysqltest/t_corrupted2.MAD;
+copy_file $MYSQLTEST_VARDIR/master-data/mysqltest/t1.MAI $MYSQLTEST_VARDIR/master-data/mysqltest/t_corrupted2.MAI;
+
+# Ruin the index file.
+# If maria-block-size is smaller than the default, the corruption
+# messages will differ.
+perl;
+ use strict;
+ use warnings;
+ my $fname= "$ENV{'MYSQLTEST_VARDIR'}/master-data/mysqltest/t_corrupted2.MAI";
+ open(FILE, "+<", $fname) or die;
+ my $whatever= ("\xAB" x 100);
+ sysseek (FILE, 8192, 0) or die;
+ syswrite (FILE, $whatever) or die;
+ close FILE;
+EOF
+
+select * from t_corrupted2; # should show corruption and repair messages
+select * from t_corrupted2; # should show just rows
+
+drop database mysqltest;
diff --git a/mysql-test/t/maria-recovery-big.test b/mysql-test/t/maria-recovery-big.test
index 591109b7eae..5511d1a0cfb 100644
--- a/mysql-test/t/maria-recovery-big.test
+++ b/mysql-test/t/maria-recovery-big.test
@@ -15,6 +15,7 @@ set global maria_log_file_size=4294967295;
drop database if exists mysqltest;
--enable_warnings
create database mysqltest;
+let $mms_tname=t;
# Include scripts can perform SQL. For it to not influence the main test
# they use a separate connection. This way if they use a DDL it would
diff --git a/mysql-test/t/maria-recovery-bitmap.test b/mysql-test/t/maria-recovery-bitmap.test
index ee5f6cbadd3..a44565c9f95 100644
--- a/mysql-test/t/maria-recovery-bitmap.test
+++ b/mysql-test/t/maria-recovery-bitmap.test
@@ -11,6 +11,7 @@
drop database if exists mysqltest;
--enable_warnings
create database mysqltest;
+let $mms_tname=t;
# Include scripts can perform SQL. For it to not influence the main test
# they use a separate connection. This way if they use a DDL it would
diff --git a/mysql-test/t/maria-recovery-rtree-ft.test b/mysql-test/t/maria-recovery-rtree-ft.test
index dd38cc0b0b8..b9bc0e718d2 100644
--- a/mysql-test/t/maria-recovery-rtree-ft.test
+++ b/mysql-test/t/maria-recovery-rtree-ft.test
@@ -14,6 +14,7 @@ let $MARIA_LOG=.;
drop database if exists mysqltest;
--enable_warnings
create database mysqltest;
+let $mms_tname=t;
# Include scripts can perform SQL. For it to not influence the main test
# they use a separate connection. This way if they use a DDL it would
diff --git a/mysql-test/t/maria-recovery.test b/mysql-test/t/maria-recovery.test
index 81cd9408041..cbd5cf2bb4c 100644
--- a/mysql-test/t/maria-recovery.test
+++ b/mysql-test/t/maria-recovery.test
@@ -12,6 +12,7 @@ let $MARIA_LOG=../tmp;
drop database if exists mysqltest;
--enable_warnings
create database mysqltest;
+let $mms_tname=t;
# Include scripts can perform SQL. For it to not influence the main test
# they use a separate connection. This way if they use a DDL it would
@@ -297,19 +298,25 @@ show keys from t1; # should be enabled
drop table t1;
--echo * TEST of recovery when OPTIMIZE has replaced the index file and crash
-create table t1 (a varchar(100), key(a)) engine=maria;
+create table t_corrupted1 (a varchar(100), key(a)) engine=maria;
+# we use a special name because this test portion will generate
+# corruption warnings, which we tell mtr_report.pl to ignore by
+# putting the message in mtr_report.pl, but we don't want to it ignore
+# corruption messages of other tests, hence the special name
+# 't_corrupted' and not just 't'.
+let $mms_tname=t_corrupted;
let $mvr_restore_old_snapshot=0;
let $mms_compare_physically=0;
-let $mvr_crash_statement= optimize table t1;
+let $mvr_crash_statement= optimize table t_corrupted1;
let $mvr_debug_option="+d,maria_flush_whole_log,maria_flush_whole_page_cache,maria_crash_sort_index";
-insert into t1 select (rand()) from t2;
+insert into t_corrupted1 select (rand()) from t2;
-- source include/maria_make_snapshot_for_comparison.inc
# Recovery will not fix the table, but we expect to see it marked
# "crashed on repair".
# Because crash is mild, the table is actually not corrupted, so the
# "check table extended" done below fixes the table.
-- source include/maria_verify_recovery.inc
-drop table t1, t2;
+drop table t_corrupted1, t2;
# clean up everything
let $mms_purpose=feeding_recovery;