[Commits] Rev 2929: Pulled in the latest changes in 5.1. in file:///home/igor/maria/maria-5.1-bug49322/

igor at askmonty.org igor at askmonty.org
Sun Sep 12 23:01:32 EEST 2010


At file:///home/igor/maria/maria-5.1-bug49322/

------------------------------------------------------------
revno: 2929 [merge]
revision-id: igor at askmonty.org-20100912200131-ywgcofz3kv8rsxvb
parent: igor at askmonty.org-20100910041601-vgnr7kxyl2fr62wv
parent: monty at askmonty.org-20100910202726-yic84gpzydgijhqa
committer: Igor Babaev <igor at askmonty.org>
branch nick: maria-5.1-bug49322
timestamp: Sun 2010-09-12 13:01:31 -0700
message:
  Pulled in the latest changes in 5.1.
modified:
  dbug/remove_function_from_trace.pl sp1f-remove_function_from-20071230184733-2egx7pjrv4l24265blcnxxqhfdkroy5c
  storage/maria/ha_maria.cc      sp1f-ha_maria.cc-20060411134405-dmngb4v5x5fxlxhff527ud3etiutxuxk
  storage/maria/ma_bitmap.c      sp1f-ma_bitmap.c-20070118193810-dcdqg6iu32wkt3pqyio4lqdqmaff2m7g
  storage/maria/ma_blockrec.c    sp1f-ma_blockrec.c-20070118193810-5wtbfa4irhu4voa3diiuus5km2j6jvlv
  storage/maria/ma_blockrec.h    sp1f-ma_blockrec.h-20070118193810-dmnsyug4lezfuzknreqy4jntnozdnvsc
  storage/maria/ma_check.c       sp1f-ma_check.c-20060411134408-m5d5jao4sr32xsjjkig2uhdndqm5cgba
  storage/maria/ma_open.c        sp1f-ma_open.c-20060411134425-47m3424sotlyyl5b3k5brotxm23ryffh
  storage/maria/ma_recovery.c    sp1f-recovery.c-20060427140636-kkuwrxyvjp42wmupdfbxuaro456oprrg
  storage/maria/maria_chk.c      sp1f-maria_chk.c-20060411134451-6qsrwbln6zdm4nv27ftocrv6iqdyhlti
  storage/maria/maria_def.h      sp1f-maria_def.h-20060411134454-urdx4joxwcwzxbmltpzejn53y2rgjs44
  storage/maria/trnman.c         sp1f-trxman.c-20060816182810-j2a3jdxiefkpc62ad3xtioi44dbmr3dv
-------------- next part --------------
=== 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 @@
 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/ha_maria.cc'
--- a/storage/maria/ha_maria.cc	2010-09-07 10:59:34 +0000
+++ b/storage/maria/ha_maria.cc	2010-09-10 20:27:26 +0000
@@ -2006,14 +2006,16 @@
 
   check_opt.init();
 
-  if (file->s->state.changed & STATE_MOVED)
+  error= 1;
+  if ((file->s->state.changed &
+       (STATE_CRASHED | STATE_CRASHED_ON_REPAIR | STATE_MOVED)) ==
+      STATE_MOVED)
   {
-    sql_print_information("Zerofilling table:   '%s'", table->s->path.str);
+    sql_print_information("Zerofilling moved table:  '%s'",
+                          table->s->path.str);
     if (!(error= zerofill(thd, &check_opt)))
       DBUG_RETURN(0);
   }
-  else
-    error= 1;
 
   /*
     if we got this far - the table is crashed.

=== 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 @@
   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 @@
   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 @@
                                            &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_blockrec.c'
--- a/storage/maria/ma_blockrec.c	2010-09-08 23:01:05 +0000
+++ b/storage/maria/ma_blockrec.c	2010-09-10 20:27:26 +0000
@@ -742,8 +742,8 @@
    @return 1	There is room for more entries on the page
 */
 
