[Commits] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (monty:2928)

Michael Widenius monty at askmonty.org
Fri Sep 10 02:42:15 EEST 2010


#At lp:maria based on revid:monty at askmonty.org-20100909151206-t637re7bm2fporr3

 2928 Michael Widenius	2010-09-10
      Fixed bug LP#605798 "wrong data in bitmap" after recovery.
      Extend remove_function_from_trace.pl to work with many threads (patch from Sergei)
      modified:
        dbug/remove_function_from_trace.pl
        storage/maria/ma_bitmap.c
        storage/maria/ma_check.c
        storage/maria/ma_recovery.c
        storage/maria/maria_def.h

per-file messages:
  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
=== modified file 'dbug/remove_function_from_trace.pl'
--- a/dbug/remove_function_from_trace.pl	2007-12-30 18:47:36 +0000
+++ b/dbug/remove_function_from_trace.pl	2010-09-09 23:42:12 +0000
@@ -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 befor
 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;
 }

=== modified file 'storage/maria/ma_bitmap.c'
--- a/storage/maria/ma_bitmap.c	2010-09-07 16:58:39 +0000
+++ b/storage/maria/ma_bitmap.c	2010-09-09 23:42:12 +0000
@@ -147,6 +147,12 @@ static inline my_bool write_changed_bitm
   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
   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
                                            &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

=== modified file 'storage/maria/ma_check.c'
--- a/storage/maria/ma_check.c	2010-09-05 23:25:44 +0000
+++ b/storage/maria/ma_check.c	2010-09-09 23:42:12 +0000
@@ -1760,7 +1760,7 @@ static my_bool check_head_page(HA_CHECK
             _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);

=== modified file 'storage/maria/ma_recovery.c'
--- a/storage/maria/ma_recovery.c	2010-09-09 15:12:06 +0000
+++ b/storage/maria/ma_recovery.c	2010-09-09 23:42:12 +0000
@@ -332,6 +332,8 @@ int maria_apply_log(LSN from_lsn, LSN en
   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

=== modified file 'storage/maria/maria_def.h'
--- a/storage/maria/maria_def.h	2010-09-05 23:25:44 +0000
+++ b/storage/maria/maria_def.h	2010-09-09 23:42:12 +0000
@@ -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 */



More information about the commits mailing list