mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 12:32:27 +01:00
Merge abelkin@bk-internal.mysql.com:/home/bk/mysql-maria
into desktop.sanja.is.com.ua:/home/bell/mysql/bk/work-maria-rwlock-push
This commit is contained in:
commit
c45172ec38
4 changed files with 66 additions and 29 deletions
|
@ -62,6 +62,10 @@ TARGET_LINK_LIBRARIES(maria_read_log maria myisam mysys dbug strings zlib wsock3
|
|||
ADD_EXECUTABLE(maria_pack maria_pack.c)
|
||||
TARGET_LINK_LIBRARIES(maria_pack maria myisam mysys dbug strings zlib wsock32)
|
||||
|
||||
ADD_EXECUTABLE(maria_dump_log ma_loghandler.c)
|
||||
TARGET_LINK_LIBRARIES(maria_dump_log maria myisam mysys dbug strings zlib wsock32)
|
||||
SET_TARGET_PROPERTIES(maria_dump_log PROPERTIES COMPILE_FLAGS "-DMARIA_DUMP_LOG")
|
||||
|
||||
ADD_EXECUTABLE(ma_test1 ma_test1.c)
|
||||
TARGET_LINK_LIBRARIES(ma_test1 maria myisam mysys dbug strings zlib wsock32)
|
||||
|
||||
|
|
|
@ -8381,7 +8381,7 @@ int main(int argc, char **argv)
|
|||
opt_offset+= TRANSLOG_PAGE_SIZE, opt_pages--)
|
||||
{
|
||||
if (my_pread(handler, buffer, TRANSLOG_PAGE_SIZE, opt_offset,
|
||||
MYF(MY_FNABP | MY_WME)))
|
||||
MYF(MY_NABP)))
|
||||
{
|
||||
if (my_errno == HA_ERR_FILE_TOO_SHORT)
|
||||
goto end;
|
||||
|
|
|
@ -375,12 +375,10 @@ static struct my_option my_long_options[] =
|
|||
{ "zerofill", 'z',
|
||||
"Fill empty space in data and index files with zeroes",
|
||||
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#ifdef IDENTICAL_PAGES_AFTER_RECOVERY
|
||||
{ "zerofill-keep-lsn", OPT_ZEROFILL_KEEP_LSN,
|
||||
"Like --zerofill but does not zero out LSN of data/index pages;"
|
||||
" used only for testing and debugging",
|
||||
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#endif
|
||||
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
|
@ -511,13 +509,9 @@ static void usage(void)
|
|||
(It may be VERY slow to do a sort the first time!).\n\
|
||||
-b, --block-search=#\n\
|
||||
Find a record, a block at given offset belongs to.\n\
|
||||
-z, --zerofill Fill empty space in data and index files with zeroes"
|
||||
#ifdef IDENTICAL_PAGES_AFTER_RECOVERY
|
||||
"\n\
|
||||
-z, --zerofill Fill empty space in data and index files with zeroes\n\
|
||||
--zerofill-keep-lsn Like --zerofill but does not zero out LSN of\n\
|
||||
data/index pages; used only for testing and debugging"
|
||||
#endif
|
||||
".");
|
||||
data/index pages.");
|
||||
|
||||
print_defaults("my", load_default_groups);
|
||||
my_print_variables(my_long_options);
|
||||
|
@ -1123,13 +1117,23 @@ static int maria_chk(HA_CHECK *param, char *filename)
|
|||
if (!error)
|
||||
{
|
||||
/*
|
||||
Tell the server's Recovery to ignore old REDOs on this table; we don't
|
||||
Unless this was only --zerofill-keep-lsn, old REDOs are not
|
||||
applicable, tell the server's Recovery to ignore them; we don't
|
||||
know what the log's end LSN is now, so we just let the server know
|
||||
that it will have to find and store it.
|
||||
This is the only case where create_rename_lsn can be a horizon and not
|
||||
a LSN.
|
||||
If this was only --zerofill-keep-lsn, the table can be used in
|
||||
Recovery and especially in this scenario: do a dirty-copy-based backup
|
||||
(snapshot-like), --zerofill-keep-lsn on the copies to achieve better
|
||||
compression, compress the copies with an external tool, and after a
|
||||
restore, Recovery still works (because pages and state still have
|
||||
their correct LSNs).
|
||||
*/
|
||||
if (share->base.born_transactional)
|
||||
if (share->base.born_transactional &&
|
||||
((param->testflag & (T_REP_ANY | T_SORT_RECORDS | T_SORT_INDEX |
|
||||
T_ZEROFILL | T_ZEROFILL_KEEP_LSN)) !=
|
||||
(T_ZEROFILL | T_ZEROFILL_KEEP_LSN)))
|
||||
share->state.create_rename_lsn= share->state.is_of_horizon=
|
||||
share->state.skip_redo_lsn= LSN_REPAIRED_BY_MARIA_CHK;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
use Getopt::Long;
|
||||
use File::Copy;
|
||||
use File::Compare;
|
||||
use File::Basename;
|
||||
|
||||
$|= 1;
|
||||
|
@ -140,18 +141,14 @@ sub main
|
|||
move("$table.MAI", "$tmp/$table-good.MAI") ||
|
||||
die "Can't move $table.MAI to $tmp/$table-good.MAI\n";
|
||||
apply_log($table, "shouldnotchangelog");
|
||||
$res= `cmp $table.MAD $tmp/$table-good.MAD`;
|
||||
print MY_LOG $res;
|
||||
$res= `cmp $table.MAI $tmp/$table-good.MAI`;
|
||||
print MY_LOG $res;
|
||||
check_table_is_same($table, $checksum);
|
||||
$res= physical_cmp($table, "$tmp/$table-good");
|
||||
print MY_LOG $res;
|
||||
print MY_LOG "testing idempotency\n";
|
||||
apply_log($table, "shouldnotchangelog");
|
||||
$res= `cmp $table.MAD $tmp/$table-good.MAD`;
|
||||
print MY_LOG $res;
|
||||
$res= `cmp $table.MAI $tmp/$table-good.MAI`;
|
||||
print MY_LOG $res;
|
||||
check_table_is_same($table, $checksum);
|
||||
$res= physical_cmp($table, "$tmp/$table-good");
|
||||
print MY_LOG $res;
|
||||
}
|
||||
|
||||
print MY_LOG "Testing the REDO AND UNDO PHASE\n";
|
||||
|
@ -255,21 +252,16 @@ sub main
|
|||
check_table_is_same($table, $checksum);
|
||||
print MY_LOG "testing idempotency\n";
|
||||
apply_log($table, "shouldnotchangelog");
|
||||
# We can't do a binary compary as there may have been different number
|
||||
# of calls to compact_page. We can enable this if we first call
|
||||
# maria-check to generate identically compacted pages.
|
||||
# cmp $table.MAD $tmp/$table-after_undo.MAD
|
||||
$res= `cmp $table.MAI $tmp/$table-after_undo.MAI`;
|
||||
print MY_LOG $res;
|
||||
check_table_is_same($table, $checksum);
|
||||
$res= physical_cmp($table, "$tmp/$table-after_undo");
|
||||
print MY_LOG $res;
|
||||
print MY_LOG "testing applying of CLRs to recreate table\n";
|
||||
unlink <$table.MA?>;
|
||||
# cp $tmp/maria_log* $maria_path #unneeded
|
||||
apply_log($table, "shouldnotchangelog");
|
||||
# cmp $table.MAD $tmp/$table-after_undo.MAD
|
||||
$res= `cmp $table.MAI $tmp/$table-after_undo.MAI`;
|
||||
print MY_LOG $res;
|
||||
check_table_is_same($table, $checksum);
|
||||
$res= physical_cmp($table, "$tmp/$table-after_undo");
|
||||
print MY_LOG $res;
|
||||
}
|
||||
unlink <$table.* $tmp/$table* $tmp/maria_chk_*.txt $tmp/maria_read_log_$table.txt>;
|
||||
}
|
||||
|
@ -357,7 +349,7 @@ sub apply_log
|
|||
{
|
||||
print MY_LOG "bad argument '$shouldchangelog'\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
$log_md5= `$md5sum maria_log.*`;
|
||||
|
||||
print MY_LOG "applying log\n";
|
||||
|
@ -395,6 +387,43 @@ sub my_which
|
|||
}
|
||||
|
||||
|
||||
####
|
||||
#### physical_cmp: compares two tables (MAI and MAD) physically;
|
||||
#### uses zerofill-keep-lsn to reduce irrelevant differences.
|
||||
####
|
||||
|
||||
sub physical_cmp
|
||||
{
|
||||
my ($table1, $table2)= @_;
|
||||
my ($zerofilled, $ret_text);
|
||||
foreach my $file_suffix ("MAD", "MAI")
|
||||
{
|
||||
my $file1= "$table1.$file_suffix";
|
||||
my $file2= "$table2.$file_suffix";
|
||||
my ($error_text, $differences_text)=
|
||||
("error in comparison of $file1 and $file2\n",
|
||||
"$file1 and $file2 differ\n");
|
||||
my $res= File::Compare::compare($file1, $file2);
|
||||
return $error_text if ($res == -1);
|
||||
if ($res == 1 # they differ
|
||||
and !$zerofilled)
|
||||
{
|
||||
# let's try with --zerofill-keep-lsn
|
||||
$zerofilled= 1; # but no need to do it twice
|
||||
foreach my $table ($table1, $table2)
|
||||
{
|
||||
$com= "$maria_exe_path/maria_chk$suffix -s --zerofill-keep-lsn $table";
|
||||
$res= `$com`;
|
||||
print MY_LOG $res;
|
||||
}
|
||||
$res= File::Compare::compare($file1, $file2);
|
||||
return $error_text if ($res == -1);
|
||||
}
|
||||
$ret_text.= $differences_text if ($res != 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
####
|
||||
#### usage
|
||||
####
|
||||
|
|
Loading…
Reference in a new issue