List:Commits« Previous MessageNext Message »
From:Guilhem Bichot Date:February 11 2008 3:36pm
Subject:bk commit into maria tree (guilhem:1.2585)
View as plain text  
Below is the list of changes that have just been committed into a local
maria repository of guilhem.  When guilhem does a push these changes
will be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2008-02-11 16:36:34+01:00, guilhem@stripped +3 -0
  A new option for maria_chk: --zerofill-keep-lsn. This will be used
  by ma_test_recovery.pl when it happens that Recovery does not recreate
  pages exactly as they were at first run: this option will help us
  verify that the differences are in unimportant page pieces (those pieces
  will be zeroed by --zerofill-keep-lsn, but not the important LSNs).

  include/myisamchk.h@stripped, 2008-02-11 16:36:31+01:00, guilhem@stripped +1 -0
    new zerofill flag for maria_chk

  storage/maria/ma_check.c@stripped, 2008-02-11 16:36:31+01:00, guilhem@stripped +23 -11
    If T_ZEROFILL_KEEP_LSN, we don't zero out LSNs of data/index pages.
    Then the table is not movable. We still mark it zerofilled, it helps
    to know what was last done to the table.

  storage/maria/maria_chk.c@stripped, 2008-02-11 16:36:32+01:00, guilhem@stripped +22 -2
    New option --zerofill-keep-lsn

diff -Nrup a/include/myisamchk.h b/include/myisamchk.h
--- a/include/myisamchk.h	2008-01-17 23:57:31 +01:00
+++ b/include/myisamchk.h	2008-02-11 16:36:31 +01:00
@@ -60,6 +60,7 @@
 #define T_WAIT_FOREVER          (1L << 30)
 #define T_WRITE_LOOP            ((ulong) 1L << 31)
 #define T_ZEROFILL              ((ulonglong) 1L << 32)
+#define T_ZEROFILL_KEEP_LSN     ((ulonglong) 1L << 33)
 /** If repair should not bump create_rename_lsn */
 #define T_NO_CREATE_RENAME_LSN  ((ulonglong) 1L << 33)
 
diff -Nrup a/storage/maria/ma_check.c b/storage/maria/ma_check.c
--- a/storage/maria/ma_check.c	2008-02-07 23:23:59 +01:00
+++ b/storage/maria/ma_check.c	2008-02-11 16:36:31 +01:00
@@ -2952,7 +2952,8 @@ static my_bool maria_zerofill_index(HA_C
   my_off_t pos;
   my_off_t key_file_length= share->state.state.key_file_length;
   uint block_size= share->block_size;
-  my_bool transactional= share->base.born_transactional;
+  my_bool zero_lsn= share->base.born_transactional &&
+    !(param->testflag & T_ZEROFILL_KEEP_LSN);
   DBUG_ENTER("maria_zerofill_index");
 
   if (!(param->testflag & T_SILENT))
@@ -2979,7 +2980,7 @@ static my_bool maria_zerofill_index(HA_C
                             llstr(pos, llbuff), my_errno);
       DBUG_RETURN(1);
     }
-    if (transactional)
+    if (zero_lsn)
       bzero(buff, LSN_SIZE);
     length= _ma_get_page_used(share, buff);
     /* Skip mailformed blocks */
