Commit b01c9528 authored by unknown's avatar unknown

WL#3072 Maria Recovery

fixes for ma_test_recovery.pl to work in release builds too:
- bugfix in maria_zerofill_index()
- applying of LOGREC_INSERT_ROW_BLOBS now zeroes unused end of non-full
blob page (a mutation of tail page when it takes >75% of maria_block_size)
like write_full_pages() does.


storage/maria/ma_blockrec.c:
  When we write a non-full blob page at run-time, we zero the rest of
  it (see write_full_pages()). We now do the same in
  _ma_apply_redo_insert_row_blobs(): this is consistent and helps
  having log-applying produce the same page as run-time.
storage/maria/ma_check.c:
  maria_zerofill_index() was wrong: it didn't zero certain bytes
  because it believed that the count of relevant bytes is
  _ma_get_page_used(share, buff) + share->keypage_header,
  whereas it's only the first term.
storage/maria/ma_pagecache.c:
  typo
storage/maria/ma_pagecache.h:
  typo
storage/maria/maria_chk.c:
  enable --zerofill-keep-lsn in all builds
storage/maria/unittest/ma_test_recovery.pl:
  now even release builds can run ma_test_recovery.pl, because zerofill
  makes tables of this test (made by run-time and by log-applying)
  identical.
parent b2724a6a
......@@ -6343,12 +6343,13 @@ uint _ma_apply_redo_insert_row_blobs(MARIA_HA *info,
length= data_size;
if (i == 0 && sub_ranges == 0)
{
/* Last page may be only partly filled. */
/*
Last page may be only partly filled. We zero the rest, like
write_full_pages() does.
*/
length-= empty_space;
#ifdef IDENTICAL_PAGES_AFTER_RECOVERY
bzero(buff + share->block_size - PAGE_SUFFIX_SIZE - empty_space,
empty_space);
#endif
}
memcpy(buff+ PAGE_TYPE_OFFSET + 1, data, length);
data+= length;
......
......@@ -2983,11 +2983,9 @@ static my_bool maria_zerofill_index(HA_CHECK *param, MARIA_HA *info,
if (zero_lsn)
bzero(buff, LSN_SIZE);
length= _ma_get_page_used(share, buff);
/* Skip mailformed blocks */
DBUG_ASSERT(length + share->keypage_header <= block_size);
if (length + share->keypage_header < block_size)
bzero(buff + share->keypage_header + length, block_size - length -
share->keypage_header);
DBUG_ASSERT(length <= block_size);
if (length < block_size)
bzero(buff + length, block_size - length);
pagecache_unlock_by_link(share->pagecache, page_link.link,
PAGECACHE_LOCK_WRITE_UNLOCK,
PAGECACHE_UNPIN, LSN_IMPOSSIBLE,
......@@ -3001,7 +2999,7 @@ static my_bool maria_zerofill_index(HA_CHECK *param, MARIA_HA *info,
/**
@brief Fill empty space in index file with zeroes
@brief Fill empty space in data file with zeroes
@todo
Zerofill all pages marked in bitmap as empty and change them to
......
......@@ -3416,7 +3416,7 @@ end:
@return "hits" for promotion
*/
uint pagacache_pagelevel(PAGECACHE_BLOCK_LINK *block)
uint pagecache_pagelevel(PAGECACHE_BLOCK_LINK *block)
{
return block->hits_left;
}
......
......@@ -300,7 +300,7 @@ extern my_bool pagecache_collect_changed_blocks_with_lsn(PAGECACHE *pagecache,
extern int reset_pagecache_counters(const char *name, PAGECACHE *pagecache);
extern uchar *pagecache_block_link_to_buffer(PAGECACHE_BLOCK_LINK *block);
extern uint pagacache_pagelevel(PAGECACHE_BLOCK_LINK *block);
extern uint pagecache_pagelevel(PAGECACHE_BLOCK_LINK *block);
extern void pagecache_add_level_by_link(PAGECACHE_BLOCK_LINK *block,
uint level);
......
......@@ -784,14 +784,12 @@ get_one_option(int optid,
else
check_param.testflag|= T_ZEROFILL;
break;
#ifdef IDENTICAL_PAGES_AFTER_RECOVERY
case OPT_ZEROFILL_KEEP_LSN:
if (argument == disabled_my_option)
check_param.testflag&= ~(T_ZEROFILL_KEEP_LSN | T_ZEROFILL);
else
check_param.testflag|= (T_ZEROFILL_KEEP_LSN | T_ZEROFILL);
break;
#endif
case 'H':
my_print_help(my_long_options);
exit(0);
......
......@@ -91,18 +91,6 @@ sub main
mkdir $tmp;
}
print "MARIA RECOVERY TESTS\n";
$res= `$maria_exe_path/maria_read_log$suffix --help | grep IDENTICAL_PAGES_AFTER_RECOVERY`;
if (length($res))
{
print "Recovery tests require compilation with DBUG\n";
print "Aborting test\n";
# In the future, we will not abort but use maria_chk --zerofill-keep-lsn
# for comparisons in non-debug builds.
# For now we just skip the test, pretending it passed (nothing is
# alarming).
exit(0);
}
# To not flood the screen, we redirect all the commands below to a text file
# and just give a final error if their output is not as expected
......@@ -399,7 +387,6 @@ sub physical_cmp
my ($table1, $table2)= @_;
my ($zerofilled, $ret_text)= (0, "");
#return `cmp $table1.MAD $table2.MAD`.`cmp $table1.MAI $table2.MAI`;
# save original tables to restore them later
foreach my $file_suffix ("MAD", "MAI")
{
my $file1= "$table1.$file_suffix";
......@@ -415,6 +402,7 @@ sub physical_cmp
my $table_no= 1;
foreach my $table ($table1, $table2)
{
# save original tables to restore them later
copy("$table.MAD", "$tmp/before_zerofill$table_no.MAD") || die();
copy("$table.MAI", "$tmp/before_zerofill$table_no.MAI") || die();
$com= "$maria_exe_path/maria_chk$suffix -s --zerofill-keep-lsn $table";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment