2008-11-14 09:45:32 +01:00
# -*- cperl -*-
2011-06-30 17:46:53 +02:00
# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
2008-11-14 09:45:32 +01:00
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# This is a library file used by the Perl version of mysql-test-run,
# and is part of the translation of the Bourne shell script with the
# same name.
use strict ;
use warnings ;
sub mtr_report_test_name ($) ;
sub mtr_report_test_passed ($) ;
sub mtr_report_test_failed ($) ;
sub mtr_report_test_skipped ($) ;
sub mtr_report_test_not_skipped_though_disabled ($) ;
sub mtr_report_stats ($) ;
sub mtr_print_line () ;
sub mtr_print_thick_line () ;
sub mtr_print_header () ;
sub mtr_report (@) ;
sub mtr_warning (@) ;
sub mtr_error (@) ;
sub mtr_child_error (@) ;
sub mtr_debug (@) ;
sub mtr_verbose (@) ;
my $ tot_real_time = 0 ;
##############################################################################
#
#
#
##############################################################################
sub mtr_report_test_name ($) {
my $ tinfo = shift ;
my $ tname = $ tinfo - > { name } ;
$ tname . = " '$tinfo->{combination}'"
if defined $ tinfo - > { combination } ;
_mtr_log ( $ tname ) ;
printf "%-30s " , $ tname ;
}
sub mtr_report_test_skipped ($) {
my $ tinfo = shift ;
$ tinfo - > { 'result' } = 'MTR_RES_SKIPPED' ;
if ( $ tinfo - > { 'disable' } )
{
mtr_report ( "[ disabled ] $tinfo->{'comment'}" ) ;
}
elsif ( $ tinfo - > { 'comment' } )
{
mtr_report ( "[ skipped ] $tinfo->{'comment'}" ) ;
}
else
{
mtr_report ( "[ skipped ]" ) ;
}
}
sub mtr_report_tests_not_skipped_though_disabled ($) {
my $ tests = shift ;
if ( $ ::opt_enable_disabled )
{
my @ disabled_tests = grep { $ _ - > { 'dont_skip_though_disabled' } } @$ tests ;
if ( @ disabled_tests )
{
print "\nTest(s) which will be run though they are marked as disabled:\n" ;
foreach my $ tinfo ( sort { $ a - > { 'name' } cmp $ b - > { 'name' } } @ disabled_tests )
{
printf " %-20s : %s\n" , $ tinfo - > { 'name' } , $ tinfo - > { 'comment' } ;
}
}
}
}
sub mtr_report_test_passed ($) {
my $ tinfo = shift ;
my $ timer = "" ;
if ( $ ::opt_timer and - f "$::opt_vardir/log/timer" )
{
$ timer = mtr_fromfile ( "$::opt_vardir/log/timer" ) ;
$ tot_real_time += ( $ timer / 1000 ) ;
$ timer = sprintf "%12s" , $ timer ;
}
$ tinfo - > { 'result' } = 'MTR_RES_PASSED' ;
mtr_report ( "[ pass ] $timer" ) ;
}
sub mtr_report_test_failed ($) {
my $ tinfo = shift ;
$ tinfo - > { 'result' } = 'MTR_RES_FAILED' ;
if ( defined $ tinfo - > { 'timeout' } )
{
mtr_report ( "[ fail ] timeout" ) ;
return ;
}
else
{
mtr_report ( "[ fail ]" ) ;
}
if ( $ tinfo - > { 'comment' } )
{
# The test failure has been detected by mysql-test-run.pl
# when starting the servers or due to other error, the reason for
# failing the test is saved in "comment"
mtr_report ( "\nERROR: $tinfo->{'comment'}" ) ;
}
elsif ( - f $ ::path_timefile )
{
# Test failure was detected by test tool and it's report
# about what failed has been saved to file. Display the report.
print "\n" ;
print mtr_fromfile ( $ ::path_timefile ) ; # FIXME print_file() instead
print "\n" ;
}
else
{
# Neither this script or the test tool has recorded info
# about why the test has failed. Should be debugged.
mtr_report ( "\nUnexpected termination, probably when starting mysqld" ) ; ;
}
}
sub mtr_report_stats ($) {
my $ tests = shift ;
# ----------------------------------------------------------------------
# Find out how we where doing
# ----------------------------------------------------------------------
my $ tot_skiped = 0 ;
my $ tot_passed = 0 ;
my $ tot_failed = 0 ;
my $ tot_tests = 0 ;
my $ tot_restarts = 0 ;
my $ found_problems = 0 ; # Some warnings in the logfiles are errors...
foreach my $ tinfo ( @$ tests )
{
if ( $ tinfo - > { 'result' } eq 'MTR_RES_SKIPPED' )
{
$ tot_skiped + + ;
}
elsif ( $ tinfo - > { 'result' } eq 'MTR_RES_PASSED' )
{
$ tot_tests + + ;
$ tot_passed + + ;
}
elsif ( $ tinfo - > { 'result' } eq 'MTR_RES_FAILED' )
{
$ tot_tests + + ;
$ tot_failed + + ;
}
if ( $ tinfo - > { 'restarted' } )
{
$ tot_restarts + + ;
}
}
# ----------------------------------------------------------------------
# Print out a summary report to screen
# ----------------------------------------------------------------------
if ( ! $ tot_failed )
{
print "All $tot_tests tests were successful.\n" ;
}
else
{
my $ ratio = $ tot_passed * 100 / $ tot_tests ;
print "Failed $tot_failed/$tot_tests tests, " ;
printf ( "%.2f" , $ ratio ) ;
print "\% were successful.\n\n" ;
print
"The log files in var/log may give you some hint\n" ,
"of what went wrong.\n" ,
"If you want to report this error, please read first " ,
"the documentation at\n" ,
"http://dev.mysql.com/doc/mysql/en/mysql-test-suite.html\n" ;
}
if ( ! $ ::opt_extern )
{
print "The servers were restarted $tot_restarts times\n" ;
}
if ( $ ::opt_timer )
{
use English ;
mtr_report ( "Spent" , sprintf ( "%.3f" , $ tot_real_time ) , "of" ,
time - $ BASETIME , "seconds executing testcases" ) ;
}
# ----------------------------------------------------------------------
# If a debug run, there might be interesting information inside
# the "var/log/*.err" files. We save this info in "var/log/warnings"
# ----------------------------------------------------------------------
2007-12-10 02:32:00 +02:00
if ( ! $ ::glob_use_running_server && ! $ ::opt_extern )
2008-11-14 09:45:32 +01:00
{
# Save and report if there was any fatal warnings/errors in err logs
my $ warnlog = "$::opt_vardir/log/warnings" ;
unless ( open ( WARN , ">$warnlog" ) )
{
mtr_warning ( "can't write to the file \"$warnlog\": $!" ) ;
}
else
{
# We report different types of problems in order
foreach my $ pattern ( "^Warning:" ,
"\\[Warning\\]" ,
"\\[ERROR\\]" ,
"^Error:" , "^==.* at 0x" ,
"InnoDB: Warning" ,
"InnoDB: Error" ,
"^safe_mutex:" ,
"missing DBUG_RETURN" ,
"mysqld: Warning" ,
"allocated at line" ,
"Attempting backtrace" , "Assertion .* failed" )
{
foreach my $ errlog ( sort glob ( "$::opt_vardir/log/*.err" ) )
{
my $ testname = "" ;
unless ( open ( ERR , $ errlog ) )
{
mtr_warning ( "can't read $errlog" ) ;
next ;
}
while ( <ERR> )
{
# Skip some non fatal warnings from the log files
if (
/\"SELECT UNIX_TIMESTAMP\(\)\" failed on master/ or
/Aborted connection/ or
/Client requested master to start replication from impossible position/ or
/Could not find first log file name in binary log/ or
/Enabling keys got errno/ or
/Error reading master configuration/ or
/Error reading packet/ or
/Event Scheduler/ or
/Failed to open log/ or
/Failed to open the existing master info file/ or
/Forcing shutdown of [0-9]* plugins/ or
/Can't open shared library .*\bha_example\b/ or
/Couldn't load plugin .*\bha_example\b/ or
# Due to timing issues, it might be that this warning
# is printed when the server shuts down and the
# computer is loaded.
/Forcing close of thread \d+ user: '.*?'/ or
/Got error [0-9]* when reading table/ or
/Incorrect definition of table/ or
/Incorrect information in file/ or
/InnoDB: Warning: we did not need to do crash recovery/ or
/Invalid \(old\?\) table or database name/ or
/Lock wait timeout exceeded/ or
/Log entry on master is longer than max_allowed_packet/ or
/unknown option '--loose-/ or
/unknown variable 'loose-/ or
/You have forced lower_case_table_names to 0 through a command-line option/ or
/Setting lower_case_table_names=2/ or
/NDB Binlog:/ or
/NDB: failed to setup table/ or
/NDB: only row based binary logging/ or
/Neither --relay-log nor --relay-log-index were used/ or
/Query partially completed/ or
/Slave I.O thread aborted while waiting for relay log/ or
/Slave SQL thread is stopped because UNTIL condition/ or
/Slave SQL thread retried transaction/ or
/Slave \(additional info\)/ or
/Slave: .*Duplicate column name/ or
/Slave: .*master may suffer from/ or
/Slave: According to the master's version/ or
/Slave: Column [0-9]* type mismatch/ or
/Slave: Error .* doesn't exist/ or
/Slave: Deadlock found/ or
/Slave: Error .*Unknown table/ or
/Slave: Error in Write_rows event: / or
/Slave: Field .* of table .* has no default value/ or
/Slave: Field .* doesn't have a default value/ or
/Slave: Query caused different errors on master and slave/ or
/Slave: Table .* doesn't exist/ or
/Slave: Table width mismatch/ or
/Slave: The incident LOST_EVENTS occured on the master/ or
/Slave: Unknown error.* 1105/ or
/Slave: Can't drop database.* database doesn't exist/ or
/Slave SQL:.*(?:Error_code: \d+|Query:.*)/ or
/Sort aborted/ or
/Time-out in NDB/ or
/One can only use the --user.*root/ or
/Table:.* on (delete|rename)/ or
/You have an error in your SQL syntax/ or
/deprecated/ or
/description of time zone/ or
/equal MySQL server ids/ or
/error .*connecting to master/ or
/error reading log entry/ or
/lower_case_table_names is set/ or
/skip-name-resolve mode/ or
/slave SQL thread aborted/ or
/Slave: .*Duplicate entry/ or
# Special case for Bug #26402 in show_check.test
# Question marks are not valid file name parts
# on Windows platforms. Ignore this error message.
/\QCan't find file: '.\test\????????.frm'\E/ or
# Special case, made as specific as possible, for:
# Bug #28436: Incorrect position in SHOW BINLOG EVENTS causes
# server coredump
/\QError in Log_event::read_log_event(): 'Sanity check failed', data_len: 258, event_type: 49\E/ or
/Statement is not safe to log in statement format/ or
# test case for Bug#bug29807 copies a stray frm into database
/InnoDB: Error: table `test`.`bug29807` does not exist in the InnoDB internal/ or
/Cannot find or open table test\/bug29807 from/ or
# innodb foreign key tests that fail in ALTER or RENAME produce this
/InnoDB: Error: in ALTER TABLE `test`.`t[12]`/ or
/InnoDB: Error: in RENAME TABLE table `test`.`t1`/ or
/InnoDB: Error: table `test`.`t[12]` does not exist in the InnoDB internal/ or
# Test case for Bug#14233 produces the following warnings:
/Stored routine 'test'.'bug14233_1': invalid value in column mysql.proc/ or
/Stored routine 'test'.'bug14233_2': invalid value in column mysql.proc/ or
/Stored routine 'test'.'bug14233_3': invalid value in column mysql.proc/ or
# BUG#29839 - lowercase_table3.test: Cannot find table test/T1
# from the internal data dictiona
/Cannot find table test\/BUG29839 from the internal data dictionary/ or
# BUG#32080 - Excessive warnings on Solaris: setrlimit could not
# change the size of core files
/setrlimit could not change the size of core files to 'infinity'/ or
# rpl_extrColmaster_*.test, the slave thread produces warnings
# when it get updates to a table that has more columns on the
# master
/Slave: Unknown column 'c7' in 't15' Error_code: 1054/ or
/Slave: Can't DROP 'c7'.* 1091/ or
/Slave: Key column 'c6'.* 1072/ or
2009-12-09 16:13:00 +01:00
# Warnings generated until bug#42147 is properly resolved
/Found lock of type 6 that is write and read locked/ or
2008-11-14 09:45:32 +01:00
# rpl_idempotency.test produces warnings for the slave.
( $ testname eq 'rpl.rpl_idempotency' and
( /Slave: Can\'t find record in \'t1\' Error_code: 1032/ or
/Slave: Cannot add or update a child row: a foreign key constraint fails .* Error_code: 1452/
) ) or
# These tests does "kill" on queries, causing sporadic errors when writing to logs
( ( $ testname eq 'rpl.rpl_skip_error' or
$ testname eq 'rpl.rpl_err_ignoredtable' or
$ testname eq 'binlog.binlog_killed_simulate' or
$ testname eq 'binlog.binlog_killed' ) and
( /Failed to write to mysql\.\w+_log/
) ) or
# rpl_bug33931 has deliberate failures
( $ testname eq 'rpl.rpl_bug33931' and
( /Failed during slave.*thread initialization/
) ) or
2008-02-05 16:47:11 +01:00
# rpl_temporary has an error on slave that can be ignored
( $ testname eq 'rpl.rpl_temporary' and
( /Slave: Can\'t find record in \'user\' Error_code: 1032/
2008-02-06 17:55:04 +01:00
) ) or
2008-11-14 09:45:32 +01:00
# Test case for Bug#31590 produces the following error:
/Out of sort memory; increase server sort buffer size/ or
# Bug#35161, test of auto repair --myisam-recover
/able.*_will_crash/ or
# lowercase_table3 using case sensitive option on
# case insensitive filesystem (InnoDB error).
/Cannot find or open table test\/BUG29839 from/ or
# When trying to set lower_case_table_names = 2
# on a case sensitive file system. Bug#37402.
2008-10-10 18:28:41 +03:00
/lower_case_table_names was set to 2, even though your the file system '.*' is case sensitive. Now setting lower_case_table_names to 0 to avoid future problems./ or
2007-12-31 00:04:17 +01:00
# maria-recovery.test has warning about missing log file
2008-03-19 00:07:06 +02:00
/File '.*maria_log.000.*' not found \(Errcode: 2\)/ or
WL#3072 - Maria Recovery
Bulk insert: don't log REDO/UNDO for rows, log one UNDO which will
truncate files; this is an optimization and a bugfix (table was left
half-repaired by crash).
Repair: mark table crashed-on-repair at start, bump skip_redo_lsn at start,
this is easier for recovery (tells it to skip old REDOs or even UNDO
phase) and user (tells it to repair) in case of crash, sync files
in the end.
Recovery skips missing or corrupted table and moves to next record
(in REDO or UNDO phase) to be more robust; warns if happens in UNDO phase.
Bugfix for UNDO_KEY_DELETE_WITH_ROOT (tested in ma_test_recovery)
and maria_enable_indexes().
Create missing bitmaps when needed (there can be more than one to create,
in rare cases), log a record for this.
include/myisamchk.h:
new flag: bulk insert repair mustn't bump create_rename_lsn
mysql-test/lib/mtr_report.pl:
skip normal warning in maria-recovery.test
mysql-test/r/maria-recovery.result:
result: crash before bulk insert is committed, causes proper rollback,
and crash right after OPTIMIZE replaces index file with new index file
leads to table marked corrupted and recovery not failing.
mysql-test/t/maria-recovery.test:
- can't check the table or it would commit the transaction,
but check is made after recovery.
- test of crash before bulk-insert-with-repair is committed
(to see if it is rolled back), and of crash after OPTIMIZE has replaced
index file but not finished all operations (to see if recovery fails -
it used to assert when trying to execute an old REDO on the new
index).
storage/maria/CMakeLists.txt:
new file
storage/maria/Makefile.am:
new file
storage/maria/ha_maria.cc:
- If bulk insert on a transactional table using an index repair:
table is initially empty, so don't log REDO/UNDO for data rows
(optimization), just log an UNDO_BULK_INSERT_WITH_REPAIR
which will, if executed, empty the data and index file. Re-enable
logging in end_bulk_insert().
- write log record for repair operation only after it's fully done,
index sort including (maria_repair*() used to write the log record).
- Adding back file->trn=NULL which was removed by mistake earlier.
storage/maria/ha_maria.h:
new member (see ha_maria.cc)
storage/maria/ma_bitmap.c:
Functions to create missing bitmaps:
- one function which creates missing bitmaps in page cache, except
the missing one with max offset which it does not put into page cache
as it will be modified very soon.
- one function which the one above calls, and creates bitmaps in page
cache
- one function to execute REDO_BITMAP_NEW_PAGE which uses the second
one above.
storage/maria/ma_blockrec.c:
- when logging REDO_DELETE_ALL, not only 'records' and 'checksum'
has to be reset under log's mutex.
- execution of REDO_INSERT_ROW_BLOBS now checks the dirty pages' list
- execution of UNDO_BULK_INSERT_WITH_REPAIR
storage/maria/ma_blockrec.h:
new functions
storage/maria/ma_check.c:
- table-flush-before-repair is moved to a separate function reused
by maria_sort_index(); syncing is added
- maria_repair() is allowed to re-enable logging only if it is the one
which disabled it.
- "_ma_flush_table_files_after_repair" was a bad name, it's not after
repair now, and it should not sync as we do more changes to the files
shortly after (sync is postponed to when writing the log record)
- REDO_REPAIR record should be written only after all repair
operations (in particular after sorting index in ha_mara::repair())
- close to the end of repair by sort, flushing of pages must happen
also in the non-quick case, to prepare for the sync at end.
- in parallel repair, some page flushes are not needed as done
by initialize_variables_for_repair().
storage/maria/ma_create.c:
Update skip_redo_lsn, create_rename_lsn optionally.
storage/maria/ma_delete_all.c:
Need to sync files at end of maria_delete_all_rows(), if transactional.
storage/maria/ma_extra.c:
During repair, we sometimes call _ma_flush_table_files() (via
_ma_flush_table_files_before_swap()) while there is a WRITE_CACHE.
storage/maria/ma_key_recover.c:
- when we see CLR_END for UNDO_BULK_INSERT_WITH_REPAIR, re-enable
indices.
- fixing bug: _ma_apply_undo_key_delete() parsed UNDO_KEY_DELETE_WITH_ROOT
wrongly, leading to recovery failure
storage/maria/ma_key_recover.h:
new prototype
storage/maria/ma_locking.c:
DBUG_VOID_RETURN missing
storage/maria/ma_loghandler.c:
UNDO for bulk insert with repair, and REDO for creating bitmaps.
LOGREC_FIRST_FREE to not have to change the for() every time we
add a new record type.
storage/maria/ma_loghandler.h:
new UNDO and REDO
storage/maria/ma_open.c:
Move share.kfile.file=kfile up a bit, so that _ma_update_state_lsns()
can get its value, this fixes a bug where LSN_REPAIRED_BY_MARIA_CHK
was not corrected on disk by maria_open().
Store skip_redo_lsn in index' header.
maria_enable_indexes() had a bug for BLOCK_RECORD, where an empty
file has one page, not 0 bytes.
storage/maria/ma_recovery.c:
- Skip a corrupted, missing, or repaired-with-maria_chk, table in
recovery: don't fail, just go to next REDO or UNDO; but if an UNDO
is skipped in UNDO phase we issue warnings.
- Skip REDO|UNDO in REDO phase if <skip_redo_lsn.
- If UNDO phase fails, delete transactions to not make trnman
assert.
- Update skip_redo_lsn when playing REDO_CREATE_TABLE
- Don't record UNDOs for old transactions which we don't know (long_trid==0)
- Bugfix for UNDO_KEY_DELETE_WITH_ROOT (see ma_key_recover.c)
- Execution of UNDO_BULK_INSERT_WITH_REPAIR
- Don't try to find a page number in REDO_DELETE_ALL
- Pieces moved to ma_recovery_util.c
storage/maria/ma_rename.c:
name change
storage/maria/ma_static.c:
I modified layout of the index' header (inserted skip_redo_lsn in its middle)
storage/maria/ma_test2.c:
allow breaking the test towards the end, tests execution of
UNDO_KEY_DELETE_WITH_ROOT
storage/maria/ma_test_recovery.expected:
6 as testflag instead of 4
storage/maria/ma_test_recovery:
Increase the amount of rollback work to do when testing recovery
with ma_test2; this reproduces the UNDO_KEY_DELETE_WITH_ROOT bug.
storage/maria/maria_chk.c:
skip_redo_lsn should be updated too, for consistency.
Write a REDO_REPAIR after all operations (including sort-records)
have been done.
No reason to flush blocks after maria_chk_data_link() and
maria_sort_records(), there is maria_close() in the end.
write_log_record() is a function, to not clutter maria_chk().
storage/maria/maria_def.h:
New member skip_redo_lsn in the state, and comments
storage/maria/maria_pack.c:
skip_redo_lsn should be updated too, for consistency
storage/maria/ma_recovery_util.c:
_ma_redo_not_needed_for_page(), defined in ma_recovery.c, is needed
by ma_blockrec.c; this causes link issues, resolved by putting
_ma_redo_not_needed_for_page() into a new file (so that it is not
in the same file as repair-related objects of ma_recovery.c).
storage/maria/ma_recovery_util.h:
new file
2008-01-17 23:59:32 +01:00
# and about marked-corrupted table
2008-11-24 14:57:34 +01:00
/Table '..mysqltest.t_corrupted1' is crashed, skipping it. Please repair it with maria_chk -r/ or
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)
2008-06-02 22:53:25 +02:00
# maria-recover.test corrupts tables on purpose
2008-11-24 14:57:34 +01:00
/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/
2007-05-31 17:45:22 +03:00
)
2008-11-14 09:45:32 +01:00
{
next ; # Skip these lines
}
if ( /CURRENT_TEST: (.*)/ )
{
$ testname = $ 1 ;
}
if ( /$pattern/ )
{
$ found_problems = 1 ;
print WARN basename ( $ errlog ) . ": $testname: $_" ;
}
}
}
}
if ( $ ::opt_check_testcases )
{
# Look for warnings produced by mysqltest in testname.warnings
foreach my $ test_warning_file
( glob ( "$::glob_mysql_test_dir/r/*.warnings" ) )
{
$ found_problems = 1 ;
print WARN "Check myqltest warnings in $test_warning_file\n" ;
}
}
if ( $ found_problems )
{
mtr_warning ( "Got errors/warnings while running tests, please examine" ,
"\"$warnlog\" for details." ) ;
}
}
}
print "\n" ;
# Print a list of testcases that failed
if ( $ tot_failed != 0 )
{
my $ test_mode = join ( " " , @ ::glob_test_mode ) || "default" ;
print "mysql-test-run in $test_mode mode: *** Failing the test(s):" ;
foreach my $ tinfo ( @$ tests )
{
if ( $ tinfo - > { 'result' } eq 'MTR_RES_FAILED' )
{
print " $tinfo->{'name'}" ;
}
}
print "\n" ;
}
# Print a list of check_testcases that failed(if any)
if ( $ ::opt_check_testcases )
{
my @ check_testcases = ( ) ;
foreach my $ tinfo ( @$ tests )
{
if ( defined $ tinfo - > { 'check_testcase_failed' } )
{
push ( @ check_testcases , $ tinfo - > { 'name' } ) ;
}
}
if ( @ check_testcases )
{
print "Check of testcase failed for: " ;
print join ( " " , @ check_testcases ) ;
print "\n\n" ;
}
}
if ( $ tot_failed != 0 || $ found_problems )
{
mtr_error ( "there were failing test cases" ) ;
}
}
##############################################################################
#
# Text formatting
#
##############################################################################
sub mtr_print_line () {
print '-' x 55 , "\n" ;
}
sub mtr_print_thick_line () {
print '=' x 55 , "\n" ;
}
sub mtr_print_header () {
print "\n" ;
if ( $ ::opt_timer )
{
print "TEST RESULT TIME (ms)\n" ;
}
else
{
print "TEST RESULT\n" ;
}
mtr_print_line ( ) ;
print "\n" ;
}
##############################################################################
#
# Log and reporting functions
#
##############################################################################
use IO::File ;
my $ log_file_ref = undef ;
sub mtr_log_init ($) {
my ( $ filename ) = @ _ ;
mtr_error ( "Log is already open" ) if defined $ log_file_ref ;
$ log_file_ref = IO::File - > new ( $ filename , "a" ) or
mtr_warning ( "Could not create logfile $filename: $!" ) ;
}
sub _mtr_log (@) {
print $ log_file_ref join ( " " , @ _ ) , "\n"
if defined $ log_file_ref ;
}
sub mtr_report (@) {
# Print message to screen and log
_mtr_log ( @ _ ) ;
print join ( " " , @ _ ) , "\n" ;
}
sub mtr_warning (@) {
# Print message to screen and log
_mtr_log ( "WARNING: " , @ _ ) ;
print STDERR "mysql-test-run: WARNING: " , join ( " " , @ _ ) , "\n" ;
}
sub mtr_error (@) {
# Print message to screen and log
_mtr_log ( "ERROR: " , @ _ ) ;
print STDERR "mysql-test-run: *** ERROR: " , join ( " " , @ _ ) , "\n" ;
mtr_exit ( 1 ) ;
}
sub mtr_child_error (@) {
# Print message to screen and log
_mtr_log ( "ERROR(child): " , @ _ ) ;
print STDERR "mysql-test-run: *** ERROR(child): " , join ( " " , @ _ ) , "\n" ;
exit ( 1 ) ;
}
sub mtr_debug (@) {
# Only print if --script-debug is used
if ( $ ::opt_script_debug )
{
_mtr_log ( "###: " , @ _ ) ;
print STDERR "####: " , join ( " " , @ _ ) , "\n" ;
}
}
sub mtr_verbose (@) {
# Always print to log, print to screen only when --verbose is used
_mtr_log ( "> " , @ _ ) ;
if ( $ ::opt_verbose )
{
print STDERR "> " , join ( " " , @ _ ) , "\n" ;
}
}
1 ;