@@ -3021,6 +3022,7 @@ static my_bool maria_zerofill_data(HA_CH
   pgcache_page_no_t page;
   uint block_size= share->block_size;
   MARIA_FILE_BITMAP *bitmap= &share->bitmap;
+  my_bool zero_lsn= !(param->testflag & T_ZEROFILL_KEEP_LSN);
   DBUG_ENTER("maria_zerofill_data");
 
   /* This works only with BLOCK_RECORD files */
@@ -3055,16 +3057,23 @@ static my_bool maria_zerofill_data(HA_CH
     page_type= buff[PAGE_TYPE_OFFSET] & PAGE_TYPE_MASK;
     switch ((enum en_page_type) page_type) {
     case UNALLOCATED_PAGE:
-      bzero(buff, block_size);
+      if (zero_lsn)
+        bzero(buff, block_size);
+      else
+        bzero(buff + LSN_SIZE, block_size - LSN_SIZE);
       break;
     case BLOB_PAGE:
       if (_ma_bitmap_get_page_bits(info, bitmap, page) == 0)
       {
         /* Unallocated page */
-        bzero(buff, block_size);
+        if (zero_lsn)
+          bzero(buff, block_size);
+        else
+          bzero(buff + LSN_SIZE, block_size - LSN_SIZE);
       }
       else
-        bzero(buff, LSN_SIZE);
+        if (zero_lsn)
+          bzero(buff, LSN_SIZE);
       break;
     case HEAD_PAGE:
     case TAIL_PAGE:
@@ -3073,7 +3082,8 @@ static my_bool maria_zerofill_data(HA_CH
       uint offset, dir_start;
       uchar *dir;
 
-      bzero(buff, LSN_SIZE);
+      if (zero_lsn)
+        bzero(buff, LSN_SIZE);
       if (max_entry != 0)
       {
         dir= dir_entry_pos(buff, block_size, max_entry - 1);
@@ -3123,7 +3133,8 @@ err:
 
 int maria_zerofill(HA_CHECK *param, MARIA_HA *info, const char *name)
 {
-  my_bool error, reenable_logging;
+  my_bool error, reenable_logging,
+    zero_lsn= !(param->testflag & T_ZEROFILL_KEEP_LSN);
   DBUG_ENTER("maria_zerofill");
   if ((reenable_logging= info->s->now_transactional))
     _ma_tmp_disable_logging_for_table(info, 0);
@@ -3132,11 +3143,12 @@ int maria_zerofill(HA_CHECK *param, MARI
                 _ma_set_uuid(info, 0))))
   {
     /*
-      Mark that table is movable and that we have done zerofill of data and
-      index
+      Mark that we have done zerofill of data and index. If we zeroed pages'
+      LSN, table is movable.
     */
-    info->s->state.changed&= ~(STATE_NOT_ZEROFILLED | STATE_NOT_MOVABLE |
-                               STATE_MOVED);
+    info->s->state.changed&= ~STATE_NOT_ZEROFILLED;
+    if (zero_lsn)
+      info->s->state.changed&= ~(STATE_NOT_MOVABLE | STATE_MOVED);
     /* Ensure state are flushed to disk */
     info->update= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED);
   }
diff -Nrup a/storage/maria/maria_chk.c b/storage/maria/maria_chk.c
--- a/storage/maria/maria_chk.c	2008-01-31 02:11:06 +01:00
+++ b/storage/maria/maria_chk.c	2008-02-11 16:36:32 +01:00
@@ -183,7 +183,7 @@ enum options_mc {
   OPT_SORT_KEY_BLOCKS, OPT_DECODE_BITS, OPT_FT_MIN_WORD_LEN,
   OPT_FT_MAX_WORD_LEN, OPT_FT_STOPWORD_FILE,
   OPT_MAX_RECORD_LENGTH, OPT_AUTO_CLOSE, OPT_STATS_METHOD, OPT_TRANSACTION_LOG,
-  OPT_SKIP_SAFEMALLOC
+  OPT_SKIP_SAFEMALLOC, OPT_ZEROFILL_KEEP_LSN
 };
 
 static struct my_option my_long_options[] =
@@ -375,6 +375,12 @@ 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",
+#endif
+    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
   { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
 
@@ -505,7 +511,13 @@ 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.");
+  -z,  --zerofill     Fill empty space in data and index files with zeroes"
+#ifdef IDENTICAL_PAGES_AFTER_RECOVERY
+"\n\
+  --zerofill-keep-lsn Like --zerofill but does not zero out LSN of\n\
+                      data/index pages; used only for testing and debugging"
+#endif
+       ".");
 
   print_defaults("my", load_default_groups);
   my_print_variables(my_long_options);
@@ -778,6 +790,14 @@ 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);
Thread
bk commit into maria tree (guilhem:1.2585)Guilhem Bichot11 Feb