-static my_bool enough_free_entries_on_page(MARIA_SHARE *share,
-                                           uchar *page_buff)
+my_bool enough_free_entries_on_page(MARIA_SHARE *share,
+                                    uchar *page_buff)
 {
   enum en_page_type page_type;
   page_type= (enum en_page_type) (page_buff[PAGE_TYPE_OFFSET] &

=== modified file 'storage/maria/ma_blockrec.h'
--- a/storage/maria/ma_blockrec.h	2010-06-13 22:13:32 +0000
+++ b/storage/maria/ma_blockrec.h	2010-09-10 20:27:26 +0000
@@ -176,6 +176,7 @@
 void    _ma_compact_block_page(uchar *buff, uint block_size, uint rownr,
                                my_bool extend_block, TrID min_read_from,
                                uint min_row_length);
+my_bool enough_free_entries_on_page(MARIA_SHARE *share, uchar *page_buff);
 TRANSLOG_ADDRESS
 maria_page_get_lsn(uchar *page, pgcache_page_no_t page_no, uchar* data_ptr);
 

=== 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-10 20:27:26 +0000
@@ -1760,7 +1760,7 @@
             _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);
@@ -3376,7 +3376,7 @@
     case TAIL_PAGE:
     {
       uint max_entry= (uint) buff[DIR_COUNT_OFFSET];
-      uint offset, dir_start;
+      uint offset, dir_start, empty_space;
       uchar *dir;
 
       if (zero_lsn)
@@ -3389,9 +3389,13 @@
                                is_head_page ? ~(TrID) 0 : 0,
                                is_head_page ?
                                share->base.min_block_length : 0);
+
         /* compactation may have increased free space */
+        empty_space= uint2korr(buff + EMPTY_SPACE_OFFSET);
+        if (!enough_free_entries_on_page(share, buff))
+          empty_space= 0;                         /* Page is full */
         if (_ma_bitmap_set(info, page, is_head_page,
-                           uint2korr(buff + EMPTY_SPACE_OFFSET)))
+                           empty_space))
           goto err;
 
         /* Zerofill the not used part */

=== modified file 'storage/maria/ma_open.c'
--- a/storage/maria/ma_open.c	2010-09-05 23:25:44 +0000
+++ b/storage/maria/ma_open.c	2010-09-10 20:27:26 +0000
@@ -434,8 +434,14 @@
         share->base.born_transactional &&
         ((!(open_flags & HA_OPEN_IGNORE_MOVED_STATE) &&
           memcmp(share->base.uuid, maria_uuid, MY_UUID_SIZE)) ||
-         share->state.create_trid > trnman_get_max_trid()))
+         (share->state.create_trid > trnman_get_max_trid() &&
+          !maria_in_recovery)))
     {
+      DBUG_PRINT("warning", ("table is moved from another system.  uuid_diff: %d  create_trid: %lu  max_trid: %lu",
+                            memcmp(share->base.uuid, maria_uuid,
+                                   MY_UUID_SIZE) != 0,
+                             (ulong) share->state.create_trid,
+                             (ulong) trnman_get_max_trid()));
       if (open_flags & HA_OPEN_FOR_REPAIR)
         share->state.changed|= STATE_MOVED;
       else

=== 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-10 20:27:26 +0000
@@ -332,6 +332,8 @@
   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 @@
   }
 
   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
@@ -3315,7 +3321,12 @@
       state while they were used. As Recovery corrected them, don't alarm the
       user, don't ask for a table check:
     */
-    info->s->state.open_count= 0;
+    if (info->s->state.open_count != 0)
+    {
+      /* let ma_close() mark the table properly closed */
+      info->s->state.open_count= 1;
+      info->s->global_changed= 1;
+    }
     prepare_table_for_close(info, addr);
     error|= maria_close(info);
     pthread_mutex_lock(&THR_LOCK_maria);

