mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Fixed bug LP#605798 "wrong data in bitmap" after recovery.
Extend remove_function_from_trace.pl to work with many threads (patch from Sergei) dbug/remove_function_from_trace.pl: Extend remove_function_from_trace.pl to work with many threads (patch from Sergei) storage/maria/ma_bitmap.c: Added marker that table had changed since last checkpoint. This ensures that we will flush all bitmap pages from cache at checkpoint. This fixes bug LP#605798 "wrong data in bitmap" after recovery. storage/maria/ma_check.c: Cleaned up error output storage/maria/ma_recovery.c: Cleaned up error output storage/maria/maria_def.h: Added changed_not_flushed
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
|
||||
die <<EEE unless @ARGV;
|
||||
Usage: $0 func1 [func2 [ ...] ]
|
||||
|
||||
@ -11,16 +10,16 @@ DBUG_ENTER() and DBUG_POP(); right before DBUG_RETURN in every such a function.
|
||||
EEE
|
||||
|
||||
$re=join('|', @ARGV);
|
||||
$skip='';
|
||||
|
||||
while(<STDIN>) {
|
||||
print unless $skip;
|
||||
($thd) = /^(T@\d+)/;
|
||||
print unless $skip{$thd};
|
||||
next unless /^(?:.*: )*((?:\| )*)([<>])($re)\n/o;
|
||||
if ($2 eq '>') {
|
||||
$skip=$1.$3 unless $skip;
|
||||
$skip{$thd}=$1.$3 unless $skip{$thd};
|
||||
next;
|
||||
}
|
||||
next if $skip ne $1.$3;
|
||||
$skip='';
|
||||
next if $skip{$thd} ne $1.$3;
|
||||
delete $skip{$thd};
|
||||
print;
|
||||
}
|
||||
|
@ -147,6 +147,12 @@ static inline my_bool write_changed_bitmap(MARIA_SHARE *share,
|
||||
DBUG_ASSERT(bitmap->file.write_callback != 0);
|
||||
DBUG_PRINT("info", ("bitmap->non_flushable: %u", bitmap->non_flushable));
|
||||
|
||||
/*
|
||||
Mark that a bitmap page has been written to page cache and we have
|
||||
to flush it during checkpoint.
|
||||
*/
|
||||
bitmap->changed_not_flushed= 1;
|
||||
|
||||
if ((bitmap->non_flushable == 0)
|
||||
#ifdef WRONG_BITMAP_FLUSH
|
||||
|| 1
|
||||
@ -347,7 +353,7 @@ my_bool _ma_bitmap_flush_all(MARIA_SHARE *share)
|
||||
MARIA_FILE_BITMAP *bitmap= &share->bitmap;
|
||||
DBUG_ENTER("_ma_bitmap_flush_all");
|
||||
pthread_mutex_lock(&bitmap->bitmap_lock);
|
||||
if (bitmap->changed)
|
||||
if (bitmap->changed || bitmap->changed_not_flushed)
|
||||
{
|
||||
bitmap->flush_all_requested= TRUE;
|
||||
#ifndef WRONG_BITMAP_FLUSH
|
||||
@ -384,6 +390,7 @@ my_bool _ma_bitmap_flush_all(MARIA_SHARE *share)
|
||||
&bitmap->pages_covered) &
|
||||
PCFLUSH_PINNED_AND_ERROR)
|
||||
res= TRUE;
|
||||
bitmap->changed_not_flushed= FALSE;
|
||||
bitmap->flush_all_requested= FALSE;
|
||||
/*
|
||||
Some well-behaved threads may be waiting for flush_all_requested to
|
||||
|
@ -1760,7 +1760,7 @@ static my_bool check_head_page(HA_CHECK *param, MARIA_HA *info, uchar *record,
|
||||
_ma_check_print_error(param,
|
||||
"Page %9s: Row: %3d has an extent with "
|
||||
"wrong information in bitmap: "
|
||||
"Page %9s Page_type: %d Bitmap: %d",
|
||||
"Page: %9s Page_type: %d Bitmap: %d",
|
||||
llstr(page, llbuff), row,
|
||||
llstr(extent_page, llbuff2),
|
||||
page_type, bitmap_pattern);
|
||||
|
@ -332,6 +332,8 @@ int maria_apply_log(LSN from_lsn, LSN end_lsn,
|
||||
if (end_lsn != LSN_IMPOSSIBLE)
|
||||
{
|
||||
abort_message_printed= 1;
|
||||
if (!trace_file)
|
||||
fputc('\n', stderr);
|
||||
my_message(HA_ERR_INITIALIZATION,
|
||||
"Maria recovery aborted as end_lsn/end of file was reached",
|
||||
MYF(0));
|
||||
@ -502,9 +504,13 @@ end:
|
||||
}
|
||||
|
||||
if (error && !abort_message_printed)
|
||||
{
|
||||
if (!trace_file)
|
||||
fputc('\n', stderr);
|
||||
my_message(HA_ERR_INITIALIZATION,
|
||||
"Maria recovery failed. Please run maria_chk -r on all maria "
|
||||
"tables and delete all maria_log.######## files", MYF(0));
|
||||
}
|
||||
procent_printed= 0;
|
||||
/*
|
||||
We don't cleanly close tables if we hit some error (may corrupt them by
|
||||
|
@ -244,7 +244,8 @@ typedef struct st_maria_file_bitmap
|
||||
uchar *map;
|
||||
pgcache_page_no_t page; /* Page number for current bitmap */
|
||||
uint used_size; /* Size of bitmap head that is not 0 */
|
||||
my_bool changed; /* 1 if page needs to be flushed */
|
||||
my_bool changed; /* 1 if page needs to be written */
|
||||
my_bool changed_not_flushed; /* 1 if some bitmap is not flushed */
|
||||
my_bool flush_all_requested; /**< If _ma_bitmap_flush_all waiting */
|
||||
uint non_flushable; /**< 0 if bitmap and log are in sync */
|
||||
PAGECACHE_FILE file; /* datafile where bitmap is stored */
|
||||
|
Reference in New Issue
Block a user