=== modified file 'storage/maria/maria_chk.c'
--- a/storage/maria/maria_chk.c	2010-08-24 22:43:26 +0000
+++ b/storage/maria/maria_chk.c	2010-09-10 20:27:26 +0000
@@ -271,10 +271,10 @@
    &check_param.keys_in_use,
    0, GET_ULL, REQUIRED_ARG, -1, 0, 0, 0, 0, 0},
   {"datadir", OPT_DATADIR,
-   "Path for control file (and logs if --log-dir not used).",
+   "Path for control file (and logs if --logdir not used).",
    &maria_data_root, 0, 0, GET_STR, REQUIRED_ARG,
    0, 0, 0, 0, 0, 0},
-  {"log-dir", OPT_LOG_DIR,
+  {"logdir", OPT_LOG_DIR,
    "Path for log files.",
    (char**) &opt_log_dir, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"max-record-length", OPT_MAX_RECORD_LENGTH,
@@ -320,9 +320,6 @@
    "Change the collation used by the index",
    (char**) &set_collation_name, 0, 0, GET_STR, REQUIRED_ARG,
    0, 0, 0, 0, 0, 0},
-  {"set-variable", 'O',
-   "Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.",
-   0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"silent", 's',
    "Only print errors. One can use two -s to make maria_chk very silent.",
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -353,7 +350,7 @@
    "properly closed'",
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"unpack", 'u',
-   "Unpack file packed with mariapack.",
+   "Unpack file packed with maria_pack.",
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"verbose", 'v',
    "Print more information. This can be used with --description and --check. Use many -v for more verbosity!",
@@ -372,12 +369,14 @@
     &check_param.use_buffers, &check_param.use_buffers, 0,
     GET_ULONG, REQUIRED_ARG, (long) USE_BUFFER_INIT, 1024L*1024L,
     (long) ~0L, (long) MALLOC_OVERHEAD, (long) IO_SIZE, 0},
-  { "read_buffer_size", OPT_READ_BUFFER_SIZE, "",
+  { "read_buffer_size", OPT_READ_BUFFER_SIZE,
+    "Read buffer size for sequential reads during scanning",
     &check_param.read_buffer_length,
     &check_param.read_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
     (long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD,
     (long) ~0L, (long) MALLOC_OVERHEAD, (long) 1L, 0},
-  { "write_buffer_size", OPT_WRITE_BUFFER_SIZE, "",
+  { "write_buffer_size", OPT_WRITE_BUFFER_SIZE,
+    "Write buffer size for sequential writes during repair of fixed size or dynamic size rows",
     &check_param.write_buffer_length,
     &check_param.write_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
     (long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD,
@@ -388,7 +387,8 @@
     &check_param.sort_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
     (long) SORT_BUFFER_INIT, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD),
     (long) ~0L, (long) MALLOC_OVERHEAD, (long) 1L, 0},
-  { "sort_key_blocks", OPT_SORT_KEY_BLOCKS, "",
+  { "sort_key_blocks", OPT_SORT_KEY_BLOCKS,
+    "Internal buffer for sorting keys; Don't touch :)",
     &check_param.sort_key_blocks,
     &check_param.sort_key_blocks, 0, GET_ULONG, REQUIRED_ARG,
     BUFFERS_WHEN_SORTING, 4L, 100L, 0L, 1L, 0},
@@ -411,7 +411,7 @@
     (char**) &maria_stats_method_str, (char**) &maria_stats_method_str, 0,
     GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   { "zerofill", 'z',
-    "Fill empty space in data and index files with zeroes",
+    "Fill empty space in data and index files with zeroes,",
     0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
   { "zerofill-keep-lsn", OPT_ZEROFILL_KEEP_LSN,
     "Like --zerofill but does not zero out LSN of data/index pages;"
@@ -447,10 +447,12 @@
   printf("\
   -H, --HELP          Display this help and exit.\n\
   -?, --help          Display this help and exit.\n\
-  -O, --set-variable var=option.\n\
-                      Change the value of a variable. Please note that\n\
-                      this option is deprecated; you can set variables\n\
-                      directly with '--variable-name=value'.\n\
+  --datadir=path      Path for control file (and logs if --logdir not used)\n\
+  --logdir=path       Path for log files\n\
+  --require-control-file  Abort if we can't find/read the maria_log_control\n\
+                          file\n\
+  -s, --silent	      Only print errors.  One can use two -s to make\n\
+		      maria_chk very silent.\n\
   -t, --tmpdir=path   Path for temporary files. Multiple paths can be\n\
                       specified, separated by ");
 #if defined( __WIN__) || defined(__NETWARE__)
@@ -458,12 +460,8 @@
 #else
    printf("colon (:)");
 #endif
-                      printf(", they will be used\n\
+   printf(", they will be used\n\
                       in a round-robin fashion.\n\
-  --require-control-file  Abort if we can't find/read the maria_log_control\n\
-                          file\n\
-  -s, --silent	      Only print errors.  One can use two -s to make\n\
-		      maria_chk very silent.\n\
   -v, --verbose       Print more information. This can be used with\n\
                       --description and --check. Use many -v for more verbosity.\n\
   -V, --version       Print version and exit.\n\
@@ -485,10 +483,11 @@
   -i, --information   Print statistics information about table that is checked.\n\
   -m, --medium-check  Faster than extend-check, but only finds 99.99% of\n\
 		      all errors.  Should be good enough for most cases.\n\
-  -U  --update-state  Mark tables as crashed if you find any errors.\n\
+  -U, --update-state  Mark tables as crashed if you find any errors.\n\
   -T, --read-only     Don't mark table as checked.\n");
 
-  puts("Recover (repair)/ options (When using '-r' or '-o'):\n\
+  puts("\
+Recover (repair)/ options (When using '--recover' or '--safe-recover'):\n\
   -B, --backup	      Make a backup of the .MAD file as 'filename-time.BAK'.\n\
   --correct-checksum  Correct checksum information for table.\n\
   -D, --data-file-length=#  Max length of data file (when recreating data\n\
@@ -531,7 +530,7 @@
 
   puts("Other actions:\n\
   -a, --analyze	      Analyze distribution of keys. Will make some joins in\n\
-		      MySQL faster.  You can check the calculated distribution\n\
+		      MariaDB faster.  You can check the calculated distribution\n\
 		      by using '--description --verbose table_name'.\n\
   --stats_method=name Specifies how index statistics collection code should\n\
                       treat NULLs. Possible values of name are \"nulls_unequal\"\n\
@@ -554,6 +553,13 @@
   --zerofill-keep-lsn Like --zerofill but does not zero out LSN of\n\
                       data/index pages.");
 
+  puts("Variables:\n\
+--page_buffer_size=#   Size of page buffer. Used by --safe-repair\n\
+--read_buffer_size=#   Read buffer size for sequential reads during scanning\n\
+--sort_buffer_size=#   Size of sort buffer. Used by --recover\n\
+--sort_key_blocks=#    Internal buffer for sorting keys; Don't touch :)\n\
+--write_buffer_size=#  Write buffer size for sequential writes during repair");
+
   print_defaults("my", load_default_groups);
   my_print_variables(my_long_options);
 }

=== 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 @@
   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 */

=== modified file 'storage/maria/trnman.c'
--- a/storage/maria/trnman.c	2010-09-05 23:25:44 +0000
+++ b/storage/maria/trnman.c	2010-09-10 20:27:26 +0000
@@ -145,6 +145,7 @@
 int trnman_init(TrID initial_trid)
 {
   DBUG_ENTER("trnman_init");
+  DBUG_PRINT("enter", ("initial_trid: %lu", (ulong) initial_trid));
 
   short_trid_to_active_trn= (TRN **)my_malloc(SHORT_TRID_MAX*sizeof(TRN*),
                                      MYF(MY_WME|MY_ZEROFILL));



More information about the commits mailing list