]> git.pld-linux.org Git - packages/mysql.git/commitdiff
- up to 5.5.13 auto/th/mysql-5_5_13-1
authorArkadiusz Miśkiewicz <arekm@maven.pl>
Sat, 25 Jun 2011 15:06:50 +0000 (15:06 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    control_online_alter_index.patch -> 1.5
    file-contents.patch -> 1.1
    innodb_adaptive_hash_index_partitions.patch -> 1.6
    innodb_admin_command_base.patch -> 1.5
    innodb_buffer_pool_pages_i_s.patch -> 1.6
    innodb_buffer_pool_shm.patch -> 1.6
    innodb_deadlock_count.patch -> 1.6
    innodb_dict_size_limit.patch -> 1.5
    innodb_expand_fast_index_creation.patch -> 1.2
    innodb_expand_import.patch -> 1.6
    innodb_extend_slow.patch -> 1.5
    innodb_extra_rseg.patch -> 1.5
    innodb_fast_checksum.patch -> 1.6
    innodb_files_extend.patch -> 1.6
    innodb_fix_misc.patch -> 1.6
    innodb_io_patches.patch -> 1.5
    innodb_lru_dump_restore.patch -> 1.6
    innodb_opt_lru_count.patch -> 1.4
    innodb_overwrite_relay_log_info.patch -> 1.6
    innodb_pass_corrupt_table.patch -> 1.6
    innodb_recovery_patches.patch -> 1.6
    innodb_separate_doublewrite.patch -> 1.6
    innodb_show_lock_name.patch -> 1.5
    innodb_show_status.patch -> 1.5
    innodb_show_status_extend.patch -> 1.6
    innodb_show_sys_tables.patch -> 1.5
    innodb_split_buf_pool_mutex.patch -> 1.5
    innodb_stats.patch -> 1.6
    innodb_thread_concurrency_timer_based.patch -> 1.5
    log_connection_error.patch -> 1.5
    log_warnings_suppress.patch -> 1.4
    microsec_process.patch -> 1.4
    mysql.spec -> 1.551
    mysql_dump_ignore_ct.patch -> 1.5
    mysql_remove_eol_carret.patch -> 1.4
    mysql_syslog.patch -> 1.5
    optimizer_fix.patch -> 1.5
    percona_support.patch -> 1.2
    processlist_row_stats.patch -> 1.2
    query_cache_enhance.patch -> 1.6
    response_time_distribution.patch -> 1.5
    show_slave_status_nolock.patch -> 1.5
    show_temp.patch -> 1.5
    slave_timeout_fix.patch -> 1.1
    slow_extended.patch -> 1.6
    sql_no_fcache.patch -> 1.5
    userstat.patch -> 1.6

47 files changed:
control_online_alter_index.patch
file-contents.patch [new file with mode: 0644]
innodb_adaptive_hash_index_partitions.patch
innodb_admin_command_base.patch
innodb_buffer_pool_pages_i_s.patch
innodb_buffer_pool_shm.patch
innodb_deadlock_count.patch
innodb_dict_size_limit.patch
innodb_expand_fast_index_creation.patch
innodb_expand_import.patch
innodb_extend_slow.patch
innodb_extra_rseg.patch
innodb_fast_checksum.patch
innodb_files_extend.patch
innodb_fix_misc.patch
innodb_io_patches.patch
innodb_lru_dump_restore.patch
innodb_opt_lru_count.patch
innodb_overwrite_relay_log_info.patch
innodb_pass_corrupt_table.patch
innodb_recovery_patches.patch
innodb_separate_doublewrite.patch
innodb_show_lock_name.patch
innodb_show_status.patch
innodb_show_status_extend.patch
innodb_show_sys_tables.patch
innodb_split_buf_pool_mutex.patch
innodb_stats.patch
innodb_thread_concurrency_timer_based.patch
log_connection_error.patch
log_warnings_suppress.patch
microsec_process.patch
mysql.spec
mysql_dump_ignore_ct.patch
mysql_remove_eol_carret.patch
mysql_syslog.patch
optimizer_fix.patch
percona_support.patch
processlist_row_stats.patch
query_cache_enhance.patch
response_time_distribution.patch
show_slave_status_nolock.patch
show_temp.patch
slave_timeout_fix.patch [new file with mode: 0644]
slow_extended.patch
sql_no_fcache.patch
userstat.patch

index 5c72e03a67d918e95d50e44078c6d2ad0a99d2df..1f5615241b7944fcf1c3d49cd5320e1f7be41948 100644 (file)
@@ -8,7 +8,7 @@
 diff -ruN a/sql/handler.h b/sql/handler.h
 --- a/sql/handler.h    2010-11-03 07:01:14.000000000 +0900
 +++ b/sql/handler.h    2010-12-03 13:51:04.727293058 +0900
-@@ -203,6 +203,8 @@
+@@ -205,6 +205,8 @@
  #define HA_INPLACE_DROP_UNIQUE_INDEX_NO_WRITE      (1L << 9)
  #define HA_INPLACE_ADD_PK_INDEX_NO_WRITE           (1L << 10)
  #define HA_INPLACE_DROP_PK_INDEX_NO_WRITE          (1L << 11)
@@ -49,7 +49,7 @@ diff -ruN a/sql/sql_partition.cc b/sql/sql_partition.cc
 diff -ruN a/sql/sql_table.cc b/sql/sql_table.cc
 --- a/sql/sql_table.cc 2010-11-03 07:01:14.000000000 +0900
 +++ b/sql/sql_table.cc 2010-12-03 13:51:04.768955495 +0900
-@@ -6117,6 +6117,10 @@
+@@ -6112,6 +6112,10 @@
      uint  *idx_end_p;
  
      alter_flags= table->file->alter_table_flags(alter_info->flags);
@@ -63,7 +63,7 @@ diff -ruN a/sql/sql_table.cc b/sql/sql_table.cc
 diff -ruN a/sql/sys_vars.cc b/sql/sys_vars.cc
 --- a/sql/sys_vars.cc  2010-12-02 21:23:05.569356468 +0900
 +++ b/sql/sys_vars.cc  2010-12-03 14:05:28.857356603 +0900
-@@ -2150,6 +2150,13 @@
+@@ -2186,6 +2186,13 @@
         GLOBAL_VAR(opt_optimizer_fix),
         NO_CMD_LINE, DEFAULT(TRUE));
  
diff --git a/file-contents.patch b/file-contents.patch
new file mode 100644 (file)
index 0000000..0a280ba
--- /dev/null
@@ -0,0 +1,25 @@
+--- a/mysql-test/t/file_contents.test
++++ b/mysql-test/t/file_contents.test
+@@ -20,7 +20,7 @@ if ($dir_bin =~ m|/usr/|) {
+     $dir_docs = "$dir_docs/packages/MySQL-server";
+   } else {
+     # RedHat: version number in directory name
+-    $dir_docs = glob "$dir_docs/MySQL-server*";
++    $dir_docs = glob "$dir_docs/Percona-Server-server*";
+   }
+ } elsif ($dir_bin =~ m|/usr$|) {
+   # RPM build during development
+@@ -28,9 +28,12 @@ if ($dir_bin =~ m|/usr/|) {
+   if(-d "$dir_docs/packages/MySQL-server") {
+     # SuSE
+     $dir_docs = "$dir_docs/packages/MySQL-server";
++  } elsif (glob "$dir_docs/percona-server-server*") {
++    # Debian
++    $dir_docs = glob "$dir_docs/percona-server-server*";
+   } else {
+     # RedHat: version number in directory name
+-    $dir_docs = glob "$dir_docs/MySQL-server*";
++    $dir_docs = glob "$dir_docs/Percona-Server-server*";
+   }
+ } else {
+   # tar.gz package, Windows, or developer work (in BZR)
index e76cc93932935c1ff090ae982f784725f72233c2..1c181275c23ee3d46a5a73d63a68419724d5334d 100644 (file)
@@ -262,7 +262,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
  }
  
  /*****************************************************************//**
-@@ -195,11 +211,20 @@
+@@ -195,11 +211,22 @@
  btr_search_sys_free(void)
  /*=====================*/
  {
@@ -281,6 +281,8 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
 +
 +              mem_free(btr_search_latch_part[i]);
 +      }
++      mem_free(btr_search_sys->hash_index);
++      mem_free(btr_search_latch_part);
 +
 +      //rw_lock_free(&btr_search_latch);
 +      //mem_free(btr_search_latch_temp);
@@ -288,7 +290,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
        mem_free(btr_search_sys);
        btr_search_sys = NULL;
  }
-@@ -212,7 +237,7 @@
+@@ -212,7 +239,7 @@
  /*====================*/
  {
        mutex_enter(&btr_search_enabled_mutex);
@@ -297,7 +299,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
  
        /* Disable access to hash index, also tell ha_insert_for_fold()
        stop adding new nodes to hash index, but still allow updating
-@@ -230,7 +255,7 @@
+@@ -230,7 +257,7 @@
        /* btr_search_enabled_mutex should guarantee this. */
        ut_ad(!btr_search_enabled);
  
@@ -306,7 +308,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
        mutex_exit(&btr_search_enabled_mutex);
  }
  
-@@ -242,12 +267,12 @@
+@@ -242,12 +269,12 @@
  /*====================*/
  {
        mutex_enter(&btr_search_enabled_mutex);
@@ -321,7 +323,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
        mutex_exit(&btr_search_enabled_mutex);
  }
  
-@@ -300,20 +325,21 @@
+@@ -300,20 +327,21 @@
  ulint
  btr_search_info_get_ref_count(
  /*==========================*/
@@ -348,7 +350,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
  
        return(ret);
  }
-@@ -334,8 +360,8 @@
+@@ -334,8 +362,8 @@
        int             cmp;
  
  #ifdef UNIV_SYNC_DEBUG
@@ -359,7 +361,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
  #endif /* UNIV_SYNC_DEBUG */
  
        index = cursor->index;
-@@ -453,8 +479,8 @@
+@@ -453,8 +481,8 @@
                                /*!< in: cursor */
  {
  #ifdef UNIV_SYNC_DEBUG
@@ -370,7 +372,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
        ut_ad(rw_lock_own(&block->lock, RW_LOCK_SHARED)
              || rw_lock_own(&block->lock, RW_LOCK_EX));
  #endif /* UNIV_SYNC_DEBUG */
-@@ -538,7 +564,7 @@
+@@ -538,7 +566,7 @@
  
        ut_ad(cursor->flag == BTR_CUR_HASH_FAIL);
  #ifdef UNIV_SYNC_DEBUG
@@ -379,7 +381,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
        ut_ad(rw_lock_own(&(block->lock), RW_LOCK_SHARED)
              || rw_lock_own(&(block->lock), RW_LOCK_EX));
  #endif /* UNIV_SYNC_DEBUG */
-@@ -578,10 +604,10 @@
+@@ -578,10 +606,10 @@
                        mem_heap_free(heap);
                }
  #ifdef UNIV_SYNC_DEBUG
@@ -392,7 +394,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
                                   block, rec);
        }
  }
-@@ -601,8 +627,8 @@
+@@ -601,8 +629,8 @@
        ulint*          params2;
  
  #ifdef UNIV_SYNC_DEBUG
@@ -403,7 +405,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
  #endif /* UNIV_SYNC_DEBUG */
  
        block = btr_cur_get_block(cursor);
-@@ -623,7 +649,7 @@
+@@ -623,7 +651,7 @@
  
        if (build_index || (cursor->flag == BTR_CUR_HASH_FAIL)) {
  
@@ -412,7 +414,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
        }
  
        if (cursor->flag == BTR_CUR_HASH_FAIL) {
-@@ -633,11 +659,11 @@
+@@ -633,11 +661,11 @@
                btr_search_n_hash_fail++;
  #endif /* UNIV_SEARCH_PERF_STAT */
  
@@ -426,7 +428,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
        }
  
        if (build_index) {
-@@ -881,17 +907,17 @@
+@@ -881,17 +909,17 @@
        cursor->flag = BTR_CUR_HASH;
  
        if (UNIV_LIKELY(!has_search_latch)) {
@@ -448,7 +450,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
  
        if (UNIV_UNLIKELY(!rec)) {
                goto failure_unlock;
-@@ -909,7 +935,7 @@
+@@ -909,7 +937,7 @@
                        goto failure_unlock;
                }
  
@@ -457,7 +459,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
  
                buf_block_dbg_add_level(block, SYNC_TREE_NODE_FROM_HASH);
        }
-@@ -1006,7 +1032,7 @@
+@@ -1006,7 +1034,7 @@
        /*-------------------------------------------*/
  failure_unlock:
        if (UNIV_LIKELY(!has_search_latch)) {
@@ -466,7 +468,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
        }
  failure:
        cursor->flag = BTR_CUR_HASH_FAIL;
-@@ -1029,10 +1055,11 @@
+@@ -1029,10 +1057,11 @@
  void
  btr_search_drop_page_hash_index(
  /*============================*/
@@ -479,7 +481,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
  {
        hash_table_t*           table;
        ulint                   n_fields;
-@@ -1051,22 +1078,60 @@
+@@ -1051,22 +1080,60 @@
        ulint*                  offsets;
  
  #ifdef UNIV_SYNC_DEBUG
@@ -514,7 +516,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
 +              }
 +              if (UNIV_LIKELY(!block->is_hashed)) {
 +                      rw_lock_s_unlock(btr_search_latch);
-+                      return;
++                      goto retry;
 +              }
 +              index = block->index;
 +              ut_a(btr_search_latch == btr_search_get_latch(index->id));
@@ -545,7 +547,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
  
  #ifdef UNIV_SYNC_DEBUG
        ut_ad(rw_lock_own(&(block->lock), RW_LOCK_SHARED)
-@@ -1076,14 +1141,14 @@
+@@ -1076,14 +1143,14 @@
  
        n_fields = block->curr_n_fields;
        n_bytes = block->curr_n_bytes;
@@ -562,7 +564,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
  
        ut_a(n_fields + n_bytes > 0);
  
-@@ -1133,7 +1198,7 @@
+@@ -1133,7 +1200,7 @@
                mem_heap_free(heap);
        }
  
@@ -571,7 +573,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
  
        if (UNIV_UNLIKELY(!block->is_hashed)) {
                /* Someone else has meanwhile dropped the hash index */
-@@ -1149,7 +1214,7 @@
+@@ -1149,7 +1216,7 @@
                /* Someone else has meanwhile built a new hash index on the
                page, with different parameters */
  
@@ -580,7 +582,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
  
                mem_free(folds);
                goto retry;
-@@ -1165,6 +1230,7 @@
+@@ -1165,6 +1232,7 @@
  
        block->is_hashed = FALSE;
        block->index = NULL;
@@ -588,7 +590,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
        
  cleanup:
  #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
-@@ -1177,14 +1243,14 @@
+@@ -1177,14 +1245,14 @@
                        "InnoDB: the hash index to a page of %s,"
                        " still %lu hash nodes remain.\n",
                        index->name, (ulong) block->n_pointers);
@@ -606,7 +608,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
  #endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
  
        mem_free(folds);
-@@ -1216,9 +1282,9 @@
+@@ -1216,9 +1284,9 @@
        ulint*          offsets;
        ibool           released_search_latch;
  
@@ -618,7 +620,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
  
        for (j = 0; j < srv_buf_pool_instances; j++) {
                buf_pool_t*     buf_pool;
-@@ -1252,7 +1318,7 @@
+@@ -1252,7 +1320,7 @@
  
  
                                        /* keeping latch order */
@@ -627,7 +629,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
                                        released_search_latch = TRUE;
                                        rw_lock_x_lock(&block->lock);
  
-@@ -1304,7 +1370,7 @@
+@@ -1304,7 +1372,7 @@
                                                mem_heap_empty(heap);
                                        }
  
@@ -636,7 +638,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
  
                                        if (UNIV_UNLIKELY(!block->is_hashed)) {
                                                goto cleanup;
-@@ -1314,12 +1380,12 @@
+@@ -1314,12 +1382,12 @@
  
                                        if (UNIV_UNLIKELY(block->curr_n_fields != n_fields)
                                            || UNIV_UNLIKELY(block->curr_n_bytes != n_bytes)) {
@@ -651,7 +653,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
                                                goto retry;
                                        }
  
-@@ -1333,6 +1399,7 @@
+@@ -1333,6 +1401,7 @@
  
                                        block->is_hashed = FALSE;
                                        block->index = NULL;
@@ -659,7 +661,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
  
  cleanup:
  #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
-@@ -1345,18 +1412,18 @@
+@@ -1345,18 +1414,18 @@
                                                        index->name, (ulong) block->n_pointers);
                                        }
  #endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
@@ -681,7 +683,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
  
        if (UNIV_LIKELY_NULL(heap)) {
                mem_heap_free(heap);
-@@ -1403,7 +1470,7 @@
+@@ -1403,7 +1472,7 @@
  
                buf_block_dbg_add_level(block, SYNC_TREE_NODE_FROM_HASH);
  
@@ -690,7 +692,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
        }
  
        mtr_commit(&mtr);
-@@ -1445,26 +1512,26 @@
+@@ -1445,26 +1514,26 @@
        ut_ad(index);
        ut_a(!dict_index_is_ibuf(index));
  
@@ -723,7 +725,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
        }
  
        n_recs = page_get_n_recs(page);
-@@ -1558,9 +1625,9 @@
+@@ -1558,9 +1627,9 @@
                fold = next_fold;
        }
  
@@ -735,7 +737,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
  
        if (UNIV_UNLIKELY(btr_search_fully_disabled)) {
                goto exit_func;
-@@ -1588,6 +1655,7 @@
+@@ -1588,6 +1657,7 @@
        block->curr_n_bytes = n_bytes;
        block->curr_left_side = left_side;
        block->index = index;
@@ -743,7 +745,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
  
        for (i = 0; i < n_cached; i++) {
  
-@@ -1595,7 +1663,7 @@
+@@ -1595,7 +1665,7 @@
        }
  
  exit_func:
@@ -752,7 +754,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
  
        mem_free(folds);
        mem_free(recs);
-@@ -1634,13 +1702,13 @@
+@@ -1634,13 +1704,13 @@
        ut_a(!(new_block->is_hashed || block->is_hashed)
             || !dict_index_is_ibuf(index));
  
@@ -769,7 +771,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
  
                return;
        }
-@@ -1655,7 +1723,7 @@
+@@ -1655,7 +1725,7 @@
                new_block->n_bytes = block->curr_n_bytes;
                new_block->left_side = left_side;
  
@@ -778,7 +780,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
  
                ut_a(n_fields + n_bytes > 0);
  
-@@ -1667,7 +1735,7 @@
+@@ -1667,7 +1737,7 @@
                return;
        }
  
@@ -787,7 +789,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
  }
  
  /********************************************************************//**
-@@ -1706,7 +1774,7 @@
+@@ -1706,7 +1776,7 @@
        ut_a(block->curr_n_fields + block->curr_n_bytes > 0);
        ut_a(!dict_index_is_ibuf(cursor->index));
  
@@ -796,7 +798,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
  
        index_id = cursor->index->id;
        fold = rec_fold(rec, rec_get_offsets(rec, cursor->index, offsets_,
-@@ -1715,11 +1783,11 @@
+@@ -1715,11 +1785,11 @@
        if (UNIV_LIKELY_NULL(heap)) {
                mem_heap_free(heap);
        }
@@ -810,7 +812,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
  }
  
  /********************************************************************//**
-@@ -1753,21 +1821,21 @@
+@@ -1753,21 +1823,21 @@
        ut_a(block->index == cursor->index);
        ut_a(!dict_index_is_ibuf(cursor->index));
  
@@ -836,7 +838,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
  
                btr_search_update_hash_on_insert(cursor);
        }
-@@ -1802,9 +1870,9 @@
+@@ -1802,9 +1872,9 @@
        ulint*          offsets         = offsets_;
        rec_offs_init(offsets_);
  
@@ -848,7 +850,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
  
        rec = btr_cur_get_rec(cursor);
  
-@@ -1849,7 +1917,7 @@
+@@ -1849,7 +1919,7 @@
        } else {
                if (left_side) {
  
@@ -857,7 +859,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
  
                        locked = TRUE;
  
-@@ -1863,7 +1931,7 @@
+@@ -1863,7 +1933,7 @@
  
                if (!locked) {
  
@@ -866,7 +868,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
  
                        locked = TRUE;
                }
-@@ -1881,7 +1949,7 @@
+@@ -1881,7 +1951,7 @@
                if (!left_side) {
  
                        if (!locked) {
@@ -875,7 +877,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
  
                                locked = TRUE;
                        }
-@@ -1896,7 +1964,7 @@
+@@ -1896,7 +1966,7 @@
  
                if (!locked) {
  
@@ -884,7 +886,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
  
                        locked = TRUE;
                }
-@@ -1919,7 +1987,7 @@
+@@ -1919,7 +1989,7 @@
                mem_heap_free(heap);
        }
        if (locked) {
@@ -893,7 +895,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
        }
  }
  
-@@ -1935,7 +2003,7 @@
+@@ -1935,7 +2005,7 @@
        ha_node_t*      node;
        ulint           n_page_dumps    = 0;
        ibool           ok              = TRUE;
@@ -902,7 +904,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
        ulint           cell_count;
        mem_heap_t*     heap            = NULL;
        ulint           offsets_[REC_OFFS_NORMAL_SIZE];
-@@ -1947,23 +2015,25 @@
+@@ -1947,23 +2017,25 @@
  
        rec_offs_init(offsets_);
  
@@ -933,7 +935,7 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
  
                for (; node != NULL; node = node->next) {
                        const buf_block_t*      block
-@@ -2072,19 +2142,21 @@
+@@ -2072,19 +2144,21 @@
                give other queries a chance to run. */
                if (i != 0) {
                        buf_pool_page_hash_x_unlock_all();
@@ -970,7 +972,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
        block->is_hashed = FALSE;
  
-@@ -1477,7 +1478,7 @@
+@@ -1481,7 +1482,7 @@
                        /* To follow the latching order, we
                        have to release btr_search_latch
                        before acquiring block->latch. */
@@ -979,21 +981,21 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
                        /* When we release the search latch,
                        we must rescan all blocks, because
                        some may become hashed again. */
-@@ -1508,11 +1509,11 @@
+@@ -1512,11 +1513,11 @@
                        anything.  block->is_hashed can only
                        be set on uncompressed file pages. */
-                       
 -                      btr_search_drop_page_hash_index(block);
 +                      btr_search_drop_page_hash_index(block, NULL);
-                       
                        rw_lock_x_unlock(&block->lock);
-                       
 -                      rw_lock_x_lock(&btr_search_latch);
 +                      btr_search_x_lock_all();
-                       
                        ut_ad(!btr_search_enabled);
                }
-@@ -1531,7 +1532,11 @@
+@@ -1535,7 +1536,11 @@
        ibool           released_search_latch;
  
  #ifdef UNIV_SYNC_DEBUG
@@ -1017,7 +1019,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
 diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
 --- a/storage/innobase/buf/buf0lru.c   2010-12-04 15:35:29.137347521 +0900
 +++ b/storage/innobase/buf/buf0lru.c   2010-12-04 16:12:48.658550840 +0900
-@@ -1776,7 +1776,7 @@
+@@ -1798,7 +1798,7 @@
  
                UNIV_MEM_VALID(((buf_block_t*) bpage)->frame,
                               UNIV_PAGE_SIZE);
@@ -1029,7 +1031,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
 diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.c
 --- a/storage/innobase/dict/dict0dict.c        2010-12-04 15:52:23.398513916 +0900
 +++ b/storage/innobase/dict/dict0dict.c        2010-12-04 16:12:48.662550715 +0900
-@@ -1812,7 +1812,7 @@
+@@ -1811,7 +1811,7 @@
        zero. */
  
        for (;;) {
@@ -1054,19 +1056,19 @@ diff -ruN a/storage/innobase/ha/ha0ha.c b/storage/innobase/ha/ha0ha.c
 diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
 --- a/storage/innobase/handler/ha_innodb.cc    2010-12-04 16:12:20.185850734 +0900
 +++ b/storage/innobase/handler/ha_innodb.cc    2010-12-04 16:12:48.674552412 +0900
-@@ -11682,6 +11682,11 @@
+@@ -11702,6 +11702,11 @@
    "Disable with --skip-innodb-adaptive-hash-index.",
    NULL, innodb_adaptive_hash_index_update, TRUE);
  
 +static MYSQL_SYSVAR_ULONG(adaptive_hash_index_partitions, btr_search_index_num,
 +  PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
 +  "Number of InnoDB adaptive hash index partitions (default 1: disable partitioning)",
-+  NULL, NULL, 1, 1, 32, 0);
++  NULL, NULL, 1, 1, sizeof(ulint) * 8, 0);
 +
  static MYSQL_SYSVAR_ULONG(replication_delay, srv_replication_delay,
    PLUGIN_VAR_RQCMDARG,
    "Replication thread delay (ms) on the slave server if "
-@@ -12047,6 +12052,7 @@
+@@ -12068,6 +12073,7 @@
    MYSQL_SYSVAR(use_sys_stats_table),
    MYSQL_SYSVAR(stats_sample_pages),
    MYSQL_SYSVAR(adaptive_hash_index),
@@ -1262,7 +1264,7 @@ diff -ruN a/storage/innobase/include/btr0sea.ic b/storage/innobase/include/btr0s
 diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
 --- a/storage/innobase/include/buf0buf.h       2010-12-15 19:00:07.713604580 +0900
 +++ b/storage/innobase/include/buf0buf.h       2010-12-15 20:58:03.546839883 +0900
-@@ -1545,7 +1545,7 @@
+@@ -1546,7 +1546,7 @@
                                        pointers in the adaptive hash index
                                        pointing to this frame */
  #endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
@@ -1271,7 +1273,7 @@ diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0bu
                                        already been built on this
                                        page; note that it does not
                                        guarantee that the index is
-@@ -1559,6 +1559,7 @@
+@@ -1560,6 +1560,7 @@
        unsigned        curr_left_side:1;/*!< TRUE or FALSE in hash indexing */
        dict_index_t*   index;          /*!< Index for which the adaptive
                                        hash index has been created. */
@@ -1315,7 +1317,7 @@ diff -ruN a/storage/innobase/page/page0page.c b/storage/innobase/page/page0page.
 diff -ruN a/storage/innobase/page/page0zip.c b/storage/innobase/page/page0zip.c
 --- a/storage/innobase/page/page0zip.c 2010-12-04 15:57:13.061494433 +0900
 +++ b/storage/innobase/page/page0zip.c 2010-12-04 16:12:48.716470334 +0900
-@@ -4445,7 +4445,7 @@
+@@ -4444,7 +4444,7 @@
  
  #ifndef UNIV_HOTBACKUP
        temp_block = buf_block_alloc(buf_pool);
@@ -1387,7 +1389,7 @@ diff -ruN a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c
  #ifdef UNIV_SEARCH_DEBUG
        ulint           cnt                             = 0;
  #endif /* UNIV_SEARCH_DEBUG */
-@@ -3441,18 +3443,32 @@
+@@ -3446,18 +3448,33 @@
        /* PHASE 0: Release a possible s-latch we are holding on the
        adaptive hash index latch if there is someone waiting behind */
  
@@ -1395,9 +1397,9 @@ diff -ruN a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c
 -          && trx->has_search_latch) {
 +      should_release = 0;
 +      for (i = 0; i < btr_search_index_num; i++) {
-+              if ((trx->has_search_latch & ((ulint)1 << i))
-+                  && rw_lock_get_writer(btr_search_latch_part[i])
-+                              != RW_LOCK_NOT_LOCKED) {
++              /* we should check all latches (fix Bug#791030) */
++              if (rw_lock_get_writer(btr_search_latch_part[i])
++                  != RW_LOCK_NOT_LOCKED) {
 +                      should_release |= ((ulint)1 << i);
 +              }
 +      }
@@ -1412,9 +1414,10 @@ diff -ruN a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c
 -              rw_lock_s_unlock(&btr_search_latch);
 -              trx->has_search_latch = FALSE;
 +              for (i = 0; i < btr_search_index_num; i++) {
-+                      if (should_release & ((ulint)1 << i)) {
++                      /* we should release all s-latches (fix Bug#791030) */
++                      if (trx->has_search_latch & ((ulint)1 << i)) {
 +                              rw_lock_s_unlock(btr_search_latch_part[i]);
-+                              trx->has_search_latch &= ~((ulint)1 << i);
++                              trx->has_search_latch &= (~((ulint)1 << i));
 +                      }
 +              }
  
@@ -1424,7 +1427,7 @@ diff -ruN a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c
        }
  
        /* Reset the new record lock info if srv_locks_unsafe_for_binlog
-@@ -3603,9 +3619,11 @@
+@@ -3608,9 +3625,28 @@
                        hash index semaphore! */
  
  #ifndef UNIV_SEARCH_DEBUG
@@ -1433,13 +1436,30 @@ diff -ruN a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c
 -                              trx->has_search_latch = TRUE;
 +                      if (!(trx->has_search_latch
 +                            & ((ulint)1 << (index->id % btr_search_index_num)))) {
-+                              rw_lock_s_lock(btr_search_get_latch(index->id));
-+                              trx->has_search_latch |=
-+                                      (ulint)1 << (index->id % btr_search_index_num);
++                              if (trx->has_search_latch
++                                  < ((ulint)1 << (index->id % btr_search_index_num))) {
++                                      rw_lock_s_lock(btr_search_get_latch(index->id));
++                                      trx->has_search_latch |=
++                                              ((ulint)1 << (index->id % btr_search_index_num));
++                              } else {
++                                      /* should re-lock to obay latch-order */
++                                      for (i = 0; i < btr_search_index_num; i++) {
++                                              if (trx->has_search_latch & ((ulint)1 << i)) {
++                                                      rw_lock_s_unlock(btr_search_latch_part[i]);
++                                              }
++                                      }
++                                      trx->has_search_latch |=
++                                              ((ulint)1 << (index->id % btr_search_index_num));
++                                      for (i = 0; i < btr_search_index_num; i++) {
++                                              if (trx->has_search_latch & ((ulint)1 << i)) {
++                                                      rw_lock_s_lock(btr_search_latch_part[i]);
++                                              }
++                                      }
++                              }
                        }
  #endif
                        switch (row_sel_try_search_shortcut_for_mysql(
-@@ -3666,7 +3684,11 @@
+@@ -3671,7 +3707,11 @@
  
                                        trx->search_latch_timeout--;
  
@@ -1452,7 +1472,7 @@ diff -ruN a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c
                                        trx->has_search_latch = FALSE;
                                }
  
-@@ -3690,7 +3712,12 @@
+@@ -3695,7 +3735,12 @@
        /* PHASE 3: Open or restore index cursor position */
  
        if (trx->has_search_latch) {
@@ -1469,7 +1489,7 @@ diff -ruN a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c
 diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
 --- a/storage/innobase/srv/srv0srv.c   2010-12-04 16:12:20.231484679 +0900
 +++ b/storage/innobase/srv/srv0srv.c   2010-12-04 16:12:48.726551018 +0900
-@@ -2050,7 +2050,9 @@
+@@ -2045,7 +2045,9 @@
              "-------------------------------------\n", file);
        ibuf_print(file);
  
@@ -1480,7 +1500,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
  
        fprintf(file,
                "%.2f hash searches/s, %.2f non-hash searches/s\n",
-@@ -2075,14 +2077,15 @@
+@@ -2070,14 +2072,15 @@
                        ut_total_allocated_memory,
                        mem_pool_get_reserved(mem_comm_pool));
        /* Calcurate reserved memories */
@@ -1500,8 +1520,8 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
  
        lock_sys_subtotal = 0;
        if (trx_sys) {
-@@ -2109,10 +2112,10 @@
-                       "    Threads             %lu \t(%lu + %lu)\n",
+@@ -2103,10 +2106,10 @@
+                       "    Recovery system     %lu \t(%lu + %lu)\n",
  
                        (ulong) (btr_search_sys
 -                              ? (btr_search_sys->hash_index->n_cells * sizeof(hash_cell_t)) : 0)
@@ -1516,7 +1536,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
 diff -ruN a/storage/innobase/sync/sync0sync.c b/storage/innobase/sync/sync0sync.c
 --- a/storage/innobase/sync/sync0sync.c        2010-12-03 17:36:44.300986571 +0900
 +++ b/storage/innobase/sync/sync0sync.c        2010-12-04 16:12:48.729513564 +0900
-@@ -1177,7 +1177,6 @@
+@@ -1223,7 +1223,6 @@
        case SYNC_OUTER_ANY_LATCH:
        case SYNC_FILE_FORMAT_TAG:
        case SYNC_DOUBLEWRITE:
@@ -1524,7 +1544,7 @@ diff -ruN a/storage/innobase/sync/sync0sync.c b/storage/innobase/sync/sync0sync.
        case SYNC_SEARCH_SYS_CONF:
        case SYNC_TRX_LOCK_HEAP:
        case SYNC_KERNEL:
-@@ -1198,6 +1197,7 @@
+@@ -1244,6 +1243,7 @@
                        ut_error;
                }
                break;
@@ -1535,7 +1555,7 @@ diff -ruN a/storage/innobase/sync/sync0sync.c b/storage/innobase/sync/sync0sync.
 diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c
 --- a/storage/innobase/trx/trx0trx.c   2010-12-03 17:49:11.623953784 +0900
 +++ b/storage/innobase/trx/trx0trx.c   2010-12-04 16:12:48.731513275 +0900
-@@ -267,8 +267,14 @@
+@@ -265,8 +265,14 @@
  /*=================================*/
        trx_t*     trx) /*!< in: transaction */
  {
index 07acfd530c164afcb3865499d9b31cbedb927024..b692fbdc1a7ceb2bf94bb2b707909d33fab7a673 100644 (file)
@@ -8,7 +8,7 @@
 diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
 --- a/storage/innobase/handler/ha_innodb.cc    2010-12-03 17:32:15.624039043 +0900
 +++ b/storage/innobase/handler/ha_innodb.cc    2010-12-03 17:32:35.424957827 +0900
-@@ -11839,7 +11839,8 @@
+@@ -11863,7 +11863,8 @@
  i_s_innodb_sys_foreign_cols,
  i_s_innodb_sys_stats,
  i_s_innodb_table_stats,
@@ -21,7 +21,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
 diff -ruN a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
 --- a/storage/innobase/handler/i_s.cc  2010-12-03 17:30:16.299955549 +0900
 +++ b/storage/innobase/handler/i_s.cc  2010-12-03 17:32:35.425989972 +0900
-@@ -4179,3 +4179,139 @@
+@@ -4177,3 +4177,139 @@
        STRUCT_FLD(system_vars, NULL),
        STRUCT_FLD(__reserved1, NULL)
  };
@@ -151,7 +151,7 @@ diff -ruN a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
 +      STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
 +      STRUCT_FLD(info, &i_s_info),
 +      STRUCT_FLD(name, "XTRADB_ADMIN_COMMAND"),
-+      STRUCT_FLD(author, plugin_author),
++      STRUCT_FLD(author, "Percona"),
 +      STRUCT_FLD(descr, "XtraDB specific command acceptor"),
 +      STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
 +      STRUCT_FLD(init, i_s_innodb_admin_command_init),
@@ -164,7 +164,7 @@ diff -ruN a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
 diff -ruN a/storage/innobase/handler/i_s.h b/storage/innobase/handler/i_s.h
 --- a/storage/innobase/handler/i_s.h   2010-12-03 17:30:16.301987692 +0900
 +++ b/storage/innobase/handler/i_s.h   2010-12-03 17:32:35.426954555 +0900
-@@ -44,5 +44,6 @@
+@@ -46,5 +46,6 @@
  extern struct st_mysql_plugin i_s_innodb_sys_stats;
  extern struct st_mysql_plugin i_s_innodb_table_stats;
  extern struct st_mysql_plugin i_s_innodb_index_stats;
index 660ebd343c812350cda4458b779bf280806421e7..af32e07c4a83f83c417e6be5dae81d0c51c59d39 100644 (file)
@@ -8,7 +8,7 @@
 diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
 --- a/storage/innobase/buf/buf0buf.c   2010-12-04 20:20:44.595483291 +0900
 +++ b/storage/innobase/buf/buf0buf.c   2010-12-06 19:28:04.055227506 +0900
-@@ -4519,6 +4519,36 @@
+@@ -4541,6 +4541,36 @@
        mutex_exit(block_mutex);
  }
  
@@ -48,7 +48,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
 diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
 --- a/storage/innobase/handler/ha_innodb.cc    2010-12-04 20:20:44.614551139 +0900
 +++ b/storage/innobase/handler/ha_innodb.cc    2010-12-06 19:23:47.622195800 +0900
-@@ -12127,6 +12127,9 @@
+@@ -12148,6 +12148,9 @@
  i_s_innodb_sys_stats,
  i_s_innodb_table_stats,
  i_s_innodb_index_stats,
@@ -68,8 +68,8 @@ diff -ruN a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
 +#include "btr0btr.h" /* for btr_page_get_index_id */
  }
  
- static const char plugin_author[] = "Innobase Oy";
-@@ -4346,3 +4347,701 @@
+ #define OK(expr)              \
+@@ -4344,3 +4345,701 @@
        STRUCT_FLD(system_vars, NULL),
        STRUCT_FLD(__reserved1, NULL)
  };
@@ -640,7 +640,7 @@ diff -ruN a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
 +
 +      /* plugin author (for SHOW PLUGINS) */
 +      /* const char* */
-+      STRUCT_FLD(author, plugin_author),
++      STRUCT_FLD(author, "Percona"),
 +
 +      /* general descriptive text (for SHOW PLUGINS) */
 +      /* const char* */
@@ -689,7 +689,7 @@ diff -ruN a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
 +
 +      /* plugin author (for SHOW PLUGINS) */
 +      /* const char* */
-+      STRUCT_FLD(author, plugin_author),
++      STRUCT_FLD(author, "Percona"),
 +
 +      /* general descriptive text (for SHOW PLUGINS) */
 +      /* const char* */
@@ -738,7 +738,7 @@ diff -ruN a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
 +
 +      /* plugin author (for SHOW PLUGINS) */
 +      /* const char* */
-+      STRUCT_FLD(author, plugin_author),
++      STRUCT_FLD(author, "Percona"),
 +
 +      /* general descriptive text (for SHOW PLUGINS) */
 +      /* const char* */
@@ -774,7 +774,7 @@ diff -ruN a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
 diff -ruN a/storage/innobase/handler/i_s.h b/storage/innobase/handler/i_s.h
 --- a/storage/innobase/handler/i_s.h   2010-12-04 19:46:39.657513849 +0900
 +++ b/storage/innobase/handler/i_s.h   2010-12-06 19:23:47.635192988 +0900
-@@ -45,5 +45,8 @@
+@@ -47,5 +47,8 @@
  extern struct st_mysql_plugin i_s_innodb_table_stats;
  extern struct st_mysql_plugin i_s_innodb_index_stats;
  extern struct st_mysql_plugin i_s_innodb_admin_command;
@@ -786,7 +786,7 @@ diff -ruN a/storage/innobase/handler/i_s.h b/storage/innobase/handler/i_s.h
 diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
 --- a/storage/innobase/include/buf0buf.h       2010-12-04 19:46:40.197471531 +0900
 +++ b/storage/innobase/include/buf0buf.h       2010-12-06 19:23:47.638195824 +0900
-@@ -1143,6 +1143,14 @@
+@@ -1144,6 +1144,14 @@
  /*===========*/
        const buf_pool_t*       buf_pool)       /*!< in: buffer pool */
        __attribute__((nonnull, const));
index 48c4535c36dfe3ea5f2fdef46034256791663ace..b8fd4487096cbfcfc2cefe1e65ceb2d5903198b9 100644 (file)
 #!!! notice !!!
 # Any small change to this file in the main branch
 # should be done or reviewed by the maintainer!
-diff -ruN a/storage/innobase/buf/buf0buddy.c b/storage/innobase/buf/buf0buddy.c
---- a/storage/innobase/buf/buf0buddy.c 2011-04-09 18:48:28.000000000 +0400
-+++ b/storage/innobase/buf/buf0buddy.c 2011-04-09 18:48:48.000000000 +0400
-@@ -183,7 +183,7 @@
-       void*           buf,            /*!< in: buffer frame to deallocate */
-       ibool           have_page_hash_mutex)
- {
--      const ulint     fold    = BUF_POOL_ZIP_FOLD_PTR(buf);
-+      const ulint     fold    = BUF_POOL_ZIP_FOLD_PTR(buf_pool, buf);
-       buf_page_t*     bpage;
-       buf_block_t*    block;
-@@ -227,7 +227,7 @@
-       buf_block_t*    block)  /*!< in: buffer frame to allocate */
- {
-       buf_pool_t*     buf_pool = buf_pool_from_block(block);
--      const ulint     fold = BUF_POOL_ZIP_FOLD(block);
-+      const ulint     fold = BUF_POOL_ZIP_FOLD(buf_pool, block);
-       //ut_ad(buf_pool_mutex_own(buf_pool));
-       ut_ad(!mutex_own(&buf_pool->zip_mutex));
-       ut_ad(buf_block_get_state(block) == BUF_BLOCK_READY_FOR_USE);
 diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
 --- a/storage/innobase/buf/buf0buf.c   2011-04-09 18:48:47.000000000 +0400
 +++ b/storage/innobase/buf/buf0buf.c   2011-04-09 18:48:48.000000000 +0400
-@@ -53,6 +53,10 @@
- #include "page0zip.h"
- #include "trx0trx.h"
- #include "srv0start.h"
-+#include "que0que.h"
-+#include "read0read.h"
-+#include "row0row.h"
-+#include "ha_prototypes.h"
- /* prototypes for new functions added to ha_innodb.cc */
- trx_t* innobase_get_trx();
-@@ -342,6 +346,31 @@
- //                                    was allocated for the frames */
- //    buf_block_t*    blocks;         /*!< array of buffer control blocks */
- //};
-+
-+/* Buffer pool shared memory segment information */
-+typedef       struct buf_shm_info_struct      buf_shm_info_t;
-+
-+struct buf_shm_info_struct {
-+      char    head_str[8];
-+      ulint   binary_id;
-+      ibool   is_new;         /* during initializing */
-+      ibool   clean;          /* clean shutdowned and free */
-+      ibool   reusable;       /* reusable */
-+      ulint   buf_pool_size;  /* backup value */
-+      ulint   page_size;      /* backup value */
-+      ulint   frame_offset;   /* offset of the first frame based on chunk->mem */
-+      ulint   zip_hash_offset;
-+      ulint   zip_hash_n;
-+
-+      ulint   checksum;
-+
-+      buf_pool_t      buf_pool_backup;
-+      buf_chunk_t     chunk_backup;
-+
-+      ib_uint64_t     dummy;
-+};
-+
-+#define BUF_SHM_INFO_HEAD "XTRA_SHM"
- #endif /* !UNIV_HOTBACKUP */
- /********************************************************************//**
-@@ -988,6 +1017,58 @@
- #endif /* UNIV_SYNC_DEBUG */
- }
-+static
-+void
-+buf_block_reuse(
-+/*============*/
-+      buf_block_t*    block,
-+      ptrdiff_t       frame_offset)
-+{
-+      /* block_init */
-+      block->frame += frame_offset;
-+
-+      UNIV_MEM_DESC(block->frame, UNIV_PAGE_SIZE, block);
-+
-+      block->index = NULL;
-+      block->btr_search_latch = NULL;
-+
-+#ifdef UNIV_DEBUG
-+      /* recreate later */
-+      block->page.in_page_hash = FALSE;
-+      block->page.in_zip_hash = FALSE;
-+#endif /* UNIV_DEBUG */
-+
-+#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
-+      block->n_pointers = 0;
-+#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
-+
-+      if (block->page.zip.data)
-+              block->page.zip.data += frame_offset;
-+
-+      block->is_hashed = FALSE;
-+
-+#if defined PFS_SKIP_BUFFER_MUTEX_RWLOCK || defined PFS_GROUP_BUFFER_SYNC
-+      /* If PFS_SKIP_BUFFER_MUTEX_RWLOCK is defined, skip registration
-+      of buffer block mutex/rwlock with performance schema. If
-+      PFS_GROUP_BUFFER_SYNC is defined, skip the registration
-+      since buffer block mutex/rwlock will be registered later in
-+      pfs_register_buffer_block() */
-+
-+      mutex_create(PFS_NOT_INSTRUMENTED, &block->mutex, SYNC_BUF_BLOCK);
-+      rw_lock_create(PFS_NOT_INSTRUMENTED, &block->lock, SYNC_LEVEL_VARYING);
-+#else /* PFS_SKIP_BUFFER_MUTEX_RWLOCK || PFS_GROUP_BUFFER_SYNC */
-+      mutex_create(buffer_block_mutex_key, &block->mutex, SYNC_BUF_BLOCK);
-+      rw_lock_create(buf_block_lock_key, &block->lock, SYNC_LEVEL_VARYING);
-+#endif /* PFS_SKIP_BUFFER_MUTEX_RWLOCK || PFS_GROUP_BUFFER_SYNC */
-+
-+      ut_ad(rw_lock_validate(&(block->lock)));
-+
-+#ifdef UNIV_SYNC_DEBUG
-+      rw_lock_create(buf_block_debug_latch_key,
-+                     &block->debug_latch, SYNC_NO_ORDER_CHECK);
-+#endif /* UNIV_SYNC_DEBUG */
-+}
-+
- /********************************************************************//**
- Allocates a chunk of buffer frames.
- @return       chunk, or NULL on failure */
-@@ -1001,26 +1082,190 @@
- {
+@@ -1006,10 +1006,12 @@
        buf_block_t*    block;
        byte*           frame;
-+      ulint           zip_hash_n = 0;
-+      ulint           zip_hash_mem_size = 0;
-+      hash_table_t*   zip_hash_tmp = NULL;
        ulint           i;
 +      ulint           size_target;
-+      buf_shm_info_t* shm_info = NULL;
  
        /* Round down to a multiple of page size,
        although it already should be. */
        mem_size = ut_2pow_round(mem_size, UNIV_PAGE_SIZE);
 +      size_target = (mem_size / UNIV_PAGE_SIZE) - 1;
-+
-+      srv_buffer_pool_shm_is_reused = FALSE;
-+
-+      if (srv_buffer_pool_shm_key) {
-+              /* zip_hash size */
-+              zip_hash_n = (mem_size / UNIV_PAGE_SIZE) * 2;
-+              zip_hash_mem_size = ut_2pow_round(hash_create_needed(zip_hash_n)
-+                                                + (UNIV_PAGE_SIZE - 1), UNIV_PAGE_SIZE);
-+      }
-+
        /* Reserve space for the block descriptors. */
        mem_size += ut_2pow_round((mem_size / UNIV_PAGE_SIZE) * (sizeof *block)
                                  + (UNIV_PAGE_SIZE - 1), UNIV_PAGE_SIZE);
-+      if (srv_buffer_pool_shm_key) {
-+               mem_size += ut_2pow_round(sizeof(buf_shm_info_t)
-+                                         + (UNIV_PAGE_SIZE - 1), UNIV_PAGE_SIZE);
-+               mem_size += zip_hash_mem_size;
-+      }
-       chunk->mem_size = mem_size;
-+
-+      if (srv_buffer_pool_shm_key) {
-+              ulint   binary_id;
-+              ibool   is_new;
-+
-+              ut_a(buf_pool->n_chunks == 1);
-+
-+              fprintf(stderr,
-+              "InnoDB: Notice: The innodb_buffer_pool_shm_key option has been specified.\n"
-+              "InnoDB: Do not change the following between restarts of the server while this option is being used:\n"
-+              "InnoDB:   * the mysqld executable between restarts of the server.\n"
-+              "InnoDB:   * the value of innodb_buffer_pool_size.\n"
-+              "InnoDB:   * the value of innodb_page_size.\n"
-+              "InnoDB:   * datafiles created by InnoDB during this session.\n"
-+              "InnoDB: Otherwise, data corruption in datafiles may result.\n");
-+
-+              /* FIXME: This is vague id still */
-+              binary_id = (ulint) ((byte*)mtr_commit - (byte*)btr_root_get)
-+                        + (ulint) ((byte*)os_file_get_last_error - (byte*)buf_calc_page_new_checksum)
-+                        + (ulint) ((byte*)page_dir_find_owner_slot - (byte*)dfield_data_is_binary_equal)
-+                        + (ulint) ((byte*)que_graph_publish - (byte*)dict_casedn_str)
-+                        + (ulint) ((byte*)read_view_oldest_copy_or_open_new - (byte*)fil_space_get_version)
-+                        + (ulint) ((byte*)rec_get_n_extern_new - (byte*)fsp_get_size_low)
-+                        + (ulint) ((byte*)row_get_trx_id_offset - (byte*)ha_create_func)
-+                        + (ulint) ((byte*)srv_set_io_thread_op_info - (byte*)thd_is_replication_slave_thread)
-+                        + (ulint) ((byte*)mutex_create_func - (byte*)ibuf_inside)
-+                        + (ulint) ((byte*)trx_set_detailed_error - (byte*)lock_check_trx_id_sanity)
-+                        + (ulint) ((byte*)ut_time - (byte*)mem_heap_strdup);
-+
-+              chunk->mem = os_shm_alloc(&chunk->mem_size, srv_buffer_pool_shm_key, &is_new);
-+
-+              if (UNIV_UNLIKELY(chunk->mem == NULL)) {
-+                      return(NULL);
-+              }
-+init_again:
-+#ifdef UNIV_SET_MEM_TO_ZERO
-+              if (is_new) {
-+                      memset(chunk->mem, '\0', chunk->mem_size);
-+              }
-+#endif
-+              /* for ut_fold_binary_32(), these values should be 32-bit aligned */
-+              ut_a(sizeof(buf_shm_info_t) % 4 == 0);
-+              ut_a((ulint)chunk->mem % 4 == 0);
-+              ut_a(chunk->mem_size % 4 == 0);
-+
-+              shm_info = chunk->mem;
-+
-+              zip_hash_tmp = (hash_table_t*)((byte*)chunk->mem + chunk->mem_size - zip_hash_mem_size);
-+
-+              if (is_new) {
-+                      strncpy(shm_info->head_str, BUF_SHM_INFO_HEAD, 8);
-+                      shm_info->binary_id = binary_id;
-+                      shm_info->is_new = TRUE;        /* changed to FALSE when the initialization is finished */
-+                      shm_info->clean = FALSE;        /* changed to TRUE when free the segment. */
-+                      shm_info->reusable = FALSE;     /* changed to TRUE when validation is finished. */
-+                      shm_info->buf_pool_size = srv_buf_pool_size;
-+                      shm_info->page_size = srv_page_size;
-+                      shm_info->zip_hash_offset = chunk->mem_size - zip_hash_mem_size;
-+                      shm_info->zip_hash_n = zip_hash_n;
-+              } else {
-+                      ulint   checksum;
-+
-+                      if (strncmp(shm_info->head_str, BUF_SHM_INFO_HEAD, 8)) {
-+                              fprintf(stderr,
-+                              "InnoDB: Error: The shared memory segment seems not to be for buffer pool.\n");
-+                              return(NULL);
-+                      }
-+                      if (shm_info->binary_id != binary_id) {
-+                              fprintf(stderr,
-+                              "InnoDB: Error: The shared memory segment seems not to be for this binary.\n");
-+                              return(NULL);
-+                      }
-+                      if (shm_info->is_new) {
-+                              fprintf(stderr,
-+                              "InnoDB: Error: The shared memory was not initialized yet.\n");
-+                              return(NULL);
-+                      }
-+                      if (shm_info->buf_pool_size != srv_buf_pool_size) {
-+                              fprintf(stderr,
-+                              "InnoDB: Error: srv_buf_pool_size is different (shm=%lu current=%lu).\n",
-+                              shm_info->buf_pool_size, srv_buf_pool_size);
-+                              return(NULL);
-+                      }
-+                      if (shm_info->page_size != srv_page_size) {
-+                              fprintf(stderr,
-+                              "InnoDB: Error: srv_page_size is different (shm=%lu current=%lu).\n",
-+                              shm_info->page_size, srv_page_size);
-+                              return(NULL);
-+                      }
-+                      if (!shm_info->reusable) {
-+                              fprintf(stderr,
-+                              "InnoDB: Warning: The shared memory has unrecoverable contents.\n"
-+                              "InnoDB: The shared memory segment is initialized.\n");
-+                              is_new = TRUE;
-+                              goto init_again;
-+                      }
-+                      if (!shm_info->clean) {
-+                              fprintf(stderr,
-+                              "InnoDB: Warning: The shared memory was not shut down cleanly.\n"
-+                              "InnoDB: The shared memory segment is initialized.\n");
-+                              is_new = TRUE;
-+                              goto init_again;
-+                      }
-+
-+                      ut_a(shm_info->zip_hash_offset == chunk->mem_size - zip_hash_mem_size);
-+                      ut_a(shm_info->zip_hash_n == zip_hash_n);
-+
-+                      /* check checksum */
-+                      if (srv_buffer_pool_shm_checksum) {
-+                              checksum = ut_fold_binary_32((byte*)chunk->mem + sizeof(buf_shm_info_t),
-+                                                           chunk->mem_size - sizeof(buf_shm_info_t));
-+                      } else {
-+                              checksum = BUF_NO_CHECKSUM_MAGIC;
-+                      }
-+
-+                      if (shm_info->checksum != BUF_NO_CHECKSUM_MAGIC
-+                          && shm_info->checksum != checksum) {
-+                              fprintf(stderr,
-+                              "InnoDB: Error: checksum of the shared memory is not match. "
-+                              "(stored=%lu calculated=%lu)\n",
-+                              shm_info->checksum, checksum);
-+                              return(NULL);
-+                      }
-+
-+                      /* flag to use the segment. */
-+                      shm_info->clean = FALSE;        /* changed to TRUE when free the segment. */
-+              }
-+
-+              /* init zip_hash contents */
-+              if (is_new) {
-+                      hash_create_init(zip_hash_tmp, zip_hash_n);
-+              } else {
-+                      /* adjust offset is done later */
-+                      hash_create_reuse(zip_hash_tmp);
-+
-+                      srv_buffer_pool_shm_is_reused = TRUE;
-+              }
-+      } else {
-       chunk->mem = os_mem_alloc_large(&chunk->mem_size);
-       if (UNIV_UNLIKELY(chunk->mem == NULL)) {
-               return(NULL);
-       }
-+      }
-       /* Allocate the block descriptors from
-       the start of the memory block. */
-+      if (srv_buffer_pool_shm_key) {
-+              chunk->blocks = (buf_block_t*)((byte*)chunk->mem + sizeof(buf_shm_info_t));
-+      } else {
-       chunk->blocks = chunk->mem;
-+      }
-       /* Align a pointer to the first frame.  Note that when
-       os_large_page_size is smaller than UNIV_PAGE_SIZE,
-@@ -1028,8 +1273,13 @@
-       it is bigger, we may allocate more blocks than requested. */
-       frame = ut_align(chunk->mem, UNIV_PAGE_SIZE);
-+      if (srv_buffer_pool_shm_key) {
-+              /* reserve zip_hash space and always -1 for reproductibity */
-+              chunk->size = (chunk->mem_size - zip_hash_mem_size) / UNIV_PAGE_SIZE - 1;
-+      } else {
-       chunk->size = chunk->mem_size / UNIV_PAGE_SIZE
-               - (frame != chunk->mem);
-+      }
-       /* Subtract the space needed for block descriptors. */
-       {
-@@ -1043,6 +1293,102 @@
+@@ -1047,6 +1049,10 @@
                chunk->size = size;
        }
  
@@ -344,445 +29,52 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
 +              chunk->size = size_target;
 +      }
 +
-+      if (shm_info && !(shm_info->is_new)) {
-+              /* convert the shared memory segment for reuse */
-+              ptrdiff_t       phys_offset;
-+              ptrdiff_t       logi_offset;
-+              ptrdiff_t       blocks_offset;
-+              void*           previous_frame_address;
-+
-+              if (chunk->size < shm_info->chunk_backup.size) {
-+                      fprintf(stderr,
-+                      "InnoDB: Error: The buffer pool became smaller because of allocated address.\n"
-+                      "InnoDB: Retrying may avoid this situation.\n");
-+                      shm_info->clean = TRUE; /* release the flag for retrying */
-+                      return(NULL);
-+              }
-+
-+              chunk->size = shm_info->chunk_backup.size;
-+              phys_offset = frame - ((byte*)chunk->mem + shm_info->frame_offset);
-+              logi_offset = frame - chunk->blocks[0].frame;
-+              previous_frame_address = chunk->blocks[0].frame;
-+              blocks_offset = (byte*)chunk->blocks - (byte*)shm_info->chunk_backup.blocks;
-+
-+              if (phys_offset || logi_offset || blocks_offset) {
-+                      fprintf(stderr,
-+                      "InnoDB: Buffer pool in the shared memory segment should be converted.\n"
-+                      "InnoDB: Previous frames in address      : %p\n"
-+                      "InnoDB: Previous frames were located    : %p\n"
-+                      "InnoDB: Current frames should be located: %p\n"
-+                      "InnoDB: Pysical offset                  : %ld (%#lx)\n"
-+                      "InnoDB: Logical offset (frames)         : %ld (%#lx)\n"
-+                      "InnoDB: Logical offset (blocks)         : %ld (%#lx)\n",
-+                              (byte*)chunk->mem + shm_info->frame_offset,
-+                              chunk->blocks[0].frame, frame,
-+                              phys_offset, phys_offset, logi_offset, logi_offset,
-+                              blocks_offset, blocks_offset);
-+              } else {
-+                      fprintf(stderr,
-+                      "InnoDB: Buffer pool in the shared memory segment can be used as it is.\n");
-+              }
-+
-+              if (phys_offset) {
-+                      fprintf(stderr,
-+                      "InnoDB: Aligning physical offset...");
-+
-+                      memmove(frame, (byte*)chunk->mem + shm_info->frame_offset,
-+                              chunk->size * UNIV_PAGE_SIZE);
-+
-+                      fprintf(stderr,
-+                      " Done.\n");
-+              }
-+
-+              /* buf_block_t */
-+              block = chunk->blocks;
-+              for (i = chunk->size; i--; ) {
-+                      buf_block_reuse(block, logi_offset);
-+                      block++;
-+              }
-+
-+              if (logi_offset || blocks_offset) {
-+                      fprintf(stderr,
-+                      "InnoDB: Aligning logical offset...");
-+
-+
-+                      /* buf_pool_t buf_pool_backup */
-+                      UT_LIST_OFFSET(flush_list, buf_page_t, shm_info->buf_pool_backup.flush_list,
-+                                      previous_frame_address, logi_offset, blocks_offset);
-+                      UT_LIST_OFFSET(free, buf_page_t, shm_info->buf_pool_backup.free,
-+                                      previous_frame_address, logi_offset, blocks_offset);
-+                      UT_LIST_OFFSET(LRU, buf_page_t, shm_info->buf_pool_backup.LRU,
-+                                      previous_frame_address, logi_offset, blocks_offset);
-+                      if (shm_info->buf_pool_backup.LRU_old)
-+                              shm_info->buf_pool_backup.LRU_old =
-+                                      (buf_page_t*)((byte*)(shm_info->buf_pool_backup.LRU_old)
-+                                              + (((void*)shm_info->buf_pool_backup.LRU_old > previous_frame_address)
-+                                                ? logi_offset : blocks_offset));
-+
-+                      UT_LIST_OFFSET(unzip_LRU, buf_block_t, shm_info->buf_pool_backup.unzip_LRU,
-+                                      previous_frame_address, logi_offset, blocks_offset);
-+
-+                      UT_LIST_OFFSET(zip_list, buf_page_t, shm_info->buf_pool_backup.zip_clean,
-+                                      previous_frame_address, logi_offset, blocks_offset);
-+                      for (i = 0; i < BUF_BUDDY_SIZES_MAX; i++) {
-+                              UT_LIST_OFFSET(zip_list, buf_page_t, shm_info->buf_pool_backup.zip_free[i],
-+                                      previous_frame_address, logi_offset, blocks_offset);
-+                      }
-+
-+                      HASH_OFFSET(zip_hash_tmp, buf_page_t, hash,
-+                                      previous_frame_address, logi_offset, blocks_offset);
-+
-+                      fprintf(stderr,
-+                      " Done.\n");
-+              }
-+      } else {
        /* Init block structs and assign frames for them. Then we
        assign the frames to the first blocks (we already mapped the
        memory above). */
-@@ -1068,6 +1414,11 @@
-               block++;
-               frame += UNIV_PAGE_SIZE;
-       }
-+      }
-+
-+      if (shm_info) {
-+              shm_info->frame_offset = chunk->blocks[0].frame - (byte*)chunk->mem;
-+      }
- #ifdef PFS_GROUP_BUFFER_SYNC
-       pfs_register_buffer_block(chunk);
-@@ -1249,6 +1600,8 @@
-               UNIV_MEM_UNDESC(block);
-       }
-+      ut_a(!srv_buffer_pool_shm_key);
-+
-       os_mem_free_large(chunk->mem, chunk->mem_size);
- }
-@@ -1289,7 +1642,7 @@
-       ulint           instance_no)    /*!< in: id of the instance */
- {
-       ulint           i;
--      buf_chunk_t*    chunk;
-+      buf_chunk_t*    chunk = NULL;
-       /* 1. Initialize general fields
-       ------------------------------- */
-@@ -1335,7 +1688,10 @@
-               buf_pool->curr_pool_size = buf_pool->curr_size * UNIV_PAGE_SIZE;
-               buf_pool->page_hash = hash_create(2 * buf_pool->curr_size);
-+              /* zip_hash is allocated to shm when srv_buffer_pool_shm_key is enabled */
-+              if (!srv_buffer_pool_shm_key) {
-               buf_pool->zip_hash = hash_create(2 * buf_pool->curr_size);
-+              }
-               
-               buf_pool->last_printout_time = ut_time();
-       }
-@@ -1354,6 +1710,86 @@
-       /* All fields are initialized by mem_zalloc(). */
-+      if (chunk && srv_buffer_pool_shm_key) {
-+              buf_shm_info_t* shm_info;
-+
-+              ut_a((byte*)chunk->blocks == (byte*)chunk->mem + sizeof(buf_shm_info_t));
-+              shm_info = chunk->mem;
-+
-+              buf_pool->zip_hash = (hash_table_t*)((byte*)chunk->mem + shm_info->zip_hash_offset);
-+
-+              if(shm_info->is_new) {
-+                      shm_info->is_new = FALSE; /* initialization was finished */
-+              } else {
-+                      buf_block_t*    block = chunk->blocks;
-+                      buf_page_t*     b;
-+
-+                      /* shm_info->buf_pool_backup should be converted */
-+                      /* at buf_chunk_init(). So copy simply. */
-+                      buf_pool->flush_list            = shm_info->buf_pool_backup.flush_list;
-+                      buf_pool->freed_page_clock      = shm_info->buf_pool_backup.freed_page_clock;
-+                      buf_pool->free                  = shm_info->buf_pool_backup.free;
-+                      buf_pool->LRU                   = shm_info->buf_pool_backup.LRU;
-+                      buf_pool->LRU_old               = shm_info->buf_pool_backup.LRU_old;
-+                      buf_pool->LRU_old_len           = shm_info->buf_pool_backup.LRU_old_len;
-+                      buf_pool->unzip_LRU             = shm_info->buf_pool_backup.unzip_LRU;
-+                      buf_pool->zip_clean             = shm_info->buf_pool_backup.zip_clean;
-+                      for (i = 0; i < BUF_BUDDY_SIZES_MAX; i++) {
-+                              buf_pool->zip_free[i]   = shm_info->buf_pool_backup.zip_free[i];
-+                      }
-+
-+                      for (i = 0; i < chunk->size; i++, block++) {
-+                              if (buf_block_get_state(block)
-+                                  == BUF_BLOCK_FILE_PAGE) {
-+                                      ut_d(block->page.in_page_hash = TRUE);
-+                                      HASH_INSERT(buf_page_t, hash, buf_pool->page_hash,
-+                                                  buf_page_address_fold(
-+                                                          block->page.space,
-+                                                          block->page.offset),
-+                                                  &block->page);
-+                              }
-+                      }
-+
-+                      for (b = UT_LIST_GET_FIRST(buf_pool->zip_clean); b;
-+                           b = UT_LIST_GET_NEXT(zip_list, b)) {
-+                              ut_ad(!b->in_flush_list);
-+                              ut_ad(b->in_LRU_list);
-+
-+                              ut_d(b->in_page_hash = TRUE);
-+                              HASH_INSERT(buf_page_t, hash, buf_pool->page_hash,
-+                                          buf_page_address_fold(b->space, b->offset), b);
-+                      }
-+
-+                      for (b = UT_LIST_GET_FIRST(buf_pool->flush_list); b;
-+                           b = UT_LIST_GET_NEXT(flush_list, b)) {
-+                              ut_ad(b->in_flush_list);
-+                              ut_ad(b->in_LRU_list);
-+
-+                              switch (buf_page_get_state(b)) {
-+                              case BUF_BLOCK_ZIP_DIRTY:
-+                                      ut_d(b->in_page_hash = TRUE);
-+                                      HASH_INSERT(buf_page_t, hash, buf_pool->page_hash,
-+                                                  buf_page_address_fold(b->space,
-+                                                                        b->offset), b);
-+                                      break;
-+                              case BUF_BLOCK_FILE_PAGE:
-+                                      /* uncompressed page */
-+                                      break;
-+                              case BUF_BLOCK_ZIP_FREE:
-+                              case BUF_BLOCK_ZIP_PAGE:
-+                              case BUF_BLOCK_NOT_USED:
-+                              case BUF_BLOCK_READY_FOR_USE:
-+                              case BUF_BLOCK_MEMORY:
-+                              case BUF_BLOCK_REMOVE_HASH:
-+                                      ut_error;
-+                                      break;
-+                              }
-+                      }
-+
-+
-+              }
-+      }
-+
-       mutex_exit(&buf_pool->LRU_list_mutex);
-       rw_lock_x_unlock(&buf_pool->page_hash_latch);
-       buf_pool_mutex_exit(buf_pool);
-@@ -1373,6 +1809,42 @@
-       buf_chunk_t*    chunk;
-       buf_chunk_t*    chunks;
-+      if (srv_buffer_pool_shm_key) {
-+              buf_shm_info_t* shm_info;
-+
-+              ut_a(buf_pool->n_chunks == 1);
-+
-+              chunk = buf_pool->chunks;
-+              shm_info = chunk->mem;
-+              ut_a((byte*)chunk->blocks == (byte*)chunk->mem + sizeof(buf_shm_info_t));
-+
-+              /* if opened, close shm. */
-+              if (!shm_info->clean) {
-+                      /* validation the shared memory segment doesn't have unrecoverable contents. */
-+                      /* Currently, validation became not needed */
-+                      shm_info->reusable = TRUE;
-+
-+                      memcpy(&(shm_info->buf_pool_backup), buf_pool, sizeof(buf_pool_t));
-+                      memcpy(&(shm_info->chunk_backup), chunk, sizeof(buf_chunk_t));
-+
-+                      if (srv_fast_shutdown < 2) {
-+                              if (srv_buffer_pool_shm_checksum) {
-+                                      shm_info->checksum =
-+                                              ut_fold_binary_32(
-+                                                      (byte*)chunk->mem + sizeof(buf_shm_info_t),
-+                                                      chunk->mem_size - sizeof(buf_shm_info_t));
-+                              } else {
-+                                      shm_info->checksum = BUF_NO_CHECKSUM_MAGIC;
-+                              }
-+                              shm_info->clean = TRUE;
-+                      }
-+
-+                      fprintf(stderr,
-+                              "InnoDB: The shared memory was closed.\n");
-+              }
-+
-+              os_shm_free(chunk->mem, chunk->mem_size);
-+      } else {
-       chunks = buf_pool->chunks;
-       chunk = chunks + buf_pool->n_chunks;
-@@ -1381,10 +1853,13 @@
-               would fail at shutdown. */
-               os_mem_free_large(chunk->mem, chunk->mem_size);
-       }
-+      }
-       mem_free(buf_pool->chunks);
-       hash_table_free(buf_pool->page_hash);
-+      if (!srv_buffer_pool_shm_key) {
-       hash_table_free(buf_pool->zip_hash);
-+      }
- }
- /********************************************************************//**
-@@ -1668,6 +2143,11 @@
-       //buf_pool_mutex_enter(buf_pool);
-       mutex_enter(&buf_pool->LRU_list_mutex);
-+      if (srv_buffer_pool_shm_key) {
-+              /* Cannot support shrink */
-+              goto func_done;
-+      }
-+
- shrink_again:
-       if (buf_pool->n_chunks <= 1) {
-@@ -1848,7 +2328,7 @@
-       zip_hash = hash_create(2 * buf_pool->curr_size);
-       HASH_MIGRATE(buf_pool->zip_hash, zip_hash, buf_page_t, hash,
--                   BUF_POOL_ZIP_FOLD_BPAGE);
-+                   buf_pool, BUF_POOL_ZIP_FOLD_BPAGE);
-       hash_table_free(buf_pool->zip_hash);
-       buf_pool->zip_hash = zip_hash;
-@@ -2130,6 +2610,11 @@
-       ulint   change_size;
-       ulint   min_change_size = 1048576 * srv_buf_pool_instances;
-+      if (srv_buffer_pool_shm_key) {
-+              /* Cannot support resize */
-+              return;
-+      }
-+
-       buf_pool_mutex_enter_all();
-   
-       if (srv_buf_pool_old_size == srv_buf_pool_size) {
-diff -ruN a/storage/innobase/ha/hash0hash.c b/storage/innobase/ha/hash0hash.c
---- a/storage/innobase/ha/hash0hash.c  2011-04-09 18:48:05.000000000 +0400
-+++ b/storage/innobase/ha/hash0hash.c  2011-04-09 18:48:48.000000000 +0400
-@@ -133,6 +133,70 @@
- }
- /*************************************************************//**
-+*/
-+UNIV_INTERN
-+ulint
-+hash_create_needed(
-+/*===============*/
-+      ulint   n)
-+{
-+      ulint   prime;
-+      ulint   offset;
-+
-+      prime = ut_find_prime(n);
-+
-+      offset = (sizeof(hash_table_t) + 7) / 8;
-+      offset *= 8;
-+
-+      return(offset + sizeof(hash_cell_t) * prime);
-+}
-+
-+UNIV_INTERN
-+void
-+hash_create_init(
-+/*=============*/
-+      hash_table_t*   table,
-+      ulint           n)
-+{
-+      ulint   prime;
-+      ulint   offset;
-+
-+      prime = ut_find_prime(n);
-+
-+      offset = (sizeof(hash_table_t) + 7) / 8;
-+      offset *= 8;
-+
-+      table->array = (hash_cell_t*)(((byte*)table) + offset);
-+      table->n_cells = prime;
-+# if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
-+      table->adaptive = FALSE;
-+# endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
-+      table->n_mutexes = 0;
-+      table->mutexes = NULL;
-+      table->heaps = NULL;
-+      table->heap = NULL;
-+      ut_d(table->magic_n = HASH_TABLE_MAGIC_N);
-+
-+      /* Initialize the cell array */
-+      hash_table_clear(table);
-+}
-+
-+UNIV_INTERN
-+void
-+hash_create_reuse(
-+/*==============*/
-+      hash_table_t*   table)
-+{
-+      ulint   offset;
-+
-+      offset = (sizeof(hash_table_t) + 7) / 8;
-+      offset *= 8;
-+
-+      table->array = (hash_cell_t*)(((byte*)table) + offset);
-+      ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
-+}
-+
-+/*************************************************************//**
- Frees a hash table. */
- UNIV_INTERN
- void
 diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
 --- a/storage/innobase/handler/ha_innodb.cc    2011-04-09 18:48:47.000000000 +0400
 +++ b/storage/innobase/handler/ha_innodb.cc    2011-04-09 18:48:48.000000000 +0400
-@@ -194,6 +194,7 @@
+@@ -194,6 +194,8 @@
  static my_bool        innobase_create_status_file             = FALSE;
  static my_bool        innobase_stats_on_metadata              = TRUE;
  static my_bool        innobase_use_sys_stats_table            = FALSE;
 +static my_bool        innobase_buffer_pool_shm_checksum       = TRUE;
++static uint   innobase_buffer_pool_shm_key            = 0;
  
  
  static char*  internal_innobase_data_file_path        = NULL;
-@@ -2643,6 +2644,14 @@
+@@ -2670,6 +2672,12 @@
        srv_buf_pool_size = (ulint) innobase_buffer_pool_size;
        srv_buf_pool_instances = (ulint) innobase_buffer_pool_instances;
  
-+      if (srv_buffer_pool_shm_key && srv_buf_pool_instances > 1) {
++      if (innobase_buffer_pool_shm_key) {
 +              fprintf(stderr,
-+                      "InnoDB: Warning: innodb_buffer_pool_shm_key cannot be used with several innodb_buffer_pool_instances.\n"
-+                      "InnoDB:          innodb_buffer_pool_instances was set to 1.\n");
-+              srv_buf_pool_instances = 1;
-+              innobase_buffer_pool_instances = 1;
++                      "InnoDB: Warning: innodb_buffer_pool_shm_key is deprecated function.\n"
++                      "InnoDB:          innodb_buffer_pool_shm_key was ignored.\n");
 +      }
 +
        srv_mem_pool_size = (ulint) innobase_additional_mem_pool_size;
  
        srv_n_file_io_threads = (ulint) innobase_file_io_threads;
-@@ -2659,6 +2668,7 @@
-       srv_use_doublewrite_buf = (ibool) innobase_use_doublewrite;
-       srv_use_checksums = (ibool) innobase_use_checksums;
-       srv_fast_checksum = (ibool) innobase_fast_checksum;
-+      srv_buffer_pool_shm_checksum = (ibool) innobase_buffer_pool_shm_checksum;
- #ifdef HAVE_LARGE_PAGES
-         if ((os_use_large_pages = (ibool) my_use_large_pages))
-@@ -11713,6 +11723,16 @@
+@@ -11733,6 +11741,16 @@
    "Number of buffer pool instances, set to higher value on high-end machines to increase scalability",
    NULL, NULL, 1L, 1L, MAX_BUFFER_POOLS, 1L);
  
-+static MYSQL_SYSVAR_UINT(buffer_pool_shm_key, srv_buffer_pool_shm_key,
++static MYSQL_SYSVAR_UINT(buffer_pool_shm_key, innobase_buffer_pool_shm_key,
 +  PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
-+  "[experimental] The key value of shared memory segment for the buffer pool. 0 (default) disables the feature.",
++  "[Deprecated option] no effect",
 +  NULL, NULL, 0, 0, INT_MAX32, 0);
 +
 +static MYSQL_SYSVAR_BOOL(buffer_pool_shm_checksum, innobase_buffer_pool_shm_checksum,
 +  PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
-+  "Enable buffer_pool_shm checksum validation (enabled by default).",
++  "[Deprecated option] no effect",
 +  NULL, NULL, TRUE);
 +
  static MYSQL_SYSVAR_ULONG(commit_concurrency, innobase_commit_concurrency,
    PLUGIN_VAR_RQCMDARG,
    "Helps in performance tuning in heavily concurrent environments.",
-@@ -12006,6 +12026,8 @@
+@@ -12027,6 +12045,8 @@
    MYSQL_SYSVAR(autoextend_increment),
    MYSQL_SYSVAR(buffer_pool_size),
    MYSQL_SYSVAR(buffer_pool_instances),
@@ -791,440 +83,3 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
    MYSQL_SYSVAR(checksums),
    MYSQL_SYSVAR(fast_checksum),
    MYSQL_SYSVAR(commit_concurrency),
-diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
---- a/storage/innobase/include/buf0buf.h       2011-04-09 18:48:47.000000000 +0400
-+++ b/storage/innobase/include/buf0buf.h       2011-04-09 18:48:48.000000000 +0400
-@@ -36,6 +36,7 @@
- #ifndef UNIV_HOTBACKUP
- #include "ut0rbt.h"
- #include "os0proc.h"
-+#include "srv0srv.h"
- /** @name Modes for buf_page_get_gen */
- /* @{ */
-@@ -1592,9 +1593,12 @@
- /**********************************************************************//**
- Compute the hash fold value for blocks in buf_pool->zip_hash. */
- /* @{ */
--#define BUF_POOL_ZIP_FOLD_PTR(ptr) ((ulint) (ptr) / UNIV_PAGE_SIZE)
--#define BUF_POOL_ZIP_FOLD(b) BUF_POOL_ZIP_FOLD_PTR((b)->frame)
--#define BUF_POOL_ZIP_FOLD_BPAGE(b) BUF_POOL_ZIP_FOLD((buf_block_t*) (b))
-+/* the fold should be relative when srv_buffer_pool_shm_key is enabled */
-+#define BUF_POOL_ZIP_FOLD_PTR(bpool, ptr) (!srv_buffer_pool_shm_key\
-+                                      ?((ulint) (ptr) / UNIV_PAGE_SIZE)\
-+                                      :((ulint) ((byte*)ptr - (byte*)(buf_page_from_array(bpool, 0)->frame)) / UNIV_PAGE_SIZE))
-+#define BUF_POOL_ZIP_FOLD(bpool, b) BUF_POOL_ZIP_FOLD_PTR(bpool, (b)->frame)
-+#define BUF_POOL_ZIP_FOLD_BPAGE(bpool, b) BUF_POOL_ZIP_FOLD(bpool, (buf_block_t*) (b))
- /* @} */
- /** A chunk of buffers.  The buffer pool is allocated in chunks. */
-diff -ruN a/storage/innobase/include/hash0hash.h b/storage/innobase/include/hash0hash.h
---- a/storage/innobase/include/hash0hash.h     2011-04-09 18:48:05.000000000 +0400
-+++ b/storage/innobase/include/hash0hash.h     2011-04-09 18:48:48.000000000 +0400
-@@ -49,6 +49,28 @@
- hash_create(
- /*========*/
-       ulint   n);     /*!< in: number of array cells */
-+
-+/*************************************************************//**
-+*/
-+UNIV_INTERN
-+ulint
-+hash_create_needed(
-+/*===============*/
-+      ulint   n);
-+
-+UNIV_INTERN
-+void
-+hash_create_init(
-+/*=============*/
-+      hash_table_t*   table,
-+      ulint           n);
-+
-+UNIV_INTERN
-+void
-+hash_create_reuse(
-+/*==============*/
-+      hash_table_t*   table);
-+
- #ifndef UNIV_HOTBACKUP
- /*************************************************************//**
- Creates a mutex array to protect a hash table. */
-@@ -306,7 +328,7 @@
- /****************************************************************//**
- Move all hash table entries from OLD_TABLE to NEW_TABLE. */
--#define HASH_MIGRATE(OLD_TABLE, NEW_TABLE, NODE_TYPE, PTR_NAME, FOLD_FUNC) \
-+#define HASH_MIGRATE(OLD_TABLE, NEW_TABLE, NODE_TYPE, PTR_NAME, BPOOL, FOLD_FUNC) \
- do {\
-       ulint           i2222;\
-       ulint           cell_count2222;\
-@@ -318,7 +340,7 @@
- \
-               while (node2222) {\
-                       NODE_TYPE*      next2222 = node2222->PTR_NAME;\
--                      ulint           fold2222 = FOLD_FUNC(node2222);\
-+                      ulint           fold2222 = FOLD_FUNC(BPOOL, node2222);\
- \
-                       HASH_INSERT(NODE_TYPE, PTR_NAME, (NEW_TABLE),\
-                               fold2222, node2222);\
-@@ -327,6 +349,33 @@
-               }\
-       }\
- } while (0)
-+
-+/********************************************************************//**
-+Align nodes with moving location.*/
-+#define HASH_OFFSET(TABLE, NODE_TYPE, PTR_NAME, FADDR, FOFFSET, BOFFSET) \
-+do {\
-+      ulint           i2222;\
-+      ulint           cell_count2222;\
-+\
-+      cell_count2222 = hash_get_n_cells(TABLE);\
-+\
-+      for (i2222 = 0; i2222 < cell_count2222; i2222++) {\
-+              NODE_TYPE*      node2222;\
-+\
-+              if ((TABLE)->array[i2222].node) \
-+                      (TABLE)->array[i2222].node = (void*)((byte*)(TABLE)->array[i2222].node \
-+                      + (((TABLE)->array[i2222].node > (void*)FADDR)?FOFFSET:BOFFSET));\
-+              node2222 = HASH_GET_FIRST((TABLE), i2222);\
-+\
-+              while (node2222) {\
-+                      if (node2222->PTR_NAME) \
-+                              node2222->PTR_NAME = (void*)((byte*)(node2222->PTR_NAME) \
-+                              + ((((void*)node2222->PTR_NAME) > (void*)FADDR)?FOFFSET:BOFFSET));\
-+\
-+                      node2222 = node2222->PTR_NAME;\
-+              }\
-+      }\
-+} while (0)
- /************************************************************//**
- Gets the mutex index for a fold value in a hash table.
-diff -ruN a/storage/innobase/include/os0proc.h b/storage/innobase/include/os0proc.h
---- a/storage/innobase/include/os0proc.h       2011-04-09 18:48:05.000000000 +0400
-+++ b/storage/innobase/include/os0proc.h       2011-04-09 18:48:48.000000000 +0400
-@@ -32,6 +32,11 @@
- #ifdef UNIV_LINUX
- #include <sys/ipc.h>
- #include <sys/shm.h>
-+#else
-+# if defined HAVE_SYS_IPC_H && HAVE_SYS_SHM_H
-+#include <sys/ipc.h>
-+#include <sys/shm.h>
-+# endif
- #endif
- typedef void*                 os_process_t;
-@@ -70,6 +75,29 @@
-       ulint   size);                  /*!< in: size returned by
-                                       os_mem_alloc_large() */
-+
-+/****************************************************************//**
-+Allocates or attaches and reuses shared memory segment.
-+The content is not cleared automatically.
-+@return       allocated memory */
-+UNIV_INTERN
-+void*
-+os_shm_alloc(
-+/*=========*/
-+      ulint*  n,                      /*!< in/out: number of bytes */
-+      uint    key,
-+      ibool*  is_new);
-+
-+/****************************************************************//**
-+Detach shared memory segment. */
-+UNIV_INTERN
-+void
-+os_shm_free(
-+/*========*/
-+      void    *ptr,                   /*!< in: pointer returned by
-+                                      os_shm_alloc() */
-+      ulint   size);                  /*!< in: size returned by
-+                                      os_shm_alloc() */
- #ifndef UNIV_NONINL
- #include "os0proc.ic"
- #endif
-diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
---- a/storage/innobase/include/srv0srv.h       2011-04-09 18:48:45.000000000 +0400
-+++ b/storage/innobase/include/srv0srv.h       2011-04-09 18:48:48.000000000 +0400
-@@ -171,6 +171,10 @@
- extern ulint  srv_mem_pool_size;
- extern ulint  srv_lock_table_size;
-+extern uint   srv_buffer_pool_shm_key;
-+extern ibool  srv_buffer_pool_shm_is_reused;
-+extern ibool  srv_buffer_pool_shm_checksum;
-+
- extern ibool  srv_thread_concurrency_timer_based;
- extern ulint  srv_n_file_io_threads;
-diff -ruN a/storage/innobase/include/ut0lst.h b/storage/innobase/include/ut0lst.h
---- a/storage/innobase/include/ut0lst.h        2011-04-09 18:48:05.000000000 +0400
-+++ b/storage/innobase/include/ut0lst.h        2011-04-09 18:48:48.000000000 +0400
-@@ -257,5 +257,48 @@
-       ut_a(ut_list_node_313 == NULL);                                 \
- } while (0)
-+/********************************************************************//**
-+Align nodes with moving location.
-+@param NAME           the name of the list
-+@param TYPE           node type
-+@param BASE           base node (not a pointer to it)
-+@param OFFSET         offset moved */
-+#define UT_LIST_OFFSET(NAME, TYPE, BASE, FADDR, FOFFSET, BOFFSET)     \
-+do {                                                                  \
-+      ulint   ut_list_i_313;                                          \
-+      TYPE*   ut_list_node_313;                                       \
-+                                                                      \
-+      if ((BASE).start)                                               \
-+              (BASE).start = (void*)((byte*)((BASE).start)                    \
-+                      + (((void*)((BASE).start) > (void*)FADDR)?FOFFSET:BOFFSET));\
-+      if ((BASE).end)                                                 \
-+              (BASE).end   = (void*)((byte*)((BASE).end)                      \
-+                      + (((void*)((BASE).end) > (void*)FADDR)?FOFFSET:BOFFSET));\
-+                                                                      \
-+      ut_list_node_313 = (BASE).start;                                \
-+                                                                      \
-+      for (ut_list_i_313 = (BASE).count; ut_list_i_313--; ) {         \
-+              ut_a(ut_list_node_313);                                 \
-+              if ((ut_list_node_313->NAME).prev)                      \
-+                      (ut_list_node_313->NAME).prev = (void*)((byte*)((ut_list_node_313->NAME).prev)\
-+                              + (((void*)((ut_list_node_313->NAME).prev) > (void*)FADDR)?FOFFSET:BOFFSET));\
-+              if ((ut_list_node_313->NAME).next)                      \
-+                      (ut_list_node_313->NAME).next = (void*)((byte*)((ut_list_node_313->NAME).next)\
-+                              + (((void*)((ut_list_node_313->NAME).next)> (void*)FADDR)?FOFFSET:BOFFSET));\
-+              ut_list_node_313 = (ut_list_node_313->NAME).next;       \
-+      }                                                               \
-+                                                                      \
-+      ut_a(ut_list_node_313 == NULL);                                 \
-+                                                                      \
-+      ut_list_node_313 = (BASE).end;                                  \
-+                                                                      \
-+      for (ut_list_i_313 = (BASE).count; ut_list_i_313--; ) {         \
-+              ut_a(ut_list_node_313);                                 \
-+              ut_list_node_313 = (ut_list_node_313->NAME).prev;       \
-+      }                                                               \
-+                                                                      \
-+      ut_a(ut_list_node_313 == NULL);                                 \
-+} while (0)
-+
- #endif
-diff -ruN a/storage/innobase/log/log0recv.c b/storage/innobase/log/log0recv.c
---- a/storage/innobase/log/log0recv.c  2011-04-09 18:48:42.000000000 +0400
-+++ b/storage/innobase/log/log0recv.c  2011-04-09 18:48:48.000000000 +0400
-@@ -2912,6 +2912,7 @@
- /*==========================*/
- {
-       ut_a(!recv_needed_recovery);
-+      ut_a(!srv_buffer_pool_shm_is_reused);
-       recv_needed_recovery = TRUE;
-diff -ruN a/storage/innobase/os/os0proc.c b/storage/innobase/os/os0proc.c
---- a/storage/innobase/os/os0proc.c    2011-04-09 18:48:05.000000000 +0400
-+++ b/storage/innobase/os/os0proc.c    2011-04-09 18:48:48.000000000 +0400
-@@ -229,3 +229,173 @@
-       }
- #endif
- }
-+
-+/****************************************************************//**
-+Allocates or attaches and reuses shared memory segment.
-+The content is not cleared automatically.
-+@return       allocated memory */
-+UNIV_INTERN
-+void*
-+os_shm_alloc(
-+/*=========*/
-+      ulint*  n,                      /*!< in/out: number of bytes */
-+      uint    key,
-+      ibool*  is_new)
-+{
-+      void*   ptr;
-+#if defined HAVE_SYS_IPC_H && HAVE_SYS_SHM_H
-+      ulint   size;
-+      int     shmid;
-+
-+      *is_new = FALSE;
-+      fprintf(stderr,
-+              "InnoDB: The shared memory segment containing the buffer pool is: key  %#x (%d).\n",
-+              key, key);
-+# if defined HAVE_LARGE_PAGES && defined UNIV_LINUX
-+      if (!os_use_large_pages || !os_large_page_size) {
-+              goto skip;
-+      }
-+
-+      /* Align block size to os_large_page_size */
-+      ut_ad(ut_is_2pow(os_large_page_size));
-+      size = ut_2pow_round(*n + (os_large_page_size - 1),
-+                           os_large_page_size);
-+
-+      shmid = shmget((key_t)key, (size_t)size,
-+                      IPC_CREAT | IPC_EXCL | SHM_HUGETLB | SHM_R | SHM_W);
-+      if (shmid < 0) {
-+              if (errno == EEXIST) {
-+                      fprintf(stderr,
-+                              "InnoDB: HugeTLB: The shared memory segment exists.\n");
-+                      shmid = shmget((key_t)key, (size_t)size,
-+                                      SHM_HUGETLB | SHM_R | SHM_W);
-+                      if (shmid < 0) {
-+                              fprintf(stderr,
-+                                      "InnoDB: HugeTLB: Warning: Failed to allocate %lu bytes. (reuse) errno %d\n",
-+                                      size, errno);
-+                              goto skip;
-+                      } else {
-+                              fprintf(stderr,
-+                                      "InnoDB: HugeTLB: The existent shared memory segment is used.\n");
-+                      }
-+              } else {
-+                      fprintf(stderr,
-+                              "InnoDB: HugeTLB: Warning: Failed to allocate %lu bytes. (new) errno %d\n",
-+                              size, errno);
-+                      goto skip;
-+              }
-+      } else {
-+              *is_new = TRUE;
-+              fprintf(stderr,
-+                      "InnoDB: HugeTLB: A new shared memory segment has been created .\n");
-+      }
-+
-+      ptr = shmat(shmid, NULL, 0);
-+      if (ptr == (void *)-1) {
-+              fprintf(stderr,
-+                      "InnoDB: HugeTLB: Warning: Failed to attach shared memory segment, errno %d\n",
-+                      errno);
-+              ptr = NULL;
-+      }
-+
-+      if (ptr) {
-+              *n = size;
-+              os_fast_mutex_lock(&ut_list_mutex);
-+              ut_total_allocated_memory += size;
-+              os_fast_mutex_unlock(&ut_list_mutex);
-+              UNIV_MEM_ALLOC(ptr, size);
-+              return(ptr);
-+      }
-+skip:
-+      *is_new = FALSE;
-+# endif /* HAVE_LARGE_PAGES && defined UNIV_LINUX */
-+# ifdef HAVE_GETPAGESIZE
-+      size = getpagesize();
-+# else
-+      size = UNIV_PAGE_SIZE;
-+# endif
-+      /* Align block size to system page size */
-+      ut_ad(ut_is_2pow(size));
-+      size = *n = ut_2pow_round(*n + (size - 1), size);
-+
-+      shmid = shmget((key_t)key, (size_t)size,
-+                      IPC_CREAT | IPC_EXCL | SHM_R | SHM_W);
-+      if (shmid < 0) {
-+              if (errno == EEXIST) {
-+                      fprintf(stderr,
-+                              "InnoDB: A shared memory segment containing the buffer pool seems to already exist.\n");
-+                      shmid = shmget((key_t)key, (size_t)size,
-+                                      SHM_R | SHM_W);
-+                      if (shmid < 0) {
-+                              fprintf(stderr,
-+                                      "InnoDB: Warning: Failed to allocate %lu bytes. (reuse) errno %d\n",
-+                                      size, errno);
-+                              ptr = NULL;
-+                              goto end;
-+                      } else {
-+                              fprintf(stderr,
-+                                      "InnoDB: The existent shared memory segment is used.\n");
-+                      }
-+              } else {
-+                      fprintf(stderr,
-+                              "InnoDB: Warning: Failed to allocate %lu bytes. (new) errno %d\n",
-+                              size, errno);
-+                      ptr = NULL;
-+                      goto end;
-+              }
-+      } else {
-+              *is_new = TRUE;
-+              fprintf(stderr,
-+                      "InnoDB: A new shared memory segment has been created.\n");
-+      }
-+
-+      ptr = shmat(shmid, NULL, 0);
-+      if (ptr == (void *)-1) {
-+              fprintf(stderr,
-+                      "InnoDB: Warning: Failed to attach shared memory segment, errno %d\n",
-+                      errno);
-+              ptr = NULL;
-+      }
-+
-+      if (ptr) {
-+              *n = size;
-+              os_fast_mutex_lock(&ut_list_mutex);
-+              ut_total_allocated_memory += size;
-+              os_fast_mutex_unlock(&ut_list_mutex);
-+              UNIV_MEM_ALLOC(ptr, size);
-+      }
-+end:
-+#else /* HAVE_SYS_IPC_H && HAVE_SYS_SHM_H */
-+      fprintf(stderr, "InnoDB: shared memory segment is not supported.\n");
-+      ptr = NULL;
-+#endif /* HAVE_SYS_IPC_H && HAVE_SYS_SHM_H */
-+      return(ptr);
-+}
-+
-+/****************************************************************//**
-+Detach shared memory segment. */
-+UNIV_INTERN
-+void
-+os_shm_free(
-+/*========*/
-+      void    *ptr,                   /*!< in: pointer returned by
-+                                      os_shm_alloc() */
-+      ulint   size)                   /*!< in: size returned by
-+                                      os_shm_alloc() */
-+{
-+      os_fast_mutex_lock(&ut_list_mutex);
-+      ut_a(ut_total_allocated_memory >= size);
-+      os_fast_mutex_unlock(&ut_list_mutex);
-+
-+#if defined HAVE_SYS_IPC_H && HAVE_SYS_SHM_H
-+      if (!shmdt(ptr)) {
-+              os_fast_mutex_lock(&ut_list_mutex);
-+              ut_a(ut_total_allocated_memory >= size);
-+              ut_total_allocated_memory -= size;
-+              os_fast_mutex_unlock(&ut_list_mutex);
-+              UNIV_MEM_FREE(ptr, size);
-+      }
-+#else /* HAVE_SYS_IPC_H && HAVE_SYS_SHM_H */
-+      fprintf(stderr, "InnoDB: shared memory segment is not supported.\n");
-+#endif /* HAVE_SYS_IPC_H && HAVE_SYS_SHM_H */
-+}
-diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
---- a/storage/innobase/srv/srv0srv.c   2011-04-09 18:48:46.000000000 +0400
-+++ b/storage/innobase/srv/srv0srv.c   2011-04-09 18:48:48.000000000 +0400
-@@ -235,6 +235,11 @@
- UNIV_INTERN ulint     srv_mem_pool_size       = ULINT_MAX;
- UNIV_INTERN ulint     srv_lock_table_size     = ULINT_MAX;
-+/* key value for shm */
-+UNIV_INTERN uint      srv_buffer_pool_shm_key = 0;
-+UNIV_INTERN ibool     srv_buffer_pool_shm_is_reused = FALSE;
-+UNIV_INTERN ibool     srv_buffer_pool_shm_checksum = TRUE;
-+
- /* This parameter is deprecated. Use srv_n_io_[read|write]_threads
- instead. */
- UNIV_INTERN ulint     srv_n_file_io_threads   = ULINT_MAX;
-diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c
---- a/storage/innobase/srv/srv0start.c 2011-04-09 18:48:43.000000000 +0400
-+++ b/storage/innobase/srv/srv0start.c 2011-04-09 18:48:48.000000000 +0400
-@@ -1844,6 +1844,8 @@
-               Note that this is not as heavy weight as it seems. At
-               this point there will be only ONE page in the buf_LRU
-               and there must be no page in the buf_flush list. */
-+              /* buffer_pool_shm should not be reused when recovery was needed. */
-+              if (!srv_buffer_pool_shm_is_reused)
-               buf_pool_invalidate();
-               /* We always try to do a recovery, even if the database had
index 2e5b3e8361ae9496d16c8d0341efd9ec59e605df..082ab72e32bca9f758938f0e8561fa7c348d9acd 100644 (file)
@@ -8,7 +8,7 @@
 diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
 --- a/storage/innobase/handler/ha_innodb.cc    2010-12-04 16:09:53.145500265 +0900
 +++ b/storage/innobase/handler/ha_innodb.cc    2010-12-04 16:10:24.605515894 +0900
-@@ -687,6 +687,8 @@
+@@ -686,6 +686,8 @@
    (char*) &export_vars.innodb_dblwr_pages_written,      SHOW_LONG},
    {"dblwr_writes",
    (char*) &export_vars.innodb_dblwr_writes,             SHOW_LONG},
@@ -31,7 +31,7 @@ diff -ruN a/storage/innobase/include/lock0lock.h b/storage/innobase/include/lock
 diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
 --- a/storage/innobase/include/srv0srv.h       2010-12-04 15:55:21.378480843 +0900
 +++ b/storage/innobase/include/srv0srv.h       2010-12-04 16:10:24.606550983 +0900
-@@ -776,6 +776,7 @@
+@@ -758,6 +758,7 @@
        ulint innodb_buffer_pool_read_ahead_evicted;/*!< srv_read_ahead evicted*/
        ulint innodb_dblwr_pages_written;       /*!< srv_dblwr_pages_written */
        ulint innodb_dblwr_writes;              /*!< srv_dblwr_writes */
@@ -53,7 +53,7 @@ diff -ruN a/storage/innobase/lock/lock0lock.c b/storage/innobase/lock/lock0lock.
 diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
 --- a/storage/innobase/srv/srv0srv.c   2010-12-04 15:57:13.069513371 +0900
 +++ b/storage/innobase/srv/srv0srv.c   2010-12-04 16:10:24.610593039 +0900
-@@ -475,6 +475,7 @@
+@@ -468,6 +468,7 @@
  static ulint  srv_n_rows_deleted_old          = 0;
  static ulint  srv_n_rows_read_old             = 0;
  
@@ -61,7 +61,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
  UNIV_INTERN ulint             srv_n_lock_wait_count           = 0;
  UNIV_INTERN ulint             srv_n_lock_wait_current_count   = 0;
  UNIV_INTERN ib_int64_t        srv_n_lock_wait_time            = 0;
-@@ -2293,6 +2294,7 @@
+@@ -2282,6 +2283,7 @@
        export_vars.innodb_buffer_pool_pages_data = LRU_len;
        export_vars.innodb_buffer_pool_pages_dirty = flush_list_len;
        export_vars.innodb_buffer_pool_pages_free = free_len;
index e66e67decac8ea01210c4d8f54e6c05019712707..37a6b54aba1d9e47b5ac86a95f879fffd4c493a5 100644 (file)
@@ -277,7 +277,7 @@ diff -ruN a/storage/innobase/dict/dict0crea.c b/storage/innobase/dict/dict0crea.
 diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.c
 --- a/storage/innobase/dict/dict0dict.c        2010-11-03 07:01:13.000000000 +0900
 +++ b/storage/innobase/dict/dict0dict.c        2010-12-03 15:45:47.525953769 +0900
-@@ -627,6 +627,8 @@
+@@ -626,6 +626,8 @@
  
        table = dict_table_get_on_id_low(table_id);
  
@@ -286,7 +286,7 @@ diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.
        mutex_exit(&(dict_sys->mutex));
  
        return(table);
-@@ -745,6 +747,8 @@
+@@ -744,6 +746,8 @@
                table->n_mysql_handles_opened++;
        }
  
@@ -295,7 +295,7 @@ diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.
        mutex_exit(&(dict_sys->mutex));
  
        if (table != NULL) {
-@@ -1260,6 +1264,64 @@
+@@ -1259,6 +1263,64 @@
        dict_mem_table_free(table);
  }
  
@@ -360,7 +360,7 @@ diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.
  /****************************************************************//**
  If the given column name is reserved for InnoDB system columns, return
  TRUE.
-@@ -1729,6 +1791,11 @@
+@@ -1728,6 +1790,11 @@
        ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
        ut_ad(mutex_own(&(dict_sys->mutex)));
  
@@ -375,7 +375,7 @@ diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.
 diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
 --- a/storage/innobase/handler/ha_innodb.cc    2010-12-03 15:43:57.294986852 +0900
 +++ b/storage/innobase/handler/ha_innodb.cc    2010-12-03 15:45:47.534959966 +0900
-@@ -675,6 +675,8 @@
+@@ -674,6 +674,8 @@
    (char*) &export_vars.innodb_dblwr_pages_written,      SHOW_LONG},
    {"dblwr_writes",
    (char*) &export_vars.innodb_dblwr_writes,             SHOW_LONG},
@@ -384,7 +384,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
    {"have_atomic_builtins",
    (char*) &export_vars.innodb_have_atomic_builtins,     SHOW_BOOL},
    {"log_waits",
-@@ -11618,6 +11620,11 @@
+@@ -11642,6 +11644,11 @@
    "Choose method of innodb_adaptive_flushing. (native, [estimate], keep_average)",
    NULL, innodb_adaptive_flushing_method_update, 1, &adaptive_flushing_method_typelib);
  
@@ -396,7 +396,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
  static struct st_mysql_sys_var* innobase_system_variables[]= {
    MYSQL_SYSVAR(additional_mem_pool_size),
    MYSQL_SYSVAR(autoextend_increment),
-@@ -11685,6 +11692,7 @@
+@@ -11709,6 +11716,7 @@
    MYSQL_SYSVAR(flush_neighbor_pages),
    MYSQL_SYSVAR(read_ahead),
    MYSQL_SYSVAR(adaptive_flushing_method),
@@ -407,7 +407,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
 diff -ruN a/storage/innobase/ibuf/ibuf0ibuf.c b/storage/innobase/ibuf/ibuf0ibuf.c
 --- a/storage/innobase/ibuf/ibuf0ibuf.c        2010-12-03 15:18:48.889024455 +0900
 +++ b/storage/innobase/ibuf/ibuf0ibuf.c        2010-12-03 15:45:47.553025057 +0900
-@@ -578,6 +578,7 @@
+@@ -566,6 +566,7 @@
  
        /* Use old-style record format for the insert buffer. */
        table = dict_mem_table_create(IBUF_TABLE_NAME, IBUF_SPACE_ID, 1, 0);
@@ -435,7 +435,7 @@ diff -ruN a/storage/innobase/include/btr0sea.h b/storage/innobase/include/btr0se
 diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
 --- a/storage/innobase/include/buf0buf.h       2011-02-01 18:00:03.000000000 +0900
 +++ b/storage/innobase/include/buf0buf.h       2011-02-01 18:03:29.000000000 +0900
-@@ -1553,6 +1553,15 @@
+@@ -1555,6 +1555,15 @@
  #define BUF_POOL_ZIP_FOLD_BPAGE(b) BUF_POOL_ZIP_FOLD((buf_block_t*) (b))
  /* @} */
  
@@ -500,7 +500,7 @@ diff -ruN a/storage/innobase/include/dict0dict.ic b/storage/innobase/include/dic
 diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
 --- a/storage/innobase/include/srv0srv.h       2010-12-03 15:43:57.297067100 +0900
 +++ b/storage/innobase/include/srv0srv.h       2010-12-03 15:45:47.562024404 +0900
-@@ -232,6 +232,7 @@
+@@ -229,6 +229,7 @@
  extern ulint  srv_read_ahead;
  extern ulint  srv_adaptive_flushing_method;
  
@@ -508,7 +508,7 @@ diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0sr
  /*-------------------------------------------*/
  
  extern ulint  srv_n_rows_inserted;
-@@ -727,6 +728,7 @@
+@@ -709,6 +710,7 @@
        ulint innodb_data_writes;               /*!< I/O write requests */
        ulint innodb_data_written;              /*!< Data bytes written */
        ulint innodb_data_reads;                /*!< I/O read requests */
@@ -519,7 +519,7 @@ diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0sr
 diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
 --- a/storage/innobase/srv/srv0srv.c   2010-12-03 15:43:57.301024390 +0900
 +++ b/storage/innobase/srv/srv0srv.c   2010-12-03 15:45:47.565023830 +0900
-@@ -422,6 +422,8 @@
+@@ -415,6 +415,8 @@
  UNIV_INTERN ulint     srv_enable_unsafe_group_commit = 0; /* 0:disable 1:enable */
  UNIV_INTERN ulint     srv_read_ahead = 3; /* 1: random  2: linear  3: Both */
  UNIV_INTERN ulint     srv_adaptive_flushing_method = 0; /* 0: native  1: estimate  2: keep_average */
@@ -528,7 +528,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
  /*-------------------------------------------*/
  UNIV_INTERN ulong     srv_n_spin_wait_rounds  = 30;
  UNIV_INTERN ulong     srv_n_free_tickets_to_enter = 500;
-@@ -2232,6 +2234,7 @@
+@@ -2220,6 +2222,7 @@
        export_vars.innodb_data_reads = os_n_file_reads;
        export_vars.innodb_data_writes = os_n_file_writes;
        export_vars.innodb_data_written = srv_data_written;
index c103a5a47ae101d8cde6cbe2f9483b14c8f151ff..b2cd574a3a9d3e8b8e5ebb09e3d237b359c6f557 100644 (file)
@@ -4,10 +4,11 @@
 # Expands the applicability of InnoDB fast index creation to mysqldump,
 # ALTER TABLE and OPTIMIZE TABLE.
 #
+#
 diff -ruN a/client/client_priv.h b/client/client_priv.h
 --- a/client/client_priv.h     2011-04-11 08:57:20.000000000 +0400
 +++ b/client/client_priv.h     2011-04-11 08:57:21.000000000 +0400
-@@ -89,6 +89,7 @@
+@@ -90,6 +90,7 @@
    OPT_NO_REMOVE_EOL_CARRET,
    OPT_DEFAULT_AUTH,
    OPT_DEFAULT_PLUGIN,
@@ -524,15 +525,7 @@ diff -ruN a/sql/sql_table.cc b/sql/sql_table.cc
  
    DBUG_ENTER("mysql_prepare_alter_table");
  
-@@ -5286,6 +5314,7 @@
-     char *tablespace= static_cast<char *>(thd->alloc(FN_LEN + 1));
-     /*
-        Regular alter table of disk stored table (no tablespace/storage change)
-+
-        Copy tablespace name
-     */
-     if (tablespace &&
-@@ -5436,7 +5465,23 @@
+@@ -5431,7 +5459,23 @@
    /*
      Collect all keys which isn't in drop list. Add only those
      for which some fields exists.
@@ -557,7 +550,7 @@ diff -ruN a/sql/sql_table.cc b/sql/sql_table.cc
  
    for (uint i=0 ; i < table->s->keys ; i++,key_info++)
    {
-@@ -5553,6 +5598,8 @@
+@@ -5548,6 +5592,8 @@
                     test(key_info->flags & HA_GENERATED_KEY),
                     key_parts);
        new_key_list.push_back(key);
@@ -566,7 +559,7 @@ diff -ruN a/sql/sql_table.cc b/sql/sql_table.cc
      }
    }
    {
-@@ -5560,7 +5607,21 @@
+@@ -5555,7 +5601,21 @@
      while ((key=key_it++))                    // Add new keys
      {
        if (key->type != Key::FOREIGN_KEY)
@@ -588,7 +581,7 @@ diff -ruN a/sql/sql_table.cc b/sql/sql_table.cc
        if (key->name.str &&
          !my_strcasecmp(system_charset_info, key->name.str, primary_key_name))
        {
-@@ -5609,12 +5670,100 @@
+@@ -5604,12 +5664,100 @@
    rc= FALSE;
    alter_info->create_list.swap(new_create_list);
    alter_info->key_list.swap(new_key_list);
@@ -689,7 +682,7 @@ diff -ruN a/sql/sql_table.cc b/sql/sql_table.cc
    Alter table
  
    SYNOPSIS
-@@ -6405,19 +6554,38 @@
+@@ -6400,19 +6548,38 @@
    */
    if (new_table && !(new_table->file->ha_table_flags() & HA_NO_COPY_ON_ALTER))
    {
index c758f2ce5a3aafd04bbe73fe759fcecd8b3e23ba..fb82f0f2a62b7d0fbc8ba88f8728754e07382e63 100644 (file)
@@ -5,10 +5,40 @@
 #!!! notice !!!
 # Any small change to this file in the main branch
 # should be done or reviewed by the maintainer!
+diff -ruN a/storage/innobase/btr/btr0btr.c b/storage/innobase/btr/btr0btr.c
+--- a/storage/innobase/btr/btr0btr.c   2011-04-11 19:44:03.000000000 +0900
++++ b/storage/innobase/btr/btr0btr.c   2011-05-24 20:30:12.455852287 +0900
+@@ -837,7 +837,7 @@
+ /**************************************************************//**
+ Creates a new index page (not the root, and also not
+ used in page reorganization).  @see btr_page_empty(). */
+-static
++UNIV_INTERN
+ void
+ btr_page_create(
+ /*============*/
+@@ -1707,7 +1707,7 @@
+ #ifndef UNIV_HOTBACKUP
+ /*************************************************************//**
+ Empties an index page.  @see btr_page_create(). */
+-static
++UNIV_INTERN
+ void
+ btr_page_empty(
+ /*===========*/
+@@ -2269,7 +2269,7 @@
+ /**************************************************************//**
+ Attaches the halves of an index page on the appropriate level in an
+ index tree. */
+-static
++UNIV_INTERN
+ void
+ btr_attach_half_pages(
+ /*==================*/
 diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
 --- a/storage/innobase/fil/fil0fil.c   2010-12-03 15:09:51.274957577 +0900
 +++ b/storage/innobase/fil/fil0fil.c   2010-12-03 15:52:23.553986552 +0900
-@@ -40,6 +40,12 @@
+@@ -40,6 +40,14 @@
  #include "dict0dict.h"
  #include "page0page.h"
  #include "page0zip.h"
@@ -18,10 +48,97 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
 +#include "row0mysql.h"
 +#include "row0row.h"
 +#include "que0que.h"
++#include "btr0btr.h"
++#include "btr0sea.h"
  #ifndef UNIV_HOTBACKUP
  # include "buf0lru.h"
  # include "ibuf0ibuf.h"
-@@ -3078,7 +3084,7 @@
+@@ -3032,6 +3040,84 @@
+ }
+ /********************************************************************//**
++Checks if a page is corrupt. (for offline page)
++*/
++static
++ibool
++fil_page_buf_page_is_corrupted_offline(
++/*===================================*/
++      const byte*     page,           /*!< in: a database page */
++      ulint           zip_size)       /*!< in: size of compressed page;
++                                      0 for uncompressed pages */
++{
++      ulint           checksum_field;
++      ulint           old_checksum_field;
++
++      if (!zip_size
++          && memcmp(page + FIL_PAGE_LSN + 4,
++                    page + UNIV_PAGE_SIZE
++                    - FIL_PAGE_END_LSN_OLD_CHKSUM + 4, 4)) {
++              return(TRUE);
++      }
++
++      checksum_field = mach_read_from_4(page
++                                        + FIL_PAGE_SPACE_OR_CHKSUM);
++
++      if (zip_size) {
++              return(checksum_field != BUF_NO_CHECKSUM_MAGIC
++                     && checksum_field
++                     != page_zip_calc_checksum(page, zip_size));
++      }
++
++      old_checksum_field = mach_read_from_4(
++              page + UNIV_PAGE_SIZE
++              - FIL_PAGE_END_LSN_OLD_CHKSUM);
++
++      if (old_checksum_field != mach_read_from_4(page
++                                                 + FIL_PAGE_LSN)
++          && old_checksum_field != BUF_NO_CHECKSUM_MAGIC
++          && old_checksum_field
++          != buf_calc_page_old_checksum(page)) {
++              return(TRUE);
++      }
++
++      if (checksum_field != 0
++          && checksum_field != BUF_NO_CHECKSUM_MAGIC
++          && checksum_field
++          != buf_calc_page_new_checksum(page)) {
++              return(TRUE);
++      }
++
++      return(FALSE);
++}
++
++/********************************************************************//**
++*/
++static
++void
++fil_page_buf_page_store_checksum(
++/*=============================*/
++      byte*   page,
++      ulint   zip_size)
++{
++      if (!zip_size) {
++              mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM,
++                              srv_use_checksums
++                              ? buf_calc_page_new_checksum(page)
++                                              : BUF_NO_CHECKSUM_MAGIC);
++              mach_write_to_4(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,
++                              srv_use_checksums
++                              ? buf_calc_page_old_checksum(page)
++                                              : BUF_NO_CHECKSUM_MAGIC);
++      } else {
++              mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM,
++                              srv_use_checksums
++                              ? page_zip_calc_checksum(page, zip_size)
++                              : BUF_NO_CHECKSUM_MAGIC);
++      }
++}
++
++/********************************************************************//**
+ Tries to open a single-table tablespace and optionally checks the space id is
+ right in it. If does not succeed, prints an error message to the .err log. This
+ function is used to open a tablespace when we start up mysqld, and also in
+@@ -3078,7 +3164,7 @@
  
        file = os_file_create_simple_no_error_handling(
                innodb_file_data_key, filepath, OS_FILE_OPEN,
@@ -30,7 +147,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
        if (!success) {
                /* The following call prints an error message */
                os_file_get_last_error(TRUE);
-@@ -3125,6 +3131,466 @@
+@@ -3125,6 +3211,445 @@
        space_id = fsp_header_get_space_id(page);
        space_flags = fsp_header_get_flags(page);
  
@@ -56,6 +173,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
 +              fil_system_t*   system;
 +              fil_node_t*     node = NULL;
 +              fil_space_t*    space;
++              ulint           zip_size;
 +
 +              buf3 = ut_malloc(2 * UNIV_PAGE_SIZE);
 +              descr_page = ut_align(buf3, UNIV_PAGE_SIZE);
@@ -73,12 +191,15 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
 +              /* store as first descr page */
 +              memcpy(descr_page, page, UNIV_PAGE_SIZE);
 +
++              zip_size = dict_table_flags_to_zip_size(flags);
++              ut_a(zip_size == dict_table_flags_to_zip_size(space_flags));
++
 +              /* get free limit (page number) of the table space */
 +/* these should be same to the definition in fsp0fsp.c */
 +#define FSP_HEADER_OFFSET     FIL_PAGE_DATA
 +#define       FSP_FREE_LIMIT          12
 +              free_limit = mach_read_from_4(FSP_HEADER_OFFSET + FSP_FREE_LIMIT + page);
-+              free_limit_bytes = (ib_int64_t)free_limit * (ib_int64_t)UNIV_PAGE_SIZE;
++              free_limit_bytes = (ib_int64_t)free_limit * (ib_int64_t)(zip_size ? zip_size : UNIV_PAGE_SIZE);
 +
 +              /* overwrite fsp header */
 +              fsp_header_init_fields(page, id, flags);
@@ -87,14 +208,9 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
 +              space_flags = flags;
 +              if (mach_read_from_8(page + FIL_PAGE_FILE_FLUSH_LSN) > current_lsn)
 +                      mach_write_to_8(page + FIL_PAGE_FILE_FLUSH_LSN, current_lsn);
-+              mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM,
-+                              srv_use_checksums
-+                              ? buf_calc_page_new_checksum(page)
-+                                              : BUF_NO_CHECKSUM_MAGIC);
-+              mach_write_to_4(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,
-+                              srv_use_checksums
-+                              ? buf_calc_page_old_checksum(page)
-+                                              : BUF_NO_CHECKSUM_MAGIC);
++
++              fil_page_buf_page_store_checksum(page, zip_size);
++
 +              success = os_file_write(filepath, file, page, 0, 0, UNIV_PAGE_SIZE);
 +
 +              /* get file size */
@@ -104,7 +220,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
 +
 +              if (size_bytes < free_limit_bytes) {
 +                      free_limit_bytes = size_bytes;
-+                      if (size_bytes >= FSP_EXTENT_SIZE * UNIV_PAGE_SIZE) {
++                      if (size_bytes >= (lint)FSP_EXTENT_SIZE * (lint)(zip_size ? zip_size : UNIV_PAGE_SIZE)) {
 +                              fprintf(stderr, "InnoDB: free limit of %s is larger than its real size.\n", filepath);
 +                              file_is_corrupt = TRUE;
 +                      }
@@ -168,63 +284,41 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
 +                      size_bytes = ut_2pow_round(size_bytes, 1024 * 1024);
 +              }
 +              */
-+              if (!(flags & DICT_TF_ZSSIZE_MASK)) {
++
++              if (zip_size) {
++                      fprintf(stderr, "InnoDB: Warning: importing compressed table is still EXPERIMENTAL, currently.\n");
++              }
++
++              {
 +                      mem_heap_t*     heap = NULL;
 +                      ulint           offsets_[REC_OFFS_NORMAL_SIZE];
 +                      ulint*          offsets = offsets_;
 +                      ib_int64_t      offset;
 +
-+                      size = (ulint) (size_bytes / UNIV_PAGE_SIZE);
++                      size = (ulint) (size_bytes / (zip_size ? zip_size : UNIV_PAGE_SIZE));
 +                      /* over write space id of all pages */
 +                      rec_offs_init(offsets_);
 +
 +                      fprintf(stderr, "InnoDB: Progress in %%:");
 +
-+                      for (offset = 0; offset < free_limit_bytes; offset += UNIV_PAGE_SIZE) {
-+                              ulint           checksum_field;
-+                              ulint           old_checksum_field;
++                      for (offset = 0; offset < free_limit_bytes;
++                           offset += zip_size ? zip_size : UNIV_PAGE_SIZE) {
 +                              ibool           page_is_corrupt;
 +
 +                              success = os_file_read(file, page,
 +                                                      (ulint)(offset & 0xFFFFFFFFUL),
-+                                                      (ulint)(offset >> 32), UNIV_PAGE_SIZE);
++                                                      (ulint)(offset >> 32),
++                                                      zip_size ? zip_size : UNIV_PAGE_SIZE);
 +
 +                              page_is_corrupt = FALSE;
 +
 +                              /* check consistency */
-+                              if (memcmp(page + FIL_PAGE_LSN + 4,
-+                                         page + UNIV_PAGE_SIZE
-+                                         - FIL_PAGE_END_LSN_OLD_CHKSUM + 4, 4)) {
-+
++                              if (fil_page_buf_page_is_corrupted_offline(page, zip_size)) {
 +                                      page_is_corrupt = TRUE;
 +                              }
 +
 +                              if (mach_read_from_4(page + FIL_PAGE_OFFSET)
-+                                  != offset / UNIV_PAGE_SIZE) {
-+
-+                                      page_is_corrupt = TRUE;
-+                              }
-+
-+                              checksum_field = mach_read_from_4(page
-+                                                                + FIL_PAGE_SPACE_OR_CHKSUM);
-+
-+                              old_checksum_field = mach_read_from_4(
-+                                      page + UNIV_PAGE_SIZE
-+                                      - FIL_PAGE_END_LSN_OLD_CHKSUM);
-+
-+                              if (old_checksum_field != mach_read_from_4(page
-+                                                                         + FIL_PAGE_LSN)
-+                                  && old_checksum_field != BUF_NO_CHECKSUM_MAGIC
-+                                  && old_checksum_field
-+                                  != buf_calc_page_old_checksum(page)) {
-+
-+                                      page_is_corrupt = TRUE;
-+                              }
-+
-+                              if (checksum_field != 0
-+                                  && checksum_field != BUF_NO_CHECKSUM_MAGIC
-+                                  && checksum_field
-+                                  != buf_calc_page_new_checksum(page)) {
++                                  != offset / (zip_size ? zip_size : UNIV_PAGE_SIZE)) {
 +
 +                                      page_is_corrupt = TRUE;
 +                              }
@@ -235,7 +329,8 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
 +                                      /* it should be overwritten already */
 +                                      ut_a(!page_is_corrupt);
 +
-+                              } else if (!((offset / UNIV_PAGE_SIZE) % UNIV_PAGE_SIZE)) {
++                              } else if (!((offset / (zip_size ? zip_size : UNIV_PAGE_SIZE))
++                                           % (zip_size ? zip_size : UNIV_PAGE_SIZE))) {
 +                                      /* descr page (not header) */
 +                                      if (page_is_corrupt) {
 +                                              file_is_corrupt = TRUE;
@@ -246,7 +341,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
 +                                      }
 +
 +                                      /* store as descr page */
-+                                      memcpy(descr_page, page, UNIV_PAGE_SIZE);
++                                      memcpy(descr_page, page, (zip_size ? zip_size : UNIV_PAGE_SIZE));
 +
 +                              } else if (descr_is_corrupt) {
 +                                      /* unknown state of the page */
@@ -274,9 +369,12 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
 +                                      ulint   bit_index;
 +
 +                                      descr = descr_page + XDES_ARR_OFFSET
-+                                              + XDES_SIZE * (ut_2pow_remainder((offset / UNIV_PAGE_SIZE), UNIV_PAGE_SIZE) / FSP_EXTENT_SIZE);
++                                              + XDES_SIZE * (ut_2pow_remainder(
++                                                      (offset / (zip_size ? zip_size : UNIV_PAGE_SIZE)),
++                                                      (zip_size ? zip_size : UNIV_PAGE_SIZE)) / FSP_EXTENT_SIZE);
 +
-+                                      index = XDES_FREE_BIT + XDES_BITS_PER_PAGE * ((offset / UNIV_PAGE_SIZE) % FSP_EXTENT_SIZE);
++                                      index = XDES_FREE_BIT
++                                              + XDES_BITS_PER_PAGE * ((offset / (zip_size ? zip_size : UNIV_PAGE_SIZE)) % FSP_EXTENT_SIZE);
 +                                      byte_index = index / 8;
 +                                      bit_index = index % 8;
 +
@@ -294,7 +392,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
 +                              }
 +
 +                              if (page_is_corrupt) {
-+                                      fprintf(stderr, " [errp:%lld]", offset / UNIV_PAGE_SIZE);
++                                      fprintf(stderr, " [errp:%lld]", offset / (zip_size ? zip_size : UNIV_PAGE_SIZE));
 +
 +                                      /* cannot treat corrupt page */
 +                                      goto skip_write;
@@ -304,7 +402,13 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
 +                                      mach_write_to_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, id);
 +
 +                                      for (i = 0; i < n_index; i++) {
-+                                              if (offset / UNIV_PAGE_SIZE == root_page[i]) {
++                                              if (offset / (zip_size ? zip_size : UNIV_PAGE_SIZE) == root_page[i]) {
++                                                      if (fil_page_get_type(page) != FIL_PAGE_INDEX) {
++                                                              file_is_corrupt = TRUE;
++                                                              fprintf(stderr, " [etyp:%lld]",
++                                                                      offset / (zip_size ? zip_size : UNIV_PAGE_SIZE));
++                                                              goto skip_write;
++                                                      }
 +                                                      /* this is index root page */
 +                                                      mach_write_to_4(page + FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF
 +                                                                                      + FSEG_HDR_SPACE, id);
@@ -317,7 +421,14 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
 +                                      if (fil_page_get_type(page) == FIL_PAGE_INDEX) {
 +                                              index_id_t tmp = mach_read_from_8(page + (PAGE_HEADER + PAGE_INDEX_ID));
 +
-+                                              if (mach_read_from_2(page + PAGE_HEADER + PAGE_LEVEL) == 0
++                                              for (i = 0; i < n_index; i++) {
++                                                      if (old_id[i] == tmp) {
++                                                              mach_write_to_8(page + (PAGE_HEADER + PAGE_INDEX_ID), new_id[i]);
++                                                              break;
++                                                      }
++                                              }
++
++                                              if (!zip_size && mach_read_from_2(page + PAGE_HEADER + PAGE_LEVEL) == 0
 +                                                  && old_id[0] == tmp) {
 +                                                      /* leaf page of cluster index, reset trx_id of records */
 +                                                      rec_t*  rec;
@@ -356,42 +467,34 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
 +                                                              rec = page_rec_get_next(rec);
 +                                                              n_recs--;
 +                                                      }
-+                                              }
-+
-+                                              for (i = 0; i < n_index; i++) {
-+                                                      if (old_id[i] == tmp) {
-+                                                              mach_write_to_8(page + (PAGE_HEADER + PAGE_INDEX_ID), new_id[i]);
-+                                                              break;
-+                                                      }
++                                              } else if (mach_read_from_2(page + PAGE_HEADER + PAGE_LEVEL) == 0
++                                                         && old_id[0] != tmp) {
++                                                      mach_write_to_8(page + (PAGE_HEADER + PAGE_MAX_TRX_ID), 1);
 +                                              }
 +                                      }
 +
 +                                      if (mach_read_from_8(page + FIL_PAGE_LSN) > current_lsn) {
 +                                              mach_write_to_8(page + FIL_PAGE_LSN, current_lsn);
-+                                              mach_write_to_8(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,
-+                                                                              current_lsn);
++                                              if (!zip_size) {
++                                                      mach_write_to_8(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,
++                                                                      current_lsn);
++                                              }
 +                                      }
 +
-+                                      mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM,
-+                                                      srv_use_checksums
-+                                                      ? buf_calc_page_new_checksum(page)
-+                                                                      : BUF_NO_CHECKSUM_MAGIC);
-+                                      mach_write_to_4(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,
-+                                                      srv_use_checksums
-+                                                      ? buf_calc_page_old_checksum(page)
-+                                                                      : BUF_NO_CHECKSUM_MAGIC);
++                                      fil_page_buf_page_store_checksum(page, zip_size);
 +
 +                                      success = os_file_write(filepath, file, page,
 +                                                              (ulint)(offset & 0xFFFFFFFFUL),
-+                                                              (ulint)(offset >> 32), UNIV_PAGE_SIZE);
++                                                              (ulint)(offset >> 32),
++                                                              zip_size ? zip_size : UNIV_PAGE_SIZE);
 +                              }
 +
 +skip_write:
 +                              if (free_limit_bytes
-+                                  && ((ib_int64_t)((offset + UNIV_PAGE_SIZE) * 100) / free_limit_bytes)
++                                  && ((ib_int64_t)((offset + (zip_size ? zip_size : UNIV_PAGE_SIZE)) * 100) / free_limit_bytes)
 +                                      != ((offset * 100) / free_limit_bytes)) {
 +                                      fprintf(stderr, " %lu",
-+                                              (ulong)((ib_int64_t)((offset + UNIV_PAGE_SIZE) * 100) / free_limit_bytes));
++                                              (ulong)((ib_int64_t)((offset + (zip_size ? zip_size : UNIV_PAGE_SIZE)) * 100) / free_limit_bytes));
 +                              }
 +                      }
 +
@@ -447,13 +550,6 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
 +                      if (UNIV_LIKELY_NULL(heap)) {
 +                              mem_heap_free(heap);
 +                      }
-+              } else {
-+                      /* zip page? */
-+                      size = (ulint)
-+                      (size_bytes
-+                                      / dict_table_flags_to_zip_size(flags));
-+                      fprintf(stderr, "InnoDB: Import: The table %s seems to be in a newer format."
-+                                      " It may not be possible to process it.\n", name);
 +              }
 +              /* .exp file should be removed */
 +              success = os_file_delete(info_file_path);
@@ -497,10 +593,282 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
        ut_free(buf2);
  
        if (UNIV_UNLIKELY(space_id != id
+@@ -3166,6 +3691,271 @@
+       os_file_close(file);
+       mem_free(filepath);
++      if (srv_expand_import && dict_table_flags_to_zip_size(flags)) {
++              ulint           page_no;
++              ulint           zip_size;
++              ulint           height;
++              ulint           root_height = 0;
++              rec_t*          node_ptr;
++              dict_table_t*   table;
++              dict_index_t*   index;
++              buf_block_t*    block;
++              page_t*         page;
++              page_zip_des_t* page_zip;
++              mtr_t           mtr;
++
++              mem_heap_t*     heap            = NULL;
++              ulint           offsets_[REC_OFFS_NORMAL_SIZE];
++              ulint*          offsets         = offsets_;
++
++              rec_offs_init(offsets_);
++
++              zip_size = dict_table_flags_to_zip_size(flags);
++
++              table = dict_table_get_low(name);
++              index = dict_table_get_first_index(table);
++              page_no = dict_index_get_page(index);
++              ut_a(page_no == 3);
++
++              fprintf(stderr, "InnoDB: It is compressed .ibd file. need to convert additionaly on buffer pool.\n");
++
++              /* down to leaf */
++              mtr_start(&mtr);
++              mtr_set_log_mode(&mtr, MTR_LOG_NONE);
++
++              height = ULINT_UNDEFINED;
++
++              for (;;) {
++                      block = buf_page_get(space_id, zip_size, page_no,
++                                           RW_NO_LATCH, &mtr);
++                      page = buf_block_get_frame(block);
++
++                      block->check_index_page_at_flush = TRUE;
++
++                      if (height == ULINT_UNDEFINED) {
++                              height = btr_page_get_level(page, &mtr);
++                              root_height = height;
++                      }
++
++                      if (height == 0) {
++                              break;
++                      }
++
++                      node_ptr = page_rec_get_next(page_get_infimum_rec(page));
++
++                      height--;
++
++                      offsets = rec_get_offsets(node_ptr, index, offsets, ULINT_UNDEFINED, &heap);
++                      page_no = btr_node_ptr_get_child_page_no(node_ptr, offsets);
++              }
++
++              mtr_commit(&mtr);
++
++              fprintf(stderr, "InnoDB: pages needs split are ...");
++
++              /* scan reaf pages */
++              while (page_no != FIL_NULL) {
++                      rec_t*  rec;
++                      rec_t*  supremum;
++                      ulint   n_recs;
++
++                      mtr_start(&mtr);
++
++                      block = buf_page_get(space_id, zip_size, page_no,
++                                           RW_X_LATCH, &mtr);
++                      page = buf_block_get_frame(block);
++                      page_zip = buf_block_get_page_zip(block);
++
++                      if (!page_zip) {
++                              /*something wrong*/
++                              fprintf(stderr, "InnoDB: Something wrong with reading page %lu.\n", page_no);
++convert_err_exit:
++                              mtr_commit(&mtr);
++                              mutex_enter(&fil_system->mutex);
++                              fil_space_free(space_id, FALSE);
++                              mutex_exit(&fil_system->mutex);
++                              success = FALSE;
++                              goto convert_exit;
++                      }
++
++                      supremum = page_get_supremum_rec(page);
++                      rec = page_rec_get_next(page_get_infimum_rec(page));
++                      n_recs = page_get_n_recs(page);
++
++                      /* illegal operation as InnoDB online system. so not logged */
++                      while (rec && rec != supremum && n_recs > 0) {
++                              ulint   n_fields;
++                              ulint   i;
++                              ulint   offset = index->trx_id_offset;
++
++                              offsets = rec_get_offsets(rec, index, offsets,
++                                              ULINT_UNDEFINED, &heap);
++                              n_fields = rec_offs_n_fields(offsets);
++                              if (!offset) {
++                                      offset = row_get_trx_id_offset(rec, index, offsets);
++                              }
++                              trx_write_trx_id(rec + offset, 1);
++
++                              for (i = 0; i < n_fields; i++) {
++                                      if (rec_offs_nth_extern(offsets, i)) {
++                                              ulint   local_len;
++                                              byte*   data;
++
++                                              data = rec_get_nth_field(rec, offsets, i, &local_len);
++
++                                              local_len -= BTR_EXTERN_FIELD_REF_SIZE;
++
++                                              mach_write_to_4(data + local_len + BTR_EXTERN_SPACE_ID, id);
++                                      }
++                              }
++
++                              rec = page_rec_get_next(rec);
++                              n_recs--;
++                      }
++
++                      /* dummy logged update for along with modified page path */
++                      if (index->id != btr_page_get_index_id(page)) {
++                              /* this should be adjusted already */
++                              fprintf(stderr, "InnoDB: The page %lu seems to be converted wrong.\n", page_no);
++                              goto convert_err_exit;
++                      }
++                      btr_page_set_index_id(page, page_zip, index->id, &mtr);
++
++                      /* confirm whether fits to the page size or not */
++                      if (!page_zip_compress(page_zip, page, index, &mtr)
++                          && !btr_page_reorganize(block, index, &mtr)) {
++                              buf_block_t*    new_block;
++                              page_t*         new_page;
++                              page_zip_des_t* new_page_zip;
++                              rec_t*          split_rec;
++                              ulint           n_uniq;
++
++                              /* split page is needed */
++                              fprintf(stderr, " %lu", page_no);
++
++                              mtr_x_lock(dict_index_get_lock(index), &mtr);
++
++                              n_uniq = dict_index_get_n_unique_in_tree(index);
++
++                              if(page_get_n_recs(page) < 2) {
++                                      /* no way to make smaller */
++                                      fprintf(stderr, "InnoDB: The page %lu cannot be store to the page size.\n", page_no);
++                                      goto convert_err_exit;
++                              }
++
++                              if (UNIV_UNLIKELY(page_no == dict_index_get_page(index))) {
++                                      ulint           new_page_no;
++                                      dtuple_t*       node_ptr;
++                                      ulint           level;
++                                      rec_t*          node_ptr_rec;
++                                      page_cur_t      page_cursor;
++
++                                      /* it is root page, need to raise before split */
++
++                                      level = btr_page_get_level(page, &mtr);
++
++                                      new_block = btr_page_alloc(index, 0, FSP_NO_DIR, level, &mtr);
++                                      new_page = buf_block_get_frame(new_block);
++                                      new_page_zip = buf_block_get_page_zip(new_block);
++                                      btr_page_create(new_block, new_page_zip, index, level, &mtr);
++
++                                      btr_page_set_next(new_page, new_page_zip, FIL_NULL, &mtr);
++                                      btr_page_set_prev(new_page, new_page_zip, FIL_NULL, &mtr);
++
++                                      page_zip_copy_recs(new_page_zip, new_page,
++                                                         page_zip, page, index, &mtr);
++                                      btr_search_move_or_delete_hash_entries(new_block, block, index);
++
++                                      rec = page_rec_get_next(page_get_infimum_rec(new_page));
++                                      new_page_no = buf_block_get_page_no(new_block);
++
++                                      node_ptr = dict_index_build_node_ptr(index, rec, new_page_no, heap,
++                                                                           level);
++                                      dtuple_set_info_bits(node_ptr,
++                                                           dtuple_get_info_bits(node_ptr)
++                                                           | REC_INFO_MIN_REC_FLAG);
++                                      btr_page_empty(block, page_zip, index, level + 1, &mtr);
++
++                                      btr_page_set_next(page, page_zip, FIL_NULL, &mtr);
++                                      btr_page_set_prev(page, page_zip, FIL_NULL, &mtr);
++
++                                      page_cur_set_before_first(block, &page_cursor);
++
++                                      node_ptr_rec = page_cur_tuple_insert(&page_cursor, node_ptr,
++                                                                           index, 0, &mtr);
++                                      ut_a(node_ptr_rec);
++
++                                      if (!btr_page_reorganize(block, index, &mtr)) {
++                                              fprintf(stderr, "InnoDB: failed to store the page %lu.\n", page_no);
++                                              goto convert_err_exit;
++                                      }
++
++                                      /* move to the raised page */
++                                      page_no = new_page_no;
++                                      block = new_block;
++                                      page = new_page;
++                                      page_zip = new_page_zip;
++
++                                      fprintf(stderr, "(raise_to:%lu)", page_no);
++                              }
++
++                              split_rec = page_get_middle_rec(page);
++
++                              new_block = btr_page_alloc(index, page_no + 1, FSP_UP,
++                                                         btr_page_get_level(page, &mtr), &mtr);
++                              new_page = buf_block_get_frame(new_block);
++                              new_page_zip = buf_block_get_page_zip(new_block);
++                              btr_page_create(new_block, new_page_zip, index,
++                                              btr_page_get_level(page, &mtr), &mtr);
++
++                              offsets = rec_get_offsets(split_rec, index, offsets, n_uniq, &heap);
++
++                              btr_attach_half_pages(index, block,
++                                                    split_rec, new_block, FSP_UP, &mtr);
++
++                              page_zip_copy_recs(new_page_zip, new_page,
++                                                 page_zip, page, index, &mtr);
++                              page_delete_rec_list_start(split_rec - page + new_page,
++                                                         new_block, index, &mtr);
++                              btr_search_move_or_delete_hash_entries(new_block, block, index);
++                              page_delete_rec_list_end(split_rec, block, index,
++                                                       ULINT_UNDEFINED, ULINT_UNDEFINED, &mtr);
++
++                              fprintf(stderr, "(new:%lu)", buf_block_get_page_no(new_block));
++
++                              /* Are they needed? */
++                              if (!btr_page_reorganize(block, index, &mtr)) {
++                                      fprintf(stderr, "InnoDB: failed to store the page %lu.\n", page_no);
++                                      goto convert_err_exit;
++                              }
++                              if (!btr_page_reorganize(new_block, index, &mtr)) {
++                                      fprintf(stderr, "InnoDB: failed to store the page %lu.\n", buf_block_get_page_no(new_block));
++                                      goto convert_err_exit;
++                              }
++                      }
++
++                      page_no = btr_page_get_next(page, &mtr);
++
++                      mtr_commit(&mtr);
++
++                      if (heap) {
++                              mem_heap_empty(heap);
++                      }
++              }
++
++              fprintf(stderr, "...done.\nInnoDB: waiting the flush batch of the additional conversion.\n");
++
++              /* should wait for the not-logged changes are all flushed */
++              buf_flush_list(ULINT_MAX, mtr.end_lsn + 1);
++              buf_flush_wait_batch_end(NULL, BUF_FLUSH_LIST);
++
++              fprintf(stderr, "InnoDB: done.\n");
++convert_exit:
++              if (UNIV_LIKELY_NULL(heap)) {
++                      mem_heap_free(heap);
++              }
++      }
++
+       return(success);
+ }
+ #endif /* !UNIV_HOTBACKUP */
 diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
 --- a/storage/innobase/handler/ha_innodb.cc    2010-12-03 15:49:59.195023983 +0900
 +++ b/storage/innobase/handler/ha_innodb.cc    2010-12-03 15:52:23.555957062 +0900
-@@ -7356,6 +7356,14 @@
+@@ -7377,6 +7377,14 @@
                err = row_discard_tablespace_for_mysql(dict_table->name, trx);
        } else {
                err = row_import_tablespace_for_mysql(dict_table->name, trx);
@@ -515,7 +883,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
        }
  
        err = convert_error_code_to_mysql(err, dict_table->flags, NULL);
-@@ -11625,6 +11633,11 @@
+@@ -11649,6 +11657,11 @@
    "Choose method of innodb_adaptive_flushing. (native, [estimate], keep_average)",
    NULL, innodb_adaptive_flushing_method_update, 1, &adaptive_flushing_method_typelib);
  
@@ -527,7 +895,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
  static MYSQL_SYSVAR_ULONG(dict_size_limit, srv_dict_size_limit,
    PLUGIN_VAR_RQCMDARG,
    "Limit the allocated memory for dictionary cache. (0: unlimited)",
-@@ -11697,6 +11710,7 @@
+@@ -11721,6 +11734,7 @@
    MYSQL_SYSVAR(flush_neighbor_pages),
    MYSQL_SYSVAR(read_ahead),
    MYSQL_SYSVAR(adaptive_flushing_method),
@@ -535,10 +903,125 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
    MYSQL_SYSVAR(dict_size_limit),
    MYSQL_SYSVAR(use_sys_malloc),
    MYSQL_SYSVAR(use_native_aio),
+diff -ruN a/storage/innobase/include/btr0btr.h b/storage/innobase/include/btr0btr.h
+--- a/storage/innobase/include/btr0btr.h       2011-04-11 19:44:03.000000000 +0900
++++ b/storage/innobase/include/btr0btr.h       2011-05-24 20:30:12.459853343 +0900
+@@ -219,6 +219,17 @@
+ @return the uncompressed page frame */
+ # define btr_page_get(space,zip_size,page_no,mode,mtr) \
+       buf_block_get_frame(btr_block_get(space,zip_size,page_no,mode,mtr))
++/**************************************************************//**
++Sets the index id field of a page. */
++UNIV_INLINE
++void
++btr_page_set_index_id(
++/*==================*/
++      page_t*         page,   /*!< in: page to be created */
++      page_zip_des_t* page_zip,/*!< in: compressed page whose uncompressed
++                              part will be updated, or NULL */
++      index_id_t      id,     /*!< in: index id */
++      mtr_t*          mtr);   /*!< in: mtr */
+ #endif /* !UNIV_HOTBACKUP */
+ /**************************************************************//**
+ Gets the index id field of a page.
+@@ -256,6 +267,17 @@
+       const page_t*   page,   /*!< in: index page */
+       mtr_t*          mtr);   /*!< in: mini-transaction handle */
+ /********************************************************//**
++Sets the next index page field. */
++UNIV_INLINE
++void
++btr_page_set_next(
++/*==============*/
++      page_t*         page,   /*!< in: index page */
++      page_zip_des_t* page_zip,/*!< in: compressed page whose uncompressed
++                              part will be updated, or NULL */
++      ulint           next,   /*!< in: next page number */
++      mtr_t*          mtr);   /*!< in: mini-transaction handle */
++/********************************************************//**
+ Gets the previous index page number.
+ @return       prev page number */
+ UNIV_INLINE
+@@ -264,6 +286,17 @@
+ /*==============*/
+       const page_t*   page,   /*!< in: index page */
+       mtr_t*          mtr);   /*!< in: mini-transaction handle */
++/********************************************************//**
++Sets the previous index page field. */
++UNIV_INLINE
++void
++btr_page_set_prev(
++/*==============*/
++      page_t*         page,   /*!< in: index page */
++      page_zip_des_t* page_zip,/*!< in: compressed page whose uncompressed
++                              part will be updated, or NULL */
++      ulint           prev,   /*!< in: previous page number */
++      mtr_t*          mtr);   /*!< in: mini-transaction handle */
+ /*************************************************************//**
+ Gets pointer to the previous user record in the tree. It is assumed
+ that the caller has appropriate latches on the page and its neighbor.
+@@ -309,6 +342,18 @@
+ /*===========================*/
+       const rec_t*    rec,    /*!< in: node pointer record */
+       const ulint*    offsets);/*!< in: array returned by rec_get_offsets() */
++/**************************************************************//**
++Creates a new index page (not the root, and also not
++used in page reorganization).  @see btr_page_empty(). */
++UNIV_INTERN
++void
++btr_page_create(
++/*============*/
++      buf_block_t*    block,  /*!< in/out: page to be created */
++      page_zip_des_t* page_zip,/*!< in/out: compressed page, or NULL */
++      dict_index_t*   index,  /*!< in: index */
++      ulint           level,  /*!< in: the B-tree level of the page */
++      mtr_t*          mtr);   /*!< in: mtr */
+ /************************************************************//**
+ Creates the root node for a new index tree.
+ @return       page number of the created root, FIL_NULL if did not succeed */
+@@ -379,6 +424,17 @@
+       dict_index_t*   index,  /*!< in: record descriptor */
+       mtr_t*          mtr);   /*!< in: mtr */
+ /*************************************************************//**
++Empties an index page.  @see btr_page_create(). */
++UNIV_INTERN
++void
++btr_page_empty(
++/*===========*/
++      buf_block_t*    block,  /*!< in: page to be emptied */
++      page_zip_des_t* page_zip,/*!< out: compressed page, or NULL */
++      dict_index_t*   index,  /*!< in: index of the page */
++      ulint           level,  /*!< in: the B-tree level of the page */
++      mtr_t*          mtr);   /*!< in: mtr */
++/*************************************************************//**
+ Decides if the page should be split at the convergence point of
+ inserts converging to left.
+ @return       TRUE if split recommended */
+@@ -437,6 +493,20 @@
+ # define btr_insert_on_non_leaf_level(i,l,t,m)                                \
+       btr_insert_on_non_leaf_level_func(i,l,t,__FILE__,__LINE__,m)
+ #endif /* !UNIV_HOTBACKUP */
++/**************************************************************//**
++Attaches the halves of an index page on the appropriate level in an
++index tree. */
++UNIV_INTERN
++void
++btr_attach_half_pages(
++/*==================*/
++      dict_index_t*   index,          /*!< in: the index tree */
++      buf_block_t*    block,          /*!< in/out: page to be split */
++      rec_t*          split_rec,      /*!< in: first record on upper
++                                      half page */
++      buf_block_t*    new_block,      /*!< in/out: the new half page */
++      ulint           direction,      /*!< in: FSP_UP or FSP_DOWN */
++      mtr_t*          mtr);           /*!< in: mtr */
+ /****************************************************************//**
+ Sets a record as the predefined minimum record. */
+ UNIV_INTERN
 diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
 --- a/storage/innobase/include/srv0srv.h       2010-12-03 15:48:03.077954270 +0900
 +++ b/storage/innobase/include/srv0srv.h       2010-12-03 15:52:23.561986996 +0900
-@@ -232,6 +232,8 @@
+@@ -229,6 +229,8 @@
  extern ulint  srv_read_ahead;
  extern ulint  srv_adaptive_flushing_method;
  
@@ -547,10 +1030,37 @@ diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0sr
  extern ulint  srv_dict_size_limit;
  /*-------------------------------------------*/
  
+diff -ruN a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c
+--- a/storage/innobase/row/row0mysql.c 2011-04-11 19:44:03.000000000 +0900
++++ b/storage/innobase/row/row0mysql.c 2011-06-06 11:53:18.395764565 +0900
+@@ -2568,6 +2568,11 @@
+       current_lsn = log_get_lsn();
++      /* Enlarge the fatal lock wait timeout during import. */
++      mutex_enter(&kernel_mutex);
++      srv_fatal_semaphore_wait_threshold += 7200; /* 2 hours */
++      mutex_exit(&kernel_mutex);
++
+       /* It is possible, though very improbable, that the lsn's in the
+       tablespace to be imported have risen above the current system lsn, if
+       a lengthy purge, ibuf merge, or rollback was performed on a backup
+@@ -2679,6 +2684,11 @@
+       trx->op_info = "";
++      /* Restore the fatal semaphore wait timeout */
++      mutex_enter(&kernel_mutex);
++      srv_fatal_semaphore_wait_threshold -= 7200; /* 2 hours */
++      mutex_exit(&kernel_mutex);
++
+       return((int) err);
+ }
 diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
 --- a/storage/innobase/srv/srv0srv.c   2010-12-03 15:49:59.230956118 +0900
 +++ b/storage/innobase/srv/srv0srv.c   2010-12-03 15:52:23.562954411 +0900
-@@ -423,6 +423,8 @@
+@@ -416,6 +416,8 @@
  UNIV_INTERN ulint     srv_read_ahead = 3; /* 1: random  2: linear  3: Both */
  UNIV_INTERN ulint     srv_adaptive_flushing_method = 0; /* 0: native  1: estimate  2: keep_average */
  
index 1441bb3f2f82d4eece879bcb9aa04f7de8873aa5..188a2ad97099382a012f801fa7aa4ab88ac893ab 100644 (file)
@@ -49,7 +49,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
  /*
                IMPLEMENTATION OF THE BUFFER POOL
-@@ -2399,11 +2433,19 @@
+@@ -2403,8 +2437,16 @@
        mutex_t*        block_mutex;
        ibool           must_read;
        unsigned        access_time;
@@ -60,16 +60,13 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
 +      ib_uint64_t     finish_time;
        buf_pool_t*     buf_pool = buf_pool_get(space, offset);
  
- #ifndef UNIV_LOG_DEBUG
-       ut_ad(!ibuf_inside());
- #endif
 +      if (innobase_get_slow_log()) {
 +              trx = innobase_get_trx();
 +      }
        buf_pool->stat.n_page_gets++;
  
        for (;;) {
-@@ -2421,7 +2463,7 @@
+@@ -2422,7 +2464,7 @@
                //buf_pool_mutex_exit(buf_pool);
                rw_lock_s_unlock(&buf_pool->page_hash_latch);
  
@@ -78,7 +75,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
  #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
                ut_a(++buf_dbg_counter % 37 || buf_validate());
-@@ -2498,6 +2540,13 @@
+@@ -2499,6 +2541,13 @@
                /* Let us wait until the read operation
                completes */
  
@@ -92,7 +89,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
                for (;;) {
                        enum buf_io_fix io_fix;
  
-@@ -2512,6 +2561,12 @@
+@@ -2513,6 +2562,12 @@
                                break;
                        }
                }
@@ -105,7 +102,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
        }
  
  #ifdef UNIV_IBUF_COUNT_DEBUG
-@@ -2824,6 +2879,11 @@
+@@ -2828,6 +2883,11 @@
        ibool           must_read;
        ulint           retries = 0;
        mutex_t*        block_mutex = NULL;
@@ -117,9 +114,9 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
        buf_pool_t*     buf_pool = buf_pool_get(space, offset);
  
        ut_ad(mtr);
-@@ -2842,6 +2902,9 @@
-       ut_ad(!ibuf_inside() || ibuf_page_low(space, zip_size, offset,
-                                             FALSE, file, line, NULL));
+@@ -2856,6 +2916,9 @@
+             || ibuf_page_low(space, zip_size, offset,
+                              FALSE, file, line, NULL));
  #endif
 +      if (innobase_get_slow_log()) {
 +              trx = innobase_get_trx();
@@ -127,7 +124,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
        buf_pool->stat.n_page_gets++;
        fold = buf_page_address_fold(space, offset);
  loop:
-@@ -2915,7 +2978,7 @@
+@@ -2930,7 +2993,7 @@
                        return(NULL);
                }
  
@@ -136,7 +133,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
                        retries = 0;
                } else if (retries < BUF_PAGE_READ_MAX_RETRIES) {
                        ++retries;
-@@ -3220,6 +3283,13 @@
+@@ -3239,6 +3302,13 @@
                        /* Let us wait until the read operation
                        completes */
  
@@ -150,7 +147,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
                        for (;;) {
                                enum buf_io_fix io_fix;
  
-@@ -3234,6 +3304,12 @@
+@@ -3253,6 +3323,12 @@
                                        break;
                                }
                        }
@@ -163,12 +160,12 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
                }
  
                fix_type = MTR_MEMO_BUF_FIX;
-@@ -3259,13 +3335,17 @@
-               /* In the case of a first access, try to apply linear
+@@ -3279,13 +3355,17 @@
                read-ahead */
  
--              buf_read_ahead_linear(space, zip_size, offset);
-+              buf_read_ahead_linear(space, zip_size, offset, trx);
+               buf_read_ahead_linear(space, zip_size, offset,
+-                                    ibuf_inside(mtr));
++                                    ibuf_inside(mtr), trx);
        }
  
  #ifdef UNIV_IBUF_COUNT_DEBUG
@@ -182,7 +179,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
        return(block);
  }
  
-@@ -3289,6 +3369,7 @@
+@@ -3309,6 +3389,7 @@
        unsigned        access_time;
        ibool           success;
        ulint           fix_type;
@@ -190,7 +187,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
        ut_ad(block);
        ut_ad(mtr);
-@@ -3366,13 +3447,17 @@
+@@ -3386,6 +3467,10 @@
  #if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
        ut_a(block->page.file_page_was_freed == FALSE);
  #endif
@@ -201,15 +198,16 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
        if (UNIV_UNLIKELY(!access_time)) {
                /* In the case of a first access, try to apply linear
                read-ahead */
+@@ -3393,7 +3478,7 @@
                buf_read_ahead_linear(buf_block_get_space(block),
                                      buf_block_get_zip_size(block),
--                                    buf_block_get_page_no(block));
-+                                    buf_block_get_page_no(block), trx);
+                                     buf_block_get_page_no(block),
+-                                    ibuf_inside(mtr));
++                                    ibuf_inside(mtr), trx);
        }
  
  #ifdef UNIV_IBUF_COUNT_DEBUG
-@@ -3382,6 +3467,9 @@
+@@ -3403,6 +3488,9 @@
        buf_pool = buf_pool_from_block(block);
        buf_pool->stat.n_page_gets++;
  
@@ -219,7 +217,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
        return(TRUE);
  }
  
-@@ -3404,6 +3492,7 @@
+@@ -3425,6 +3513,7 @@
        buf_pool_t*     buf_pool;
        ibool           success;
        ulint           fix_type;
@@ -227,7 +225,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
        ut_ad(mtr);
        ut_ad(mtr->state == MTR_ACTIVE);
-@@ -3490,6 +3579,11 @@
+@@ -3511,6 +3600,11 @@
  #endif
        buf_pool->stat.n_page_gets++;
  
@@ -291,27 +289,26 @@ diff -ruN a/storage/innobase/buf/buf0rea.c b/storage/innobase/buf/buf0rea.c
        srv_buf_pool_reads += count;
        if (err == DB_TABLESPACE_DELETED) {
                ut_print_timestamp(stderr);
-@@ -278,8 +280,9 @@
- /*==================*/
-       ulint   space,  /*!< in: space id */
-       ulint   zip_size,/*!< in: compressed page size in bytes, or 0 */
--      ulint   offset) /*!< in: page number of a page; NOTE: the current thread
-+      ulint   offset, /*!< in: page number of a page; NOTE: the current thread
-                       must want access to this page (see NOTE 3 above) */
+@@ -279,7 +281,8 @@
+       ulint   space,          /*!< in: space id */
+       ulint   zip_size,       /*!< in: compressed page size in bytes, or 0 */
+       ulint   offset,         /*!< in: page number; see NOTE 3 above */
+-      ibool   inside_ibuf)    /*!< in: TRUE if we are inside ibuf routine */
++      ibool   inside_ibuf,    /*!< in: TRUE if we are inside ibuf routine */
 +      trx_t*  trx)
  {
        buf_pool_t*     buf_pool = buf_pool_get(space, offset);
        ib_int64_t      tablespace_version;
-@@ -500,7 +503,7 @@
+@@ -498,7 +501,7 @@
                        count += buf_read_page_low(
                                &err, FALSE,
-                               ibuf_mode | OS_AIO_SIMULATED_WAKE_LATER,
+                               ibuf_mode,
 -                              space, zip_size, FALSE, tablespace_version, i);
 +                              space, zip_size, FALSE, tablespace_version, i, trx);
                        if (err == DB_TABLESPACE_DELETED) {
                                ut_print_timestamp(stderr);
                                fprintf(stderr,
-@@ -594,7 +597,7 @@
+@@ -591,7 +594,7 @@
                buf_read_page_low(&err, sync && (i + 1 == n_stored),
                                  BUF_READ_ANY_PAGE, space_ids[i],
                                  zip_size, TRUE, space_versions[i],
@@ -320,7 +317,7 @@ diff -ruN a/storage/innobase/buf/buf0rea.c b/storage/innobase/buf/buf0rea.c
  
                if (UNIV_UNLIKELY(err == DB_TABLESPACE_DELETED)) {
  tablespace_deleted:
-@@ -736,12 +739,12 @@
+@@ -733,12 +736,12 @@
                if ((i + 1 == n_stored) && sync) {
                        buf_read_page_low(&err, TRUE, BUF_READ_ANY_PAGE, space,
                                          zip_size, TRUE, tablespace_version,
@@ -338,7 +335,7 @@ diff -ruN a/storage/innobase/buf/buf0rea.c b/storage/innobase/buf/buf0rea.c
 diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
 --- a/storage/innobase/fil/fil0fil.c   2010-12-03 15:53:54.610037199 +0900
 +++ b/storage/innobase/fil/fil0fil.c   2010-12-03 17:42:42.079064198 +0900
-@@ -4423,7 +4423,7 @@
+@@ -4747,7 +4747,7 @@
                                 node->name, node->handle, buf,
                                 offset_low, offset_high,
                                 page_size * n_pages,
@@ -347,7 +344,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
  #endif
                if (success) {
                        node->size += n_pages;
-@@ -4750,7 +4750,7 @@
+@@ -5074,7 +5074,7 @@
  i/o on a tablespace which does not exist */
  UNIV_INTERN
  ulint
@@ -356,7 +353,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
  /*===*/
        ulint   type,           /*!< in: OS_FILE_READ or OS_FILE_WRITE,
                                ORed to OS_FILE_LOG, if a log i/o
-@@ -4775,8 +4775,9 @@
+@@ -5099,8 +5099,9 @@
        void*   buf,            /*!< in/out: buffer where to store read data
                                or from where to write; in aio this must be
                                appropriately aligned */
@@ -367,7 +364,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
  {
        ulint           mode;
        fil_space_t*    space;
-@@ -4946,7 +4947,7 @@
+@@ -5268,7 +5269,7 @@
  #else
        /* Queue the aio request */
        ret = os_aio(type, mode | wake_later, node->name, node->handle, buf,
@@ -379,7 +376,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
 diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
 --- a/storage/innobase/handler/ha_innodb.cc    2010-12-03 17:36:44.293955189 +0900
 +++ b/storage/innobase/handler/ha_innodb.cc    2010-12-03 17:42:42.090024586 +0900
-@@ -1546,6 +1546,16 @@
+@@ -1573,6 +1573,16 @@
        trx->check_unique_secondary = !thd_test_options(
                thd, OPTION_RELAXED_UNIQUE_CHECKS);
  
@@ -396,7 +393,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
        DBUG_VOID_RETURN;
  }
  
-@@ -1600,6 +1610,32 @@
+@@ -1627,6 +1637,32 @@
        return(trx);
  }
  
@@ -429,7 +426,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
  /*********************************************************************//**
  Note that a transaction has been registered with MySQL.
  @return true if transaction is registered with MySQL 2PC coordinator */
-@@ -9284,6 +9320,25 @@
+@@ -9301,6 +9337,25 @@
        statement has ended */
  
        if (trx->n_mysql_tables_in_use == 0) {
@@ -476,13 +473,12 @@ diff -ruN a/storage/innobase/include/buf0rea.h b/storage/innobase/include/buf0re
  /********************************************************************//**
  Applies linear read-ahead if in the buf_pool the page is a border page of
  a linear read-ahead area and all the pages in the area have been accessed.
-@@ -72,8 +74,9 @@
- /*==================*/
-       ulint   space,  /*!< in: space id */
-       ulint   zip_size,/*!< in: compressed page size in bytes, or 0 */
--      ulint   offset);/*!< in: page number of a page; NOTE: the current thread
-+      ulint   offset, /*!< in: page number of a page; NOTE: the current thread
-                       must want access to this page (see NOTE 3 above) */
+@@ -73,7 +75,8 @@
+       ulint   space,          /*!< in: space id */
+       ulint   zip_size,       /*!< in: compressed page size in bytes, or 0 */
+       ulint   offset,         /*!< in: page number; see NOTE 3 above */
+-      ibool   inside_ibuf);   /*!< in: TRUE if we are inside ibuf routine */
++      ibool   inside_ibuf,    /*!< in: TRUE if we are inside ibuf routine */
 +      trx_t*  trx);
  /********************************************************************//**
  Issues read requests for pages which the ibuf module wants to read in, in
@@ -652,13 +648,13 @@ diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0sr
 +/* prototypes for new functions added to ha_innodb.cc */
 +ibool innobase_get_slow_log();
 +
- /* This is set to the MySQL server value for this variable. */
- extern uint   srv_lower_case_table_names;
+ /* Mutex for locking srv_monitor_file */
+ extern mutex_t        srv_monitor_file_mutex;
+ /* Temporary file for innodb monitor output */
 diff -ruN a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h
 --- a/storage/innobase/include/trx0trx.h       2010-12-03 15:41:52.049372966 +0900
 +++ b/storage/innobase/include/trx0trx.h       2010-12-03 17:42:42.107024532 +0900
-@@ -738,6 +738,17 @@
+@@ -743,6 +743,17 @@
        /*------------------------------*/
        char detailed_error[256];       /*!< detailed error message for last
                                        error, or empty. */
@@ -847,8 +843,8 @@ diff -ruN a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c
                }
  
                ut_a(type == OS_FILE_WRITE);
-@@ -4099,6 +4131,11 @@
-               ut_error;
+@@ -4101,6 +4133,11 @@
+               array = NULL; /* Eliminate compiler warning */
        }
  
 +      if (trx && type == OS_FILE_READ)
@@ -862,17 +858,17 @@ diff -ruN a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c
 diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
 --- a/storage/innobase/srv/srv0srv.c   2010-12-03 17:32:15.648024399 +0900
 +++ b/storage/innobase/srv/srv0srv.c   2010-12-03 17:45:05.067023254 +0900
-@@ -88,6 +88,9 @@
+@@ -87,6 +87,9 @@
  #include "mysql/plugin.h"
  #include "mysql/service_thd_wait.h"
  
 +/* prototypes for new functions added to ha_innodb.cc */
 +ibool innobase_get_slow_log();
 +
- /* This is set to the MySQL server value for this variable.  It is only
- needed for FOREIGN KEY definition parsing since FOREIGN KEY names are not
- stored in the server metadata. The server stores and enforces it for
-@@ -1259,6 +1262,10 @@
+ /* The following counter is incremented whenever there is some user activity
+ in the server */
+ UNIV_INTERN ulint     srv_activity_count      = 0;
+@@ -1232,6 +1235,10 @@
        ibool                   has_slept = FALSE;
        srv_conc_slot_t*        slot      = NULL;
        ulint                   i;
@@ -881,9 +877,9 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
 +      ulint                   sec;
 +      ulint                   ms;
  
-       if (trx->mysql_thd != NULL
-           && thd_is_replication_slave_thread(trx->mysql_thd)) {
-@@ -1335,6 +1342,7 @@
+ #ifdef UNIV_SYNC_DEBUG
+       ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch));
+@@ -1312,6 +1319,7 @@
                switches. */
                if (SRV_THREAD_SLEEP_DELAY > 0) {
                        os_thread_sleep(SRV_THREAD_SLEEP_DELAY);
@@ -891,10 +887,11 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
                }
  
                trx->op_info = "";
-@@ -1390,6 +1398,13 @@
-       /* Go to wait for the event; when a thread leaves InnoDB it will
-       release this thread */
+@@ -1371,6 +1379,14 @@
+ #ifdef UNIV_SYNC_DEBUG
+       ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch));
+ #endif /* UNIV_SYNC_DEBUG */
++
 +      if (innobase_get_slow_log() && trx->take_stats) {
 +              ut_usectime(&sec, &ms);
 +              start_time = (ib_uint64_t)sec * 1000000 + ms;
@@ -905,7 +902,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
        trx->op_info = "waiting in InnoDB queue";
  
        thd_wait_begin(trx->mysql_thd, THD_WAIT_ROW_TABLE_LOCK);
-@@ -1398,6 +1413,12 @@
+@@ -1379,6 +1395,12 @@
  
        trx->op_info = "";
  
@@ -921,7 +918,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
 diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c
 --- a/storage/innobase/trx/trx0trx.c   2010-12-03 15:41:52.053955669 +0900
 +++ b/storage/innobase/trx/trx0trx.c   2010-12-03 17:42:42.127023410 +0900
-@@ -186,6 +186,15 @@
+@@ -188,6 +188,15 @@
        trx->global_read_view = NULL;
        trx->read_view = NULL;
  
@@ -937,9 +934,9 @@ diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c
        /* Set X/Open XA transaction identification to NULL */
        memset(&trx->xid, 0, sizeof(trx->xid));
        trx->xid.formatID = -1;
-@@ -223,6 +232,11 @@
+@@ -221,6 +230,11 @@
  
-       trx->mysql_process_no = os_proc_get_number();
+       mutex_exit(&kernel_mutex);
  
 +      if (innobase_get_slow_log() && trx->take_stats) {
 +              trx->distinct_page_access_hash = mem_alloc(DPAH_SIZE);
@@ -949,7 +946,7 @@ diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c
        return(trx);
  }
  
-@@ -354,6 +368,12 @@
+@@ -406,6 +420,12 @@
  /*===============*/
        trx_t*  trx)    /*!< in, own: trx object */
  {
@@ -962,7 +959,7 @@ diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c
        mutex_enter(&kernel_mutex);
  
        UT_LIST_REMOVE(mysql_trx_list, trx_sys->mysql_trx_list, trx);
-@@ -375,6 +395,12 @@
+@@ -427,6 +447,12 @@
  /*====================*/
        trx_t*  trx)    /*!< in, own: trx object */
  {
@@ -975,7 +972,7 @@ diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c
        mutex_enter(&kernel_mutex);
  
        trx_free(trx);
-@@ -1153,6 +1179,9 @@
+@@ -1212,6 +1238,9 @@
        trx_t*  trx)    /*!< in: transaction */
  {
        que_thr_t*      thr;
@@ -985,7 +982,7 @@ diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c
  
        ut_ad(mutex_own(&kernel_mutex));
        ut_ad(trx->que_state == TRX_QUE_LOCK_WAIT);
-@@ -1167,6 +1196,11 @@
+@@ -1226,6 +1255,11 @@
                thr = UT_LIST_GET_FIRST(trx->wait_thrs);
        }
  
@@ -997,7 +994,7 @@ diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c
        trx->que_state = TRX_QUE_RUNNING;
  }
  
-@@ -1180,6 +1214,9 @@
+@@ -1239,6 +1273,9 @@
        trx_t*  trx)    /*!< in: transaction in the TRX_QUE_LOCK_WAIT state */
  {
        que_thr_t*      thr;
@@ -1007,7 +1004,7 @@ diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c
  
        ut_ad(mutex_own(&kernel_mutex));
        ut_ad(trx->que_state == TRX_QUE_LOCK_WAIT);
-@@ -1194,6 +1231,11 @@
+@@ -1253,6 +1290,11 @@
                thr = UT_LIST_GET_FIRST(trx->wait_thrs);
        }
  
index e34bdf39104494250bb2a08089196231e37f09be..cd773bd5c5d2de6eead7b00f90f811d307675095 100644 (file)
@@ -8,7 +8,7 @@
 diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
 --- a/storage/innobase/handler/ha_innodb.cc    2010-12-03 15:18:48.879955903 +0900
 +++ b/storage/innobase/handler/ha_innodb.cc    2010-12-03 15:22:53.779955671 +0900
-@@ -11504,6 +11504,7 @@
+@@ -11528,6 +11528,7 @@
    innobase_system_variables, /* system variables */
    NULL /* reserved */
  },
@@ -27,8 +27,8 @@ diff -ruN a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
 +#include "trx0sys.h" /* for trx_sys */
  }
  
- static const char plugin_author[] = "Innobase Oy";
-@@ -1781,3 +1783,166 @@
+ #define OK(expr)              \
+@@ -1779,3 +1781,166 @@
  
        DBUG_RETURN(0);
  }
@@ -163,7 +163,7 @@ diff -ruN a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
 +
 +      /* plugin author (for SHOW PLUGINS) */
 +      /* const char* */
-+      STRUCT_FLD(author, plugin_author),
++      STRUCT_FLD(author, "Percona"),
 +
 +      /* general descriptive text (for SHOW PLUGINS) */
 +      /* const char* */
@@ -198,7 +198,7 @@ diff -ruN a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
 diff -ruN a/storage/innobase/handler/i_s.h b/storage/innobase/handler/i_s.h
 --- a/storage/innobase/handler/i_s.h   2010-12-03 15:06:58.744953398 +0900
 +++ b/storage/innobase/handler/i_s.h   2010-12-03 15:22:53.783953418 +0900
-@@ -33,5 +33,6 @@
+@@ -35,5 +35,6 @@
  extern struct st_mysql_plugin i_s_innodb_cmp_reset;
  extern struct st_mysql_plugin i_s_innodb_cmpmem;
  extern struct st_mysql_plugin i_s_innodb_cmpmem_reset;
index b0e1da062f2008ea88ff5e5bd52bbe329ee87499..8374d46ee6857f159aa6584fc73dc67ef9361b76 100644 (file)
@@ -109,8 +109,34 @@ diff -ruN a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c
 diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
 --- a/storage/innobase/fil/fil0fil.c   2010-12-04 15:52:23.406513743 +0900
 +++ b/storage/innobase/fil/fil0fil.c   2010-12-04 15:53:45.020513800 +0900
-@@ -3199,7 +3199,9 @@
-                       mach_write_to_8(page + FIL_PAGE_FILE_FLUSH_LSN, current_lsn);
+@@ -3094,13 +3094,24 @@
+               return(TRUE);
+       }
+-      if (checksum_field != 0
++      if (!srv_fast_checksum
++          && checksum_field != 0
+           && checksum_field != BUF_NO_CHECKSUM_MAGIC
+           && checksum_field
+           != buf_calc_page_new_checksum(page)) {
+               return(TRUE);
+       }
++      if (srv_fast_checksum
++          && checksum_field != 0
++          && checksum_field != BUF_NO_CHECKSUM_MAGIC
++          && checksum_field
++          != buf_calc_page_new_checksum_32(page)
++          && checksum_field
++          != buf_calc_page_new_checksum(page)) {
++              return(TRUE);
++      }
++
+       return(FALSE);
+ }
+@@ -3116,7 +3127,9 @@
+       if (!zip_size) {
                mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM,
                                srv_use_checksums
 -                              ? buf_calc_page_new_checksum(page)
@@ -120,45 +146,6 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
                                                : BUF_NO_CHECKSUM_MAGIC);
                mach_write_to_4(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,
                                srv_use_checksums
-@@ -3331,7 +3333,8 @@
-                                       page_is_corrupt = TRUE;
-                               }
--                              if (checksum_field != 0
-+                              if (!srv_fast_checksum
-+                                  && checksum_field != 0
-                                   && checksum_field != BUF_NO_CHECKSUM_MAGIC
-                                   && checksum_field
-                                   != buf_calc_page_new_checksum(page)) {
-@@ -3339,6 +3342,17 @@
-                                       page_is_corrupt = TRUE;
-                               }
-+                              if (srv_fast_checksum
-+                                  && checksum_field != 0
-+                                  && checksum_field != BUF_NO_CHECKSUM_MAGIC
-+                                  && checksum_field
-+                                  != buf_calc_page_new_checksum_32(page)
-+                                  && checksum_field
-+                                  != buf_calc_page_new_checksum(page)) {
-+
-+                                      page_is_corrupt = TRUE;
-+                              }
-+
-                               /* if it is free page, inconsistency is acceptable */
-                               if (!offset) {
-                                       /* header page*/
-@@ -3484,7 +3498,9 @@
-                                       mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM,
-                                                       srv_use_checksums
--                                                      ? buf_calc_page_new_checksum(page)
-+                                                      ? (!srv_fast_checksum
-+                                                         ? buf_calc_page_new_checksum(page)
-+                                                         : buf_calc_page_new_checksum_32(page))
-                                                                       : BUF_NO_CHECKSUM_MAGIC);
-                                       mach_write_to_4(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,
-                                                       srv_use_checksums
 diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
 --- a/storage/innobase/handler/ha_innodb.cc    2010-12-04 15:52:23.420480329 +0900
 +++ b/storage/innobase/handler/ha_innodb.cc    2010-12-04 15:53:45.029551892 +0900
@@ -170,7 +157,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
  static my_bool        innobase_recovery_stats                 = TRUE;
  static my_bool        innobase_locks_unsafe_for_binlog        = FALSE;
  static my_bool        innobase_overwrite_relay_log_info       = FALSE;
-@@ -2593,6 +2594,7 @@
+@@ -2620,6 +2621,7 @@
  
        srv_use_doublewrite_buf = (ibool) innobase_use_doublewrite;
        srv_use_checksums = (ibool) innobase_use_checksums;
@@ -178,7 +165,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
  
  #ifdef HAVE_LARGE_PAGES
          if ((os_use_large_pages = (ibool) my_use_large_pages))
-@@ -11401,6 +11403,15 @@
+@@ -11421,6 +11423,15 @@
    "Disable with --skip-innodb-checksums.",
    NULL, NULL, TRUE);
  
@@ -194,7 +181,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
  static MYSQL_SYSVAR_STR(data_home_dir, innobase_data_home_dir,
    PLUGIN_VAR_READONLY,
    "The common part for InnoDB table spaces.",
-@@ -11909,6 +11920,7 @@
+@@ -11930,6 +11941,7 @@
    MYSQL_SYSVAR(buffer_pool_size),
    MYSQL_SYSVAR(buffer_pool_instances),
    MYSQL_SYSVAR(checksums),
@@ -205,7 +192,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
 diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
 --- a/storage/innobase/include/buf0buf.h       2010-12-04 15:52:23.458514045 +0900
 +++ b/storage/innobase/include/buf0buf.h       2010-12-04 15:53:45.044514150 +0900
-@@ -602,6 +602,11 @@
+@@ -604,6 +604,11 @@
  buf_calc_page_new_checksum(
  /*=======================*/
        const byte*     page);  /*!< in: buffer page */
@@ -231,7 +218,7 @@ diff -ruN a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fi
 diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
 --- a/storage/innobase/include/srv0srv.h       2010-12-04 15:52:23.474482590 +0900
 +++ b/storage/innobase/include/srv0srv.h       2010-12-04 15:53:45.048512100 +0900
-@@ -227,6 +227,7 @@
+@@ -224,6 +224,7 @@
  
  extern ibool  srv_use_doublewrite_buf;
  extern ibool  srv_use_checksums;
@@ -291,7 +278,7 @@ diff -ruN a/storage/innobase/include/ut0rnd.ic b/storage/innobase/include/ut0rnd
 diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
 --- a/storage/innobase/srv/srv0srv.c   2010-12-04 15:52:23.498513634 +0900
 +++ b/storage/innobase/srv/srv0srv.c   2010-12-04 15:53:45.053550283 +0900
-@@ -421,6 +421,7 @@
+@@ -414,6 +414,7 @@
  
  UNIV_INTERN ibool     srv_use_doublewrite_buf = TRUE;
  UNIV_INTERN ibool     srv_use_checksums = TRUE;
index 9a2130e19224367827dd7d791b252422e46c366f..a131b39e5730358e7f196e2084c1627035d7205f 100644 (file)
@@ -8,7 +8,7 @@
 diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
 --- a/storage/innobase/fil/fil0fil.c   2010-12-04 15:55:21.358513751 +0900
 +++ b/storage/innobase/fil/fil0fil.c   2010-12-04 15:55:58.243481131 +0900
-@@ -729,7 +729,7 @@
+@@ -731,7 +731,7 @@
                ut_a(space->purpose != FIL_LOG);
                ut_a(!trx_sys_sys_space(space->id));
  
@@ -17,16 +17,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
                        fprintf(stderr,
                                "InnoDB: Error: the size of single-table"
                                " tablespace file %s\n"
-@@ -3216,7 +3216,7 @@
-               if (size_bytes < free_limit_bytes) {
-                       free_limit_bytes = size_bytes;
--                      if (size_bytes >= FSP_EXTENT_SIZE * UNIV_PAGE_SIZE) {
-+                      if (size_bytes >= (lint)FSP_EXTENT_SIZE * (lint)UNIV_PAGE_SIZE) {
-                               fprintf(stderr, "InnoDB: free limit of %s is larger than its real size.\n", filepath);
-                               file_is_corrupt = TRUE;
-                       }
-@@ -3830,7 +3830,7 @@
+@@ -4151,7 +4151,7 @@
  
        size = (((ib_int64_t)size_high) << 32) + (ib_int64_t)size_low;
  #ifndef UNIV_HOTBACKUP
@@ -35,7 +26,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
                fprintf(stderr,
                        "InnoDB: Error: the size of single-table tablespace"
                        " file %s\n"
-@@ -3850,7 +3850,7 @@
+@@ -4171,7 +4171,7 @@
        /* Align the memory for file i/o if we might have O_DIRECT set */
        page = ut_align(buf2, UNIV_PAGE_SIZE);
  
@@ -44,7 +35,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
                success = os_file_read(file, page, 0, 0, UNIV_PAGE_SIZE);
  
                /* We have to read the tablespace id from the file */
-@@ -4828,9 +4828,9 @@
+@@ -5149,9 +5149,9 @@
        ut_ad(ut_is_2pow(zip_size));
        ut_ad(buf);
        ut_ad(len > 0);
@@ -121,7 +112,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
  static my_bool innobase_thread_concurrency_timer_based;
  static long long innobase_buffer_pool_size, innobase_log_file_size;
  
-@@ -2289,6 +2292,65 @@
+@@ -2316,6 +2319,65 @@
        }
  #endif /* DBUG_OFF */
  
@@ -200,7 +191,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
                }
        }
  
-@@ -11412,6 +11474,16 @@
+@@ -11432,6 +11494,16 @@
    "#### Attention: The checksum is not compatible for normal or disabled version! ####",
    NULL, NULL, FALSE);
  
@@ -217,7 +208,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
  static MYSQL_SYSVAR_STR(data_home_dir, innobase_data_home_dir,
    PLUGIN_VAR_READONLY,
    "The common part for InnoDB table spaces.",
-@@ -11915,6 +11987,8 @@
+@@ -11936,6 +12008,8 @@
    NULL, NULL, 0, &corrupt_table_action_typelib);
  
  static struct st_mysql_sys_var* innobase_system_variables[]= {
@@ -229,7 +220,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
 diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
 --- a/storage/innobase/include/buf0buf.h       2010-12-04 15:55:21.375482937 +0900
 +++ b/storage/innobase/include/buf0buf.h       2010-12-04 15:55:58.258469088 +0900
-@@ -1682,7 +1682,7 @@
+@@ -1683,7 +1683,7 @@
        time_t          last_printout_time;
                                        /*!< when buf_print_io was last time
                                        called */
@@ -238,7 +229,7 @@ diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0bu
                                        /*!< Statistics of buddy system,
                                        indexed by block size */
        buf_pool_stat_t stat;           /*!< current statistics */
-@@ -1778,7 +1778,7 @@
+@@ -1779,7 +1779,7 @@
        /* @{ */
        UT_LIST_BASE_NODE_T(buf_page_t) zip_clean;
                                        /*!< unmodified compressed pages */
@@ -247,7 +238,7 @@ diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0bu
                                        /*!< buddy free lists */
  
        buf_page_t                      watch[BUF_POOL_WATCH_SIZE];
-@@ -1786,9 +1786,9 @@
+@@ -1787,9 +1787,9 @@
                                        pool watches. Protected by
                                        buf_pool->mutex. */
  
@@ -379,7 +370,7 @@ diff -ruN a/storage/innobase/include/trx0sys.h b/storage/innobase/include/trx0sy
 diff -ruN a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i
 --- a/storage/innobase/include/univ.i  2010-11-03 07:01:13.000000000 +0900
 +++ b/storage/innobase/include/univ.i  2010-12-04 15:55:58.263549721 +0900
-@@ -298,9 +298,13 @@
+@@ -311,9 +311,13 @@
  */
  
  /* The 2-logarithm of UNIV_PAGE_SIZE: */
@@ -395,7 +386,7 @@ diff -ruN a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i
  
  /* Maximum number of parallel threads in a parallelized operation */
  #define UNIV_MAX_PARALLELISM  32
-@@ -419,7 +423,7 @@
+@@ -432,7 +436,7 @@
  stored part of the field in the tablespace. The length field then
  contains the sum of the following flag and the locally stored len. */
  
@@ -404,7 +395,7 @@ diff -ruN a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i
  
  /* Some macros to improve branch prediction and reduce cache misses */
  #if defined(__GNUC__) && (__GNUC__ > 2) && ! defined(__INTEL_COMPILER)
-@@ -522,4 +526,6 @@
+@@ -535,4 +539,6 @@
        UNIV_MEM_ALLOC(addr, size);                     \
  } while (0)
  
@@ -547,7 +538,7 @@ diff -ruN a/storage/innobase/row/row0merge.c b/storage/innobase/row/row0merge.c
 diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
 --- a/storage/innobase/srv/srv0srv.c   2010-12-04 15:55:21.384486344 +0900
 +++ b/storage/innobase/srv/srv0srv.c   2010-12-04 15:55:58.282550845 +0900
-@@ -241,6 +241,13 @@
+@@ -234,6 +234,13 @@
  UNIV_INTERN ulint     srv_n_read_io_threads   = ULINT_MAX;
  UNIV_INTERN ulint     srv_n_write_io_threads  = ULINT_MAX;
  
@@ -564,7 +555,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
 diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c
 --- a/storage/innobase/srv/srv0start.c 2010-12-04 15:52:23.502513556 +0900
 +++ b/storage/innobase/srv/srv0start.c 2010-12-04 15:55:58.285550583 +0900
-@@ -1562,11 +1562,13 @@
+@@ -1561,11 +1561,13 @@
        }
  #endif /* UNIV_LOG_ARCHIVE */
  
@@ -580,7 +571,7 @@ diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c
  
                return(DB_ERROR);
        }
-@@ -1575,7 +1577,7 @@
+@@ -1574,7 +1576,7 @@
  
        for (i = 0; i < srv_n_data_files; i++) {
  #ifndef __WIN__
index f6110f2cae600eba2e7690910e6a2e7adb7550bf..d70ff8f8752a4852fee3223c0ca8e8a04c4d3851 100644 (file)
@@ -13,7 +13,7 @@
 diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
 --- a/storage/innobase/buf/buf0buf.c   2011-02-23 19:00:48.178696354 +0900
 +++ b/storage/innobase/buf/buf0buf.c   2011-02-23 19:01:19.138826278 +0900
-@@ -4046,6 +4046,7 @@
+@@ -4065,6 +4065,7 @@
                bpage->state    = BUF_BLOCK_ZIP_PAGE;
                bpage->space    = space;
                bpage->offset   = offset;
@@ -50,7 +50,7 @@ diff -ruN a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c
 diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
 --- a/storage/innobase/buf/buf0lru.c   2011-02-23 19:00:47.939695791 +0900
 +++ b/storage/innobase/buf/buf0lru.c   2011-02-23 19:01:19.142741970 +0900
-@@ -554,6 +554,37 @@
+@@ -574,6 +574,37 @@
        }
  }
  
@@ -88,7 +88,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
  /********************************************************************//**
  Insert a compressed block into buf_pool->zip_clean in the LRU order. */
  UNIV_INTERN
-@@ -1538,6 +1569,10 @@
+@@ -1558,6 +1589,10 @@
                return(BUF_LRU_NOT_FREED);
        }
  
@@ -102,7 +102,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
 diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
 --- a/storage/innobase/fil/fil0fil.c   2011-02-23 19:00:48.223696428 +0900
 +++ b/storage/innobase/fil/fil0fil.c   2011-02-23 19:01:19.147655510 +0900
-@@ -252,6 +252,7 @@
+@@ -254,6 +254,7 @@
  struct fil_system_struct {
  #ifndef UNIV_HOTBACKUP
        mutex_t         mutex;          /*!< The mutex protecting the cache */
@@ -110,7 +110,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
  #endif /* !UNIV_HOTBACKUP */
        hash_table_t*   spaces;         /*!< The hash table of spaces in the
                                        system; they are hashed on the space
-@@ -861,7 +862,7 @@
+@@ -863,7 +864,7 @@
        ut_ad(node && system);
        ut_ad(mutex_own(&(system->mutex)));
        ut_a(node->open);
@@ -119,7 +119,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
        ut_a(node->n_pending_flushes == 0);
        ut_a(node->modification_counter == node->flush_counter);
  
-@@ -874,7 +875,7 @@
+@@ -876,7 +877,7 @@
        ut_a(system->n_open > 0);
        system->n_open--;
  
@@ -128,7 +128,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
                ut_a(UT_LIST_GET_LEN(system->LRU) > 0);
  
                /* The node is in the LRU list, remove it */
-@@ -1073,7 +1074,7 @@
+@@ -1075,7 +1076,7 @@
        ut_ad(node && system && space);
        ut_ad(mutex_own(&(system->mutex)));
        ut_a(node->magic_n == FIL_NODE_MAGIC_N);
@@ -137,7 +137,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
  
        if (node->open) {
                /* We fool the assertion in fil_node_close_file() to think
-@@ -1595,6 +1596,8 @@
+@@ -1597,6 +1598,8 @@
  
        mutex_create(fil_system_mutex_key,
                     &fil_system->mutex, SYNC_ANY_LATCH);
@@ -146,7 +146,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
  
        fil_system->spaces = hash_create(hash_size);
        fil_system->name_hash = hash_create(hash_size);
-@@ -2341,7 +2344,11 @@
+@@ -2343,7 +2346,11 @@
        completely and permanently. The flag is_being_deleted also prevents
        fil_flush() from being applied to this tablespace. */
  
@@ -158,7 +158,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
  #endif
        /* printf("Deleting tablespace %s id %lu\n", space->name, id); */
  
-@@ -4400,6 +4407,10 @@
+@@ -4721,6 +4728,10 @@
        ulint           page_size;
        ibool           success         = TRUE;
  
@@ -169,7 +169,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
        fil_mutex_enter_and_prepare_for_io(space_id);
  
        space = fil_space_get_by_id(space_id);
-@@ -4411,6 +4422,7 @@
+@@ -4732,6 +4743,7 @@
                *actual_size = space->size;
  
                mutex_exit(&fil_system->mutex);
@@ -177,7 +177,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
  
                return(TRUE);
        }
-@@ -4443,6 +4455,8 @@
+@@ -4764,6 +4776,8 @@
                offset_low  = ((start_page_no - file_start_page_no)
                               % (4096 * ((1024 * 1024) / page_size)))
                        * page_size;
@@ -186,7 +186,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
  #ifdef UNIV_HOTBACKUP
                success = os_file_write(node->name, node->handle, buf,
                                        offset_low, offset_high,
-@@ -4452,8 +4466,10 @@
+@@ -4773,8 +4787,10 @@
                                 node->name, node->handle, buf,
                                 offset_low, offset_high,
                                 page_size * n_pages,
@@ -198,7 +198,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
                if (success) {
                        node->size += n_pages;
                        space->size += n_pages;
-@@ -4499,6 +4515,7 @@
+@@ -4820,6 +4836,7 @@
        printf("Extended %s to %lu, actual size %lu pages\n", space->name,
        size_after_extend, *actual_size); */
        mutex_exit(&fil_system->mutex);
@@ -206,7 +206,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
  
        fil_flush(space_id);
  
-@@ -4863,6 +4880,22 @@
+@@ -5182,6 +5199,22 @@
                srv_data_written+= len;
        }
  
@@ -216,7 +216,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
 +          && ((buf_page_t*)message)->space_was_being_deleted) {
 +
 +              if (mode == OS_AIO_NORMAL) {
-+                      buf_page_io_complete(message, trx);
++                      buf_page_io_complete(message);
 +                      return(DB_SUCCESS); /*fake*/
 +              }
 +              if (type == OS_FILE_READ) {
@@ -229,7 +229,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
        /* Reserve the fil_system mutex and make sure that we can open at
        least one file while holding it, if the file is not already open */
  
-@@ -4992,10 +5025,24 @@
+@@ -5323,10 +5356,24 @@
  #else
        /* Queue the aio request */
        ret = os_aio(type, mode | wake_later, node->name, node->handle, buf,
@@ -255,7 +255,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
        ut_a(ret);
  
        if (mode == OS_AIO_SYNC) {
-@@ -5095,6 +5142,7 @@
+@@ -5426,6 +5473,7 @@
        fil_node_t*     fil_node;
        void*           message;
        ulint           type;
@@ -263,7 +263,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
  
        ut_ad(fil_validate_skip());
  
-@@ -5102,10 +5150,10 @@
+@@ -5433,10 +5481,10 @@
                srv_set_io_thread_op_info(segment, "native aio handle");
  #ifdef WIN_ASYNC_IO
                ret = os_aio_windows_handle(segment, 0, &fil_node,
@@ -274,9 +274,9 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
 -                                        &message, &type);
 +                                        &message, &type, &space_id);
  #else
-               ret = 0; /* Eliminate compiler warning */
                ut_error;
-@@ -5114,7 +5162,22 @@
+               ret = 0; /* Eliminate compiler warning */
+@@ -5445,7 +5493,22 @@
                srv_set_io_thread_op_info(segment, "simulated aio handle");
  
                ret = os_aio_simulated_handle(segment, &fil_node,
@@ -295,7 +295,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
 +                   || buf_page_get_state(message) != BUF_BLOCK_FILE_PAGE);
 +
 +              srv_set_io_thread_op_info(segment, "complete io for buf page");
-+              buf_page_io_complete(message, NULL);
++              buf_page_io_complete(message);
 +              return;
        }
  
@@ -303,7 +303,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
 diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
 --- a/storage/innobase/handler/ha_innodb.cc    2010-12-04 15:57:13.035513990 +0900
 +++ b/storage/innobase/handler/ha_innodb.cc    2010-12-04 15:57:53.084513775 +0900
-@@ -11986,6 +11986,12 @@
+@@ -12007,6 +12007,12 @@
    "except for the deletion.",
    NULL, NULL, 0, &corrupt_table_action_typelib);
  
@@ -316,7 +316,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
  static struct st_mysql_sys_var* innobase_system_variables[]= {
    MYSQL_SYSVAR(page_size),
    MYSQL_SYSVAR(log_block_size),
-@@ -12076,6 +12082,7 @@
+@@ -12097,6 +12103,7 @@
    MYSQL_SYSVAR(purge_batch_size),
    MYSQL_SYSVAR(rollback_segments),
    MYSQL_SYSVAR(corrupt_table_action),
@@ -324,10 +324,10 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
    NULL
  };
  
-@@ -12085,7 +12092,7 @@
+@@ -12106,7 +12113,7 @@
    &innobase_storage_engine,
    innobase_hton_name,
-   "Innobase Oy",
+   plugin_author,
 -  "Supports transactions, row-level locking, and foreign keys",
 +  "Percona-XtraDB, Supports transactions, row-level locking, and foreign keys",
    PLUGIN_LICENSE_GPL,
@@ -336,7 +336,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
 diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
 --- a/storage/innobase/include/buf0buf.h       2011-02-23 19:00:48.252696774 +0900
 +++ b/storage/innobase/include/buf0buf.h       2011-02-23 19:01:19.182655902 +0900
-@@ -1437,6 +1437,7 @@
+@@ -1438,6 +1438,7 @@
                                        0 if the block was never accessed
                                        in the buffer pool */
        /* @} */
@@ -468,7 +468,7 @@ diff -ruN a/storage/innobase/include/os0file.ic b/storage/innobase/include/os0fi
 diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
 --- a/storage/innobase/include/srv0srv.h       2011-02-23 19:00:48.212625715 +0900
 +++ b/storage/innobase/include/srv0srv.h       2011-02-23 19:01:19.193655990 +0900
-@@ -247,6 +247,8 @@
+@@ -244,6 +244,8 @@
  extern ulint  srv_pass_corrupt_table;
  
  extern ulint  srv_dict_size_limit;
@@ -480,7 +480,7 @@ diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0sr
 diff -ruN a/storage/innobase/include/sync0sync.h b/storage/innobase/include/sync0sync.h
 --- a/storage/innobase/include/sync0sync.h     2011-02-23 19:00:47.875625940 +0900
 +++ b/storage/innobase/include/sync0sync.h     2011-02-23 19:01:19.195703856 +0900
-@@ -683,6 +683,7 @@
+@@ -691,6 +691,7 @@
  #define       SYNC_BUF_POOL           150     /* Buffer pool mutex */
  #define       SYNC_BUF_FLUSH_LIST     145     /* Buffer flush list mutex */
  #define SYNC_DOUBLEWRITE      140
@@ -493,10 +493,10 @@ diff -ruN a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i
 +++ b/storage/innobase/include/univ.i  2010-12-04 15:57:53.091592933 +0900
 @@ -53,6 +53,11 @@
  #define INNODB_VERSION_MINOR  1
- #define INNODB_VERSION_BUGFIX 6
+ #define INNODB_VERSION_BUGFIX 7
  
 +#ifndef PERCONA_INNODB_VERSION
-+#define PERCONA_INNODB_VERSION 12.1
++#define PERCONA_INNODB_VERSION 20.1
 +#endif
 +
 +
@@ -550,7 +550,7 @@ diff -ruN a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c
        trx_t*          trx)
  {
        os_aio_array_t* array;
-@@ -4137,7 +4141,7 @@
+@@ -4139,7 +4143,7 @@
                trx->io_read += n;
        }
        slot = os_aio_array_reserve_slot(type, array, message1, message2, file,
@@ -559,7 +559,7 @@ diff -ruN a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c
        if (type == OS_FILE_READ) {
                if (srv_use_native_aio) {
                        os_n_file_reads++;
-@@ -4256,7 +4260,8 @@
+@@ -4258,7 +4262,8 @@
                                parameters are valid and can be used to
                                restart the operation, for example */
        void**  message2,
@@ -569,7 +569,7 @@ diff -ruN a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c
  {
        ulint           orig_seg        = segment;
        os_aio_array_t* array;
-@@ -4329,6 +4334,7 @@
+@@ -4337,6 +4342,7 @@
        *message2 = slot->message2;
  
        *type = slot->type;
@@ -577,7 +577,7 @@ diff -ruN a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c
  
        if (ret && len == slot->len) {
                ret_val = TRUE;
-@@ -4569,7 +4575,8 @@
+@@ -4565,7 +4571,8 @@
                                aio operation failed, these output
                                parameters are valid and can be used to
                                restart the operation. */
@@ -587,7 +587,7 @@ diff -ruN a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c
  {
        ulint           segment;
        os_aio_array_t* array;
-@@ -4627,6 +4634,7 @@
+@@ -4638,6 +4645,7 @@
        *message2 = slot->message2;
  
        *type = slot->type;
@@ -595,7 +595,7 @@ diff -ruN a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c
  
        if ((slot->ret == 0) && (slot->n_bytes == (long)slot->len)) {
                ret = TRUE;
-@@ -4680,7 +4688,8 @@
+@@ -4691,7 +4699,8 @@
                                parameters are valid and can be used to
                                restart the operation, for example */
        void**  message2,
@@ -605,7 +605,7 @@ diff -ruN a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c
  {
        os_aio_array_t* array;
        ulint           segment;
-@@ -4958,6 +4967,7 @@
+@@ -4987,6 +4996,7 @@
        *message2 = slot->message2;
  
        *type = slot->type;
@@ -624,7 +624,7 @@ diff -ruN a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c
  
  /** Provide optional 4.x backwards compatibility for 5.0 and above */
  UNIV_INTERN ibool     row_rollback_on_timeout = FALSE;
-@@ -1194,6 +1195,13 @@
+@@ -1191,6 +1192,13 @@
  
        thr = que_fork_get_first_thr(prebuilt->ins_graph);
  
@@ -649,7 +649,7 @@ diff -ruN a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c
  
        rec_offs_init(offsets_);
  
-@@ -3732,6 +3733,17 @@
+@@ -3737,6 +3738,17 @@
  
        /* Do some start-of-statement preparations */
  
@@ -667,7 +667,7 @@ diff -ruN a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c
        if (!prebuilt->sql_stat_start) {
                /* No need to set an intention lock or assign a read view */
  
-@@ -3742,6 +3754,18 @@
+@@ -3747,6 +3759,18 @@
                              " perform a consistent read\n"
                              "InnoDB: but the read view is not assigned!\n",
                              stderr);
@@ -689,7 +689,7 @@ diff -ruN a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c
 diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
 --- a/storage/innobase/srv/srv0srv.c   2011-02-23 19:00:48.283695497 +0900
 +++ b/storage/innobase/srv/srv0srv.c   2011-02-23 19:01:19.204696643 +0900
-@@ -448,6 +448,8 @@
+@@ -441,6 +441,8 @@
  UNIV_INTERN ulint     srv_pass_corrupt_table = 0; /* 0:disable 1:enable */
  
  UNIV_INTERN ulint     srv_dict_size_limit = 0;
@@ -701,7 +701,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
 diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c
 --- a/storage/innobase/srv/srv0start.c 2010-12-04 15:57:13.073495392 +0900
 +++ b/storage/innobase/srv/srv0start.c 2010-12-04 16:02:50.704884053 +0900
-@@ -2162,7 +2162,7 @@
+@@ -2161,7 +2161,7 @@
        if (srv_print_verbose_log) {
                ut_print_timestamp(stderr);
                fprintf(stderr,
@@ -713,7 +713,7 @@ diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c
 diff -ruN a/storage/innobase/sync/sync0sync.c b/storage/innobase/sync/sync0sync.c
 --- a/storage/innobase/sync/sync0sync.c        2011-02-25 14:18:55.817202060 +0900
 +++ b/storage/innobase/sync/sync0sync.c        2011-02-25 14:19:44.596202017 +0900
-@@ -1174,6 +1174,7 @@
+@@ -1220,6 +1220,7 @@
        case SYNC_LOG_FLUSH_ORDER:
        case SYNC_THR_LOCAL:
        case SYNC_ANY_LATCH:
index 0315e344e4efc5d499f5ebea495d90d981a32f24..c81c90953b2ad4dedb19a66fdf2f24fd7be826e5 100644 (file)
@@ -53,7 +53,7 @@ diff -ruN a/storage/innobase/buf/buf0rea.c b/storage/innobase/buf/buf0rea.c
 diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
 --- a/storage/innobase/handler/ha_innodb.cc    2010-12-03 15:09:51.283956391 +0900
 +++ b/storage/innobase/handler/ha_innodb.cc    2010-12-03 15:10:08.963980444 +0900
-@@ -445,6 +445,12 @@
+@@ -444,6 +444,12 @@
    "Timeout in seconds an InnoDB transaction may wait for a lock before being rolled back. Values above 100000000 disable the timeout.",
    NULL, NULL, 50, 1, 1024 * 1024 * 1024, 0);
  
@@ -66,7 +66,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
  
  static handler *innobase_create_handler(handlerton *hton,
                                          TABLE_SHARE *table,
-@@ -839,6 +845,17 @@
+@@ -838,6 +844,17 @@
        }
  }
  
@@ -84,7 +84,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
  /********************************************************************//**
  Obtain the InnoDB transaction of a MySQL thread.
  @return       reference to transaction pointer */
-@@ -2410,6 +2427,9 @@
+@@ -2437,6 +2454,9 @@
        srv_n_read_io_threads = (ulint) innobase_read_io_threads;
        srv_n_write_io_threads = (ulint) innobase_write_io_threads;
  
@@ -94,7 +94,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
        srv_force_recovery = (ulint) innobase_force_recovery;
  
        srv_use_doublewrite_buf = (ibool) innobase_use_doublewrite;
-@@ -11001,7 +11021,7 @@
+@@ -11025,7 +11045,7 @@
    PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
    "Purge threads can be either 0 or 1.",
    NULL, NULL,
@@ -103,7 +103,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
    0,                  /* Minimum value */
    1, 0);              /* Maximum value */
  
-@@ -11043,12 +11063,18 @@
+@@ -11067,12 +11087,18 @@
    innodb_file_format_max_validate,
    innodb_file_format_max_update, "Antelope");
  
@@ -128,7 +128,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
  
  static MYSQL_SYSVAR_STR(flush_method, innobase_file_flush_method,
    PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
-@@ -11143,7 +11169,7 @@
+@@ -11167,7 +11193,7 @@
  static MYSQL_SYSVAR_LONGLONG(buffer_pool_size, innobase_buffer_pool_size,
    PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
    "The size of the memory buffer InnoDB uses to cache data and indexes of its tables.",
@@ -137,7 +137,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
  
  static MYSQL_SYSVAR_LONG(buffer_pool_instances, innobase_buffer_pool_instances,
    PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
-@@ -11295,6 +11321,95 @@
+@@ -11319,6 +11345,95 @@
    "trigger a readahead.",
    NULL, NULL, 56, 0, 64, 0);
  
@@ -233,7 +233,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
  static struct st_mysql_sys_var* innobase_system_variables[]= {
    MYSQL_SYSVAR(additional_mem_pool_size),
    MYSQL_SYSVAR(autoextend_increment),
-@@ -11315,6 +11430,7 @@
+@@ -11339,6 +11454,7 @@
    MYSQL_SYSVAR(file_format_check),
    MYSQL_SYSVAR(file_format_max),
    MYSQL_SYSVAR(flush_log_at_trx_commit),
@@ -241,7 +241,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
    MYSQL_SYSVAR(flush_method),
    MYSQL_SYSVAR(force_recovery),
    MYSQL_SYSVAR(locks_unsafe_for_binlog),
-@@ -11352,6 +11468,13 @@
+@@ -11376,6 +11492,13 @@
    MYSQL_SYSVAR(show_verbose_locks),
    MYSQL_SYSVAR(show_locks_held),
    MYSQL_SYSVAR(version),
@@ -258,7 +258,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
 diff -ruN a/storage/innobase/ibuf/ibuf0ibuf.c b/storage/innobase/ibuf/ibuf0ibuf.c
 --- a/storage/innobase/ibuf/ibuf0ibuf.c        2010-11-03 07:01:13.000000000 +0900
 +++ b/storage/innobase/ibuf/ibuf0ibuf.c        2010-12-03 15:10:09.073984282 +0900
-@@ -524,8 +524,10 @@
+@@ -514,8 +514,10 @@
        grow in size, as the references on the upper levels of the tree can
        change */
  
@@ -271,7 +271,7 @@ diff -ruN a/storage/innobase/ibuf/ibuf0ibuf.c b/storage/innobase/ibuf/ibuf0ibuf.
  
        mutex_create(ibuf_pessimistic_insert_mutex_key,
                     &ibuf_pessimistic_insert_mutex,
-@@ -2712,9 +2714,11 @@
+@@ -2753,9 +2755,11 @@
        size = ibuf->size;
        max_size = ibuf->max_size;
  
@@ -299,7 +299,7 @@ diff -ruN a/storage/innobase/include/buf0rea.h b/storage/innobase/include/buf0re
 diff -ruN a/storage/innobase/include/ha_prototypes.h b/storage/innobase/include/ha_prototypes.h
 --- a/storage/innobase/include/ha_prototypes.h 2010-11-03 07:01:13.000000000 +0900
 +++ b/storage/innobase/include/ha_prototypes.h 2010-12-03 15:10:09.078026360 +0900
-@@ -275,5 +275,12 @@
+@@ -284,6 +284,13 @@
  /*===================*/
          void*   thd,  /*!< in: thread handle (THD*) */
          ulint   value);       /*!< in: time waited for the lock */
@@ -311,11 +311,12 @@ diff -ruN a/storage/innobase/include/ha_prototypes.h b/storage/innobase/include/
 +/*================================*/
 +      void*   thd);
  
- #endif
+ /**********************************************************************//**
+ Get the current setting of the lower_case_table_names global parameter from
 diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
 --- a/storage/innobase/include/srv0srv.h       2010-12-03 15:09:51.291955835 +0900
 +++ b/storage/innobase/include/srv0srv.h       2010-12-03 15:10:09.079029047 +0900
-@@ -141,7 +141,8 @@
+@@ -138,7 +138,8 @@
  extern ulint  srv_n_log_files;
  extern ulint  srv_log_file_size;
  extern ulint  srv_log_buffer_size;
@@ -325,7 +326,7 @@ diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0sr
  extern char   srv_adaptive_flushing;
  
  
-@@ -219,6 +220,16 @@
+@@ -216,6 +217,16 @@
  extern ulong  srv_max_purge_lag;
  
  extern ulong  srv_replication_delay;
@@ -342,7 +343,7 @@ diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0sr
  /*-------------------------------------------*/
  
  extern ulint  srv_n_rows_inserted;
-@@ -397,8 +408,9 @@
+@@ -394,8 +405,9 @@
                                when writing data files, but do flush
                                after writing to log files */
        SRV_UNIX_NOSYNC,        /*!< do not flush after writing */
@@ -540,7 +541,7 @@ diff -ruN a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c
 diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
 --- a/storage/innobase/srv/srv0srv.c   2010-12-03 15:09:51.301987792 +0900
 +++ b/storage/innobase/srv/srv0srv.c   2010-12-03 15:13:29.369986988 +0900
-@@ -190,7 +190,8 @@
+@@ -183,7 +183,8 @@
  UNIV_INTERN ulint     srv_log_file_size       = ULINT_MAX;
  /* size in database pages */
  UNIV_INTERN ulint     srv_log_buffer_size     = ULINT_MAX;
@@ -550,7 +551,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
  
  /* Try to flush dirty pages so as to avoid IO bursts at
  the checkpoints. */
-@@ -409,6 +410,17 @@
+@@ -402,6 +403,17 @@
  
  UNIV_INTERN ulong     srv_replication_delay           = 0;
  
@@ -568,7 +569,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
  /*-------------------------------------------*/
  UNIV_INTERN ulong     srv_n_spin_wait_rounds  = 30;
  UNIV_INTERN ulong     srv_n_free_tickets_to_enter = 500;
-@@ -2745,6 +2757,7 @@
+@@ -2742,6 +2754,7 @@
        ulint           n_pages_purged  = 0;
        ulint           n_bytes_merged;
        ulint           n_pages_flushed;
@@ -576,7 +577,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
        ulint           n_bytes_archived;
        ulint           n_tables_to_drop;
        ulint           n_ios;
-@@ -2752,7 +2765,20 @@
+@@ -2749,7 +2762,20 @@
        ulint           n_ios_very_old;
        ulint           n_pend_ios;
        ulint           next_itr_time;
@@ -597,7 +598,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
  
  #ifdef UNIV_DEBUG_THREAD_CREATION
        fprintf(stderr, "Master thread starts, id %lu\n",
-@@ -2774,6 +2800,9 @@
+@@ -2771,6 +2797,9 @@
  
        mutex_exit(&kernel_mutex);
  
@@ -607,7 +608,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
  loop:
        /*****************************************************************/
        /* ---- When there is database activity by users, we cycle in this
-@@ -2804,9 +2833,13 @@
+@@ -2801,9 +2830,13 @@
        /* Sleep for 1 second on entrying the for loop below the first time. */
        next_itr_time = ut_time_ms() + 1000;
  
@@ -621,7 +622,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
                /* ALTER TABLE in MySQL requires on Unix that the table handler
                can drop tables lazily after there no longer are SELECT
                queries to them. */
-@@ -2830,6 +2863,7 @@
+@@ -2827,6 +2860,7 @@
                srv_main_thread_op_info = "sleeping";
                srv_main_1_second_loops++;
  
@@ -629,7 +630,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
                if (next_itr_time > cur_time
                    && srv_shutdown_state == SRV_SHUTDOWN_NONE) {
  
-@@ -2840,10 +2874,26 @@
+@@ -2837,10 +2871,26 @@
                                        (next_itr_time - cur_time)
                                         * 1000));
                        srv_main_sleeps++;
@@ -656,7 +657,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
  
                /* Flush logs if needed */
                srv_sync_log_buffer_in_background();
-@@ -2863,7 +2913,7 @@
+@@ -2860,7 +2910,7 @@
                if (n_pend_ios < SRV_PEND_IO_THRESHOLD
                    && (n_ios - n_ios_old < SRV_RECENT_IO_ACTIVITY)) {
                        srv_main_thread_op_info = "doing insert buffer merge";
@@ -665,7 +666,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
  
                        /* Flush logs if needed */
                        srv_sync_log_buffer_in_background();
-@@ -2880,7 +2930,11 @@
+@@ -2877,7 +2927,11 @@
                        n_pages_flushed = buf_flush_list(
                                PCT_IO(100), IB_ULONGLONG_MAX);
  
@@ -678,7 +679,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
  
                        /* Try to keep the rate of flushing of dirty
                        pages such that redo log generation does not
-@@ -2896,6 +2950,224 @@
+@@ -2893,6 +2947,224 @@
                                                n_flush,
                                                IB_ULONGLONG_MAX);
                        }
@@ -903,7 +904,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
                }
  
                if (srv_activity_count == old_activity_count) {
-@@ -2944,7 +3216,7 @@
+@@ -2941,7 +3213,7 @@
        even if the server were active */
  
        srv_main_thread_op_info = "doing insert buffer merge";
@@ -912,7 +913,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
  
        /* Flush logs if needed */
        srv_sync_log_buffer_in_background();
-@@ -3052,7 +3324,7 @@
+@@ -3049,7 +3321,7 @@
                buf_flush_list below. Otherwise, the system favors
                clean pages over cleanup throughput. */
                n_bytes_merged = ibuf_contract_for_n_pages(FALSE,
@@ -921,15 +922,15 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
        }
  
        srv_main_thread_op_info = "reserving kernel mutex";
-@@ -3199,6 +3471,7 @@
+@@ -3189,6 +3461,7 @@
+       srv_slot_t*     slot;
        ulint           retries = 0;
-       ulint           slot_no = ULINT_UNDEFINED;
        ulint           n_total_purged = ULINT_UNDEFINED;
 +      ulint           next_itr_time;
  
        ut_a(srv_n_purge_threads == 1);
  
-@@ -3221,9 +3494,12 @@
+@@ -3209,9 +3482,12 @@
  
        mutex_exit(&kernel_mutex);
  
@@ -942,7 +943,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
  
                /* If there are very few records to purge or the last
                purge didn't purge any records then wait for activity.
-@@ -3272,6 +3548,16 @@
+@@ -3258,6 +3534,16 @@
                } while (n_pages_purged > 0 && !srv_fast_shutdown);
  
                srv_sync_log_buffer_in_background();
@@ -962,7 +963,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
 diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c
 --- a/storage/innobase/srv/srv0start.c 2010-11-03 07:01:13.000000000 +0900
 +++ b/storage/innobase/srv/srv0start.c 2010-12-03 15:10:09.103023543 +0900
-@@ -1218,6 +1218,9 @@
+@@ -1217,6 +1217,9 @@
        } else if (0 == ut_strcmp(srv_file_flush_method_str, "O_DIRECT")) {
                srv_unix_file_flush_method = SRV_UNIX_O_DIRECT;
  
@@ -991,7 +992,7 @@ diff -ruN a/storage/innobase/trx/trx0purge.c b/storage/innobase/trx/trx0purge.c
 diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c
 --- a/storage/innobase/trx/trx0trx.c   2010-11-03 07:01:13.000000000 +0900
 +++ b/storage/innobase/trx/trx0trx.c   2010-12-03 15:10:09.106023937 +0900
-@@ -925,6 +925,7 @@
+@@ -984,6 +984,7 @@
        trx->read_view = NULL;
  
        if (lsn) {
@@ -999,7 +1000,7 @@ diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c
  
                mutex_exit(&kernel_mutex);
  
-@@ -933,6 +934,12 @@
+@@ -992,6 +993,12 @@
                        trx_undo_insert_cleanup(trx);
                }
  
@@ -1012,7 +1013,7 @@ diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c
                /* NOTE that we could possibly make a group commit more
                efficient here: call os_thread_yield here to allow also other
                trxs to come to commit! */
-@@ -964,9 +971,9 @@
+@@ -1023,9 +1030,9 @@
                if (trx->flush_log_later) {
                        /* Do nothing yet */
                        trx->must_flush_log_later = TRUE;
@@ -1024,7 +1025,7 @@ diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c
                        if (srv_unix_file_flush_method == SRV_UNIX_NOSYNC) {
                                /* Write the log but do not flush it to disk */
  
-@@ -978,7 +985,7 @@
+@@ -1037,7 +1044,7 @@
  
                                log_write_up_to(lsn, LOG_WAIT_ONE_GROUP, TRUE);
                        }
@@ -1033,7 +1034,7 @@ diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c
  
                        /* Write the log but do not flush it to disk */
  
-@@ -1642,16 +1649,23 @@
+@@ -1701,16 +1708,23 @@
        trx_t*  trx)    /*!< in: trx handle */
  {
        ib_uint64_t     lsn     = trx->commit_lsn;
@@ -1059,7 +1060,7 @@ diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c
                if (srv_unix_file_flush_method == SRV_UNIX_NOSYNC) {
                        /* Write the log but do not flush it to disk */
  
-@@ -1662,7 +1676,7 @@
+@@ -1721,7 +1735,7 @@
  
                        log_write_up_to(lsn, LOG_WAIT_ONE_GROUP, TRUE);
                }
@@ -1068,7 +1069,7 @@ diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c
  
                /* Write the log but do not flush it to disk */
  
-@@ -1915,6 +1929,8 @@
+@@ -1969,6 +1983,8 @@
        /*--------------------------------------*/
  
        if (lsn) {
@@ -1077,7 +1078,7 @@ diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c
                /* Depending on the my.cnf options, we may now write the log
                buffer to the log files, making the prepared state of the
                transaction durable if the OS does not crash. We may also
-@@ -1934,9 +1950,15 @@
+@@ -1988,9 +2004,15 @@
  
                mutex_exit(&kernel_mutex);
  
@@ -1095,7 +1096,7 @@ diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c
                        if (srv_unix_file_flush_method == SRV_UNIX_NOSYNC) {
                                /* Write the log but do not flush it to disk */
  
-@@ -1948,7 +1970,7 @@
+@@ -2002,7 +2024,7 @@
  
                                log_write_up_to(lsn, LOG_WAIT_ONE_GROUP, TRUE);
                        }
index fff4ee8dcf9f2c125438328486ca92710653805f..6f3c349937aeca601e518e5ef01351f98738c20d 100644 (file)
@@ -8,7 +8,7 @@
 diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
 --- a/storage/innobase/buf/buf0lru.c   2010-12-03 15:49:59.185023424 +0900
 +++ b/storage/innobase/buf/buf0lru.c   2010-12-04 15:33:37.626482350 +0900
-@@ -2224,6 +2224,284 @@
+@@ -2247,6 +2247,284 @@
        memset(&buf_LRU_stat_cur, 0, sizeof buf_LRU_stat_cur);
  }
  
@@ -308,7 +308,7 @@ diff -ruN a/storage/innobase/buf/buf0rea.c b/storage/innobase/buf/buf0rea.c
 diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
 --- a/storage/innobase/fil/fil0fil.c   2010-12-03 17:49:11.581025127 +0900
 +++ b/storage/innobase/fil/fil0fil.c   2010-12-04 15:33:37.632482885 +0900
-@@ -4967,6 +4967,70 @@
+@@ -5289,6 +5289,70 @@
        return(DB_SUCCESS);
  }
  
@@ -382,7 +382,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
 diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
 --- a/storage/innobase/handler/ha_innodb.cc    2010-12-03 17:49:11.589956135 +0900
 +++ b/storage/innobase/handler/ha_innodb.cc    2010-12-04 15:33:37.645555490 +0900
-@@ -11773,6 +11773,12 @@
+@@ -11793,6 +11793,12 @@
    "Limit the allocated memory for dictionary cache. (0: unlimited)",
    NULL, NULL, 0, 0, LONG_MAX, 0);
  
@@ -395,7 +395,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
  static struct st_mysql_sys_var* innobase_system_variables[]= {
    MYSQL_SYSVAR(additional_mem_pool_size),
    MYSQL_SYSVAR(autoextend_increment),
-@@ -11854,6 +11860,7 @@
+@@ -11874,6 +11880,7 @@
  #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
    MYSQL_SYSVAR(read_ahead_threshold),
    MYSQL_SYSVAR(io_capacity),
@@ -413,8 +413,8 @@ diff -ruN a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
 +#include "buf0lru.h" /* for XTRA_LRU_[DUMP/RESTORE] */
  }
  
- static const char plugin_author[] = "Innobase Oy";
-@@ -4272,6 +4273,36 @@
+ #define OK(expr)              \
+@@ -4270,6 +4271,36 @@
                        "Hello!");
                goto end_func;
        }
@@ -535,7 +535,7 @@ diff -ruN a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fi
 diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
 --- a/storage/innobase/include/srv0srv.h       2010-12-03 17:49:11.603969747 +0900
 +++ b/storage/innobase/include/srv0srv.h       2010-12-04 15:33:37.685550816 +0900
-@@ -359,6 +359,9 @@
+@@ -356,6 +356,9 @@
  reading of a disk page */
  extern ulint srv_buf_pool_reads;
  
@@ -545,7 +545,7 @@ diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0sr
  /** Status variables to be passed to MySQL */
  typedef struct export_var_struct export_struc;
  
-@@ -679,6 +682,16 @@
+@@ -661,6 +664,16 @@
  /*=====================*/
        void*   arg);   /*!< in: a dummy parameter required by
                        os_thread_create */
@@ -565,7 +565,7 @@ diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0sr
 diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
 --- a/storage/innobase/srv/srv0srv.c   2010-12-03 17:49:11.620986661 +0900
 +++ b/storage/innobase/srv/srv0srv.c   2010-12-04 15:33:37.708550811 +0900
-@@ -337,6 +337,9 @@
+@@ -330,6 +330,9 @@
  reading of a disk page */
  UNIV_INTERN ulint srv_buf_pool_reads = 0;
  
@@ -575,7 +575,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
  /* structure to pass status variables to MySQL */
  UNIV_INTERN export_struc export_vars;
  
-@@ -2703,6 +2706,56 @@
+@@ -2701,6 +2704,56 @@
        /* We count the number of threads in os_thread_exit(). A created
        thread should always use that to exit and not use return() to exit. */
  
@@ -635,7 +635,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
 diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c
 --- a/storage/innobase/srv/srv0start.c 2010-12-03 15:18:48.916955609 +0900
 +++ b/storage/innobase/srv/srv0start.c 2010-12-04 15:33:37.711484798 +0900
-@@ -121,9 +121,9 @@
+@@ -120,9 +120,9 @@
  static os_file_t      files[1000];
  
  /** io_handler_thread parameters for thread identification */
@@ -647,7 +647,7 @@ diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c
  
  /** We use this mutex to test the return value of pthread_mutex_trylock
     on successful locking. HP-UX does NOT return 0, though Linux et al do. */
-@@ -1822,6 +1822,10 @@
+@@ -1821,6 +1821,10 @@
        os_thread_create(&srv_monitor_thread, NULL,
                         thread_ids + 4 + SRV_MAX_N_IO_THREADS);
  
index 01559ebf6f564eaf16c10333be0315e2b30c750f..d86314c4d489acdccfe5790c42af0ef7aec16718 100644 (file)
@@ -40,7 +40,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
        ut_d(bpage->in_page_hash = FALSE);
  
        /* relocate buf_pool->LRU */
-@@ -3730,8 +3730,8 @@
+@@ -3747,8 +3747,8 @@
                bpage->in_zip_hash = FALSE;
                bpage->in_flush_list = FALSE;
                bpage->in_free_list = FALSE;
@@ -50,7 +50,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
                ut_d(bpage->in_page_hash = TRUE);
  
-@@ -3894,7 +3894,7 @@
+@@ -3911,7 +3911,7 @@
        ibuf_merge_or_delete_for_page(NULL, space, offset, zip_size, TRUE);
  
        /* Flush pages from the end of the LRU list if necessary */
@@ -190,7 +190,7 @@ diff -ruN a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c
 diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
 --- a/storage/innobase/buf/buf0lru.c   2010-11-03 07:01:13.000000000 +0900
 +++ b/storage/innobase/buf/buf0lru.c   2010-12-03 15:20:49.602952786 +0900
-@@ -992,7 +992,7 @@
+@@ -996,7 +996,7 @@
  
        /* No free block was found: try to flush the LRU list */
  
@@ -199,7 +199,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
        ++srv_buf_pool_wait_free;
  
        os_aio_simulated_wake_handler_threads();
-@@ -1189,7 +1189,7 @@
+@@ -1193,7 +1193,7 @@
  
        /* Remove the block from the LRU list */
        UT_LIST_REMOVE(LRU, buf_pool->LRU, bpage);
@@ -208,7 +208,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
  
        buf_unzip_LRU_remove_block_if_needed(bpage);
  
-@@ -1268,7 +1268,7 @@
+@@ -1272,7 +1272,7 @@
  
        ut_ad(!bpage->in_LRU_list);
        UT_LIST_ADD_LAST(LRU, buf_pool->LRU, bpage);
@@ -217,7 +217,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
  
        if (UT_LIST_GET_LEN(buf_pool->LRU) > BUF_LRU_OLD_MIN_LEN) {
  
-@@ -1338,7 +1338,7 @@
+@@ -1342,7 +1342,7 @@
                buf_pool->LRU_old_len++;
        }
  
@@ -226,7 +226,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
  
        if (UT_LIST_GET_LEN(buf_pool->LRU) > BUF_LRU_OLD_MIN_LEN) {
  
-@@ -1589,7 +1589,7 @@
+@@ -1593,7 +1593,7 @@
                                buf_page_set_old(b, buf_page_is_old(b));
  #endif /* UNIV_LRU_DEBUG */
                        } else {
@@ -247,7 +247,7 @@ diff -ruN a/storage/innobase/buf/buf0rea.c b/storage/innobase/buf/buf0rea.c
  
        /* Increment number of I/O operations used for LRU policy. */
        buf_LRU_stat_inc_io();
-@@ -476,7 +476,7 @@
+@@ -474,7 +474,7 @@
        os_aio_simulated_wake_handler_threads();
  
        /* Flush pages from the end of the LRU list if necessary */
@@ -256,7 +256,7 @@ diff -ruN a/storage/innobase/buf/buf0rea.c b/storage/innobase/buf/buf0rea.c
  
  #ifdef UNIV_DEBUG
        if (buf_debug_prints && (count > 0)) {
-@@ -565,7 +565,7 @@
+@@ -562,7 +562,7 @@
        os_aio_simulated_wake_handler_threads();
  
        /* Flush pages from the end of all the LRU lists if necessary */
@@ -265,7 +265,7 @@ diff -ruN a/storage/innobase/buf/buf0rea.c b/storage/innobase/buf/buf0rea.c
  
  #ifdef UNIV_DEBUG
        if (buf_debug_prints) {
-@@ -659,7 +659,7 @@
+@@ -656,7 +656,7 @@
        os_aio_simulated_wake_handler_threads();
  
        /* Flush pages from the end of all the LRU lists if necessary */
@@ -277,7 +277,7 @@ diff -ruN a/storage/innobase/buf/buf0rea.c b/storage/innobase/buf/buf0rea.c
 diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
 --- a/storage/innobase/include/buf0buf.h       2010-11-03 07:01:13.000000000 +0900
 +++ b/storage/innobase/include/buf0buf.h       2010-12-03 15:20:49.608986590 +0900
-@@ -1385,11 +1385,11 @@
+@@ -1387,11 +1387,11 @@
  
        UT_LIST_NODE_T(buf_page_t) LRU;
                                        /*!< node of the LRU list */
index 1bda99d3f7e57a26c999ee9244b6c6fcf1e82ac3..5478979a144a67ede1845b0e583aff0ea25fe198 100644 (file)
@@ -17,9 +17,9 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
  #include <sql_table.h>        // explain_filename, nz2, EXPLAIN_PARTITIONS_AS_COMMENT,
                        // EXPLAIN_FILENAME_MAX_EXTRA_LENGTH
  
-@@ -52,6 +54,15 @@
- #include <mysql/innodb_priv.h>
+@@ -53,6 +55,15 @@
  #include <mysql/psi/psi.h>
+ #include <my_sys.h>
  
 +#ifdef MYSQL_SERVER
 +#include <rpl_mi.h>
@@ -56,7 +56,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
  static my_bool        innobase_rollback_on_timeout            = FALSE;
  static my_bool        innobase_create_status_file             = FALSE;
  static my_bool        innobase_stats_on_metadata              = TRUE;
-@@ -2221,6 +2241,89 @@
+@@ -2248,6 +2268,89 @@
        }
  #endif /* DBUG_OFF */
  
@@ -146,7 +146,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
        /* Check that values don't overflow on 32-bit systems. */
        if (sizeof(ulint) == 4) {
                if (innobase_buffer_pool_size > UINT_MAX32) {
-@@ -2519,6 +2622,76 @@
+@@ -2546,6 +2649,76 @@
                goto mem_free_and_error;
        }
  
@@ -223,7 +223,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
        innobase_old_blocks_pct = buf_LRU_old_ratio_update(
                innobase_old_blocks_pct, TRUE);
  
-@@ -2631,6 +2804,25 @@
+@@ -2658,6 +2831,25 @@
        trx_t*  trx)    /*!< in: transaction handle */
  {
        if (trx_is_started(trx)) {
@@ -249,7 +249,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
  
                trx_commit_for_mysql(trx);
        }
-@@ -10990,6 +11182,12 @@
+@@ -11014,6 +11206,12 @@
    "The common part for InnoDB table spaces.",
    NULL, NULL, NULL);
  
@@ -262,7 +262,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
  static MYSQL_SYSVAR_BOOL(doublewrite, innobase_use_doublewrite,
    PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
    "Enable InnoDB doublewrite buffer (enabled by default). "
-@@ -11450,6 +11648,7 @@
+@@ -11474,6 +11672,7 @@
    MYSQL_SYSVAR(old_blocks_pct),
    MYSQL_SYSVAR(old_blocks_time),
    MYSQL_SYSVAR(open_files),
@@ -312,7 +312,7 @@ diff -ruN a/storage/innobase/include/trx0sys.h b/storage/innobase/include/trx0sy
 diff -ruN a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h
 --- a/storage/innobase/include/trx0trx.h       2010-12-03 15:18:48.894955550 +0900
 +++ b/storage/innobase/include/trx0trx.h       2010-12-03 15:38:20.323953416 +0900
-@@ -569,6 +569,21 @@
+@@ -580,6 +580,20 @@
        ib_int64_t      mysql_log_offset;/* if MySQL binlog is used, this field
                                        contains the end offset of the binlog
                                        entry */
@@ -330,14 +330,13 @@ diff -ruN a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0tr
 +                                      replication has processed */
 +      const char*     mysql_relay_log_file_name;
 +      ib_int64_t      mysql_relay_log_pos;
-+
-       os_thread_id_t  mysql_thread_id;/* id of the MySQL thread associated
-                                       with this transaction object */
-       ulint           mysql_process_no;/* since in Linux, 'top' reports
+       /*------------------------------*/
+       ulint           n_mysql_tables_in_use; /* number of Innobase tables
+                                       used in the processing of the current
 diff -ruN a/storage/innobase/trx/trx0sys.c b/storage/innobase/trx/trx0sys.c
 --- a/storage/innobase/trx/trx0sys.c   2010-11-03 07:01:13.000000000 +0900
 +++ b/storage/innobase/trx/trx0sys.c   2010-12-03 15:38:20.325956917 +0900
-@@ -75,13 +75,16 @@
+@@ -76,13 +76,16 @@
  file name and position here. */
  /* @{ */
  /** Master binlog file name */
@@ -355,7 +354,7 @@ diff -ruN a/storage/innobase/trx/trx0sys.c b/storage/innobase/trx/trx0sys.c
  /** If this MySQL server uses binary logging, after InnoDB has been inited
  and if it has done a crash recovery, we store the binlog file name and position
  here. */
-@@ -683,23 +686,25 @@
+@@ -684,23 +687,25 @@
  void
  trx_sys_update_mysql_binlog_offset(
  /*===============================*/
@@ -387,7 +386,7 @@ diff -ruN a/storage/innobase/trx/trx0sys.c b/storage/innobase/trx/trx0sys.c
        if (mach_read_from_4(sys_header + field
                             + TRX_SYS_MYSQL_LOG_MAGIC_N_FLD)
            != TRX_SYS_MYSQL_LOG_MAGIC_N) {
-@@ -821,13 +826,26 @@
+@@ -822,13 +827,26 @@
                                         + TRX_SYS_MYSQL_LOG_OFFSET_LOW),
                sys_header + TRX_SYS_MYSQL_MASTER_LOG_INFO
                + TRX_SYS_MYSQL_LOG_NAME);
@@ -415,7 +414,7 @@ diff -ruN a/storage/innobase/trx/trx0sys.c b/storage/innobase/trx/trx0sys.c
  
        trx_sys_mysql_master_log_pos
                = (((ib_int64_t) mach_read_from_4(
-@@ -836,6 +854,19 @@
+@@ -837,6 +855,19 @@
                + ((ib_int64_t) mach_read_from_4(
                           sys_header + TRX_SYS_MYSQL_MASTER_LOG_INFO
                           + TRX_SYS_MYSQL_LOG_OFFSET_LOW));
@@ -438,7 +437,7 @@ diff -ruN a/storage/innobase/trx/trx0sys.c b/storage/innobase/trx/trx0sys.c
 diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c
 --- a/storage/innobase/trx/trx0trx.c   2010-12-03 15:37:45.549028990 +0900
 +++ b/storage/innobase/trx/trx0trx.c   2010-12-03 15:38:20.328957217 +0900
-@@ -136,6 +136,10 @@
+@@ -138,6 +138,10 @@
  
        trx->mysql_log_file_name = NULL;
        trx->mysql_log_offset = 0;
@@ -449,7 +448,7 @@ diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c
  
        mutex_create(trx_undo_mutex_key, &trx->undo_mutex, SYNC_TRX_UNDO);
  
-@@ -766,6 +770,7 @@
+@@ -820,6 +824,7 @@
  {
        mtr_t           mtr;
        trx_rseg_t*     rseg;
@@ -457,7 +456,7 @@ diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c
  
        ut_ad(!mutex_own(&kernel_mutex));
  
-@@ -819,8 +824,12 @@
+@@ -873,8 +878,12 @@
  
        if (trx->mysql_log_file_name
            && trx->mysql_log_file_name[0] != '\0') {
@@ -470,7 +469,7 @@ diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c
                        trx->mysql_log_file_name,
                        trx->mysql_log_offset,
                        TRX_SYS_MYSQL_LOG_INFO, &mtr);
-@@ -828,6 +837,27 @@
+@@ -882,6 +891,27 @@
                trx->mysql_log_file_name = NULL;
        }
  
index 910e9fe43c970a3fb48c8be34573b52ca96f0b5c..b731ba49597eee81cb9b99e329d0bb9e399f8849 100644 (file)
@@ -331,7 +331,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
  /* prototypes for new functions added to ha_innodb.cc */
  trx_t* innobase_get_trx();
-@@ -1131,6 +1132,11 @@
+@@ -1135,6 +1136,11 @@
                        ready = buf_flush_ready_for_replace(&block->page);
                        mutex_exit(&block->mutex);
  
@@ -343,37 +343,35 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
                        if (!ready) {
  
                                return(block);
-@@ -2478,6 +2484,14 @@
+@@ -2479,6 +2485,13 @@
                return(NULL);
        }
  
-+      if (srv_pass_corrupt_table) {
++      if (srv_pass_corrupt_table <= 1) {
 +              if (bpage->is_corrupt) {
 +                      rw_lock_s_unlock(&buf_pool->page_hash_latch);
 +                      return(NULL);
 +              }
 +      }
-+      ut_a(!(bpage->is_corrupt));
 +
        block_mutex = buf_page_get_mutex_enter(bpage);
  
        rw_lock_s_unlock(&buf_pool->page_hash_latch);
-@@ -3024,6 +3038,14 @@
+@@ -3040,6 +3053,13 @@
                return(NULL);
        }
  
-+      if (srv_pass_corrupt_table) {
++      if (srv_pass_corrupt_table <= 1) {
 +              if (block->page.is_corrupt) {
 +                      mutex_exit(block_mutex);
 +                      return(NULL);
 +              }
 +      }
-+      ut_a(!(block->page.is_corrupt));
 +
        switch (buf_block_get_state(block)) {
                buf_page_t*     bpage;
                ibool           success;
-@@ -3693,6 +3715,7 @@
+@@ -3714,6 +3734,7 @@
        bpage->newest_modification = 0;
        bpage->oldest_modification = 0;
        HASH_INVALIDATE(bpage, hash);
@@ -381,17 +379,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  #if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
        bpage->file_page_was_freed = FALSE;
  #endif /* UNIV_DEBUG_FILE_ACCESSES || UNIV_DEBUG */
-@@ -4203,7 +4226,8 @@
- void
- buf_page_io_complete(
- /*=================*/
--      buf_page_t*     bpage)  /*!< in: pointer to the block in question */
-+      buf_page_t*     bpage,  /*!< in: pointer to the block in question */
-+      trx_t*          trx)
- {
-       enum buf_io_fix io_type;
-       buf_pool_t*     buf_pool = buf_pool_from_bpage(bpage);
-@@ -4282,6 +4306,7 @@
+@@ -4303,6 +4324,7 @@
                                (ulong) bpage->offset);
                }
  
@@ -399,27 +387,31 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
                /* From version 3.23.38 up we store the page checksum
                to the 4 first bytes of the page end lsn field */
  
-@@ -4323,6 +4348,19 @@
+@@ -4344,6 +4366,23 @@
                              REFMAN "forcing-innodb-recovery.html\n"
                              "InnoDB: about forcing recovery.\n", stderr);
  
 +                      if (srv_pass_corrupt_table && !trx_sys_sys_space(bpage->space)
 +                          && bpage->space < SRV_LOG_SPACE_FIRST_ID) {
++                              trx_t*  trx;
++
 +                              fprintf(stderr,
 +                                      "InnoDB: space %u will be treated as corrupt.\n",
 +                                      bpage->space);
 +                              fil_space_set_corrupt(bpage->space);
-+                              if (trx && trx->dict_operation_lock_mode == 0) {
-+                                      dict_table_set_corrupt_by_space(bpage->space, TRUE);
-+                              } else {
++
++                              trx = innobase_get_trx();
++                              if (trx && trx->dict_operation_lock_mode == RW_X_LATCH) {
 +                                      dict_table_set_corrupt_by_space(bpage->space, FALSE);
++                              } else {
++                                      dict_table_set_corrupt_by_space(bpage->space, TRUE);
 +                              }
 +                              bpage->is_corrupt = TRUE;
 +                      } else
                        if (srv_force_recovery < SRV_FORCE_IGNORE_CORRUPT) {
                                fputs("InnoDB: Ending processing because of"
                                      " a corrupt database page.\n",
-@@ -4330,6 +4368,7 @@
+@@ -4351,6 +4390,7 @@
                                exit(1);
                        }
                }
@@ -427,7 +419,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
                if (recv_recovery_is_on()) {
                        /* Pages must be uncompressed for crash recovery. */
-@@ -4339,8 +4378,11 @@
+@@ -4360,8 +4400,11 @@
  
                if (uncompressed && !recv_no_ibuf_operations) {
                        ibuf_merge_or_delete_for_page(
@@ -442,7 +434,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
 diff -ruN a/storage/innobase/buf/buf0rea.c b/storage/innobase/buf/buf0rea.c
 --- a/storage/innobase/buf/buf0rea.c   2010-12-04 15:37:50.557553380 +0900
 +++ b/storage/innobase/buf/buf0rea.c   2010-12-04 15:41:09.784467585 +0900
-@@ -193,12 +193,19 @@
+@@ -193,7 +193,14 @@
                              ((buf_block_t*) bpage)->frame, bpage, trx);
        }
        thd_wait_end(NULL);
@@ -457,24 +449,18 @@ diff -ruN a/storage/innobase/buf/buf0rea.c b/storage/innobase/buf/buf0rea.c
  
        if (sync) {
                /* The i/o is already completed when we arrive from
-               fil_read */
--              buf_page_io_complete(bpage);
-+              buf_page_io_complete(bpage, trx);
-       }
-       return(1);
 diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.c
 --- a/storage/innobase/dict/dict0dict.c        2010-12-03 17:30:16.248987063 +0900
 +++ b/storage/innobase/dict/dict0dict.c        2010-12-04 15:45:23.808513973 +0900
-@@ -55,6 +55,7 @@
- #include "srv0srv.h" /* srv_lower_case_table_names */
+@@ -54,6 +54,7 @@
+ #include "row0merge.h"
  #include "m_ctype.h" /* my_isspace() */
  #include "ha_prototypes.h" /* innobase_strcasecmp(), innobase_casedn_str()*/
 +#include "srv0start.h" /* SRV_LOG_SPACE_FIRST_ID */
  
  #include <ctype.h>
  
-@@ -751,7 +752,7 @@
+@@ -750,7 +751,7 @@
  
        mutex_exit(&(dict_sys->mutex));
  
@@ -483,7 +469,7 @@ diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.
                /* If table->ibd_file_missing == TRUE, this will
                print an error message and return without doing
                anything. */
-@@ -1294,7 +1295,7 @@
+@@ -1293,7 +1294,7 @@
                    + dict_sys->size) > srv_dict_size_limit ) {
                prev_table = UT_LIST_GET_PREV(table_LRU, table);
  
@@ -492,7 +478,7 @@ diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.
                        goto next_loop;
  
                cached_foreign_tables = 0;
-@@ -4333,6 +4334,12 @@
+@@ -4332,6 +4333,12 @@
        heap = mem_heap_create(1000);
  
        while (index) {
@@ -505,7 +491,7 @@ diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.
                size = btr_get_size(index, BTR_TOTAL_SIZE);
  
                index->stat_index_size = size;
-@@ -4480,6 +4487,12 @@
+@@ -4479,6 +4486,12 @@
        heap = mem_heap_create(1000);
  
        while (index) {
@@ -518,20 +504,21 @@ diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.
  /*===========================================*/
  {
        dict_table_t*   sys_stats;
-@@ -4666,6 +4679,12 @@
+@@ -4671,6 +4684,13 @@
                     || (srv_force_recovery < SRV_FORCE_NO_LOG_REDO
                         && dict_index_is_clust(index)))) {
                        ulint   size;
 +
 +                      if (table->is_corrupt) {
 +                              ut_a(srv_pass_corrupt_table);
++                              dict_table_stats_unlock(table, RW_X_LATCH);
 +                              return;
 +                      }
 +
                        size = btr_get_size(index, BTR_TOTAL_SIZE);
  
                        index->stat_index_size = size;
-@@ -5462,4 +5481,42 @@
+@@ -5467,4 +5487,42 @@
                rw_lock_free(&dict_table_stats_latches[i]);
        }
  }
@@ -577,7 +564,7 @@ diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.
 diff -ruN a/storage/innobase/dict/dict0mem.c b/storage/innobase/dict/dict0mem.c
 --- a/storage/innobase/dict/dict0mem.c 2010-11-03 07:01:13.000000000 +0900
 +++ b/storage/innobase/dict/dict0mem.c 2010-12-04 15:38:18.126549463 +0900
-@@ -97,6 +97,8 @@
+@@ -96,6 +96,8 @@
        /* The number of transactions that are either waiting on the
        AUTOINC lock or have been granted the lock. */
        table->n_waiting_or_granted_auto_inc_locks = 0;
@@ -589,7 +576,7 @@ diff -ruN a/storage/innobase/dict/dict0mem.c b/storage/innobase/dict/dict0mem.c
 diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
 --- a/storage/innobase/fil/fil0fil.c   2010-12-04 15:37:50.564551587 +0900
 +++ b/storage/innobase/fil/fil0fil.c   2010-12-04 15:38:18.128549252 +0900
-@@ -233,6 +233,7 @@
+@@ -235,6 +235,7 @@
                                file we have written to */
        ibool           is_in_unflushed_spaces; /*!< TRUE if this space is
                                currently in unflushed_spaces */
@@ -597,7 +584,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
        UT_LIST_NODE_T(fil_space_t) space_list;
                                /*!< list of all spaces */
        ulint           magic_n;/*!< FIL_SPACE_MAGIC_N */
-@@ -1291,6 +1292,8 @@
+@@ -1293,6 +1294,8 @@
                    ut_fold_string(name), space);
        space->is_in_unflushed_spaces = FALSE;
  
@@ -606,18 +593,18 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
        UT_LIST_ADD_LAST(space_list, fil_system->space_list, space);
  
        mutex_exit(&fil_system->mutex);
-@@ -4945,6 +4948,22 @@
+@@ -5267,6 +5270,34 @@
        ut_a(byte_offset % OS_FILE_LOG_BLOCK_SIZE == 0);
        ut_a((len % OS_FILE_LOG_BLOCK_SIZE) == 0);
  
-+      if (srv_pass_corrupt_table && space->is_corrupt) {
++      if (srv_pass_corrupt_table == 1 && space->is_corrupt) {
 +              /* should ignore i/o for the crashed space */
 +              mutex_enter(&fil_system->mutex);
 +              fil_node_complete_io(node, fil_system, type);
 +              mutex_exit(&fil_system->mutex);
 +              if (mode == OS_AIO_NORMAL) {
 +                      ut_a(space->purpose == FIL_TABLESPACE);
-+                      buf_page_io_complete(message, trx);
++                      buf_page_io_complete(message);
 +              }
 +              if (type == OS_FILE_READ) {
 +                      return(DB_TABLESPACE_DELETED);
@@ -625,11 +612,23 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
 +                      return(DB_SUCCESS);
 +              }
 +      } else {
-+              ut_a(!space->is_corrupt);
++              if (srv_pass_corrupt_table > 1 && space->is_corrupt) {
++                      /* should ignore write i/o for the crashed space */
++                      if (type == OS_FILE_WRITE) {
++                              mutex_enter(&fil_system->mutex);
++                              fil_node_complete_io(node, fil_system, type);
++                              mutex_exit(&fil_system->mutex);
++                              if (mode == OS_AIO_NORMAL) {
++                                      ut_a(space->purpose == FIL_TABLESPACE);
++                                      buf_page_io_complete(message);
++                              }
++                              return(DB_SUCCESS);
++                      }
++              }
  #ifdef UNIV_HOTBACKUP
        /* In ibbackup do normal i/o, not aio */
        if (type == OS_FILE_READ) {
-@@ -4959,6 +4978,8 @@
+@@ -5281,6 +5312,8 @@
        ret = os_aio(type, mode | wake_later, node->name, node->handle, buf,
                     offset_low, offset_high, len, node, message, trx);
  #endif
@@ -638,16 +637,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
        ut_a(ret);
  
        if (mode == OS_AIO_SYNC) {
-@@ -5100,7 +5121,7 @@
-       if (fil_node->space->purpose == FIL_TABLESPACE) {
-               srv_set_io_thread_op_info(segment, "complete io for buf page");
--              buf_page_io_complete(message);
-+              buf_page_io_complete(message, NULL);
-       } else {
-               srv_set_io_thread_op_info(segment, "complete io for log");
-               log_io_complete(message);
-@@ -5454,3 +5475,46 @@
+@@ -5780,3 +5813,46 @@
                 return 0;
         }
  }
@@ -808,11 +798,11 @@ diff -ruN a/storage/innobase/fsp/fsp0fsp.c b/storage/innobase/fsp/fsp0fsp.c
 diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
 --- a/storage/innobase/handler/ha_innodb.cc    2010-12-04 15:37:50.578486593 +0900
 +++ b/storage/innobase/handler/ha_innodb.cc    2010-12-04 15:38:18.137549396 +0900
-@@ -3947,6 +3947,12 @@
+@@ -3972,6 +3972,12 @@
                DBUG_RETURN(1);
        }
  
-+      if (share->ib_table && share->ib_table->is_corrupt) {
++      if (srv_pass_corrupt_table <= 1 && share->ib_table && share->ib_table->is_corrupt) {
 +              free_share(share);
 +
 +              DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
@@ -821,11 +811,11 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
        /* Create buffers for packing the fields of a record. Why
        table->reclength did not work here? Obviously, because char
        fields when packed actually became 1 byte longer, when we also
-@@ -3974,6 +3980,19 @@
+@@ -3999,6 +4005,19 @@
        /* Get pointer to a table object in InnoDB dictionary cache */
        ib_table = dict_table_get(norm_name, TRUE);
        
-+      if (ib_table && ib_table->is_corrupt) {
++      if (srv_pass_corrupt_table <= 1 && ib_table && ib_table->is_corrupt) {
 +              free_share(share);
 +              my_free(upd_buff);
 +
@@ -841,7 +831,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
        if (NULL == ib_table) {
                if (is_part && retries < 10) {
                        ++retries;
-@@ -5138,6 +5157,10 @@
+@@ -5163,6 +5182,10 @@
  
        ha_statistic_increment(&SSV::ha_write_count);
  
@@ -852,7 +842,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
        if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
                table->timestamp_field->set_time();
  
-@@ -5355,6 +5378,10 @@
+@@ -5380,6 +5403,10 @@
  func_exit:
        innobase_active_small();
  
@@ -863,7 +853,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
        DBUG_RETURN(error_result);
  }
  
-@@ -5531,6 +5558,10 @@
+@@ -5556,6 +5583,10 @@
  
        ha_statistic_increment(&SSV::ha_update_count);
  
@@ -874,7 +864,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
        if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
                table->timestamp_field->set_time();
  
-@@ -5620,6 +5651,10 @@
+@@ -5645,6 +5676,10 @@
  
        innobase_active_small();
  
@@ -885,7 +875,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
        DBUG_RETURN(error);
  }
  
-@@ -5641,6 +5676,10 @@
+@@ -5666,6 +5701,10 @@
  
        ha_statistic_increment(&SSV::ha_delete_count);
  
@@ -896,7 +886,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
        if (!prebuilt->upd_node) {
                row_get_prebuilt_update_vector(prebuilt);
        }
-@@ -5667,6 +5706,10 @@
+@@ -5692,6 +5731,10 @@
  
        innobase_active_small();
  
@@ -907,62 +897,62 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
        DBUG_RETURN(error);
  }
  
-@@ -5906,6 +5949,10 @@
+@@ -5931,6 +5974,10 @@
  
        ha_statistic_increment(&SSV::ha_read_key_count);
  
-+      if (share->ib_table->is_corrupt) {
++      if (srv_pass_corrupt_table <= 1 && share->ib_table->is_corrupt) {
 +              DBUG_RETURN(HA_ERR_CRASHED);
 +      }
 +
        index = prebuilt->index;
  
        if (UNIV_UNLIKELY(index == NULL)) {
-@@ -5971,6 +6018,10 @@
+@@ -5996,6 +6043,10 @@
                ret = DB_UNSUPPORTED;
        }
  
-+      if (share->ib_table->is_corrupt) {
++      if (srv_pass_corrupt_table <= 1 && share->ib_table->is_corrupt) {
 +              DBUG_RETURN(HA_ERR_CRASHED);
 +      }
 +
        switch (ret) {
        case DB_SUCCESS:
                error = 0;
-@@ -6086,6 +6137,10 @@
+@@ -6111,6 +6162,10 @@
  {
        DBUG_ENTER("change_active_index");
  
-+      if (share->ib_table->is_corrupt) {
++      if (srv_pass_corrupt_table <= 1 && share->ib_table->is_corrupt) {
 +              DBUG_RETURN(HA_ERR_CRASHED);
 +      }
 +
        ut_ad(user_thd == ha_thd());
        ut_a(prebuilt->trx == thd_to_trx(user_thd));
  
-@@ -6176,6 +6231,10 @@
+@@ -6201,6 +6256,10 @@
  
        DBUG_ENTER("general_fetch");
  
-+      if (share->ib_table->is_corrupt) {
++      if (srv_pass_corrupt_table <= 1 && share->ib_table->is_corrupt) {
 +              DBUG_RETURN(HA_ERR_CRASHED);
 +      }
 +
        ut_a(prebuilt->trx == thd_to_trx(user_thd));
  
        innodb_srv_conc_enter_innodb(prebuilt->trx);
-@@ -6185,6 +6244,10 @@
+@@ -6210,6 +6269,10 @@
  
        innodb_srv_conc_exit_innodb(prebuilt->trx);
  
-+      if (share->ib_table->is_corrupt) {
++      if (srv_pass_corrupt_table <= 1 && share->ib_table->is_corrupt) {
 +              DBUG_RETURN(HA_ERR_CRASHED);
 +      }
 +
        switch (ret) {
        case DB_SUCCESS:
                error = 0;
-@@ -7455,10 +7518,18 @@
+@@ -7476,10 +7539,18 @@
  
        update_thd(ha_thd());
  
@@ -981,7 +971,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
        error = convert_error_code_to_mysql(error, prebuilt->table->flags,
                                            NULL);
  
-@@ -7963,6 +8034,16 @@
+@@ -7980,6 +8051,16 @@
        return(ranges + (double) rows / (double) total_rows * time_for_scan);
  }
  
@@ -998,7 +988,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
  /*********************************************************************//**
  Calculates the key number used inside MySQL for an Innobase index. We will
  first check the "index translation table" for a match of the index to get
-@@ -8140,7 +8221,7 @@
+@@ -8157,7 +8238,7 @@
        ib_table = prebuilt->table;
  
        if (flag & HA_STATUS_TIME) {
@@ -1007,7 +997,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
                        /* In sql_show we call with this flag: update
                        then statistics so that they are up-to-date */
  
-@@ -8433,10 +8514,18 @@
+@@ -8450,10 +8531,18 @@
        THD*            thd,            /*!< in: connection thread handle */
        HA_CHECK_OPT*   check_opt)      /*!< in: currently ignored */
  {
@@ -1026,7 +1016,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
        return(0);
  }
  
-@@ -8618,6 +8707,10 @@
+@@ -8635,6 +8724,10 @@
                my_error(ER_QUERY_INTERRUPTED, MYF(0));
        }
  
@@ -1037,7 +1027,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
        DBUG_RETURN(is_ok ? HA_ADMIN_OK : HA_ADMIN_CORRUPT);
  }
  
-@@ -9388,6 +9481,10 @@
+@@ -9405,6 +9498,10 @@
  
        update_thd(thd);
  
@@ -1048,7 +1038,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
        if (prebuilt->table->ibd_file_missing && !thd_tablespace_op(thd)) {
                ut_print_timestamp(stderr);
                fprintf(stderr,
-@@ -11787,6 +11884,25 @@
+@@ -11807,6 +11904,26 @@
    "0 (the default) disables automatic dumps.",
    NULL, NULL, 0, 0, UINT_MAX32, 0);
  
@@ -1056,6 +1046,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
 +{
 +  "assert", /* 0 */
 +  "warn", /* 1 */
++  "salvage", /* 2 */
 +  NullS
 +};
 +TYPELIB corrupt_table_action_typelib=
@@ -1074,7 +1065,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
  static struct st_mysql_sys_var* innobase_system_variables[]= {
    MYSQL_SYSVAR(additional_mem_pool_size),
    MYSQL_SYSVAR(autoextend_increment),
-@@ -11873,6 +11989,7 @@
+@@ -11893,6 +12010,7 @@
    MYSQL_SYSVAR(purge_threads),
    MYSQL_SYSVAR(purge_batch_size),
    MYSQL_SYSVAR(rollback_segments),
@@ -1127,7 +1118,7 @@ diff -ruN a/storage/innobase/include/btr0btr.ic b/storage/innobase/include/btr0b
 diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
 --- a/storage/innobase/include/buf0buf.h       2010-12-03 15:49:59.218956083 +0900
 +++ b/storage/innobase/include/buf0buf.h       2010-12-04 15:38:18.164513667 +0900
-@@ -984,7 +984,7 @@
+@@ -986,7 +986,7 @@
        const buf_block_t*      block)  /*!< in: pointer to the control block */
        __attribute__((pure));
  #else /* UNIV_DEBUG */
@@ -1136,17 +1127,7 @@ diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0bu
  #endif /* UNIV_DEBUG */
  /*********************************************************************//**
  Gets the space id of a block.
-@@ -1116,7 +1116,8 @@
- void
- buf_page_io_complete(
- /*=================*/
--      buf_page_t*     bpage); /*!< in: pointer to the block in question */
-+      buf_page_t*     bpage,  /*!< in: pointer to the block in question */
-+      trx_t*          trx);
- /********************************************************************//**
- Calculates a folded value of a file page address to use in the page hash
- table.
-@@ -1431,6 +1432,7 @@
+@@ -1433,6 +1433,7 @@
                                        0 if the block was never accessed
                                        in the buffer pool */
        /* @} */
@@ -1201,7 +1182,7 @@ diff -ruN a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict
 diff -ruN a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h
 --- a/storage/innobase/include/dict0mem.h      2010-11-03 07:01:13.000000000 +0900
 +++ b/storage/innobase/include/dict0mem.h      2010-12-04 15:38:18.171513956 +0900
-@@ -636,6 +636,7 @@
+@@ -640,6 +640,7 @@
                                the AUTOINC lock on this table. */
                                /* @} */
        /*----------------------*/
@@ -1296,7 +1277,7 @@ diff -ruN a/storage/innobase/include/page0zip.h b/storage/innobase/include/page0
 diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
 --- a/storage/innobase/include/srv0srv.h       2010-12-04 15:37:50.591516341 +0900
 +++ b/storage/innobase/include/srv0srv.h       2010-12-04 15:38:18.180563749 +0900
-@@ -243,6 +243,7 @@
+@@ -240,6 +240,7 @@
  extern ulint  srv_adaptive_flushing_method;
  
  extern ulint  srv_expand_import;
@@ -1354,7 +1335,7 @@ diff -ruN a/storage/innobase/row/row0merge.c b/storage/innobase/row/row0merge.c
 diff -ruN a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c
 --- a/storage/innobase/row/row0sel.c   2010-11-03 07:01:13.000000000 +0900
 +++ b/storage/innobase/row/row0sel.c   2010-12-04 15:38:18.205551115 +0900
-@@ -3848,6 +3848,13 @@
+@@ -3853,6 +3853,13 @@
        /* PHASE 4: Look for matching records in a loop */
  
        rec = btr_pcur_get_rec(pcur);
@@ -1368,10 +1349,35 @@ diff -ruN a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c
        ut_ad(!!page_rec_is_comp(rec) == comp);
  #ifdef UNIV_SEARCH_DEBUG
        /*
+@@ -3930,7 +3937,13 @@
+       if (UNIV_UNLIKELY(next_offs >= UNIV_PAGE_SIZE - PAGE_DIR)) {
+ wrong_offs:
+-              if (srv_force_recovery == 0 || moves_up == FALSE) {
++              if (srv_pass_corrupt_table && !trx_sys_sys_space(index->table->space)) {
++                      index->table->is_corrupt = TRUE;
++                      fil_space_set_corrupt(index->table->space);
++              }
++
++              if ((srv_force_recovery == 0 || moves_up == FALSE)
++                  && srv_pass_corrupt_table <= 1) {
+                       ut_print_timestamp(stderr);
+                       buf_page_print(page_align(rec), 0);
+                       fprintf(stderr,
+@@ -3981,7 +3994,8 @@
+       offsets = rec_get_offsets(rec, index, offsets, ULINT_UNDEFINED, &heap);
+-      if (UNIV_UNLIKELY(srv_force_recovery > 0)) {
++      if (UNIV_UNLIKELY(srv_force_recovery > 0)
++          || (srv_pass_corrupt_table == 2 && index->table->is_corrupt)) {
+               if (!rec_validate(rec, offsets)
+                   || !btr_index_rec_validate(rec, index, FALSE)) {
+                       fprintf(stderr,
 diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
 --- a/storage/innobase/srv/srv0srv.c   2010-12-04 15:37:50.602481253 +0900
 +++ b/storage/innobase/srv/srv0srv.c   2010-12-04 15:38:18.209513823 +0900
-@@ -437,6 +437,7 @@
+@@ -430,6 +430,7 @@
  UNIV_INTERN ulint     srv_adaptive_flushing_method = 0; /* 0: native  1: estimate  2: keep_average */
  
  UNIV_INTERN ulint     srv_expand_import = 0; /* 0:disable 1:enable */
@@ -1382,7 +1388,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
 diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c
 --- a/storage/innobase/srv/srv0start.c 2010-12-04 15:37:50.605491300 +0900
 +++ b/storage/innobase/srv/srv0start.c 2010-12-04 15:38:18.212513722 +0900
-@@ -2150,6 +2150,13 @@
+@@ -2149,6 +2149,13 @@
  
        os_fast_mutex_free(&srv_os_test_mutex);
  
index c1de1a7f9e8d2f94af06cad8c306a8358a6ebdae..d836a8ab4d34627ce88d97bc8228e232333d1be3 100644 (file)
@@ -55,7 +55,7 @@ diff -ruN a/storage/innobase/buf/buf0rea.c b/storage/innobase/buf/buf0rea.c
  
                return(0);
        }
-@@ -613,6 +653,50 @@
+@@ -610,6 +650,50 @@
                /* It is a single table tablespace and the .ibd file is
                missing: do nothing */
  
@@ -117,7 +117,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
  static my_bool        innobase_locks_unsafe_for_binlog        = FALSE;
  static my_bool        innobase_overwrite_relay_log_info       = FALSE;
  static my_bool        innobase_rollback_on_timeout            = FALSE;
-@@ -2549,6 +2550,8 @@
+@@ -2576,6 +2577,8 @@
  
        srv_force_recovery = (ulint) innobase_force_recovery;
  
@@ -126,7 +126,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
        srv_use_doublewrite_buf = (ibool) innobase_use_doublewrite;
        srv_use_checksums = (ibool) innobase_use_checksums;
  
-@@ -11250,6 +11253,11 @@
+@@ -11274,6 +11277,11 @@
    "The common part for InnoDB table spaces.",
    NULL, NULL, NULL);
  
@@ -138,7 +138,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
  static MYSQL_SYSVAR_BOOL(recovery_update_relay_log, innobase_overwrite_relay_log_info,
    PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
    "During InnoDB crash recovery on slave overwrite relay-log.info "
-@@ -11723,6 +11731,7 @@
+@@ -11747,6 +11755,7 @@
    MYSQL_SYSVAR(data_file_path),
    MYSQL_SYSVAR(data_home_dir),
    MYSQL_SYSVAR(doublewrite),
@@ -192,7 +192,7 @@ diff -ruN a/storage/innobase/include/log0recv.h b/storage/innobase/include/log0r
 diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
 --- a/storage/innobase/include/srv0srv.h       2010-12-03 17:30:16.321953515 +0900
 +++ b/storage/innobase/include/srv0srv.h       2010-12-03 17:30:41.593985184 +0900
-@@ -129,6 +129,8 @@
+@@ -126,6 +126,8 @@
  extern ulint* srv_data_file_sizes;
  extern ulint* srv_data_file_is_raw_partition;
  
@@ -441,8 +441,8 @@ diff -ruN a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c
  #ifndef UNIV_HOTBACKUP
  # include "os0sync.h"
  # include "os0thread.h"
-@@ -4262,6 +4263,18 @@
-               os_thread_exit(NULL);
+@@ -4260,6 +4261,18 @@
+                                          INFINITE);
        }
  
 +      if (srv_recovery_stats && recv_recovery_is_on() && n_consecutive) {
@@ -459,11 +459,11 @@ diff -ruN a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c
 +
        os_mutex_enter(array->mutex);
  
-       slot = os_aio_array_get_nth_slot(array, i + segment * n);
+       if (srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS
 diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
 --- a/storage/innobase/srv/srv0srv.c   2010-12-03 17:30:16.339955597 +0900
 +++ b/storage/innobase/srv/srv0srv.c   2010-12-03 17:30:41.604958138 +0900
-@@ -167,6 +167,8 @@
+@@ -160,6 +160,8 @@
  /* size in database pages */
  UNIV_INTERN ulint*    srv_data_file_sizes = NULL;
  
@@ -475,7 +475,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
 diff -ruN a/storage/innobase/trx/trx0sys.c b/storage/innobase/trx/trx0sys.c
 --- a/storage/innobase/trx/trx0sys.c   2010-12-03 15:41:52.051986524 +0900
 +++ b/storage/innobase/trx/trx0sys.c   2010-12-03 17:30:41.607026818 +0900
-@@ -566,6 +566,12 @@
+@@ -567,6 +567,12 @@
                               zip_size ? zip_size : UNIV_PAGE_SIZE,
                               read_buf, NULL);
  
@@ -488,7 +488,7 @@ diff -ruN a/storage/innobase/trx/trx0sys.c b/storage/innobase/trx/trx0sys.c
                        /* Check if the page is corrupt */
  
                        if (UNIV_UNLIKELY
-@@ -613,6 +619,13 @@
+@@ -614,6 +620,13 @@
                                       zip_size, page_no, 0,
                                       zip_size ? zip_size : UNIV_PAGE_SIZE,
                                       page, NULL);
index 434c649dfcc2649e01c6ed7699fa641d80830600..13195009971df3ea74a3f3d4d7c401a9471247e8 100644 (file)
@@ -8,7 +8,7 @@
 diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
 --- a/storage/innobase/buf/buf0buf.c   2010-12-03 17:49:11.574962867 +0900
 +++ b/storage/innobase/buf/buf0buf.c   2010-12-04 15:35:58.624514033 +0900
-@@ -4251,7 +4251,8 @@
+@@ -4272,7 +4272,8 @@
                read_space_id = mach_read_from_4(
                        frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
  
@@ -105,7 +105,7 @@ diff -ruN a/storage/innobase/dict/dict0load.c b/storage/innobase/dict/dict0load.
 diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
 --- a/storage/innobase/fil/fil0fil.c   2010-12-04 15:35:29.143813775 +0900
 +++ b/storage/innobase/fil/fil0fil.c   2010-12-04 15:35:58.628498870 +0900
-@@ -655,7 +655,7 @@
+@@ -657,7 +657,7 @@
  
        UT_LIST_ADD_LAST(chain, space->chain, node);
  
@@ -114,7 +114,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
  
                fil_system->max_assigned_id = id;
        }
-@@ -719,14 +719,14 @@
+@@ -721,14 +721,14 @@
                size_bytes = (((ib_int64_t)size_high) << 32)
                        + (ib_int64_t)size_low;
  #ifdef UNIV_HOTBACKUP
@@ -131,7 +131,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
  
                if (size_bytes < FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE) {
                        fprintf(stderr,
-@@ -772,7 +772,7 @@
+@@ -774,7 +774,7 @@
                }
  
                if (UNIV_UNLIKELY(space_id == ULINT_UNDEFINED
@@ -140,7 +140,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
                        fprintf(stderr,
                                "InnoDB: Error: tablespace id %lu"
                                " in file %s is not sensible\n",
-@@ -840,7 +840,7 @@
+@@ -842,7 +842,7 @@
  
        system->n_open++;
  
@@ -149,7 +149,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
                /* Put the node to the LRU list */
                UT_LIST_ADD_FIRST(LRU, system->LRU, node);
        }
-@@ -873,7 +873,7 @@
+@@ -875,7 +875,7 @@
        ut_a(system->n_open > 0);
        system->n_open--;
  
@@ -158,7 +158,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
                ut_a(UT_LIST_GET_LEN(system->LRU) > 0);
  
                /* The node is in the LRU list, remove it */
-@@ -959,7 +959,7 @@
+@@ -961,7 +961,7 @@
  retry:
        mutex_enter(&fil_system->mutex);
  
@@ -167,7 +167,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
                /* We keep log files and system tablespace files always open;
                this is important in preventing deadlocks in this module, as
                a page read completion often performs another read from the
-@@ -1190,7 +1190,7 @@
+@@ -1192,7 +1192,7 @@
                        " tablespace memory cache!\n",
                        (ulong) space->id);
  
@@ -176,7 +176,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
  
                        mutex_exit(&fil_system->mutex);
  
-@@ -1252,6 +1252,7 @@
+@@ -1254,6 +1254,7 @@
        space->mark = FALSE;
  
        if (UNIV_LIKELY(purpose == FIL_TABLESPACE && !recv_recovery_on)
@@ -184,7 +184,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
            && UNIV_UNLIKELY(id > fil_system->max_assigned_id)) {
                if (!fil_system->space_id_reuse_warned) {
                        fil_system->space_id_reuse_warned = TRUE;
-@@ -1335,7 +1336,7 @@
+@@ -1337,7 +1338,7 @@
                        (ulong) SRV_LOG_SPACE_FIRST_ID);
        }
  
@@ -193,7 +193,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
  
        if (success) {
                *space_id = fil_system->max_assigned_id = id;
-@@ -1598,6 +1599,8 @@
+@@ -1600,6 +1601,8 @@
        UT_LIST_INIT(fil_system->LRU);
  
        fil_system->max_n_open = max_n_open;
@@ -202,7 +202,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
  }
  
  /*******************************************************************//**
-@@ -1619,7 +1622,7 @@
+@@ -1621,7 +1624,7 @@
        space = UT_LIST_GET_FIRST(fil_system->space_list);
  
        while (space != NULL) {
@@ -211,7 +211,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
                        node = UT_LIST_GET_FIRST(space->chain);
  
                        while (node != NULL) {
-@@ -1709,6 +1712,10 @@
+@@ -1711,6 +1714,10 @@
                ut_error;
        }
  
@@ -222,7 +222,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
        mutex_enter(&fil_system->mutex);
  
        if (fil_system->max_assigned_id < max_id) {
-@@ -1727,6 +1734,7 @@
+@@ -1729,6 +1736,7 @@
  ulint
  fil_write_lsn_and_arch_no_to_file(
  /*==============================*/
@@ -230,7 +230,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
        ulint           sum_of_sizes,   /*!< in: combined size of previous files
                                        in space, in database pages */
        ib_uint64_t     lsn,            /*!< in: lsn to write */
-@@ -1736,14 +1744,16 @@
+@@ -1738,14 +1746,16 @@
        byte*   buf1;
        byte*   buf;
  
@@ -249,7 +249,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
  
        mem_free(buf1);
  
-@@ -1779,7 +1789,7 @@
+@@ -1781,7 +1791,7 @@
                always open. */
  
                if (space->purpose == FIL_TABLESPACE
@@ -258,7 +258,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
                        sum_of_sizes = 0;
  
                        node = UT_LIST_GET_FIRST(space->chain);
-@@ -1787,7 +1797,7 @@
+@@ -1789,7 +1799,7 @@
                                mutex_exit(&fil_system->mutex);
  
                                err = fil_write_lsn_and_arch_no_to_file(
@@ -267,7 +267,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
                                if (err != DB_SUCCESS) {
  
                                        return(err);
-@@ -3834,7 +3844,7 @@
+@@ -4158,7 +4168,7 @@
        }
  
  #ifndef UNIV_HOTBACKUP
@@ -276,7 +276,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
                fprintf(stderr,
                        "InnoDB: Error: tablespace id %lu in file %s"
                        " is not sensible\n",
-@@ -3843,7 +3853,7 @@
+@@ -4167,7 +4177,7 @@
                goto func_exit;
        }
  #else
@@ -285,7 +285,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
                char*   new_path;
  
                fprintf(stderr,
-@@ -4664,7 +4674,7 @@
+@@ -4988,7 +4998,7 @@
        }
  
        if (node->n_pending == 0 && space->purpose == FIL_TABLESPACE
@@ -294,7 +294,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
                /* The node is in the LRU list, remove it */
  
                ut_a(UT_LIST_GET_LEN(system->LRU) > 0);
-@@ -4710,7 +4720,7 @@
+@@ -5034,7 +5044,7 @@
        }
  
        if (node->n_pending == 0 && node->space->purpose == FIL_TABLESPACE
@@ -303,7 +303,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
                /* The node must be put back to the LRU list */
                UT_LIST_ADD_FIRST(LRU, system->LRU, node);
        }
-@@ -5318,7 +5328,7 @@
+@@ -5644,7 +5654,7 @@
                ut_a(fil_node->n_pending == 0);
                ut_a(fil_node->open);
                ut_a(fil_node->space->purpose == FIL_TABLESPACE);
@@ -348,7 +348,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
  
  /* The highest file format being used in the database. The value can be
  set by user, however, it will be adjusted to the newer file format if
-@@ -2445,6 +2446,8 @@
+@@ -2472,6 +2473,8 @@
                goto error;
        }
  
@@ -357,7 +357,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
        srv_use_sys_stats_table = (ibool) innobase_use_sys_stats_table;
  
        /* -------------- Log files ---------------------------*/
-@@ -11621,6 +11624,11 @@
+@@ -11641,6 +11644,11 @@
    "Path to individual files and their sizes.",
    NULL, NULL, NULL);
  
@@ -369,7 +369,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
  static MYSQL_SYSVAR_LONG(autoinc_lock_mode, innobase_autoinc_lock_mode,
    PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
    "The AUTOINC lock modes supported by InnoDB:               "
-@@ -11788,6 +11796,7 @@
+@@ -11808,6 +11816,7 @@
    MYSQL_SYSVAR(commit_concurrency),
    MYSQL_SYSVAR(concurrency_tickets),
    MYSQL_SYSVAR(data_file_path),
@@ -403,7 +403,7 @@ diff -ruN a/storage/innobase/include/mtr0log.ic b/storage/innobase/include/mtr0l
 diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
 --- a/storage/innobase/include/srv0srv.h       2010-12-04 15:35:29.177480351 +0900
 +++ b/storage/innobase/include/srv0srv.h       2010-12-04 15:35:58.646556250 +0900
-@@ -132,6 +132,8 @@
+@@ -129,6 +129,8 @@
  extern ulint* srv_data_file_sizes;
  extern ulint* srv_data_file_is_raw_partition;
  
@@ -519,7 +519,7 @@ diff -ruN a/storage/innobase/include/trx0sys.ic b/storage/innobase/include/trx0s
 diff -ruN a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c
 --- a/storage/innobase/row/row0mysql.c 2010-12-03 17:30:16.334989510 +0900
 +++ b/storage/innobase/row/row0mysql.c 2010-12-04 15:35:58.652496484 +0900
-@@ -3449,7 +3449,7 @@
+@@ -3447,7 +3447,7 @@
                /* Do not drop possible .ibd tablespace if something went
                wrong: we do not want to delete valuable data of the user */
  
@@ -531,7 +531,7 @@ diff -ruN a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c
 diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
 --- a/storage/innobase/srv/srv0srv.c   2010-12-04 15:35:29.180483212 +0900
 +++ b/storage/innobase/srv/srv0srv.c   2010-12-04 15:35:58.656550107 +0900
-@@ -170,6 +170,8 @@
+@@ -163,6 +163,8 @@
  /* size in database pages */
  UNIV_INTERN ulint*    srv_data_file_sizes = NULL;
  
@@ -543,7 +543,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
 diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c
 --- a/storage/innobase/srv/srv0start.c 2010-12-04 15:35:29.183481330 +0900
 +++ b/storage/innobase/srv/srv0start.c 2010-12-04 15:35:58.661550545 +0900
-@@ -715,6 +715,7 @@
+@@ -714,6 +714,7 @@
  /*======================*/
        ibool*          create_new_db,  /*!< out: TRUE if new database should be
                                        created */
@@ -551,7 +551,7 @@ diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c
  #ifdef UNIV_LOG_ARCHIVE
        ulint*          min_arch_log_no,/*!< out: min of archived log
                                        numbers in data files */
-@@ -747,6 +748,7 @@
+@@ -746,6 +747,7 @@
        *sum_of_new_sizes = 0;
  
        *create_new_db = FALSE;
@@ -559,7 +559,7 @@ diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c
  
        srv_normalize_path_for_win(srv_data_home);
  
-@@ -984,6 +986,142 @@
+@@ -983,6 +985,142 @@
                                srv_data_file_is_raw_partition[i] != 0);
        }
  
@@ -702,7 +702,7 @@ diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c
        return(DB_SUCCESS);
  }
  
-@@ -997,6 +1135,7 @@
+@@ -996,6 +1134,7 @@
  /*====================================*/
  {
        ibool           create_new_db;
@@ -710,7 +710,7 @@ diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c
        ibool           log_file_created;
        ibool           log_created     = FALSE;
        ibool           log_opened      = FALSE;
-@@ -1462,6 +1601,7 @@
+@@ -1461,6 +1600,7 @@
        }
  
        err = open_or_create_data_files(&create_new_db,
@@ -718,7 +718,7 @@ diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c
  #ifdef UNIV_LOG_ARCHIVE
                                        &min_arch_log_no, &max_arch_log_no,
  #endif /* UNIV_LOG_ARCHIVE */
-@@ -1629,6 +1769,14 @@
+@@ -1628,6 +1768,14 @@
                after the double write buffer has been created. */
                trx_sys_create();
  
@@ -733,7 +733,7 @@ diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c
                dict_create();
  
                srv_startup_is_before_trx_rollback_phase = FALSE;
-@@ -1662,6 +1810,13 @@
+@@ -1661,6 +1809,13 @@
                recv_recovery_from_archive_finish();
  #endif /* UNIV_LOG_ARCHIVE */
        } else {
@@ -747,7 +747,7 @@ diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c
  
                /* Check if we support the max format that is stamped
                on the system tablespace. 
-@@ -1748,6 +1903,17 @@
+@@ -1747,6 +1902,17 @@
                we have finished the recovery process so that the
                image of TRX_SYS_PAGE_NO is not stale. */
                trx_sys_file_format_tag_init();
@@ -768,7 +768,7 @@ diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c
 diff -ruN a/storage/innobase/trx/trx0sys.c b/storage/innobase/trx/trx0sys.c
 --- a/storage/innobase/trx/trx0sys.c   2010-12-03 17:32:15.651024019 +0900
 +++ b/storage/innobase/trx/trx0sys.c   2010-12-04 15:35:58.664550291 +0900
-@@ -414,6 +414,152 @@
+@@ -415,6 +415,152 @@
  
                goto start_again;
        }
@@ -921,7 +921,7 @@ diff -ruN a/storage/innobase/trx/trx0sys.c b/storage/innobase/trx/trx0sys.c
  }
  
  /****************************************************************//**
-@@ -437,10 +583,19 @@
+@@ -438,10 +584,19 @@
        ulint   source_page_no;
        byte*   page;
        byte*   doublewrite;
@@ -941,7 +941,7 @@ diff -ruN a/storage/innobase/trx/trx0sys.c b/storage/innobase/trx/trx0sys.c
        /* We do the file i/o past the buffer pool */
  
        unaligned_read_buf = ut_malloc(2 * UNIV_PAGE_SIZE);
-@@ -449,7 +604,7 @@
+@@ -450,7 +605,7 @@
        /* Read the trx sys header to check if we are using the doublewrite
        buffer */
  
@@ -950,7 +950,7 @@ diff -ruN a/storage/innobase/trx/trx0sys.c b/storage/innobase/trx/trx0sys.c
               UNIV_PAGE_SIZE, read_buf, NULL);
        doublewrite = read_buf + TRX_SYS_DOUBLEWRITE;
  
-@@ -487,10 +642,10 @@
+@@ -488,10 +643,10 @@
  
        /* Read the pages from the doublewrite buffer to memory */
  
@@ -963,7 +963,7 @@ diff -ruN a/storage/innobase/trx/trx0sys.c b/storage/innobase/trx/trx0sys.c
               TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE,
               buf + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE,
               NULL);
-@@ -546,7 +701,8 @@
+@@ -547,7 +702,8 @@
                                " doublewrite buf.\n",
                                (ulong) space_id, (ulong) page_no, (ulong) i);
  
@@ -973,7 +973,7 @@ diff -ruN a/storage/innobase/trx/trx0sys.c b/storage/innobase/trx/trx0sys.c
                           && ((page_no >= block1
                                && page_no
                                < block1 + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE)
-@@ -1015,6 +1171,83 @@
+@@ -1016,6 +1172,83 @@
  }
  
  /*****************************************************************//**
@@ -1057,7 +1057,7 @@ diff -ruN a/storage/innobase/trx/trx0sys.c b/storage/innobase/trx/trx0sys.c
  Creates and initializes the central memory structures for the transaction
  system. This is called when the database is started. */
  UNIV_INTERN
-@@ -1386,6 +1619,26 @@
+@@ -1387,6 +1620,26 @@
        /* Does nothing at the moment */
  }
  
index 87e33bde7e47985ab253101c797f63b765522f5c..47e3ed087b0807f04172c06b19e15b975450fd49 100644 (file)
@@ -8,46 +8,50 @@
 diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
 --- a/storage/innobase/handler/ha_innodb.cc    2010-12-03 17:34:35.285040381 +0900
 +++ b/storage/innobase/handler/ha_innodb.cc    2010-12-03 17:35:12.974975252 +0900
-@@ -9575,8 +9575,8 @@
+@@ -9593,9 +9593,8 @@
                        rw_lock_wait_time += mutex->lspent_time;
                }
  #else /* UNIV_DEBUG */
 -              buf1len= (uint) my_snprintf(buf1, sizeof(buf1), "%s:%lu",
--                                   mutex->cfile_name, (ulong) mutex->cline);
+-                                   innobase_basename(mutex->cfile_name),
+-                                   (ulong) mutex->cline);
 +              buf1len= (uint) my_snprintf(buf1, sizeof(buf1), "%s",
 +                                   mutex->cmutex_name);
                buf2len= (uint) my_snprintf(buf2, sizeof(buf2), "os_waits=%lu",
                                     (ulong) mutex->count_os_wait);
  
-@@ -9591,9 +9591,8 @@
+@@ -9610,10 +9609,8 @@
  
        if (block_mutex) {
                buf1len = (uint) my_snprintf(buf1, sizeof buf1,
 -                                           "combined %s:%lu",
--                                           block_mutex->cfile_name,
+-                                           innobase_basename(
+-                                              block_mutex->cfile_name),
 -                                           (ulong) block_mutex->cline);
 +                                           "combined %s",
 +                                           block_mutex->cmutex_name);
                buf2len = (uint) my_snprintf(buf2, sizeof buf2,
                                             "os_waits=%lu",
                                             (ulong) block_mutex_oswait_count);
-@@ -9622,8 +9621,8 @@
+@@ -9642,9 +9639,8 @@
                        continue;
                }
  
 -              buf1len = my_snprintf(buf1, sizeof buf1, "%s:%lu",
--                                   lock->cfile_name, (ulong) lock->cline);
+-                                   innobase_basename(lock->cfile_name),
+-                                   (ulong) lock->cline);
 +              buf1len = my_snprintf(buf1, sizeof buf1, "%s",
 +                                   lock->lock_name);
                buf2len = my_snprintf(buf2, sizeof buf2, "os_waits=%lu",
                                      (ulong) lock->count_os_wait);
  
-@@ -9637,9 +9636,8 @@
+@@ -9658,10 +9654,8 @@
  
        if (block_lock) {
                buf1len = (uint) my_snprintf(buf1, sizeof buf1,
 -                                           "combined %s:%lu",
--                                           block_lock->cfile_name,
+-                                           innobase_basename(
+-                                              block_lock->cfile_name),
 -                                           (ulong) block_lock->cline);
 +                                           "combined %s",
 +                                           block_lock->lock_name);
@@ -174,7 +178,7 @@ diff -ruN a/storage/innobase/include/sync0rw.ic b/storage/innobase/include/sync0
 diff -ruN a/storage/innobase/include/sync0sync.h b/storage/innobase/include/sync0sync.h
 --- a/storage/innobase/include/sync0sync.h     2010-12-03 15:49:59.227955503 +0900
 +++ b/storage/innobase/include/sync0sync.h     2010-12-03 17:35:12.982023946 +0900
-@@ -159,14 +159,14 @@
+@@ -158,14 +158,14 @@
  # ifdef UNIV_DEBUG
  #  ifdef UNIV_SYNC_DEBUG
  #   define mutex_create(K, M, level)                          \
@@ -192,7 +196,7 @@ diff -ruN a/storage/innobase/include/sync0sync.h b/storage/innobase/include/sync
  # endif       /* UNIV_DEBUG */
  
  # define mutex_enter(M)                                               \
-@@ -186,14 +186,14 @@
+@@ -185,14 +185,14 @@
  # ifdef UNIV_DEBUG
  #  ifdef UNIV_SYNC_DEBUG
  #   define mutex_create(K, M, level)                  \
@@ -210,7 +214,7 @@ diff -ruN a/storage/innobase/include/sync0sync.h b/storage/innobase/include/sync
  # endif       /* UNIV_DEBUG */
  
  # define mutex_enter(M)       mutex_enter_func((M), __FILE__, __LINE__)
-@@ -218,13 +218,13 @@
+@@ -217,13 +217,13 @@
  /*==============*/
        mutex_t*        mutex,          /*!< in: pointer to memory */
  #ifdef UNIV_DEBUG
@@ -227,7 +231,7 @@ diff -ruN a/storage/innobase/include/sync0sync.h b/storage/innobase/include/sync
  
  /******************************************************************//**
  NOTE! Use the corresponding macro mutex_free(), not directly this function!
-@@ -292,13 +292,13 @@
+@@ -291,13 +291,13 @@
        PSI_mutex_key   key,            /*!< in: Performance Schema key */
        mutex_t*        mutex,          /*!< in: pointer to memory */
  # ifdef UNIV_DEBUG
@@ -244,7 +248,7 @@ diff -ruN a/storage/innobase/include/sync0sync.h b/storage/innobase/include/sync
  /******************************************************************//**
  NOTE! Please use the corresponding macro mutex_enter(), not directly
  this function!
-@@ -723,9 +723,9 @@
+@@ -731,9 +731,9 @@
        ulint   line;           /*!< Line where the mutex was locked */
        ulint   level;          /*!< Level in the global latching order */
  #endif /* UNIV_SYNC_DEBUG */
@@ -255,7 +259,7 @@ diff -ruN a/storage/innobase/include/sync0sync.h b/storage/innobase/include/sync
        os_thread_id_t thread_id; /*!< The thread id of the thread
                                which locked the mutex. */
        ulint           magic_n;        /*!< MUTEX_MAGIC_N */
-@@ -740,9 +740,9 @@
+@@ -748,9 +748,9 @@
        ulong           count_os_yield; /*!< count of os_wait */
        ulonglong       lspent_time;    /*!< mutex os_wait timer msec */
        ulonglong       lmax_spent_time;/*!< mutex os_wait timer msec */
@@ -306,7 +310,7 @@ diff -ruN a/storage/innobase/include/sync0sync.ic b/storage/innobase/include/syn
 diff -ruN a/storage/innobase/sync/sync0arr.c b/storage/innobase/sync/sync0arr.c
 --- a/storage/innobase/sync/sync0arr.c 2010-12-03 15:09:51.304953409 +0900
 +++ b/storage/innobase/sync/sync0arr.c 2010-12-03 17:35:12.985024561 +0900
-@@ -488,12 +488,12 @@
+@@ -489,13 +489,12 @@
                mutex = cell->old_wait_mutex;
  
                fprintf(file,
@@ -316,17 +320,18 @@ diff -ruN a/storage/innobase/sync/sync0arr.c b/storage/innobase/sync/sync0arr.c
                        "Last time reserved in file %s line %lu, "
  #endif /* UNIV_SYNC_DEBUG */
                        "waiters flag %lu\n",
--                      (void*) mutex, mutex->cfile_name, (ulong) mutex->cline,
+-                      (void*) mutex, innobase_basename(mutex->cfile_name),
+-                      (ulong) mutex->cline,
 +                      (void*) mutex, mutex->cmutex_name,
                        (ulong) mutex->lock_word,
  #ifdef UNIV_SYNC_DEBUG
                        mutex->file_name, (ulong) mutex->line,
-@@ -511,9 +511,8 @@
+@@ -513,9 +512,8 @@
                rwlock = cell->old_wait_rw_lock;
  
                fprintf(file,
 -                      " RW-latch at %p created in file %s line %lu\n",
--                      (void*) rwlock, rwlock->cfile_name,
+-                      (void*) rwlock, innobase_basename(rwlock->cfile_name),
 -                      (ulong) rwlock->cline);
 +                      " RW-latch at %p '%s'\n",
 +                      (void*) rwlock, rwlock->lock_name);
@@ -336,7 +341,7 @@ diff -ruN a/storage/innobase/sync/sync0arr.c b/storage/innobase/sync/sync0arr.c
 diff -ruN a/storage/innobase/sync/sync0rw.c b/storage/innobase/sync/sync0rw.c
 --- a/storage/innobase/sync/sync0rw.c  2010-11-03 07:01:13.000000000 +0900
 +++ b/storage/innobase/sync/sync0rw.c  2010-12-03 17:35:12.987029059 +0900
-@@ -241,10 +241,10 @@
+@@ -242,10 +242,10 @@
  # ifdef UNIV_SYNC_DEBUG
        ulint           level,          /*!< in: level */
  # endif /* UNIV_SYNC_DEBUG */
@@ -350,7 +355,7 @@ diff -ruN a/storage/innobase/sync/sync0rw.c b/storage/innobase/sync/sync0rw.c
  {
        /* If this is the very first time a synchronization object is
        created, then the following call initializes the sync system. */
-@@ -253,14 +253,15 @@
+@@ -254,14 +254,15 @@
        mutex_create(rw_lock_mutex_key, rw_lock_get_mutex(lock),
                     SYNC_NO_ORDER_CHECK);
  
@@ -370,7 +375,7 @@ diff -ruN a/storage/innobase/sync/sync0rw.c b/storage/innobase/sync/sync0rw.c
  # endif
  #endif /* INNODB_RW_LOCKS_USE_ATOMICS */
  
-@@ -283,8 +284,7 @@
+@@ -284,8 +285,7 @@
  
        ut_d(lock->magic_n = RW_LOCK_MAGIC_N);
  
@@ -380,7 +385,7 @@ diff -ruN a/storage/innobase/sync/sync0rw.c b/storage/innobase/sync/sync0rw.c
  
        lock->count_os_wait = 0;
        lock->last_s_file_name = "not yet reserved";
-@@ -404,10 +404,10 @@
+@@ -405,11 +405,10 @@
        if (srv_print_latch_waits) {
                fprintf(stderr,
                        "Thread %lu spin wait rw-s-lock at %p"
@@ -388,44 +393,48 @@ diff -ruN a/storage/innobase/sync/sync0rw.c b/storage/innobase/sync/sync0rw.c
 +                      " '%s' rnds %lu\n",
                        (ulong) os_thread_pf(os_thread_get_curr_id()),
                        (void*) lock,
--                      lock->cfile_name, (ulong) lock->cline, (ulong) i);
+-                      innobase_basename(lock->cfile_name),
+-                      (ulong) lock->cline, (ulong) i);
 +                      lock->lock_name, (ulong) i);
        }
  
        /* We try once again to obtain the lock */
-@@ -440,10 +440,9 @@
+@@ -442,11 +441,9 @@
                if (srv_print_latch_waits) {
                        fprintf(stderr,
                                "Thread %lu OS wait rw-s-lock at %p"
 -                              " cfile %s cline %lu\n",
 +                              " '%s'\n",
                                os_thread_pf(os_thread_get_curr_id()),
--                              (void*) lock, lock->cfile_name,
+-                              (void*) lock,
+-                              innobase_basename(lock->cfile_name),
 -                              (ulong) lock->cline);
 +                              (void*) lock, lock->lock_name);
                }
  
                /* these stats may not be accurate */
-@@ -662,9 +661,9 @@
+@@ -665,10 +662,9 @@
        if (srv_print_latch_waits) {
                fprintf(stderr,
                        "Thread %lu spin wait rw-x-lock at %p"
 -                      " cfile %s cline %lu rnds %lu\n",
 +                      " '%s' rnds %lu\n",
                        os_thread_pf(os_thread_get_curr_id()), (void*) lock,
--                      lock->cfile_name, (ulong) lock->cline, (ulong) i);
+-                      innobase_basename(lock->cfile_name),
+-                      (ulong) lock->cline, (ulong) i);
 +                      lock->lock_name, (ulong) i);
        }
  
        sync_array_reserve_cell(sync_primary_wait_array,
-@@ -685,9 +684,9 @@
+@@ -689,10 +685,9 @@
        if (srv_print_latch_waits) {
                fprintf(stderr,
                        "Thread %lu OS wait for rw-x-lock at %p"
 -                      " cfile %s cline %lu\n",
 +                      " '%s'\n",
                        os_thread_pf(os_thread_get_curr_id()), (void*) lock,
--                      lock->cfile_name, (ulong) lock->cline);
+-                      innobase_basename(lock->cfile_name),
+-                      (ulong) lock->cline);
 +                      lock->lock_name);
        }
  
@@ -433,7 +442,7 @@ diff -ruN a/storage/innobase/sync/sync0rw.c b/storage/innobase/sync/sync0rw.c
 diff -ruN a/storage/innobase/sync/sync0sync.c b/storage/innobase/sync/sync0sync.c
 --- a/storage/innobase/sync/sync0sync.c        2010-12-03 15:49:59.233955565 +0900
 +++ b/storage/innobase/sync/sync0sync.c        2010-12-03 17:35:12.989024400 +0900
-@@ -269,13 +269,13 @@
+@@ -270,13 +270,13 @@
  /*==============*/
        mutex_t*        mutex,          /*!< in: pointer to memory */
  #ifdef UNIV_DEBUG
@@ -450,7 +459,7 @@ diff -ruN a/storage/innobase/sync/sync0sync.c b/storage/innobase/sync/sync0sync.
  {
  #if defined(HAVE_ATOMIC_BUILTINS)
        mutex_reset_lock_word(mutex);
-@@ -293,11 +293,13 @@
+@@ -294,11 +294,13 @@
        mutex->file_name = "not yet reserved";
        mutex->level = level;
  #endif /* UNIV_SYNC_DEBUG */
@@ -465,36 +474,39 @@ diff -ruN a/storage/innobase/sync/sync0sync.c b/storage/innobase/sync/sync0sync.
        mutex->count_using=       0;
        mutex->mutex_type=        0;
        mutex->lspent_time=       0;
-@@ -551,9 +553,9 @@
+@@ -552,10 +554,9 @@
  #ifdef UNIV_SRV_PRINT_LATCH_WAITS
        fprintf(stderr,
                "Thread %lu spin wait mutex at %p"
 -              " cfile %s cline %lu rnds %lu\n",
 +              " '%s' rnds %lu\n",
                (ulong) os_thread_pf(os_thread_get_curr_id()), (void*) mutex,
--              mutex->cfile_name, (ulong) mutex->cline, (ulong) i);
+-              innobase_basename(mutex->cfile_name),
+-              (ulong) mutex->cline, (ulong) i);
 +              mutex->cmutex_name, (ulong) i);
  #endif
  
        mutex_spin_round_count += i;
-@@ -628,9 +630,9 @@
+@@ -630,10 +631,9 @@
  
  #ifdef UNIV_SRV_PRINT_LATCH_WAITS
        fprintf(stderr,
 -              "Thread %lu OS wait mutex at %p cfile %s cline %lu rnds %lu\n",
 +              "Thread %lu OS wait mutex at %p '%s' rnds %lu\n",
                (ulong) os_thread_pf(os_thread_get_curr_id()), (void*) mutex,
--              mutex->cfile_name, (ulong) mutex->cline, (ulong) i);
+-              innobase_basename(mutex->cfile_name),
+-              (ulong) mutex->cline, (ulong) i);
 +              mutex->cmutex_name, (ulong) i);
  #endif
  
        mutex_os_wait_count++;
-@@ -878,8 +880,8 @@
+@@ -881,9 +881,8 @@
  
        if (mutex->magic_n == MUTEX_MAGIC_N) {
                fprintf(stderr,
 -                      "Mutex created at %s %lu\n",
--                      mutex->cfile_name, (ulong) mutex->cline);
+-                      innobase_basename(mutex->cfile_name),
+-                      (ulong) mutex->cline);
 +                      "Mutex '%s'\n",
 +                      mutex->cmutex_name);
  
index 1aae94185b15c3cccb93464903ca92cff8584e84..4f4d421c459e08c7deeb9e153d22e88d5717546d 100644 (file)
@@ -8,7 +8,7 @@
 diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
 --- a/storage/innobase/buf/buf0buf.c   2010-11-03 07:01:13.000000000 +0900
 +++ b/storage/innobase/buf/buf0buf.c   2010-12-03 15:07:31.786968193 +0900
-@@ -4814,6 +4814,7 @@
+@@ -4831,6 +4831,7 @@
        }
  
        total_info->pool_size += pool_info->pool_size;
@@ -16,7 +16,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
        total_info->lru_len += pool_info->lru_len;
        total_info->old_lru_len += pool_info->old_lru_len;
        total_info->free_list_len += pool_info->free_list_len;
-@@ -4877,6 +4878,8 @@
+@@ -4894,6 +4895,8 @@
  
        pool_info->pool_size = buf_pool->curr_size;
  
@@ -25,7 +25,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
        pool_info->lru_len = UT_LIST_GET_LEN(buf_pool->LRU);
  
        pool_info->old_lru_len = buf_pool->LRU_old_len;
-@@ -4993,14 +4996,16 @@
+@@ -5010,14 +5013,16 @@
        ut_ad(pool_info);
  
        fprintf(file,
@@ -62,7 +62,7 @@ diff -ruN a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c
 diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
 --- a/storage/innobase/fil/fil0fil.c   2010-11-03 07:01:13.000000000 +0900
 +++ b/storage/innobase/fil/fil0fil.c   2010-12-03 15:07:31.790357112 +0900
-@@ -4886,3 +4886,30 @@
+@@ -4888,3 +4888,30 @@
  
        fil_system = NULL;
  }
@@ -96,7 +96,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
 diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
 --- a/storage/innobase/handler/ha_innodb.cc    2010-12-03 15:06:58.727955654 +0900
 +++ b/storage/innobase/handler/ha_innodb.cc    2010-12-03 15:07:31.799376984 +0900
-@@ -604,6 +604,8 @@
+@@ -603,6 +603,8 @@
    (char*) &export_vars.innodb_buffer_pool_pages_dirty,          SHOW_LONG},
    {"buffer_pool_pages_flushed",
    (char*) &export_vars.innodb_buffer_pool_pages_flushed,  SHOW_LONG},
@@ -105,7 +105,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
    {"buffer_pool_pages_free",
    (char*) &export_vars.innodb_buffer_pool_pages_free,   SHOW_LONG},
  #ifdef UNIV_DEBUG
-@@ -11057,6 +11059,16 @@
+@@ -11081,6 +11083,16 @@
    "Force InnoDB to not use next-key locking, to use only row-level locking.",
    NULL, NULL, FALSE);
  
@@ -122,7 +122,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
  #ifdef UNIV_LOG_ARCHIVE
  static MYSQL_SYSVAR_STR(log_arch_dir, innobase_log_arch_dir,
    PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
-@@ -11244,7 +11256,7 @@
+@@ -11268,7 +11280,7 @@
  
  static MYSQL_SYSVAR_STR(version, innodb_version_str,
    PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_READONLY,
@@ -131,7 +131,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
  
  static MYSQL_SYSVAR_BOOL(use_sys_malloc, srv_use_sys_malloc,
    PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
-@@ -11337,6 +11349,8 @@
+@@ -11361,6 +11373,8 @@
    MYSQL_SYSVAR(thread_concurrency),
    MYSQL_SYSVAR(thread_sleep_delay),
    MYSQL_SYSVAR(autoinc_lock_mode),
@@ -143,7 +143,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
 diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
 --- a/storage/innobase/include/buf0buf.h       2011-01-20 07:37:08.000000000 +0900
 +++ b/storage/innobase/include/buf0buf.h       2011-02-14 15:25:20.859126532 +0900
-@@ -123,6 +123,7 @@
+@@ -125,6 +125,7 @@
        /* General buffer pool info */
        ulint   pool_unique_id;         /*!< Buffer Pool ID */
        ulint   pool_size;              /*!< Buffer Pool size in pages */
@@ -186,7 +186,7 @@ diff -ruN a/storage/innobase/include/read0read.h b/storage/innobase/include/read
 diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
 --- a/storage/innobase/include/srv0srv.h       2010-11-03 07:01:13.000000000 +0900
 +++ b/storage/innobase/include/srv0srv.h       2010-12-03 15:07:31.813958103 +0900
-@@ -145,6 +145,9 @@
+@@ -142,6 +142,9 @@
  extern char   srv_adaptive_flushing;
  
  
@@ -196,7 +196,7 @@ diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0sr
  /* The sort order table of the MySQL latin1_swedish_ci character set
  collation */
  extern const byte*    srv_latin1_ordering;
-@@ -326,6 +329,8 @@
+@@ -323,6 +326,8 @@
  buffer pool to disk */
  extern ulint srv_buf_pool_flushed;
  
@@ -205,7 +205,7 @@ diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0sr
  /** Number of buffer pool reads that led to the
  reading of a disk page */
  extern ulint srv_buf_pool_reads;
-@@ -720,6 +725,7 @@
+@@ -702,6 +707,7 @@
        ulint innodb_buffer_pool_reads;         /*!< srv_buf_pool_reads */
        ulint innodb_buffer_pool_wait_free;     /*!< srv_buf_pool_wait_free */
        ulint innodb_buffer_pool_pages_flushed; /*!< srv_buf_pool_flushed */
@@ -213,27 +213,6 @@ diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0sr
        ulint innodb_buffer_pool_write_requests;/*!< srv_buf_pool_write_requests */
        ulint innodb_buffer_pool_read_ahead;    /*!< srv_read_ahead */
        ulint innodb_buffer_pool_read_ahead_evicted;/*!< srv_read_ahead evicted*/
-diff -ruN a/storage/innobase/include/thr0loc.h b/storage/innobase/include/thr0loc.h
---- a/storage/innobase/include/thr0loc.h       2010-11-03 07:01:13.000000000 +0900
-+++ b/storage/innobase/include/thr0loc.h       2010-12-03 15:07:31.815081509 +0900
-@@ -83,6 +83,17 @@
- thr_local_get_in_ibuf_field(void);
- /*=============================*/
-+/*************************************************************************
-+Return local hash table informations. */
-+
-+ulint
-+thr_local_hash_cells(void);
-+/*=======================*/
-+
-+ulint
-+thr_local_hash_nodes(void);
-+/*=======================*/
-+
- #ifndef UNIV_NONINL
- #include "thr0loc.ic"
- #endif
 diff -ruN a/storage/innobase/lock/lock0lock.c b/storage/innobase/lock/lock0lock.c
 --- a/storage/innobase/lock/lock0lock.c        2010-11-03 07:01:13.000000000 +0900
 +++ b/storage/innobase/lock/lock0lock.c        2010-12-03 15:07:31.819023998 +0900
@@ -322,7 +301,7 @@ diff -ruN a/storage/innobase/read/read0read.c b/storage/innobase/read/read0read.
 diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
 --- a/storage/innobase/srv/srv0srv.c   2010-11-03 07:01:13.000000000 +0900
 +++ b/storage/innobase/srv/srv0srv.c   2010-12-03 15:07:31.824022673 +0900
-@@ -84,6 +84,7 @@
+@@ -83,6 +83,7 @@
  #include "ha_prototypes.h"
  #include "trx0i_s.h"
  #include "os0sync.h" /* for HAVE_ATOMIC_BUILTINS */
@@ -330,7 +309,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
  #include "mysql/plugin.h"
  #include "mysql/service_thd_wait.h"
  
-@@ -195,6 +196,9 @@
+@@ -188,6 +189,9 @@
  the checkpoints. */
  UNIV_INTERN char      srv_adaptive_flushing   = TRUE;
  
@@ -340,7 +319,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
  /** Maximum number of times allowed to conditionally acquire
  mutex before switching to blocking wait on the mutex */
  #define MAX_MUTEX_NOWAIT      20
-@@ -321,6 +325,7 @@
+@@ -314,6 +318,7 @@
  /* variable to count the number of pages that were written from buffer
  pool to the disk */
  UNIV_INTERN ulint srv_buf_pool_flushed = 0;
@@ -348,7 +327,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
  
  /** Number of buffer pool reads that led to the
  reading of a disk page */
-@@ -1829,6 +1834,13 @@
+@@ -1823,6 +1828,13 @@
        ulint   n_reserved;
        ibool   ret;
  
@@ -362,7 +341,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
        mutex_enter(&srv_innodb_monitor_mutex);
  
        current_time = time(NULL);
-@@ -1877,31 +1889,6 @@
+@@ -1871,31 +1883,6 @@
  
        mutex_exit(&dict_foreign_err_mutex);
  
@@ -394,7 +373,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
        fputs("--------\n"
              "FILE I/O\n"
              "--------\n", file);
-@@ -1932,10 +1919,84 @@
+@@ -1926,10 +1913,78 @@
              "BUFFER POOL AND MEMORY\n"
              "----------------------\n", file);
        fprintf(file,
@@ -437,8 +416,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
 +                      "    Dictionary cache    %lu \t(%lu + %lu)\n"
 +                      "    File system         %lu \t(%lu + %lu)\n"
 +                      "    Lock system         %lu \t(%lu + %lu)\n"
-+                      "    Recovery system     %lu \t(%lu + %lu)\n"
-+                      "    Threads             %lu \t(%lu + %lu)\n",
++                      "    Recovery system     %lu \t(%lu + %lu)\n",
 +
 +                      (ulong) (btr_search_sys
 +                              ? (btr_search_sys->hash_index->n_cells * sizeof(hash_cell_t)) : 0)
@@ -473,17 +451,12 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
 +                                      + recv_sys_subtotal),
 +                      (ulong) ((recv_sys && recv_sys->addr_hash)
 +                                      ? (recv_sys->addr_hash->n_cells * sizeof(hash_cell_t)) : 0),
-+                      (ulong) recv_sys_subtotal,
-+
-+                      (ulong) (thr_local_hash_cells() * sizeof(hash_cell_t)
-+                                      + thr_local_hash_nodes()),
-+                      (ulong) (thr_local_hash_cells() * sizeof(hash_cell_t)),
-+                      (ulong) thr_local_hash_nodes());
++                      (ulong) recv_sys_subtotal);
 +
        fprintf(file, "Dictionary memory allocated " ULINTPF "\n",
                dict_sys->size);
  
-@@ -1951,6 +2012,16 @@
+@@ -1945,6 +2000,16 @@
        fprintf(file, "%lu read views open inside InnoDB\n",
                UT_LIST_GET_LEN(trx_sys->view_list));
  
@@ -500,7 +473,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
        n_reserved = fil_space_get_n_reserved_extents(0);
        if (n_reserved > 0) {
                fprintf(file,
-@@ -1994,6 +2065,31 @@
+@@ -1988,6 +2053,31 @@
        srv_n_rows_deleted_old = srv_n_rows_deleted;
        srv_n_rows_read_old = srv_n_rows_read;
  
@@ -532,7 +505,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
        fputs("----------------------------\n"
              "END OF INNODB MONITOR OUTPUT\n"
              "============================\n", file);
-@@ -2037,6 +2133,7 @@
+@@ -2031,6 +2121,7 @@
                = srv_buf_pool_write_requests;
        export_vars.innodb_buffer_pool_wait_free = srv_buf_pool_wait_free;
        export_vars.innodb_buffer_pool_pages_flushed = srv_buf_pool_flushed;
@@ -543,72 +516,15 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
 diff -ruN a/storage/innobase/sync/sync0arr.c b/storage/innobase/sync/sync0arr.c
 --- a/storage/innobase/sync/sync0arr.c 2010-11-03 07:01:13.000000000 +0900
 +++ b/storage/innobase/sync/sync0arr.c 2010-12-03 15:07:31.826041368 +0900
-@@ -477,7 +477,7 @@
+@@ -478,7 +478,7 @@
  
        fprintf(file,
                "--Thread %lu has waited at %s line %lu"
 -              " for %.2f seconds the semaphore:\n",
 +              " for %#.5g seconds the semaphore:\n",
-               (ulong) os_thread_pf(cell->thread), cell->file,
-               (ulong) cell->line,
+               (ulong) os_thread_pf(cell->thread),
+               innobase_basename(cell->file), (ulong) cell->line,
                difftime(time(NULL), cell->reservation_time));
-diff -ruN a/storage/innobase/thr/thr0loc.c b/storage/innobase/thr/thr0loc.c
---- a/storage/innobase/thr/thr0loc.c   2010-11-03 07:01:13.000000000 +0900
-+++ b/storage/innobase/thr/thr0loc.c   2010-12-03 15:07:31.828023915 +0900
-@@ -49,6 +49,7 @@
- /** The hash table. The module is not yet initialized when it is NULL. */
- static hash_table_t*  thr_local_hash  = NULL;
-+ulint         thr_local_hash_n_nodes = 0;
- /** Thread local data */
- typedef struct thr_local_struct thr_local_t;
-@@ -221,6 +222,7 @@
-                   os_thread_pf(os_thread_get_curr_id()),
-                   local);
-+      thr_local_hash_n_nodes++;
-       mutex_exit(&thr_local_mutex);
- }
-@@ -249,6 +251,7 @@
-       HASH_DELETE(thr_local_t, hash, thr_local_hash,
-                   os_thread_pf(id), local);
-+      thr_local_hash_n_nodes--;
-       mutex_exit(&thr_local_mutex);
-@@ -305,3 +308,29 @@
-       hash_table_free(thr_local_hash);
-       thr_local_hash = NULL;
- }
-+
-+/*************************************************************************
-+Return local hash table informations. */
-+
-+ulint
-+thr_local_hash_cells(void)
-+/*======================*/
-+{
-+      if (thr_local_hash) {
-+              return (thr_local_hash->n_cells);
-+      } else {
-+              return 0;
-+      }
-+}
-+
-+ulint
-+thr_local_hash_nodes(void)
-+/*======================*/
-+{
-+      if (thr_local_hash) {
-+              return (thr_local_hash_n_nodes
-+                      * (sizeof(thr_local_t) + MEM_BLOCK_HEADER_SIZE));
-+      } else {
-+              return 0;
-+      }
-+}
 diff -ruN a/storage/innobase/trx/trx0purge.c b/storage/innobase/trx/trx0purge.c
 --- a/storage/innobase/trx/trx0purge.c 2010-12-04 02:58:26.000000000 +0900
 +++ b/storage/innobase/trx/trx0purge.c 2011-01-21 19:40:42.086683671 +0900
index 3993c18f7eb141f3f38d16bba86105bbe3b0a9ff..2a0ecc7067a06d3a61c0ba035d5003fa97adb1ce 100644 (file)
@@ -159,7 +159,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
 diff -ruN a/storage/innobase/ibuf/ibuf0ibuf.c b/storage/innobase/ibuf/ibuf0ibuf.c
 --- a/storage/innobase/ibuf/ibuf0ibuf.c        2011-02-03 15:05:04.000000000 +0900
 +++ b/storage/innobase/ibuf/ibuf0ibuf.c        2011-02-03 15:19:47.000000000 +0900
-@@ -479,6 +479,45 @@
+@@ -469,6 +469,45 @@
  }
  
  /******************************************************************//**
@@ -208,7 +208,7 @@ diff -ruN a/storage/innobase/ibuf/ibuf0ibuf.c b/storage/innobase/ibuf/ibuf0ibuf.
 diff -ruN a/storage/innobase/include/ibuf0ibuf.h b/storage/innobase/include/ibuf0ibuf.h
 --- a/storage/innobase/include/ibuf0ibuf.h     2010-12-04 02:58:26.000000000 +0900
 +++ b/storage/innobase/include/ibuf0ibuf.h     2011-02-03 15:19:47.000000000 +0900
-@@ -420,6 +420,22 @@
+@@ -438,6 +438,22 @@
  void
  ibuf_close(void);
  /*============*/
@@ -245,7 +245,7 @@ diff -ruN a/storage/innobase/include/lock0lock.h b/storage/innobase/include/lock
 diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
 --- a/storage/innobase/include/srv0srv.h       2011-01-21 19:53:42.380638228 +0900
 +++ b/storage/innobase/include/srv0srv.h       2011-01-21 19:54:44.662600032 +0900
-@@ -753,6 +753,11 @@
+@@ -731,6 +731,11 @@
  
  /** Status variables to be passed to MySQL */
  struct export_var_struct{
@@ -257,7 +257,7 @@ diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0sr
        ulint innodb_data_pending_reads;        /*!< Pending reads */
        ulint innodb_data_pending_writes;       /*!< Pending writes */
        ulint innodb_data_pending_fsyncs;       /*!< Pending fsyncs */
-@@ -770,6 +775,9 @@
+@@ -748,6 +753,9 @@
  #ifdef UNIV_DEBUG
        ulint innodb_buffer_pool_pages_latched; /*!< Latched pages */
  #endif /* UNIV_DEBUG */
@@ -267,7 +267,7 @@ diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0sr
        ulint innodb_buffer_pool_read_requests; /*!< buf_pool->stat.n_page_gets */
        ulint innodb_buffer_pool_reads;         /*!< srv_buf_pool_reads */
        ulint innodb_buffer_pool_wait_free;     /*!< srv_buf_pool_wait_free */
-@@ -778,13 +786,43 @@
+@@ -756,13 +764,43 @@
        ulint innodb_buffer_pool_write_requests;/*!< srv_buf_pool_write_requests */
        ulint innodb_buffer_pool_read_ahead;    /*!< srv_read_ahead */
        ulint innodb_buffer_pool_read_ahead_evicted;/*!< srv_read_ahead evicted*/
@@ -311,7 +311,7 @@ diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0sr
        ulint innodb_os_log_written;            /*!< srv_os_log_written */
        ulint innodb_os_log_fsyncs;             /*!< fil_n_log_flushes */
        ulint innodb_os_log_pending_writes;     /*!< srv_os_log_pending_writes */
-@@ -793,6 +831,8 @@
+@@ -771,6 +809,8 @@
        ulint innodb_pages_created;             /*!< buf_pool->stat.n_pages_created */
        ulint innodb_pages_read;                /*!< buf_pool->stat.n_pages_read */
        ulint innodb_pages_written;             /*!< buf_pool->stat.n_pages_written */
@@ -320,7 +320,7 @@ diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0sr
        ulint innodb_row_lock_waits;            /*!< srv_n_lock_wait_count */
        ulint innodb_row_lock_current_waits;    /*!< srv_n_lock_wait_current_count */
        ib_int64_t innodb_row_lock_time;        /*!< srv_n_lock_wait_time
-@@ -802,11 +842,18 @@
+@@ -780,11 +820,18 @@
                                                / srv_n_lock_wait_count */
        ulint innodb_row_lock_time_max;         /*!< srv_n_lock_max_wait_time
                                                / 1000 */
@@ -342,7 +342,7 @@ diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0sr
 diff -ruN a/storage/innobase/include/sync0sync.h b/storage/innobase/include/sync0sync.h
 --- a/storage/innobase/include/sync0sync.h     2011-01-21 19:48:45.982637372 +0900
 +++ b/storage/innobase/include/sync0sync.h     2011-01-21 19:54:44.664638235 +0900
-@@ -761,6 +761,10 @@
+@@ -769,6 +769,10 @@
  
  #define       SYNC_SPIN_ROUNDS        srv_n_spin_wait_rounds
  
@@ -391,7 +391,7 @@ diff -ruN a/storage/innobase/lock/lock0lock.c b/storage/innobase/lock/lock0lock.
 diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
 --- a/storage/innobase/srv/srv0srv.c   2011-01-21 19:53:42.390637840 +0900
 +++ b/storage/innobase/srv/srv0srv.c   2011-01-21 19:54:44.673637084 +0900
-@@ -2269,12 +2269,49 @@
+@@ -2253,12 +2253,49 @@
        ulint           LRU_len;
        ulint           free_len;
        ulint           flush_list_len;
@@ -441,7 +441,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
        export_vars.innodb_data_pending_reads
                = os_n_pending_reads;
        export_vars.innodb_data_pending_writes
-@@ -2311,6 +2348,92 @@
+@@ -2295,6 +2332,92 @@
  
        export_vars.innodb_buffer_pool_pages_misc
                = buf_pool_get_n_pages() - LRU_len - free_len;
@@ -537,7 +537,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
 diff -ruN a/storage/innobase/sync/sync0sync.c b/storage/innobase/sync/sync0sync.c
 --- a/storage/innobase/sync/sync0sync.c        2011-01-21 19:53:03.458637954 +0900
 +++ b/storage/innobase/sync/sync0sync.c        2011-01-21 19:54:44.676637686 +0900
-@@ -170,13 +170,13 @@
+@@ -171,13 +171,13 @@
  
  /** The number of iterations in the mutex_spin_wait() spin loop.
  Intended for performance monitoring. */
index 2ecc321c0715ae591989479307dc298edb3fcebd..7a3032f0ce8f749f0540524fa1bca764bb5a6d7b 100644 (file)
@@ -41,7 +41,7 @@ diff -ruN a/storage/innobase/dict/dict0load.c b/storage/innobase/dict/dict0load.
 diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
 --- a/storage/innobase/handler/ha_innodb.cc    2010-12-03 15:53:54.615040167 +0900
 +++ b/storage/innobase/handler/ha_innodb.cc    2010-12-03 16:07:26.851357007 +0900
-@@ -11748,7 +11748,14 @@
+@@ -11772,7 +11772,14 @@
  i_s_innodb_cmp,
  i_s_innodb_cmp_reset,
  i_s_innodb_cmpmem,
@@ -72,7 +72,7 @@ diff -ruN a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
  #include "dict0mem.h"
  #include "dict0types.h"
  #include "ha_prototypes.h" /* for innobase_convert_name() */
-@@ -1786,6 +1788,1675 @@
+@@ -1784,6 +1786,1675 @@
        DBUG_RETURN(0);
  }
  
@@ -291,7 +291,7 @@ diff -ruN a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
 +
 +      /* plugin author (for SHOW PLUGINS) */
 +      /* const char* */
-+      STRUCT_FLD(author, plugin_author),
++      STRUCT_FLD(author, "Percona"),
 +
 +      /* general descriptive text (for SHOW PLUGINS) */
 +      /* const char* */
@@ -588,7 +588,7 @@ diff -ruN a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
 +
 +      /* plugin author (for SHOW PLUGINS) */
 +      /* const char* */
-+      STRUCT_FLD(author, plugin_author),
++      STRUCT_FLD(author, "Percona"),
 +
 +      /* general descriptive text (for SHOW PLUGINS) */
 +      /* const char* */
@@ -834,7 +834,7 @@ diff -ruN a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
 +
 +      /* plugin author (for SHOW PLUGINS) */
 +      /* const char* */
-+      STRUCT_FLD(author, plugin_author),
++      STRUCT_FLD(author, "Percona"),
 +
 +      /* general descriptive text (for SHOW PLUGINS) */
 +      /* const char* */
@@ -1070,7 +1070,7 @@ diff -ruN a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
 +
 +      /* plugin author (for SHOW PLUGINS) */
 +      /* const char* */
-+      STRUCT_FLD(author, plugin_author),
++      STRUCT_FLD(author, "Percona"),
 +
 +      /* general descriptive text (for SHOW PLUGINS) */
 +      /* const char* */
@@ -1277,7 +1277,7 @@ diff -ruN a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
 +
 +      /* plugin author (for SHOW PLUGINS) */
 +      /* const char* */
-+      STRUCT_FLD(author, plugin_author),
++      STRUCT_FLD(author, "Percona"),
 +
 +      /* general descriptive text (for SHOW PLUGINS) */
 +      /* const char* */
@@ -1498,7 +1498,7 @@ diff -ruN a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
 +
 +      /* plugin author (for SHOW PLUGINS) */
 +      /* const char* */
-+      STRUCT_FLD(author, plugin_author),
++      STRUCT_FLD(author, "Percona"),
 +
 +      /* general descriptive text (for SHOW PLUGINS) */
 +      /* const char* */
@@ -1712,7 +1712,7 @@ diff -ruN a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
 +
 +      /* plugin author (for SHOW PLUGINS) */
 +      /* const char* */
-+      STRUCT_FLD(author, plugin_author),
++      STRUCT_FLD(author, "Percona"),
 +
 +      /* general descriptive text (for SHOW PLUGINS) */
 +      /* const char* */
@@ -1751,7 +1751,7 @@ diff -ruN a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
 diff -ruN a/storage/innobase/handler/i_s.h b/storage/innobase/handler/i_s.h
 --- a/storage/innobase/handler/i_s.h   2010-12-03 15:37:45.540456499 +0900
 +++ b/storage/innobase/handler/i_s.h   2010-12-03 16:08:57.596941207 +0900
-@@ -33,6 +33,13 @@
+@@ -35,6 +35,13 @@
  extern struct st_mysql_plugin i_s_innodb_cmp_reset;
  extern struct st_mysql_plugin i_s_innodb_cmpmem;
  extern struct st_mysql_plugin i_s_innodb_cmpmem_reset;
index f9a9c067cf2252f6fa7ac1d8e77929b1dea49b08..57391dd2e75fe8683984e5cf699c25f53f8a7084 100644 (file)
@@ -592,18 +592,22 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  UNIV_INTERN mysql_pfs_key_t   flush_list_mutex_key;
  #endif /* UNIV_PFS_MUTEX */
  
-@@ -881,9 +886,9 @@
+@@ -881,9 +886,13 @@
        block->page.in_zip_hash = FALSE;
        block->page.in_flush_list = FALSE;
        block->page.in_free_list = FALSE;
 -      block->in_unzip_LRU_list = FALSE;
  #endif /* UNIV_DEBUG */
++      block->page.flush_list.prev = NULL;
++      block->page.flush_list.next = NULL;
++      block->page.zip_list.prev = NULL;
++      block->page.zip_list.next = NULL;
        block->page.in_LRU_list = FALSE;
 +      block->in_unzip_LRU_list = FALSE;
  #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
        block->n_pointers = 0;
  #endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
-@@ -981,9 +986,11 @@
+@@ -981,9 +990,11 @@
                memset(block->frame, '\0', UNIV_PAGE_SIZE);
  #endif
                /* Add the block to the free list */
@@ -616,7 +620,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
                ut_ad(buf_pool_from_block(block) == buf_pool);
  
                block++;
-@@ -1038,7 +1045,8 @@
+@@ -1038,7 +1049,8 @@
        buf_chunk_t*    chunk = buf_pool->chunks;
  
        ut_ad(buf_pool);
@@ -626,7 +630,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
        for (n = buf_pool->n_chunks; n--; chunk++) {
  
                buf_block_t* block = buf_chunk_contains_zip(chunk, data);
-@@ -1138,7 +1146,7 @@
+@@ -1138,7 +1150,7 @@
        buf_block_t*            block;
        const buf_block_t*      block_end;
  
@@ -635,7 +639,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
        block_end = chunk->blocks + chunk->size;
  
-@@ -1150,8 +1158,10 @@
+@@ -1150,8 +1162,10 @@
                ut_ad(!block->in_unzip_LRU_list);
                ut_ad(!block->page.in_flush_list);
                /* Remove the block from the free list. */
@@ -647,7 +651,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
                /* Free the latches. */
                mutex_free(&block->mutex);
-@@ -1208,9 +1218,21 @@
+@@ -1208,9 +1222,21 @@
        ------------------------------- */
        mutex_create(buf_pool_mutex_key,
                     &buf_pool->mutex, SYNC_BUF_POOL);
@@ -669,7 +673,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
        buf_pool_mutex_enter(buf_pool);
  
        if (buf_pool_size > 0) {
-@@ -1223,6 +1245,8 @@
+@@ -1223,6 +1249,8 @@
                        mem_free(chunk);
                        mem_free(buf_pool);
  
@@ -678,7 +682,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
                        buf_pool_mutex_exit(buf_pool);
  
                        return(DB_ERROR);
-@@ -1253,6 +1277,8 @@
+@@ -1253,6 +1281,8 @@
  
        /* All fields are initialized by mem_zalloc(). */
  
@@ -687,7 +691,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
        buf_pool_mutex_exit(buf_pool);
  
        return(DB_SUCCESS);
-@@ -1467,7 +1493,11 @@
+@@ -1467,7 +1497,11 @@
        ulint           fold;
        buf_pool_t*     buf_pool = buf_pool_from_bpage(bpage);
  
@@ -700,7 +704,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
        ut_ad(mutex_own(buf_page_get_mutex(bpage)));
        ut_a(buf_page_get_io_fix(bpage) == BUF_IO_NONE);
        ut_a(bpage->buf_fix_count == 0);
-@@ -1554,7 +1584,8 @@
+@@ -1554,7 +1588,8 @@
  
  try_again:
        btr_search_disable(); /* Empty the adaptive hash index again */
@@ -710,7 +714,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
  shrink_again:
        if (buf_pool->n_chunks <= 1) {
-@@ -1625,7 +1656,7 @@
+@@ -1625,7 +1660,7 @@
  
                                buf_LRU_make_block_old(&block->page);
                                dirty++;
@@ -719,7 +723,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
                                   != BUF_LRU_FREED) {
                                nonfree++;
                        }
-@@ -1633,7 +1664,8 @@
+@@ -1633,7 +1668,8 @@
                        mutex_exit(&block->mutex);
                }
  
@@ -729,7 +733,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
                /* Request for a flush of the chunk if it helps.
                Do not flush if there are non-free blocks, since
-@@ -1683,7 +1715,8 @@
+@@ -1683,7 +1719,8 @@
  func_done:
        buf_pool->old_pool_size = buf_pool->curr_pool_size;
  func_exit:
@@ -739,7 +743,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
        btr_search_enable();
  }
  
-@@ -1724,7 +1757,9 @@
+@@ -1724,7 +1761,9 @@
        hash_table_t*   zip_hash;
        hash_table_t*   page_hash;
  
@@ -750,7 +754,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
        /* Free, create, and populate the hash table. */
        hash_table_free(buf_pool->page_hash);
-@@ -1765,8 +1800,9 @@
+@@ -1765,8 +1804,9 @@
        All such blocks are either in buf_pool->zip_clean or
        in buf_pool->flush_list. */
  
@@ -761,7 +765,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
                ut_a(buf_page_get_state(b) == BUF_BLOCK_ZIP_PAGE);
                ut_ad(!b->in_flush_list);
                ut_ad(b->in_LRU_list);
-@@ -1776,10 +1812,11 @@
+@@ -1776,10 +1816,11 @@
                HASH_INSERT(buf_page_t, hash, page_hash,
                            buf_page_address_fold(b->space, b->offset), b);
        }
@@ -774,7 +778,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
                ut_ad(b->in_flush_list);
                ut_ad(b->in_LRU_list);
                ut_ad(b->in_page_hash);
-@@ -1806,7 +1843,9 @@
+@@ -1806,7 +1847,9 @@
        }
  
        buf_flush_list_mutex_exit(buf_pool);
@@ -785,7 +789,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  }
  
  /********************************************************************
-@@ -1853,21 +1892,32 @@
+@@ -1853,21 +1896,32 @@
        buf_page_t*     bpage;
        ulint           i;
        buf_pool_t*     buf_pool = buf_pool_get(space, offset);
@@ -819,7 +823,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
        for (i = 0; i < BUF_POOL_WATCH_SIZE; i++) {
                bpage = &buf_pool->watch[i];
  
-@@ -1891,10 +1941,12 @@
+@@ -1891,10 +1945,12 @@
                        bpage->space = space;
                        bpage->offset = offset;
                        bpage->buf_fix_count = 1;
@@ -833,7 +837,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
                        return(NULL);
                case BUF_BLOCK_ZIP_PAGE:
                        ut_ad(bpage->in_page_hash);
-@@ -1912,6 +1964,8 @@
+@@ -1912,6 +1968,8 @@
        ut_error;
  
        /* Fix compiler warning */
@@ -842,7 +846,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
        return(NULL);
  }
  
-@@ -1941,6 +1995,8 @@
+@@ -1941,6 +1999,8 @@
        buf_chunk_t*    chunks;
        buf_chunk_t*    chunk;
  
@@ -851,7 +855,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
        buf_pool_mutex_enter(buf_pool);
        chunks = mem_alloc((buf_pool->n_chunks + 1) * sizeof *chunks);
  
-@@ -1959,6 +2015,8 @@
+@@ -1959,6 +2019,8 @@
                buf_pool->n_chunks++;
        }
  
@@ -860,7 +864,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
        buf_pool_mutex_exit(buf_pool);
  }
  
-@@ -2046,7 +2104,11 @@
+@@ -2046,7 +2108,11 @@
                                        space, offset) */
        buf_page_t*     watch)          /*!< in/out: sentinel for watch */
  {
@@ -873,7 +877,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
        HASH_DELETE(buf_page_t, hash, buf_pool->page_hash, fold, watch);
        ut_d(watch->in_page_hash = FALSE);
-@@ -2068,28 +2130,31 @@
+@@ -2068,28 +2134,31 @@
        buf_pool_t*     buf_pool = buf_pool_get(space, offset);
        ulint           fold = buf_page_address_fold(space, offset);
  
@@ -909,7 +913,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  }
  
  /****************************************************************//**
-@@ -2109,14 +2174,16 @@
+@@ -2109,14 +2178,16 @@
        buf_pool_t*     buf_pool = buf_pool_get(space, offset);
        ulint           fold    = buf_page_address_fold(space, offset);
  
@@ -928,7 +932,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
        return(ret);
  }
-@@ -2133,13 +2200,15 @@
+@@ -2133,13 +2204,15 @@
  {
        buf_pool_t*     buf_pool = buf_pool_from_bpage(bpage);
  
@@ -946,7 +950,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  }
  
  /********************************************************************//**
-@@ -2163,14 +2232,20 @@
+@@ -2163,14 +2236,20 @@
        ut_a(buf_page_in_file(bpage));
  
        if (buf_page_peek_if_too_old(bpage)) {
@@ -971,7 +975,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
        }
  }
  
-@@ -2187,7 +2262,8 @@
+@@ -2187,7 +2266,8 @@
        buf_block_t*    block;
        buf_pool_t*     buf_pool = buf_pool_get(space, offset);
  
@@ -981,7 +985,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
        block = (buf_block_t*) buf_page_hash_get(buf_pool, space, offset);
  
-@@ -2196,7 +2272,8 @@
+@@ -2196,7 +2276,8 @@
                block->check_index_page_at_flush = FALSE;
        }
  
@@ -991,7 +995,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  }
  
  /********************************************************************//**
-@@ -2215,7 +2292,8 @@
+@@ -2215,7 +2296,8 @@
        ibool           is_hashed;
        buf_pool_t*     buf_pool = buf_pool_get(space, offset);
  
@@ -1001,7 +1005,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
        block = (buf_block_t*) buf_page_hash_get(buf_pool, space, offset);
  
-@@ -2226,7 +2304,8 @@
+@@ -2226,7 +2308,8 @@
                is_hashed = block->is_hashed;
        }
  
@@ -1011,7 +1015,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
        return(is_hashed);
  }
-@@ -2248,7 +2327,8 @@
+@@ -2248,7 +2331,8 @@
        buf_page_t*     bpage;
        buf_pool_t*     buf_pool = buf_pool_get(space, offset);
  
@@ -1021,7 +1025,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
        bpage = buf_page_hash_get(buf_pool, space, offset);
  
-@@ -2259,7 +2339,8 @@
+@@ -2259,7 +2343,8 @@
                bpage->file_page_was_freed = TRUE;
        }
  
@@ -1031,7 +1035,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
        return(bpage);
  }
-@@ -2280,7 +2361,8 @@
+@@ -2280,7 +2365,8 @@
        buf_page_t*     bpage;
        buf_pool_t*     buf_pool = buf_pool_get(space, offset);
  
@@ -1041,7 +1045,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
        bpage = buf_page_hash_get(buf_pool, space, offset);
  
-@@ -2289,7 +2371,8 @@
+@@ -2289,7 +2375,8 @@
                bpage->file_page_was_freed = FALSE;
        }
  
@@ -1051,7 +1055,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
        return(bpage);
  }
-@@ -2324,8 +2407,9 @@
+@@ -2321,8 +2408,9 @@
        buf_pool->stat.n_page_gets++;
  
        for (;;) {
@@ -1062,7 +1066,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
                bpage = buf_page_hash_get(buf_pool, space, offset);
                if (bpage) {
                        ut_ad(!buf_pool_watch_is_sentinel(buf_pool, bpage));
-@@ -2334,7 +2418,8 @@
+@@ -2331,7 +2419,8 @@
  
                /* Page not in buf_pool: needs to be read from file */
  
@@ -1072,7 +1076,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
                buf_read_page(space, zip_size, offset);
  
-@@ -2346,10 +2431,15 @@
+@@ -2343,10 +2432,15 @@
        if (UNIV_UNLIKELY(!bpage->zip.data)) {
                /* There is no compressed page. */
  err_exit:
@@ -1089,7 +1093,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
        ut_ad(!buf_pool_watch_is_sentinel(buf_pool, bpage));
  
        switch (buf_page_get_state(bpage)) {
-@@ -2358,19 +2448,19 @@
+@@ -2355,19 +2449,19 @@
        case BUF_BLOCK_MEMORY:
        case BUF_BLOCK_REMOVE_HASH:
        case BUF_BLOCK_ZIP_FREE:
@@ -1114,7 +1118,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
                        mutex_exit(block_mutex);
                        goto lookup;
-@@ -2388,7 +2478,7 @@
+@@ -2385,7 +2479,7 @@
        must_read = buf_page_get_io_fix(bpage) == BUF_IO_READ;
        access_time = buf_page_is_accessed(bpage);
  
@@ -1123,7 +1127,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
        mutex_exit(block_mutex);
  
-@@ -2697,7 +2787,7 @@
+@@ -2697,7 +2791,7 @@
        const buf_block_t*      block)          /*!< in: pointer to block,
                                                not dereferenced */
  {
@@ -1132,7 +1136,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
        if (UNIV_UNLIKELY((((ulint) block) % sizeof *block) != 0)) {
                /* The pointer should be aligned. */
-@@ -2733,6 +2823,7 @@
+@@ -2733,6 +2827,7 @@
        ulint           fix_type;
        ibool           must_read;
        ulint           retries = 0;
@@ -1140,7 +1144,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
        buf_pool_t*     buf_pool = buf_pool_get(space, offset);
  
        ut_ad(mtr);
-@@ -2755,9 +2846,11 @@
+@@ -2765,9 +2860,11 @@
        fold = buf_page_address_fold(space, offset);
  loop:
        block = guess;
@@ -1153,7 +1157,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
                /* If the guess is a compressed page descriptor that
                has been allocated by buf_buddy_alloc(), it may have
                been invalidated by buf_buddy_relocate().  In that
-@@ -2766,11 +2859,15 @@
+@@ -2776,11 +2873,15 @@
                the guess may be pointing to a buffer pool chunk that
                has been released when resizing the buffer pool. */
  
@@ -1170,7 +1174,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
                        block = guess = NULL;
                } else {
                        ut_ad(!block->page.in_zip_hash);
-@@ -2779,12 +2876,19 @@
+@@ -2789,12 +2890,19 @@
        }
  
        if (block == NULL) {
@@ -1190,7 +1194,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
                block = NULL;
        }
  
-@@ -2796,12 +2900,14 @@
+@@ -2806,12 +2914,14 @@
                                space, offset, fold);
  
                        if (UNIV_LIKELY_NULL(block)) {
@@ -1206,8 +1210,8 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
 +              //buf_pool_mutex_exit(buf_pool);
  
                if (mode == BUF_GET_IF_IN_POOL
-                   || mode == BUF_GET_IF_IN_POOL_OR_WATCH) {
-@@ -2849,7 +2955,8 @@
+                   || mode == BUF_PEEK_IF_IN_POOL
+@@ -2861,7 +2971,8 @@
                /* The page is being read to buffer pool,
                but we cannot wait around for the read to
                complete. */
@@ -1217,7 +1221,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
                return(NULL);
        }
-@@ -2859,38 +2966,49 @@
+@@ -2871,38 +2982,49 @@
                ibool           success;
  
        case BUF_BLOCK_FILE_PAGE:
@@ -1250,7 +1254,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
 +                      //buf_pool_mutex_exit(buf_pool);
 +                      mutex_exit(block_mutex);
                        os_thread_sleep(WAIT_FOR_READ);
-   
                        goto loop;
                }
  
@@ -1274,7 +1278,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
                {
                        buf_page_t*     hash_bpage;
-@@ -2903,35 +3021,47 @@
+@@ -2915,35 +3037,47 @@
                                while buf_pool->mutex was released.
                                Free the block that was allocated. */
  
@@ -1328,7 +1332,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
                buf_block_init_low(block);
                block->lock_hash_val = lock_rec_hash(space, offset);
  
-@@ -2940,7 +3070,7 @@
+@@ -2952,7 +3086,7 @@
  
                if (buf_page_get_state(&block->page)
                    == BUF_BLOCK_ZIP_PAGE) {
@@ -1337,7 +1341,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
                                       &block->page);
                        ut_ad(!block->page.in_flush_list);
                } else {
-@@ -2957,19 +3087,24 @@
+@@ -2969,20 +3103,25 @@
                /* Insert at the front of unzip_LRU list */
                buf_unzip_LRU_add_block(block, FALSE);
  
@@ -1357,6 +1361,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
                buf_pool->n_pend_unzip++;
 +              buf_pool_mutex_exit(buf_pool);
  
+               bpage->state = BUF_BLOCK_ZIP_FREE;
 -              buf_buddy_free(buf_pool, bpage, sizeof *bpage);
 +              buf_buddy_free(buf_pool, bpage, sizeof *bpage, FALSE);
  
@@ -1365,7 +1370,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
                /* Decompress the page and apply buffered operations
                while not holding buf_pool->mutex or block->mutex. */
-@@ -2982,12 +3117,15 @@
+@@ -2995,12 +3134,15 @@
                }
  
                /* Unfix and unlatch the block. */
@@ -1384,7 +1389,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
                rw_lock_x_unlock(&block->lock);
  
                break;
-@@ -3003,7 +3141,7 @@
+@@ -3016,7 +3158,7 @@
  
        ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
  
@@ -1393,7 +1398,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  #if UNIV_WORD_SIZE == 4
        /* On 32-bit systems, there is no padding in buf_page_t.  On
        other systems, Valgrind could complain about uninitialized pad
-@@ -3016,8 +3154,8 @@
+@@ -3029,8 +3171,8 @@
                /* Try to evict the block from the buffer pool, to use the
                insert buffer (change buffer) as much as possible. */
  
@@ -1404,7 +1409,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
                        if (mode == BUF_GET_IF_IN_POOL_OR_WATCH) {
                                /* Set the watch, as it would have
                                been set if the page were not in the
-@@ -3026,6 +3164,9 @@
+@@ -3039,6 +3181,9 @@
                                        space, offset, fold);
  
                                if (UNIV_LIKELY_NULL(block)) {
@@ -1414,7 +1419,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
                                        /* The page entered the buffer
                                        pool for some reason. Try to
-@@ -3033,7 +3174,7 @@
+@@ -3046,7 +3191,7 @@
                                        goto got_block;
                                }
                        }
@@ -1423,7 +1428,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
                        fprintf(stderr,
                                "innodb_change_buffering_debug evict %u %u\n",
                                (unsigned) space, (unsigned) offset);
-@@ -3052,13 +3193,14 @@
+@@ -3065,13 +3210,14 @@
  
        buf_block_buf_fix_inc(block, file, line);
  
@@ -1438,9 +1443,9 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
 +      //buf_pool_mutex_exit(buf_pool);
 +      mutex_exit(block_mutex);
  
-       buf_page_set_accessed_make_young(&block->page, access_time);
-@@ -3291,9 +3433,11 @@
+       if (UNIV_LIKELY(mode != BUF_PEEK_IF_IN_POOL)) {
+               buf_page_set_accessed_make_young(&block->page, access_time);
+@@ -3308,9 +3454,11 @@
        buf_pool = buf_pool_from_block(block);
  
        if (mode == BUF_MAKE_YOUNG && buf_page_peek_if_too_old(&block->page)) {
@@ -1454,7 +1459,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
        } else if (!buf_page_is_accessed(&block->page)) {
                /* Above, we do a dirty read on purpose, to avoid
                mutex contention.  The field buf_page_t::access_time
-@@ -3301,9 +3445,11 @@
+@@ -3318,9 +3466,11 @@
                field must be protected by mutex, however. */
                ulint   time_ms = ut_time_ms();
  
@@ -1467,8 +1472,8 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
 +              mutex_exit(&block->mutex);
        }
  
-       ut_ad(!ibuf_inside() || (mode == BUF_KEEP_OLD));
-@@ -3370,18 +3516,21 @@
+       ut_ad(!ibuf_inside(mtr) || mode == BUF_KEEP_OLD);
+@@ -3387,18 +3537,21 @@
        ut_ad(mtr);
        ut_ad(mtr->state == MTR_ACTIVE);
  
@@ -1493,7 +1498,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
  #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
        ut_a(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
-@@ -3470,7 +3619,10 @@
+@@ -3487,7 +3640,10 @@
        buf_page_t*     hash_page;
        buf_pool_t*     buf_pool = buf_pool_get(space, offset);
  
@@ -1505,7 +1510,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
        ut_ad(mutex_own(&(block->mutex)));
        ut_a(buf_block_get_state(block) != BUF_BLOCK_FILE_PAGE);
  
-@@ -3499,11 +3651,14 @@
+@@ -3516,11 +3672,14 @@
        if (UNIV_LIKELY(!hash_page)) {
        } else if (buf_pool_watch_is_sentinel(buf_pool, hash_page)) {
                /* Preserve the reference count. */
@@ -1521,7 +1526,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
        } else {
                fprintf(stderr,
                        "InnoDB: Error: page %lu %lu already found"
-@@ -3513,7 +3668,8 @@
+@@ -3530,7 +3689,8 @@
                        (const void*) hash_page, (const void*) block);
  #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
                mutex_exit(&block->mutex);
@@ -1531,7 +1536,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
                buf_print();
                buf_LRU_print();
                buf_validate();
-@@ -3597,7 +3753,9 @@
+@@ -3613,7 +3773,9 @@
  
        fold = buf_page_address_fold(space, offset);
  
@@ -1542,7 +1547,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
        watch_page = buf_page_hash_get_low(buf_pool, space, offset, fold);
        if (watch_page && !buf_pool_watch_is_sentinel(buf_pool, watch_page)) {
-@@ -3606,9 +3764,15 @@
+@@ -3622,9 +3784,15 @@
  err_exit:
                if (block) {
                        mutex_enter(&block->mutex);
@@ -1559,7 +1564,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
                bpage = NULL;
                goto func_exit;
-@@ -3631,6 +3795,8 @@
+@@ -3647,6 +3815,8 @@
  
                buf_page_init(space, offset, fold, block);
  
@@ -1568,7 +1573,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
                /* The block must be put to the LRU list, to the old blocks */
                buf_LRU_add_block(bpage, TRUE/* to old blocks */);
  
-@@ -3658,7 +3824,7 @@
+@@ -3674,7 +3844,7 @@
                        been added to buf_pool->LRU and
                        buf_pool->page_hash. */
                        mutex_exit(&block->mutex);
@@ -1577,7 +1582,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
                        mutex_enter(&block->mutex);
                        block->page.zip.data = data;
  
-@@ -3671,6 +3837,7 @@
+@@ -3687,6 +3857,7 @@
                        buf_unzip_LRU_add_block(block, TRUE);
                }
  
@@ -1585,7 +1590,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
                mutex_exit(&block->mutex);
        } else {
                /* Defer buf_buddy_alloc() until after the block has
-@@ -3682,8 +3849,8 @@
+@@ -3698,8 +3869,8 @@
                control block (bpage), in order to avoid the
                invocation of buf_buddy_relocate_block() on
                uninitialized data. */
@@ -1596,10 +1601,10 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
                /* Initialize the buf_pool pointer. */
                bpage->buf_pool_index = buf_pool_index(buf_pool);
-@@ -3702,8 +3869,11 @@
+@@ -3719,8 +3890,11 @@
                                /* The block was added by some other thread. */
                                watch_page = NULL;
+                               bpage->state = BUF_BLOCK_ZIP_FREE;
 -                              buf_buddy_free(buf_pool, bpage, sizeof *bpage);
 -                              buf_buddy_free(buf_pool, data, zip_size);
 +                              buf_buddy_free(buf_pool, bpage, sizeof *bpage, TRUE);
@@ -1610,7 +1615,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
                                bpage = NULL;
                                goto func_exit;
-@@ -3747,18 +3917,24 @@
+@@ -3764,18 +3938,24 @@
                HASH_INSERT(buf_page_t, hash, buf_pool->page_hash, fold,
                            bpage);
  
@@ -1636,7 +1641,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
        if (mode == BUF_READ_IBUF_PAGES_ONLY) {
  
-@@ -3800,7 +3976,9 @@
+@@ -3817,7 +3997,9 @@
  
        fold = buf_page_address_fold(space, offset);
  
@@ -1647,7 +1652,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
        block = (buf_block_t*) buf_page_hash_get_low(
                buf_pool, space, offset, fold);
-@@ -3816,7 +3994,9 @@
+@@ -3833,7 +4015,9 @@
  #endif /* UNIV_DEBUG_FILE_ACCESSES || UNIV_DEBUG */
  
                /* Page can be found in buf_pool */
@@ -1658,7 +1663,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
                buf_block_free(free_block);
  
-@@ -3838,6 +4018,7 @@
+@@ -3855,6 +4039,7 @@
        mutex_enter(&block->mutex);
  
        buf_page_init(space, offset, fold, block);
@@ -1666,7 +1671,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
        /* The block must be put to the LRU list */
        buf_LRU_add_block(&block->page, FALSE);
-@@ -3864,7 +4045,7 @@
+@@ -3881,7 +4066,7 @@
                the reacquisition of buf_pool->mutex.  We also must
                defer this operation until after the block descriptor
                has been added to buf_pool->LRU and buf_pool->page_hash. */
@@ -1675,7 +1680,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
                mutex_enter(&block->mutex);
                block->page.zip.data = data;
  
-@@ -3882,7 +4063,8 @@
+@@ -3899,7 +4084,8 @@
  
        buf_page_set_accessed(&block->page, time_ms);
  
@@ -1685,7 +1690,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
        mtr_memo_push(mtr, block, MTR_MEMO_BUF_FIX);
  
-@@ -3933,6 +4115,8 @@
+@@ -3950,6 +4136,8 @@
        buf_pool_t*     buf_pool = buf_pool_from_bpage(bpage);
        const ibool     uncompressed = (buf_page_get_state(bpage)
                                        == BUF_BLOCK_FILE_PAGE);
@@ -1694,7 +1699,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
        ut_a(buf_page_in_file(bpage));
  
-@@ -4066,8 +4250,26 @@
+@@ -4083,8 +4271,26 @@
                }
        }
  
@@ -1722,7 +1727,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
  #ifdef UNIV_IBUF_COUNT_DEBUG
        if (io_type == BUF_IO_WRITE || uncompressed) {
-@@ -4090,6 +4292,7 @@
+@@ -4107,6 +4313,7 @@
                the x-latch to this OS thread: do not let this confuse you in
                debugging! */
  
@@ -1730,7 +1735,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
                ut_ad(buf_pool->n_pend_reads > 0);
                buf_pool->n_pend_reads--;
                buf_pool->stat.n_pages_read++;
-@@ -4107,6 +4310,9 @@
+@@ -4124,6 +4331,9 @@
  
                buf_flush_write_complete(bpage);
  
@@ -1740,7 +1745,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
                if (uncompressed) {
                        rw_lock_s_unlock_gen(&((buf_block_t*) bpage)->lock,
                                             BUF_IO_WRITE);
-@@ -4129,8 +4335,8 @@
+@@ -4146,8 +4356,8 @@
        }
  #endif /* UNIV_DEBUG */
  
@@ -1750,7 +1755,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  }
  
  /*********************************************************************//**
-@@ -4147,7 +4353,9 @@
+@@ -4164,7 +4374,9 @@
  
        ut_ad(buf_pool);
  
@@ -1761,7 +1766,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
        chunk = buf_pool->chunks;
  
-@@ -4164,7 +4372,9 @@
+@@ -4181,7 +4393,9 @@
                }
        }
  
@@ -1772,7 +1777,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
        return(TRUE);
  }
-@@ -4212,7 +4422,8 @@
+@@ -4229,7 +4443,8 @@
                freed = buf_LRU_search_and_free_block(buf_pool, 100);
        }
  
@@ -1782,7 +1787,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
        ut_ad(UT_LIST_GET_LEN(buf_pool->LRU) == 0);
        ut_ad(UT_LIST_GET_LEN(buf_pool->unzip_LRU) == 0);
-@@ -4225,7 +4436,8 @@
+@@ -4242,7 +4457,8 @@
        memset(&buf_pool->stat, 0x00, sizeof(buf_pool->stat));
        buf_refresh_io_stats(buf_pool);
  
@@ -1792,7 +1797,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  }
  
  /*********************************************************************//**
-@@ -4267,7 +4479,10 @@
+@@ -4284,7 +4500,10 @@
  
        ut_ad(buf_pool);
  
@@ -1804,7 +1809,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
        chunk = buf_pool->chunks;
  
-@@ -4362,7 +4577,7 @@
+@@ -4379,7 +4598,7 @@
        /* Check clean compressed-only blocks. */
  
        for (b = UT_LIST_GET_FIRST(buf_pool->zip_clean); b;
@@ -1813,7 +1818,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
                ut_a(buf_page_get_state(b) == BUF_BLOCK_ZIP_PAGE);
                switch (buf_page_get_io_fix(b)) {
                case BUF_IO_NONE:
-@@ -4393,7 +4608,7 @@
+@@ -4410,7 +4629,7 @@
  
        buf_flush_list_mutex_enter(buf_pool);
        for (b = UT_LIST_GET_FIRST(buf_pool->flush_list); b;
@@ -1822,7 +1827,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
                ut_ad(b->in_flush_list);
                ut_a(b->oldest_modification);
                n_flush++;
-@@ -4452,6 +4667,8 @@
+@@ -4469,6 +4688,8 @@
        }
  
        ut_a(UT_LIST_GET_LEN(buf_pool->LRU) == n_lru);
@@ -1831,7 +1836,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
        if (UT_LIST_GET_LEN(buf_pool->free) != n_free) {
                fprintf(stderr, "Free list len %lu, free blocks %lu\n",
                        (ulong) UT_LIST_GET_LEN(buf_pool->free),
-@@ -4462,8 +4679,11 @@
+@@ -4479,8 +4700,11 @@
        ut_a(buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE] == n_single_flush);
        ut_a(buf_pool->n_flush[BUF_FLUSH_LIST] == n_list_flush);
        ut_a(buf_pool->n_flush[BUF_FLUSH_LRU] == n_lru_flush);
@@ -1844,7 +1849,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
        ut_a(buf_LRU_validate());
        ut_a(buf_flush_validate(buf_pool));
-@@ -4519,7 +4739,9 @@
+@@ -4536,7 +4760,9 @@
        index_ids = mem_alloc(size * sizeof *index_ids);
        counts = mem_alloc(sizeof(ulint) * size);
  
@@ -1855,7 +1860,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
        buf_flush_list_mutex_enter(buf_pool);
  
        fprintf(stderr,
-@@ -4588,7 +4810,9 @@
+@@ -4605,7 +4831,9 @@
                }
        }
  
@@ -1866,7 +1871,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
        for (i = 0; i < n_found; i++) {
                index = dict_index_get_if_in_cache(index_ids[i]);
-@@ -4645,7 +4869,7 @@
+@@ -4662,7 +4890,7 @@
        buf_chunk_t*    chunk;
        ulint           fixed_pages_number = 0;
  
@@ -1875,7 +1880,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
        chunk = buf_pool->chunks;
  
-@@ -4679,7 +4903,7 @@
+@@ -4696,7 +4924,7 @@
        /* Traverse the lists of clean and dirty compressed-only blocks. */
  
        for (b = UT_LIST_GET_FIRST(buf_pool->zip_clean); b;
@@ -1884,7 +1889,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
                ut_a(buf_page_get_state(b) == BUF_BLOCK_ZIP_PAGE);
                ut_a(buf_page_get_io_fix(b) != BUF_IO_WRITE);
  
-@@ -4691,7 +4915,7 @@
+@@ -4708,7 +4936,7 @@
  
        buf_flush_list_mutex_enter(buf_pool);
        for (b = UT_LIST_GET_FIRST(buf_pool->flush_list); b;
@@ -1893,7 +1898,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
                ut_ad(b->in_flush_list);
  
                switch (buf_page_get_state(b)) {
-@@ -4717,7 +4941,7 @@
+@@ -4734,7 +4962,7 @@
  
        buf_flush_list_mutex_exit(buf_pool);
        mutex_exit(&buf_pool->zip_mutex);
@@ -1902,7 +1907,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
        return(fixed_pages_number);
  }
-@@ -4873,6 +5097,8 @@
+@@ -4890,6 +5118,8 @@
        /* Find appropriate pool_info to store stats for this buffer pool */
        pool_info = &all_pool_info[pool_id];
  
@@ -1911,7 +1916,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
        buf_pool_mutex_enter(buf_pool);
        buf_flush_list_mutex_enter(buf_pool);
  
-@@ -4983,6 +5209,8 @@
+@@ -5000,6 +5230,8 @@
        pool_info->unzip_cur = buf_LRU_stat_cur.unzip;
  
        buf_refresh_io_stats(buf_pool);
@@ -1920,7 +1925,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
        buf_pool_mutex_exit(buf_pool);
  }
  
-@@ -5224,11 +5452,13 @@
+@@ -5241,11 +5473,13 @@
  {
        ulint   len;
  
@@ -2281,7 +2286,7 @@ diff -ruN a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c
        return(count);
  }
 @@ -1722,13 +1754,15 @@
-             || sync_thread_levels_empty_gen(TRUE));
+             || sync_thread_levels_empty_except_dict());
  #endif /* UNIV_SYNC_DEBUG */
  
 -      buf_pool_mutex_enter(buf_pool);
@@ -2421,54 +2426,99 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
  
        /* Calculate the average over past intervals, and add the values
        of the current interval. */
-@@ -246,19 +258,23 @@
+@@ -246,18 +258,25 @@
        page_arr = ut_malloc(
                sizeof(ulint) * BUF_LRU_DROP_SEARCH_HASH_SIZE);
  
 -      buf_pool_mutex_enter(buf_pool);
 +      //buf_pool_mutex_enter(buf_pool);
 +      mutex_enter(&buf_pool->LRU_list_mutex);
+       num_entries = 0;
  
  scan_again:
-       num_entries = 0;
        bpage = UT_LIST_GET_LAST(buf_pool->LRU);
  
        while (bpage != NULL) {
--              mutex_t*        block_mutex = buf_page_get_mutex(bpage);
++              /* bpage->state,space,io_fix,buf_fix_count are protected by block_mutex at XtraDB */
 +              mutex_t*        block_mutex = buf_page_get_mutex_enter(bpage);
                buf_page_t*     prev_bpage;
+               ibool           is_fixed;
  
--              mutex_enter(block_mutex);
                prev_bpage = UT_LIST_GET_PREV(LRU, bpage);
  
-+              if (!block_mutex) {
++              if (UNIV_UNLIKELY(!block_mutex)) {
 +                      goto next_page;
 +              }
 +
                ut_a(buf_page_in_file(bpage));
  
                if (buf_page_get_state(bpage) != BUF_BLOCK_FILE_PAGE
-@@ -287,14 +303,16 @@
+@@ -266,23 +285,27 @@
+                       /* Compressed pages are never hashed.
+                       Skip blocks of other tablespaces.
+                       Skip I/O-fixed blocks (to be dealt with later). */
++                      mutex_exit(block_mutex);
+ next_page:
+                       bpage = prev_bpage;
+                       continue;
+               }
  
-                       /* Array full. We release the buf_pool->mutex to
-                       obey the latching order. */
--                      buf_pool_mutex_exit(buf_pool);
-+                      //buf_pool_mutex_exit(buf_pool);
-+                      mutex_exit(&buf_pool->LRU_list_mutex);
+-              mutex_enter(&((buf_block_t*) bpage)->mutex);
++              //mutex_enter(&((buf_block_t*) bpage)->mutex);
+               is_fixed = bpage->buf_fix_count > 0
+                       || !((buf_block_t*) bpage)->is_hashed;
+-              mutex_exit(&((buf_block_t*) bpage)->mutex);
++              //mutex_exit(&((buf_block_t*) bpage)->mutex);
  
-                       buf_LRU_drop_page_hash_batch(
-                               id, zip_size, page_arr, num_entries);
+               if (is_fixed) {
++                      mutex_exit(block_mutex);
+                       goto next_page;
+               }
  
-                       num_entries = 0;
+               /* Store the page number so that we can drop the hash
+               index in a batch later. */
+               page_arr[num_entries] = bpage->offset;
++              mutex_exit(block_mutex);
++
+               ut_a(num_entries < BUF_LRU_DROP_SEARCH_HASH_SIZE);
+               ++num_entries;
  
--                      buf_pool_mutex_enter(buf_pool);
-+                      //buf_pool_mutex_enter(buf_pool);
-+                      mutex_enter(&buf_pool->LRU_list_mutex);
-               } else {
-                       mutex_exit(block_mutex);
-               }
-@@ -319,7 +337,8 @@
+@@ -292,14 +315,16 @@
+               /* Array full. We release the buf_pool->mutex to obey
+               the latching order. */
+-              buf_pool_mutex_exit(buf_pool);
++              //buf_pool_mutex_exit(buf_pool);
++              mutex_exit(&buf_pool->LRU_list_mutex);
+               buf_LRU_drop_page_hash_batch(
+                       id, zip_size, page_arr, num_entries);
+               num_entries = 0;
+-              buf_pool_mutex_enter(buf_pool);
++              //buf_pool_mutex_enter(buf_pool);
++              mutex_enter(&buf_pool->LRU_list_mutex);
+               /* Note that we released the buf_pool mutex above
+               after reading the prev_bpage during processing of a
+@@ -317,13 +342,23 @@
+               /* If, however, bpage has been removed from LRU list
+               to the free list then we should restart the scan.
+               bpage->state is protected by buf_pool mutex. */
++
++              /* obtain block_mutex again to avoid race condition of bpage->state */
++              block_mutex = buf_page_get_mutex_enter(bpage);
++              if (!block_mutex) {
++                      goto scan_again;
++              }
++
+               if (bpage
+                   && buf_page_get_state(bpage) != BUF_BLOCK_FILE_PAGE) {
++                      mutex_exit(block_mutex);
+                       goto scan_again;
                }
++              mutex_exit(block_mutex);
        }
  
 -      buf_pool_mutex_exit(buf_pool);
@@ -2477,7 +2527,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
  
        /* Drop any remaining batch of search hashed pages. */
        buf_LRU_drop_page_hash_batch(id, zip_size, page_arr, num_entries);
-@@ -341,7 +360,9 @@
+@@ -345,7 +380,9 @@
        ibool           all_freed;
  
  scan_again:
@@ -2488,7 +2538,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
  
        all_freed = TRUE;
  
-@@ -369,8 +390,16 @@
+@@ -373,8 +410,16 @@
  
                        all_freed = FALSE;
                } else {
@@ -2507,7 +2557,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
  
                        if (bpage->buf_fix_count > 0) {
  
-@@ -429,7 +458,9 @@
+@@ -433,7 +478,9 @@
                                ulint   page_no;
                                ulint   zip_size;
  
@@ -2518,7 +2568,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
  
                                zip_size = buf_page_get_zip_size(bpage);
                                page_no = buf_page_get_page_no(bpage);
-@@ -454,7 +485,7 @@
+@@ -458,7 +505,7 @@
                        if (buf_LRU_block_remove_hashed_page(bpage, TRUE)
                            != BUF_BLOCK_ZIP_FREE) {
                                buf_LRU_block_free_hashed_page((buf_block_t*)
@@ -2527,7 +2577,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
                        } else {
                                /* The block_mutex should have been
                                released by buf_LRU_block_remove_hashed_page()
-@@ -486,7 +517,9 @@
+@@ -490,7 +537,9 @@
                bpage = prev_bpage;
        }
  
@@ -2538,7 +2588,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
  
        if (!all_freed) {
                os_thread_sleep(20000);
-@@ -532,7 +565,9 @@
+@@ -536,7 +585,9 @@
        buf_page_t*     b;
        buf_pool_t*     buf_pool = buf_pool_from_bpage(bpage);
  
@@ -2549,7 +2599,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
        ut_ad(buf_page_get_state(bpage) == BUF_BLOCK_ZIP_PAGE);
  
        /* Find the first successor of bpage in the LRU list
-@@ -540,17 +575,17 @@
+@@ -544,17 +595,17 @@
        b = bpage;
        do {
                b = UT_LIST_GET_NEXT(LRU, b);
@@ -2571,7 +2621,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
        }
  }
  
-@@ -563,18 +598,19 @@
+@@ -567,18 +618,19 @@
  buf_LRU_free_from_unzip_LRU_list(
  /*=============================*/
        buf_pool_t*     buf_pool,       /*!< in: buffer pool instance */
@@ -2593,7 +2643,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
  
        /* Theoratically it should be much easier to find a victim
        from unzip_LRU as we can choose even a dirty block (as we'll
-@@ -584,7 +620,7 @@
+@@ -588,7 +640,7 @@
        if we have done five iterations so far. */
  
        if (UNIV_UNLIKELY(n_iterations >= 5)
@@ -2602,7 +2652,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
  
                return(FALSE);
        }
-@@ -592,18 +628,25 @@
+@@ -596,18 +648,25 @@
        distance = 100 + (n_iterations
                          * UT_LIST_GET_LEN(buf_pool->unzip_LRU)) / 5;
  
@@ -2630,7 +2680,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
                mutex_exit(&block->mutex);
  
                switch (freed) {
-@@ -637,21 +680,23 @@
+@@ -641,21 +700,23 @@
  buf_LRU_free_from_common_LRU_list(
  /*==============================*/
        buf_pool_t*     buf_pool,
@@ -2656,7 +2706,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
        for (bpage = UT_LIST_GET_LAST(buf_pool->LRU);
             UNIV_LIKELY(bpage != NULL) && UNIV_LIKELY(distance > 0);
             bpage = UT_LIST_GET_PREV(LRU, bpage), distance--) {
-@@ -659,14 +704,23 @@
+@@ -663,14 +724,23 @@
                enum buf_lru_free_block_status  freed;
                unsigned                        accessed;
                mutex_t*                        block_mutex
@@ -2683,7 +2733,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
                mutex_exit(block_mutex);
  
                switch (freed) {
-@@ -718,16 +772,23 @@
+@@ -722,16 +792,23 @@
                                n_iterations / 5 of the unzip_LRU list. */
  {
        ibool   freed = FALSE;
@@ -2710,7 +2760,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
        if (!freed) {
                buf_pool->LRU_flush_ended = 0;
        } else if (buf_pool->LRU_flush_ended > 0) {
-@@ -735,6 +796,8 @@
+@@ -739,6 +816,8 @@
        }
  
        buf_pool_mutex_exit(buf_pool);
@@ -2719,7 +2769,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
  
        return(freed);
  }
-@@ -795,7 +858,9 @@
+@@ -799,7 +878,9 @@
  
                buf_pool = buf_pool_from_array(i);
  
@@ -2730,7 +2780,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
  
                if (!recv_recovery_on
                    && UT_LIST_GET_LEN(buf_pool->free)
-@@ -805,7 +870,9 @@
+@@ -809,7 +890,9 @@
                        ret = TRUE;
                }
  
@@ -2741,7 +2791,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
        }
  
        return(ret);
-@@ -823,9 +890,10 @@
+@@ -827,9 +910,10 @@
  {
        buf_block_t*    block;
  
@@ -2754,7 +2804,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
  
        if (block) {
  
-@@ -834,7 +902,9 @@
+@@ -838,7 +922,9 @@
                ut_ad(!block->page.in_flush_list);
                ut_ad(!block->page.in_LRU_list);
                ut_a(!buf_page_in_file(&block->page));
@@ -2765,7 +2815,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
  
                mutex_enter(&block->mutex);
  
-@@ -844,6 +914,8 @@
+@@ -848,6 +934,8 @@
                ut_ad(buf_pool_from_block(block) == buf_pool);
  
                mutex_exit(&block->mutex);
@@ -2774,7 +2824,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
        }
  
        return(block);
-@@ -866,7 +938,7 @@
+@@ -870,7 +958,7 @@
        ibool           mon_value_was   = FALSE;
        ibool           started_monitor = FALSE;
  loop:
@@ -2783,7 +2833,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
  
        if (!recv_recovery_on && UT_LIST_GET_LEN(buf_pool->free)
            + UT_LIST_GET_LEN(buf_pool->LRU) < buf_pool->curr_size / 20) {
-@@ -934,7 +1006,7 @@
+@@ -938,7 +1026,7 @@
  
        /* If there is a block in the free list, take it */
        block = buf_LRU_get_free_only(buf_pool);
@@ -2792,7 +2842,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
  
        if (block) {
                ut_ad(buf_pool_from_block(block) == buf_pool);
-@@ -1034,7 +1106,8 @@
+@@ -1038,7 +1126,8 @@
        ulint   new_len;
  
        ut_a(buf_pool->LRU_old);
@@ -2802,7 +2852,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
        ut_ad(buf_pool->LRU_old_ratio >= BUF_LRU_OLD_RATIO_MIN);
        ut_ad(buf_pool->LRU_old_ratio <= BUF_LRU_OLD_RATIO_MAX);
  #if BUF_LRU_OLD_RATIO_MIN * BUF_LRU_OLD_MIN_LEN <= BUF_LRU_OLD_RATIO_DIV * (BUF_LRU_OLD_TOLERANCE + 5)
-@@ -1100,7 +1173,8 @@
+@@ -1104,7 +1193,8 @@
  {
        buf_page_t*     bpage;
  
@@ -2812,7 +2862,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
        ut_a(UT_LIST_GET_LEN(buf_pool->LRU) == BUF_LRU_OLD_MIN_LEN);
  
        /* We first initialize all blocks in the LRU list as old and then use
-@@ -1135,13 +1209,14 @@
+@@ -1139,13 +1229,14 @@
        ut_ad(buf_pool);
        ut_ad(bpage);
        ut_ad(buf_page_in_file(bpage));
@@ -2829,7 +2879,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
  
                UT_LIST_REMOVE(unzip_LRU, buf_pool->unzip_LRU, block);
        }
-@@ -1159,7 +1234,8 @@
+@@ -1163,7 +1254,8 @@
  
        ut_ad(buf_pool);
        ut_ad(bpage);
@@ -2839,7 +2889,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
  
        ut_a(buf_page_in_file(bpage));
  
-@@ -1236,12 +1312,13 @@
+@@ -1240,12 +1332,13 @@
  
        ut_ad(buf_pool);
        ut_ad(block);
@@ -2855,7 +2905,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
  
        if (old) {
                UT_LIST_ADD_LAST(unzip_LRU, buf_pool->unzip_LRU, block);
-@@ -1262,7 +1339,8 @@
+@@ -1266,7 +1359,8 @@
  
        ut_ad(buf_pool);
        ut_ad(bpage);
@@ -2865,7 +2915,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
  
        ut_a(buf_page_in_file(bpage));
  
-@@ -1313,7 +1391,8 @@
+@@ -1317,7 +1411,8 @@
  
        ut_ad(buf_pool);
        ut_ad(bpage);
@@ -2875,7 +2925,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
  
        ut_a(buf_page_in_file(bpage));
        ut_ad(!bpage->in_LRU_list);
-@@ -1392,7 +1471,8 @@
+@@ -1396,7 +1491,8 @@
  {
        buf_pool_t*     buf_pool = buf_pool_from_bpage(bpage);
  
@@ -2885,7 +2935,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
  
        if (bpage->old) {
                buf_pool->stat.n_pages_made_young++;
-@@ -1432,17 +1512,18 @@
+@@ -1436,17 +1532,18 @@
  buf_LRU_free_block(
  /*===============*/
        buf_page_t*     bpage,  /*!< in: block to be freed */
@@ -2907,7 +2957,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
        ut_ad(!bpage->in_flush_list == !bpage->oldest_modification);
  #if UNIV_WORD_SIZE == 4
        /* On 32-bit systems, there is no padding in buf_page_t.  On
-@@ -1451,7 +1532,7 @@
+@@ -1455,7 +1552,7 @@
        UNIV_MEM_ASSERT_RW(bpage, sizeof *bpage);
  #endif
  
@@ -2916,7 +2966,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
  
                /* Do not free buffer-fixed or I/O-fixed blocks. */
                return(BUF_LRU_NOT_FREED);
-@@ -1483,15 +1564,15 @@
+@@ -1487,15 +1584,15 @@
                If it cannot be allocated (without freeing a block
                from the LRU list), refuse to free bpage. */
  alloc:
@@ -2936,7 +2986,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
        }
  
  #ifdef UNIV_DEBUG
-@@ -1502,6 +1583,39 @@
+@@ -1506,6 +1603,39 @@
        }
  #endif /* UNIV_DEBUG */
  
@@ -2976,7 +3026,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
        if (buf_LRU_block_remove_hashed_page(bpage, zip)
            != BUF_BLOCK_ZIP_FREE) {
                ut_a(bpage->buf_fix_count == 0);
-@@ -1518,6 +1632,10 @@
+@@ -1522,6 +1652,10 @@
  
                        ut_a(!hash_b);
  
@@ -2987,8 +3037,19 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
                        b->state = b->oldest_modification
                                ? BUF_BLOCK_ZIP_DIRTY
                                : BUF_BLOCK_ZIP_PAGE;
-@@ -1610,7 +1728,9 @@
+@@ -1597,6 +1731,7 @@
+                               buf_LRU_add_block_low(b, buf_page_is_old(b));
+                       }
++                      mutex_enter(&buf_pool->zip_mutex);
+                       if (b->state == BUF_BLOCK_ZIP_PAGE) {
+                               buf_LRU_insert_zip_clean(b);
+                       } else {
+@@ -1612,9 +1747,12 @@
+                       buf_pool->mutex and block_mutex. */
+                       b->buf_fix_count++;
                        b->io_fix = BUF_IO_READ;
++                      mutex_exit(&buf_pool->zip_mutex);
                }
  
 -              buf_pool_mutex_exit(buf_pool);
@@ -2998,7 +3059,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
                mutex_exit(block_mutex);
  
                /* Remove possible adaptive hash index on the page.
-@@ -1642,7 +1762,9 @@
+@@ -1646,7 +1784,9 @@
                                : BUF_NO_CHECKSUM_MAGIC);
                }
  
@@ -3009,7 +3070,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
                mutex_enter(block_mutex);
  
                if (b) {
-@@ -1652,13 +1774,17 @@
+@@ -1656,13 +1796,17 @@
                        mutex_exit(&buf_pool->zip_mutex);
                }
  
@@ -3028,7 +3089,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
        }
  
        return(BUF_LRU_FREED);
-@@ -1670,13 +1796,14 @@
+@@ -1674,13 +1818,14 @@
  void
  buf_LRU_block_free_non_file_page(
  /*=============================*/
@@ -3045,7 +3106,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
        ut_ad(mutex_own(&block->mutex));
  
        switch (buf_block_get_state(block)) {
-@@ -1710,18 +1837,21 @@
+@@ -1714,18 +1859,21 @@
        if (data) {
                block->page.zip.data = NULL;
                mutex_exit(&block->mutex);
@@ -3071,7 +3132,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
  
        UNIV_MEM_ASSERT_AND_FREE(block->frame, UNIV_PAGE_SIZE);
  }
-@@ -1751,7 +1881,11 @@
+@@ -1755,7 +1903,11 @@
        buf_pool_t*             buf_pool = buf_pool_from_bpage(bpage);
  
        ut_ad(bpage);
@@ -3084,7 +3145,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
        ut_ad(mutex_own(buf_page_get_mutex(bpage)));
  
        ut_a(buf_page_get_io_fix(bpage) == BUF_IO_NONE);
-@@ -1859,7 +1993,9 @@
+@@ -1863,7 +2015,9 @@
  
  #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
                mutex_exit(buf_page_get_mutex(bpage));
@@ -3095,7 +3156,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
                buf_print();
                buf_LRU_print();
                buf_validate();
-@@ -1880,17 +2016,17 @@
+@@ -1884,18 +2038,18 @@
                ut_a(bpage->zip.data);
                ut_a(buf_page_get_zip_size(bpage));
  
@@ -3111,6 +3172,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
 -                      page_zip_get_size(&bpage->zip));
 +                      page_zip_get_size(&bpage->zip), TRUE);
  
+               bpage->state = BUF_BLOCK_ZIP_FREE;
 -              buf_buddy_free(buf_pool, bpage, sizeof(*bpage));
 -              buf_pool_mutex_exit_allow(buf_pool);
 +              buf_buddy_free(buf_pool, bpage, sizeof(*bpage), TRUE);
@@ -3118,7 +3180,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
  
                UNIV_MEM_UNDESC(bpage);
                return(BUF_BLOCK_ZIP_FREE);
-@@ -1913,13 +2049,13 @@
+@@ -1918,13 +2072,13 @@
                        ut_ad(!bpage->in_flush_list);
                        ut_ad(!bpage->in_LRU_list);
                        mutex_exit(&((buf_block_t*) bpage)->mutex);
@@ -3135,7 +3197,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
                        mutex_enter(&((buf_block_t*) bpage)->mutex);
                        page_zip_set_size(&bpage->zip, 0);
                }
-@@ -1945,18 +2081,19 @@
+@@ -1950,18 +2104,19 @@
  void
  buf_LRU_block_free_hashed_page(
  /*===========================*/
@@ -3159,7 +3221,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
  }
  
  /**********************************************************************//**
-@@ -1983,7 +2120,8 @@
+@@ -1988,7 +2143,8 @@
        }
  
        if (adjust) {
@@ -3169,7 +3231,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
  
                if (ratio != buf_pool->LRU_old_ratio) {
                        buf_pool->LRU_old_ratio = ratio;
-@@ -1995,7 +2133,8 @@
+@@ -2000,7 +2156,8 @@
                        }
                }
  
@@ -3179,7 +3241,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
        } else {
                buf_pool->LRU_old_ratio = ratio;
        }
-@@ -2100,7 +2239,8 @@
+@@ -2105,7 +2262,8 @@
        ulint           new_len;
  
        ut_ad(buf_pool);
@@ -3189,7 +3251,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
  
        if (UT_LIST_GET_LEN(buf_pool->LRU) >= BUF_LRU_OLD_MIN_LEN) {
  
-@@ -2161,16 +2301,22 @@
+@@ -2166,16 +2324,22 @@
  
        ut_a(buf_pool->LRU_old_len == old_len);
  
@@ -3214,7 +3276,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
        UT_LIST_VALIDATE(unzip_LRU, buf_block_t, buf_pool->unzip_LRU,
                         ut_ad(ut_list_node_313->in_unzip_LRU_list
                               && ut_list_node_313->page.in_LRU_list));
-@@ -2184,7 +2330,8 @@
+@@ -2189,7 +2353,8 @@
                ut_a(buf_page_belongs_to_unzip_LRU(&block->page));
        }
  
@@ -3224,7 +3286,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
  }
  
  /**********************************************************************//**
-@@ -2220,7 +2367,8 @@
+@@ -2225,7 +2390,8 @@
        const buf_page_t*       bpage;
  
        ut_ad(buf_pool);
@@ -3234,7 +3296,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
  
        bpage = UT_LIST_GET_FIRST(buf_pool->LRU);
  
-@@ -2277,7 +2425,8 @@
+@@ -2282,7 +2448,8 @@
                bpage = UT_LIST_GET_NEXT(LRU, bpage);
        }
  
@@ -3307,7 +3369,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
        {&cache_last_read_mutex_key, "cache_last_read_mutex", 0},
        {&dict_foreign_err_mutex_key, "dict_foreign_err_mutex", 0},
        {&dict_sys_mutex_key, "dict_sys_mutex", 0},
-@@ -314,6 +318,7 @@
+@@ -313,6 +317,7 @@
        {&archive_lock_key, "archive_lock", 0},
  #  endif /* UNIV_LOG_ARCHIVE */
        {&btr_search_latch_key, "btr_search_latch", 0},
@@ -3318,7 +3380,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
 diff -ruN a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
 --- a/storage/innobase/handler/i_s.cc  2010-12-03 15:37:45.517105700 +0900
 +++ b/storage/innobase/handler/i_s.cc  2010-12-03 15:48:29.331024462 +0900
-@@ -1565,7 +1565,8 @@
+@@ -1563,7 +1563,8 @@
  
                buf_pool = buf_pool_from_array(i);
  
@@ -3328,7 +3390,7 @@ diff -ruN a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
  
                for (uint x = 0; x <= BUF_BUDDY_SIZES; x++) {
                        buf_buddy_stat_t*       buddy_stat;
-@@ -1595,7 +1596,8 @@
+@@ -1593,7 +1594,8 @@
                        }
                }
  
@@ -3341,7 +3403,7 @@ diff -ruN a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
 diff -ruN a/storage/innobase/ibuf/ibuf0ibuf.c b/storage/innobase/ibuf/ibuf0ibuf.c
 --- a/storage/innobase/ibuf/ibuf0ibuf.c        2010-12-03 15:48:03.068954202 +0900
 +++ b/storage/innobase/ibuf/ibuf0ibuf.c        2010-12-03 15:48:29.335988682 +0900
-@@ -3766,9 +3766,11 @@
+@@ -3821,9 +3821,11 @@
                ulint           fold = buf_page_address_fold(space, page_no);
                buf_pool_t*     buf_pool = buf_pool_get(space, page_no);
  
@@ -3461,7 +3523,7 @@ diff -ruN a/storage/innobase/include/buf0buddy.ic b/storage/innobase/include/buf
 diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
 --- a/storage/innobase/include/buf0buf.h       2010-12-03 15:22:36.327954660 +0900
 +++ b/storage/innobase/include/buf0buf.h       2010-12-03 15:48:29.343024683 +0900
-@@ -203,6 +203,20 @@
+@@ -205,6 +205,20 @@
  /*==========================*/
  
  /********************************************************************//**
@@ -3482,7 +3544,7 @@ diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0bu
  Creates the buffer pool.
  @return       own: buf_pool object, NULL if not enough memory or error */
  UNIV_INTERN
-@@ -832,6 +846,15 @@
+@@ -834,6 +848,15 @@
        const buf_page_t*       bpage)  /*!< in: pointer to control block */
        __attribute__((pure));
  
@@ -3498,7 +3560,7 @@ diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0bu
  /*********************************************************************//**
  Get the flush type of a page.
  @return       flush type */
-@@ -1313,7 +1336,7 @@
+@@ -1315,7 +1338,7 @@
        All these are protected by buf_pool->mutex. */
        /* @{ */
  
@@ -3507,7 +3569,7 @@ diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0bu
                                        /*!< based on state, this is a
                                        list node, protected either by
                                        buf_pool->mutex or by
-@@ -1341,6 +1364,10 @@
+@@ -1343,6 +1366,10 @@
                                        BUF_BLOCK_REMOVE_HASH or
                                        BUF_BLOCK_READY_IN_USE. */
  
@@ -3518,7 +3580,7 @@ diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0bu
  #ifdef UNIV_DEBUG
        ibool           in_flush_list;  /*!< TRUE if in buf_pool->flush_list;
                                        when buf_pool->flush_list_mutex is
-@@ -1433,11 +1460,11 @@
+@@ -1435,11 +1462,11 @@
                                        a block is in the unzip_LRU list
                                        if page.state == BUF_BLOCK_FILE_PAGE
                                        and page.zip.data != NULL */
@@ -3532,7 +3594,7 @@ diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0bu
        mutex_t         mutex;          /*!< mutex protecting this block:
                                        state (also protected by the buffer
                                        pool mutex), io_fix, buf_fix_count,
-@@ -1612,6 +1639,11 @@
+@@ -1614,6 +1641,11 @@
                                        pool instance, protects compressed
                                        only pages (of type buf_page_t, not
                                        buf_block_t */
@@ -3544,7 +3606,7 @@ diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0bu
        ulint           instance_no;    /*!< Array index of this buffer
                                        pool instance */
        ulint           old_pool_size;  /*!< Old pool size in bytes */
-@@ -1763,8 +1795,8 @@
+@@ -1765,8 +1797,8 @@
  /** Test if a buffer pool mutex is owned. */
  #define buf_pool_mutex_own(b) mutex_own(&b->mutex)
  /** Acquire a buffer pool mutex. */
@@ -3850,7 +3912,7 @@ diff -ruN a/storage/innobase/include/sync0sync.h b/storage/innobase/include/sync
  extern mysql_pfs_key_t        cache_last_read_mutex_key;
  extern mysql_pfs_key_t        dict_foreign_err_mutex_key;
  extern mysql_pfs_key_t        dict_sys_mutex_key;
-@@ -660,7 +664,7 @@
+@@ -668,7 +672,7 @@
  #define SYNC_TRX_SYS_HEADER   290
  #define       SYNC_PURGE_QUEUE        200
  #define SYNC_LOG              170
@@ -3859,7 +3921,7 @@ diff -ruN a/storage/innobase/include/sync0sync.h b/storage/innobase/include/sync
  #define SYNC_RECV             168
  #define       SYNC_WORK_QUEUE         162
  #define       SYNC_SEARCH_SYS_CONF    161     /* for assigning btr_search_enabled */
-@@ -670,8 +674,13 @@
+@@ -678,8 +682,13 @@
                                        SYNC_SEARCH_SYS, as memory allocation
                                        can call routines there! Otherwise
                                        the level is SYNC_MEM_HASH. */
@@ -3874,7 +3936,7 @@ diff -ruN a/storage/innobase/include/sync0sync.h b/storage/innobase/include/sync
  #define       SYNC_BUF_FLUSH_LIST     145     /* Buffer flush list mutex */
  #define SYNC_DOUBLEWRITE      140
  #define       SYNC_ANY_LATCH          135
-@@ -703,7 +712,7 @@
+@@ -711,7 +720,7 @@
                os_fast_mutex;  /*!< We use this OS mutex in place of lock_word
                                when atomic operations are not enabled */
  #endif
@@ -3886,7 +3948,7 @@ diff -ruN a/storage/innobase/include/sync0sync.h b/storage/innobase/include/sync
 diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
 --- a/storage/innobase/srv/srv0srv.c   2010-12-03 15:48:03.080956216 +0900
 +++ b/storage/innobase/srv/srv0srv.c   2010-12-03 15:48:29.355023766 +0900
-@@ -3101,7 +3101,7 @@
+@@ -3098,7 +3098,7 @@
                                                                level += log_sys->max_checkpoint_age
                                                                         - (lsn - oldest_modification);
                                                        }
@@ -3895,7 +3957,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
                                                        n_blocks++;
                                                }
  
-@@ -3187,7 +3187,7 @@
+@@ -3184,7 +3184,7 @@
                                                        found = TRUE;
                                                        break;
                                                }
@@ -3907,7 +3969,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
 diff -ruN a/storage/innobase/sync/sync0sync.c b/storage/innobase/sync/sync0sync.c
 --- a/storage/innobase/sync/sync0sync.c        2010-11-03 07:01:13.000000000 +0900
 +++ b/storage/innobase/sync/sync0sync.c        2010-12-03 15:48:29.358023890 +0900
-@@ -284,7 +284,7 @@
+@@ -285,7 +285,7 @@
        mutex->lock_word = 0;
  #endif
        mutex->event = os_event_create(NULL);
@@ -3916,7 +3978,7 @@ diff -ruN a/storage/innobase/sync/sync0sync.c b/storage/innobase/sync/sync0sync.
  #ifdef UNIV_DEBUG
        mutex->magic_n = MUTEX_MAGIC_N;
  #endif /* UNIV_DEBUG */
-@@ -463,6 +463,15 @@
+@@ -464,6 +464,15 @@
        mutex_t*        mutex,  /*!< in: mutex */
        ulint           n)      /*!< in: value to set */
  {
@@ -3932,7 +3994,7 @@ diff -ruN a/storage/innobase/sync/sync0sync.c b/storage/innobase/sync/sync0sync.
        volatile ulint* ptr;            /* declared volatile to ensure that
                                        the value is stored to memory */
        ut_ad(mutex);
-@@ -471,6 +480,7 @@
+@@ -472,6 +481,7 @@
  
        *ptr = n;               /* Here we assume that the write of a single
                                word in memory is atomic */
@@ -3940,7 +4002,7 @@ diff -ruN a/storage/innobase/sync/sync0sync.c b/storage/innobase/sync/sync0sync.
  }
  
  /******************************************************************//**
-@@ -1185,7 +1195,12 @@
+@@ -1234,7 +1244,12 @@
                        ut_error;
                }
                break;
@@ -3953,7 +4015,7 @@ diff -ruN a/storage/innobase/sync/sync0sync.c b/storage/innobase/sync/sync0sync.
        case SYNC_BUF_POOL:
                /* We can have multiple mutexes of this type therefore we
                can only check whether the greater than condition holds. */
-@@ -1203,7 +1218,8 @@
+@@ -1252,7 +1267,8 @@
                buffer block (block->mutex or buf_pool->zip_mutex). */
                if (!sync_thread_levels_g(array, level, FALSE)) {
                        ut_a(sync_thread_levels_g(array, level - 1, TRUE));
index 095c25af1cd46c807256f8691db92fdb850df8dc..6d81137fdb3405f540df7100d9e7e37054dddbd0 100644 (file)
@@ -350,7 +350,7 @@ diff -ruN a/storage/innobase/dict/dict0crea.c b/storage/innobase/dict/dict0crea.
 diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.c
 --- a/storage/innobase/dict/dict0dict.c        2010-12-03 15:48:03.040222428 +0900
 +++ b/storage/innobase/dict/dict0dict.c        2010-12-03 17:19:24.841947690 +0900
-@@ -756,7 +756,7 @@
+@@ -755,7 +755,7 @@
                print an error message and return without doing
                anything. */
                dict_update_statistics(table, TRUE /* only update stats
@@ -359,7 +359,7 @@ diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.
        }
  
        return(table);
-@@ -4310,6 +4310,289 @@
+@@ -4309,6 +4309,295 @@
  }
  
  /*********************************************************************//**
@@ -592,6 +592,8 @@ diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.
 +                      break;
 +              }
 +
++              btr_pcur_store_position(&pcur, &mtr);
++
 +              if (rec_get_deleted_flag(rec, 0)) {
 +                      /* don't count */
 +                      i--;
@@ -626,6 +628,10 @@ diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.
 +              rests--;
 +
 +next_rec:
++              mtr_commit(&mtr);
++              mtr_start(&mtr);
++              btr_pcur_restore_position(BTR_MODIFY_LEAF, &pcur, &mtr);
++
 +              btr_pcur_move_to_next_user_rec(&pcur, &mtr);
 +      }
 +      btr_pcur_close(&pcur);
@@ -649,7 +655,7 @@ diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.
  Calculates new estimates for table and index statistics. The statistics
  are used in query optimization. */
  UNIV_INTERN
-@@ -4317,10 +4600,11 @@
+@@ -4316,10 +4605,11 @@
  dict_update_statistics(
  /*===================*/
        dict_table_t*   table,          /*!< in/out: table */
@@ -662,7 +668,7 @@ diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.
  {
        dict_index_t*   index;
        ulint           sum_of_index_sizes      = 0;
-@@ -4337,6 +4621,27 @@
+@@ -4336,6 +4626,27 @@
                return;
        }
  
@@ -690,7 +696,7 @@ diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.
        /* Find out the sizes of the indexes and how many different values
        for the key they approximately have */
  
-@@ -4401,6 +4706,11 @@
+@@ -4400,6 +4711,11 @@
                index = dict_table_get_next_index(index);
        } while (index);
  
@@ -702,7 +708,7 @@ diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.
        index = dict_table_get_first_index(table);
  
        table->stat_n_rows = index->stat_n_diff_key_vals[
-@@ -4418,6 +4728,78 @@
+@@ -4417,6 +4733,78 @@
        dict_table_stats_unlock(table, RW_X_LATCH);
  }
  
@@ -781,7 +787,7 @@ diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.
  /**********************************************************************//**
  Prints info of a foreign key constraint. */
  static
-@@ -4495,7 +4877,8 @@
+@@ -4494,7 +4882,8 @@
  
        ut_ad(mutex_own(&(dict_sys->mutex)));
  
@@ -906,7 +912,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
  
  
  static char*  internal_innobase_data_file_path        = NULL;
-@@ -2407,6 +2408,8 @@
+@@ -2434,6 +2435,8 @@
                goto error;
        }
  
@@ -915,7 +921,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
        /* -------------- Log files ---------------------------*/
  
        /* The default dir for log files is the datadir of MySQL */
-@@ -5211,6 +5214,10 @@
+@@ -5236,6 +5239,10 @@
  
        error = row_insert_for_mysql((byte*) record, prebuilt);
  
@@ -926,7 +932,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
        /* Handle duplicate key errors */
        if (auto_inc_used) {
                ulint           err;
-@@ -5547,6 +5554,10 @@
+@@ -5572,6 +5579,10 @@
                }
        }
  
@@ -937,7 +943,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
        innodb_srv_conc_exit_innodb(trx);
  
        error = convert_error_code_to_mysql(error,
-@@ -5600,6 +5611,10 @@
+@@ -5625,6 +5636,10 @@
  
        error = row_update_for_mysql((byte*) record, prebuilt);
  
@@ -948,7 +954,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
        innodb_srv_conc_exit_innodb(trx);
  
        error = convert_error_code_to_mysql(
-@@ -5918,6 +5933,11 @@
+@@ -5943,6 +5958,11 @@
        case DB_SUCCESS:
                error = 0;
                table->status = 0;
@@ -960,7 +966,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
                break;
        case DB_RECORD_NOT_FOUND:
                error = HA_ERR_KEY_NOT_FOUND;
-@@ -6127,6 +6147,11 @@
+@@ -6152,6 +6172,11 @@
        case DB_SUCCESS:
                error = 0;
                table->status = 0;
@@ -972,7 +978,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
                break;
        case DB_RECORD_NOT_FOUND:
                error = HA_ERR_END_OF_FILE;
-@@ -8077,11 +8102,35 @@
+@@ -8094,11 +8119,35 @@
                        /* In sql_show we call with this flag: update
                        then statistics so that they are up-to-date */
  
@@ -1009,7 +1015,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
  
                        prebuilt->trx->op_info = "returning various info to MySQL";
                }
-@@ -8159,7 +8208,7 @@
+@@ -8176,7 +8225,7 @@
                are asked by MySQL to avoid locking. Another reason to
                avoid the call is that it uses quite a lot of CPU.
                See Bug#38185. */
@@ -1018,7 +1024,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
                    || !(flag & HA_STATUS_VARIABLE_EXTRA)) {
                        /* We do not update delete_length if no
                        locking is requested so the "old" value can
-@@ -11361,6 +11410,26 @@
+@@ -11385,6 +11434,26 @@
    "The number of index pages to sample when calculating statistics (default 8)",
    NULL, NULL, 8, 1, ~0ULL, 0);
  
@@ -1045,7 +1051,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
  static MYSQL_SYSVAR_BOOL(adaptive_hash_index, btr_search_enabled,
    PLUGIN_VAR_OPCMDARG,
    "Enable InnoDB adaptive hash index (enabled by default).  "
-@@ -11686,6 +11755,9 @@
+@@ -11710,6 +11779,9 @@
    MYSQL_SYSVAR(recovery_update_relay_log),
    MYSQL_SYSVAR(rollback_on_timeout),
    MYSQL_SYSVAR(stats_on_metadata),
@@ -1055,7 +1061,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
    MYSQL_SYSVAR(stats_sample_pages),
    MYSQL_SYSVAR(adaptive_hash_index),
    MYSQL_SYSVAR(stats_method),
-@@ -11755,7 +11827,10 @@
+@@ -11779,7 +11851,10 @@
  i_s_innodb_sys_columns,
  i_s_innodb_sys_fields,
  i_s_innodb_sys_foreign,
@@ -1077,8 +1083,8 @@ diff -ruN a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
 +#include "dict0dict.h" /* for dict_sys */
  }
  
- static const char plugin_author[] = "Innobase Oy";
-@@ -3457,6 +3458,221 @@
+ #define OK(expr)              \
+@@ -3455,6 +3456,221 @@
        STRUCT_FLD(__reserved1, NULL)
  };
  
@@ -1264,7 +1270,7 @@ diff -ruN a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
 +
 +      /* plugin author (for SHOW PLUGINS) */
 +      /* const char* */
-+      STRUCT_FLD(author, plugin_author),
++      STRUCT_FLD(author, "Percona"),
 +
 +      /* general descriptive text (for SHOW PLUGINS) */
 +      /* const char* */
@@ -1300,7 +1306,7 @@ diff -ruN a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
  /***********************************************************************
  */
  static ST_FIELD_INFO  i_s_innodb_rseg_fields_info[] =
-@@ -3619,3 +3835,347 @@
+@@ -3617,3 +3833,347 @@
        /* void* */
        STRUCT_FLD(__reserved1, NULL)
  };
@@ -1622,7 +1628,7 @@ diff -ruN a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
 +      STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
 +      STRUCT_FLD(info, &i_s_info),
 +      STRUCT_FLD(name, "INNODB_TABLE_STATS"),
-+      STRUCT_FLD(author, plugin_author),
++      STRUCT_FLD(author, "Percona"),
 +      STRUCT_FLD(descr, "InnoDB table statistics in memory"),
 +      STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
 +      STRUCT_FLD(init, i_s_innodb_table_stats_init),
@@ -1638,7 +1644,7 @@ diff -ruN a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
 +      STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
 +      STRUCT_FLD(info, &i_s_info),
 +      STRUCT_FLD(name, "INNODB_INDEX_STATS"),
-+      STRUCT_FLD(author, plugin_author),
++      STRUCT_FLD(author, "Percona"),
 +      STRUCT_FLD(descr, "InnoDB index statistics in memory"),
 +      STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
 +      STRUCT_FLD(init, i_s_innodb_index_stats_init),
@@ -1651,7 +1657,7 @@ diff -ruN a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
 diff -ruN a/storage/innobase/handler/i_s.h b/storage/innobase/handler/i_s.h
 --- a/storage/innobase/handler/i_s.h   2010-12-03 17:17:03.668953884 +0900
 +++ b/storage/innobase/handler/i_s.h   2010-12-03 17:19:24.882947826 +0900
-@@ -41,5 +41,8 @@
+@@ -43,5 +43,8 @@
  extern struct st_mysql_plugin   i_s_innodb_sys_foreign;
  extern struct st_mysql_plugin   i_s_innodb_sys_foreign_cols;
  extern struct st_mysql_plugin i_s_innodb_rseg;
@@ -1862,7 +1868,7 @@ diff -ruN a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0
 diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
 --- a/storage/innobase/include/srv0srv.h       2010-12-03 15:53:54.622036720 +0900
 +++ b/storage/innobase/include/srv0srv.h       2010-12-03 17:19:24.906953188 +0900
-@@ -214,6 +214,9 @@
+@@ -211,6 +211,9 @@
  extern ibool  srv_innodb_status;
  
  extern unsigned long long     srv_stats_sample_pages;
@@ -1930,7 +1936,7 @@ diff -ruN a/storage/innobase/row/row0ins.c b/storage/innobase/row/row0ins.c
 diff -ruN a/storage/innobase/row/row0merge.c b/storage/innobase/row/row0merge.c
 --- a/storage/innobase/row/row0merge.c 2010-11-03 07:01:13.000000000 +0900
 +++ b/storage/innobase/row/row0merge.c 2010-12-03 17:19:24.914955391 +0900
-@@ -2020,6 +2020,8 @@
+@@ -2019,6 +2019,8 @@
                "UPDATE SYS_INDEXES SET NAME=CONCAT('"
                TEMP_INDEX_PREFIX_STR "', NAME) WHERE ID = :indexid;\n"
                "COMMIT WORK;\n"
@@ -1961,7 +1967,7 @@ diff -ruN a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c
        }
  }
  
-@@ -2105,6 +2108,71 @@
+@@ -2098,6 +2101,71 @@
  }
  
  /*********************************************************************//**
@@ -1978,7 +1984,7 @@ diff -ruN a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c
 +      que_thr_t*      thr;
 +      ulint           err;
 +
-+      ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
++      //ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
 +
 +      trx->op_info = "try to insert rows to SYS_STATS";
 +
@@ -2033,7 +2039,7 @@ diff -ruN a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c
  Scans a table create SQL string and adds to the data dictionary
  the foreign key constraints declared in the string. This function
  should be called after the indexes for a table have been created.
-@@ -3024,7 +3092,7 @@
+@@ -3022,7 +3090,7 @@
        dict_table_autoinc_initialize(table, 1);
        dict_table_autoinc_unlock(table);
        dict_update_statistics(table, FALSE /* update even if stats are
@@ -2042,7 +2048,7 @@ diff -ruN a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c
  
        trx_commit_for_mysql(trx);
  
-@@ -3326,6 +3394,8 @@
+@@ -3324,6 +3392,8 @@
                           "       IF (SQL % NOTFOUND) THEN\n"
                           "               found := 0;\n"
                           "       ELSE\n"
@@ -2122,7 +2128,7 @@ diff -ruN a/storage/innobase/row/row0upd.c b/storage/innobase/row/row0upd.c
 diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
 --- a/storage/innobase/srv/srv0srv.c   2010-12-03 15:53:54.625288512 +0900
 +++ b/storage/innobase/srv/srv0srv.c   2010-12-03 17:19:24.922953561 +0900
-@@ -405,6 +405,9 @@
+@@ -398,6 +398,9 @@
  /* When estimating number of different key values in an index, sample
  this many index pages */
  UNIV_INTERN unsigned long long        srv_stats_sample_pages = 8;
index 2585ff8663014e09e777f1e5853e6a57991c47f2..ef9f63f0140b409690a8a6e927f9c1554ce38461 100644 (file)
@@ -16,7 +16,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
  static long long innobase_buffer_pool_size, innobase_log_file_size;
  
  /** Percentage of the buffer pool to reserve for 'old' blocks.
-@@ -2516,6 +2517,9 @@
+@@ -2543,6 +2544,9 @@
        srv_n_log_files = (ulint) innobase_log_files_in_group;
        srv_log_file_size = (ulint) innobase_log_file_size;
  
@@ -26,7 +26,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
  #ifdef UNIV_LOG_ARCHIVE
        srv_log_archive_on = (ulint) innobase_log_archive;
  #endif /* UNIV_LOG_ARCHIVE */
-@@ -11451,6 +11455,12 @@
+@@ -11475,6 +11479,12 @@
    "Maximum delay between polling for a spin lock (6 by default)",
    NULL, NULL, 6L, 0L, ~0L, 0);
  
@@ -39,7 +39,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
  static MYSQL_SYSVAR_ULONG(thread_concurrency, srv_thread_concurrency,
    PLUGIN_VAR_RQCMDARG,
    "Helps in performance tuning in heavily concurrent environments. Sets the maximum number of threads allowed inside InnoDB. Value 0 will disable the thread throttling.",
-@@ -11662,6 +11672,7 @@
+@@ -11686,6 +11696,7 @@
    MYSQL_SYSVAR(spin_wait_delay),
    MYSQL_SYSVAR(table_locks),
    MYSQL_SYSVAR(thread_concurrency),
@@ -50,7 +50,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
 diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
 --- a/storage/innobase/include/srv0srv.h       2010-12-03 15:37:45.543027751 +0900
 +++ b/storage/innobase/include/srv0srv.h       2010-12-03 15:42:11.571024631 +0900
-@@ -164,6 +164,8 @@
+@@ -161,6 +161,8 @@
  extern ulint  srv_mem_pool_size;
  extern ulint  srv_lock_table_size;
  
@@ -62,7 +62,7 @@ diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0sr
 diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
 --- a/storage/innobase/srv/srv0srv.c   2010-12-03 15:37:45.546023493 +0900
 +++ b/storage/innobase/srv/srv0srv.c   2010-12-03 15:42:11.574955879 +0900
-@@ -354,6 +354,7 @@
+@@ -347,6 +347,7 @@
  computer. Bigger computers need bigger values. Value 0 will disable the
  concurrency check. */
  
@@ -70,7 +70,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
  UNIV_INTERN ulong     srv_thread_concurrency  = 0;
  
  /* this mutex protects srv_conc data structures */
-@@ -1170,6 +1171,75 @@
+@@ -1143,6 +1144,75 @@
  /*********************************************************************//**
  Puts an OS thread to wait if there are too many concurrent threads
  (>= srv_thread_concurrency) inside InnoDB. The threads wait in a FIFO queue. */
@@ -146,7 +146,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
  UNIV_INTERN
  void
  srv_conc_enter_innodb(
-@@ -1200,6 +1270,13 @@
+@@ -1177,6 +1247,13 @@
                return;
        }
  
@@ -160,7 +160,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
        os_fast_mutex_lock(&srv_conc_mutex);
  retry:
        if (trx->declared_to_be_inside_innodb) {
-@@ -1345,6 +1422,14 @@
+@@ -1330,6 +1407,14 @@
        }
  
        ut_ad(srv_conc_n_threads >= 0);
@@ -175,7 +175,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
  
        os_fast_mutex_lock(&srv_conc_mutex);
  
-@@ -1378,6 +1463,13 @@
+@@ -1363,6 +1448,13 @@
                return;
        }
  
index 49815e0b73380fba935ecdf7e294cf8235cdc9bd..f30c52ebfa85f8eb4f8cee2b9e03a6293c60c71a 100644 (file)
@@ -18,7 +18,7 @@ diff -ruN /dev/null b/patch_info/log_connection_error.patch
 diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
 --- a/sql/mysqld.cc    2011-04-09 18:48:53.000000000 +0400
 +++ b/sql/mysqld.cc    2011-04-09 18:48:54.000000000 +0400
-@@ -5044,6 +5044,10 @@
+@@ -5040,6 +5040,10 @@
  
      DBUG_PRINT("error",("Too many connections"));
      close_connection(thd, ER_CON_COUNT_ERROR);
@@ -29,7 +29,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
      delete thd;
      DBUG_VOID_RETURN;
    }
-@@ -5424,6 +5428,10 @@
+@@ -5420,6 +5424,10 @@
      if (!(thd->net.vio= vio_new_win32pipe(hConnectedPipe)) ||
        my_net_init(&thd->net, thd->net.vio))
      {
@@ -40,7 +40,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
        close_connection(thd, ER_OUT_OF_RESOURCES);
        delete thd;
        continue;
-@@ -5619,6 +5627,10 @@
+@@ -5615,6 +5623,10 @@
                                                     event_conn_closed)) ||
                          my_net_init(&thd->net, thd->net.vio))
      {
index 92fa4ad0b7e25359526cf5940c1ebf177103c815..d988887c16f30ef6b0ab8144731cc5b4c6b7451c 100644 (file)
@@ -21,7 +21,7 @@ diff -ruN /dev/null b/patch_info/log_warnings_suppress.patch
 diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
 --- a/sql/mysqld.cc    2011-04-09 18:48:59.000000000 +0400
 +++ b/sql/mysqld.cc    2011-04-09 18:48:59.000000000 +0400
-@@ -627,6 +627,8 @@
+@@ -623,6 +623,8 @@
  SHOW_COMP_OPTION have_crypt, have_compress;
  SHOW_COMP_OPTION have_profiling;
  
@@ -33,7 +33,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
 diff -ruN a/sql/mysqld.h b/sql/mysqld.h
 --- a/sql/mysqld.h     2011-04-09 18:48:58.000000000 +0400
 +++ b/sql/mysqld.h     2011-04-09 18:48:59.000000000 +0400
-@@ -227,6 +227,8 @@
+@@ -228,6 +228,8 @@
  extern TYPELIB thread_handling_typelib;
  extern my_decimal decimal_zero;
  
@@ -45,7 +45,7 @@ diff -ruN a/sql/mysqld.h b/sql/mysqld.h
 diff -ruN a/sql/sql_class.cc b/sql/sql_class.cc
 --- a/sql/sql_class.cc 2011-04-09 18:48:50.000000000 +0400
 +++ b/sql/sql_class.cc 2011-04-09 18:48:59.000000000 +0400
-@@ -4579,7 +4579,7 @@
+@@ -4575,7 +4575,7 @@
                            ER_BINLOG_UNSAFE_STATEMENT,
                            ER(ER_BINLOG_UNSAFE_STATEMENT),
                            ER(LEX::binlog_stmt_unsafe_errcode[unsafe_type]));
@@ -68,7 +68,7 @@ diff -ruN a/sql/sql_class.h b/sql/sql_class.h
 diff -ruN a/sql/sys_vars.cc b/sql/sys_vars.cc
 --- a/sql/sys_vars.cc  2011-04-09 18:48:55.000000000 +0400
 +++ b/sql/sys_vars.cc  2011-04-09 18:48:59.000000000 +0400
-@@ -1434,6 +1434,15 @@
+@@ -1470,6 +1470,15 @@
         READ_ONLY GLOBAL_VAR(mysqld_port), CMD_LINE(REQUIRED_ARG, 'P'),
         VALID_RANGE(0, UINT_MAX32), DEFAULT(0), BLOCK_SIZE(1));
  
index 3c36315544d99eff018a03d00b8a13a1066305ca..93fe00b2e0e2541ec0a8d755e7757f11a227f18f 100644 (file)
@@ -20,7 +20,7 @@ diff -ruN /dev/null b/patch_info/microsec_process.info
 diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc
 --- a/sql/sql_show.cc  2010-12-02 19:22:40.054024541 +0900
 +++ b/sql/sql_show.cc  2010-12-02 20:41:41.622941425 +0900
-@@ -1883,7 +1883,8 @@
+@@ -1890,7 +1890,8 @@
    TABLE *table= tables->table;
    CHARSET_INFO *cs= system_charset_info;
    char *user;
@@ -30,7 +30,7 @@ diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc
    DBUG_ENTER("fill_process_list");
  
    user= thd->security_ctx->master_access & PROCESS_ACL ?
-@@ -1967,6 +1968,10 @@
+@@ -1974,6 +1975,10 @@
        }
        mysql_mutex_unlock(&tmp->LOCK_thd_data);
  
@@ -41,7 +41,7 @@ diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc
        if (schema_table_store_record(thd, table))
        {
          mysql_mutex_unlock(&LOCK_thread_count);
-@@ -7268,6 +7273,8 @@
+@@ -7409,6 +7414,8 @@
    {"STATE", 64, MYSQL_TYPE_STRING, 0, 1, "State", SKIP_OPEN_TABLE},
    {"INFO", PROCESS_LIST_INFO_WIDTH, MYSQL_TYPE_STRING, 0, 1, "Info",
     SKIP_OPEN_TABLE},
index ec57b1a3ab165a36967463809c5db11a84cd36af..9ba40e7c7901c0143688cdf46f31782bd6670650 100644 (file)
@@ -35,13 +35,13 @@ Summary(ru.UTF-8):  MySQL - быстрый SQL-сервер
 Summary(uk.UTF-8):     MySQL - швидкий SQL-сервер
 Summary(zh_CN.UTF-8):  MySQL数据库服务器
 Name:          mysql
-Version:       5.5.11
+Version:       5.5.13
 Release:       1
 License:       GPL + MySQL FLOSS Exception
 Group:         Applications/Databases
 # Source0Download: http://dev.mysql.com/downloads/mysql/5.5.html#downloads
 Source0:       http://vesta.informatik.rwth-aachen.de/mysql/Downloads/MySQL-5.5/%{name}-%{version}.tar.gz
-# Source0-md5: befa4e0d0aa95be6c8f6f143ae3b0641
+# Source0-md5: f0e519e90ee7c00fceb0730edf859d7b
 Source100:     http://www.sphinxsearch.com/downloads/sphinx-0.9.9.tar.gz
 # Source100-md5:       7b9b618cb9b378f949bb1b91ddcc4f54
 Source1:       %{name}.init
@@ -123,6 +123,9 @@ Patch144:   mysql_remove_eol_carret.patch
 Patch145:      processlist_row_stats.patch
 Patch146:      innodb_expand_fast_index_creation.patch
 Patch147:      innodb_bug60788.patch
+Patch148:      start-stop-messages.patch
+Patch149:      file-contents.patch
+Patch150:      slave_timeout_fix.patch
 # </percona>
 URL:           http://www.mysql.com/products/community/
 BuildRequires: bison
@@ -591,9 +594,7 @@ mv sphinx-*/mysqlse storage/sphinx
 %patch133 -p1
 %patch134 -p1
 %patch135 -p1
-%ifnarch i386 alpha sparc ppc
 %patch136 -p1
-%endif
 %patch137 -p1
 %patch138 -p1
 %patch139 -p1
@@ -605,6 +606,9 @@ mv sphinx-*/mysqlse storage/sphinx
 %patch145 -p1
 %patch146 -p1
 %patch147 -p1
+%patch148 -p1
+%patch149 -p1
+%patch150 -p1
 # </percona>
 
 # to get these files rebuild
index 794019dc139900e45ce3d3ae63f893d645571c3a..ae58526f5bf1a86e00c3c54c6c94b7938f9ddc68 100644 (file)
@@ -8,7 +8,7 @@
 diff -ruN a/client/client_priv.h b/client/client_priv.h
 --- a/client/client_priv.h     2010-11-03 07:01:14.000000000 +0900
 +++ b/client/client_priv.h     2010-12-03 13:39:32.317046060 +0900
-@@ -55,6 +55,7 @@
+@@ -58,6 +58,7 @@
    OPT_MYSQL_LOCK_DIRECTORY,
    OPT_USE_THREADS,
    OPT_IMPORT_USE_THREADS,
@@ -16,9 +16,8 @@ diff -ruN a/client/client_priv.h b/client/client_priv.h
    OPT_MYSQL_NUMBER_OF_QUERY,
    OPT_IGNORE_TABLE,OPT_INSERT_IGNORE,OPT_SHOW_WARNINGS,OPT_DROP_DATABASE,
    OPT_TZ_UTC, OPT_CREATE_SLAP_SCHEMA,
-diff -ruN a/client/mysqldump.c b/client/mysqldump.c
---- a/client/mysqldump.c       2010-11-03 07:01:14.000000000 +0900
-+++ b/client/mysqldump.c       2010-12-03 13:44:55.000069761 +0900
+--- mysql-5.5.9/client/mysqldump.c~    2011-03-10 20:05:49.000000000 +0200
++++ mysql-5.5.9/client/mysqldump.c     2011-03-10 20:19:55.962339580 +0200
 @@ -101,7 +101,7 @@
                  opt_dump_triggers= 0, opt_routines=0, opt_tz_utc=1,
                  opt_slave_apply= 0, 
@@ -38,25 +37,39 @@ diff -ruN a/client/mysqldump.c b/client/mysqldump.c
    {"lines-terminated-by", OPT_LTB,
     "Lines in the output file are terminated by the given string.",
     &lines_terminated, &lines_terminated, 0, GET_STR,
-@@ -2308,13 +2311,21 @@
-       /* Make an sql-file, if path was given iow. option -T was given */
+@@ -2297,21 +2297,35 @@
        char buff[20+FN_REFLEN];
        MYSQL_FIELD *field;
-+   
 +      my_bool old_ignore_errors=ignore_errors;
 +      //fprintf(stderr, "ignore create table %d\n", opt_ignore_show_create_table_error);
 +      if (opt_ignore_show_create_table_error)
 +         ignore_errors=1;
++
        my_snprintf(buff, sizeof(buff), "show create table %s", result_table);
  
-       if (switch_character_set_results(mysql, "binary") ||
-           mysql_query_with_error_report(mysql, &result, buff) ||
-           switch_character_set_results(mysql, default_charset))
-+      {
-+        ignore_errors=old_ignore_errors;
+       if (opt_set_charset)  /* Was forced to false if server is too old. */
+       {
+         if (switch_character_set_results(mysql, "binary") != 0)
++       {
++         ignore_errors=old_ignore_errors;
+           DBUG_RETURN(0);
++       }
+       }
+       if (mysql_query_with_error_report(mysql, &result, buff) != 0)
++       {
++         ignore_errors=old_ignore_errors;
          DBUG_RETURN(0);
-+      }
++       }
  
-       if (path)
+       if (opt_set_charset)  /* Was forced to false if server is too old. */
        {
+         if (switch_character_set_results(mysql, default_charset) != 0)
++       {
++         ignore_errors=old_ignore_errors;
+           DBUG_RETURN(0);
++       }
+       }
+       if (path)
index 8efb37b7e469d6a9867a24d856773cb14a94777a..45f7ee572f2c98b200c23369cdb744ec412255c8 100644 (file)
@@ -8,7 +8,7 @@
 diff -ruN a/client/client_priv.h b/client/client_priv.h
 --- a/client/client_priv.h     2011-04-09 18:48:54.000000000 +0400
 +++ b/client/client_priv.h     2011-04-09 18:49:03.000000000 +0400
-@@ -86,6 +86,7 @@
+@@ -87,6 +87,7 @@
    OPT_SYSLOG,
  #endif
    OPT_PLUGIN_DIR,
index ac219cfc6d2ef0cf8fcc1a58d4a016f8d719e119..8ccf75108e569e34d5a494a5fbd0f682d82cab31 100644 (file)
@@ -8,7 +8,7 @@
 diff -ruN a/client/client_priv.h b/client/client_priv.h
 --- a/client/client_priv.h     2011-04-09 18:48:18.000000000 +0400
 +++ b/client/client_priv.h     2011-04-09 18:48:54.000000000 +0400
-@@ -82,6 +82,9 @@
+@@ -83,6 +83,9 @@
    OPT_DEBUG_INFO, OPT_DEBUG_CHECK, OPT_COLUMN_TYPES, OPT_ERROR_LOG_FILE,
    OPT_WRITE_BINLOG, OPT_DUMP_DATE,
    OPT_INIT_COMMAND,
index 5bdbaa3f4b404fcb38b16dbc58950514a142cfc7..214c5cd771e215b68fb8ac46045f9389c0fc3620 100644 (file)
@@ -20,7 +20,7 @@ diff -ruN /dev/null b/patch_info/optimizer_fix.info
 diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
 --- a/sql/mysqld.cc    2010-12-02 19:22:40.027024953 +0900
 +++ b/sql/mysqld.cc    2010-12-02 20:51:50.811356434 +0900
-@@ -429,6 +429,7 @@
+@@ -425,6 +425,7 @@
  uint    opt_debug_sync_timeout= 0;
  #endif /* defined(ENABLED_DEBUG_SYNC) */
  my_bool opt_old_style_user_limits= 0, trust_function_creators= 0;
@@ -129,7 +129,7 @@ diff -ruN a/sql/opt_range.cc b/sql/opt_range.cc
 diff -ruN a/sql/sql_select.cc b/sql/sql_select.cc
 --- a/sql/sql_select.cc        2010-11-03 07:01:14.000000000 +0900
 +++ b/sql/sql_select.cc        2010-12-02 20:47:55.813953789 +0900
-@@ -2615,6 +2615,11 @@
+@@ -2619,6 +2619,11 @@
        table->reginfo.impossible_range=1;
        DBUG_RETURN(0);
      }
@@ -144,7 +144,7 @@ diff -ruN a/sql/sql_select.cc b/sql/sql_select.cc
 diff -ruN a/sql/sys_vars.cc b/sql/sys_vars.cc
 --- a/sql/sys_vars.cc  2010-12-02 20:31:56.208023606 +0900
 +++ b/sql/sys_vars.cc  2010-12-02 21:17:44.618120277 +0900
-@@ -2144,6 +2144,12 @@
+@@ -2180,6 +2180,12 @@
         VALID_RANGE(1, IF_WIN(INT_MAX32/1000, LONG_TIMEOUT)),
         DEFAULT(NET_WAIT_TIMEOUT), BLOCK_SIZE(1));
  
index ee622cfda5640603db561d50f1f296c161471d29..9ec3a53224bf5fe2dd5b4313d615ff16ef92108a 100644 (file)
@@ -8,12 +8,13 @@
 diff -ruN a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh
 --- a/scripts/mysql_install_db.sh       2009-08-08 09:20:07.000000000 +0000
 +++ b/scripts/mysql_install_db.sh       2009-08-08 09:29:23.000000000 +0000
-@@ -475,6 +475,8 @@
+@@ -475,6 +475,9 @@
    echo
    echo "Please report any problems with the $scriptdir/mysqlbug script!"
    echo
-+  echo "For commercial support please contact Percona at http://www.percona.com/support/"
-+  echo
++  echo "Percona recommends that all production deployments be protected with a support"
++  echo "contract (http://www.percona.com/mysql-suppport/) to ensure the highest uptime,"
++  echo "be eligible for hot fixes, and boost your team's productivity."
  fi
  
  exit 0
index f34909faaf33be53e7f58d0abbee152c53430062..4ce9632f70ed9c8db6476414cb79022d89464768 100644 (file)
@@ -8,7 +8,7 @@
 diff -ruN a/sql/sql_class.cc b/sql/sql_class.cc
 --- a/sql/sql_class.cc 2011-03-09 17:07:26.221709282 +0200
 +++ b/sql/sql_class.cc 2011-03-09 17:07:44.900164285 +0200
-@@ -2022,6 +2022,7 @@
+@@ -2017,6 +2017,7 @@
  
    thd->sent_row_count++;
    thd->sent_row_count_2++;
@@ -19,7 +19,7 @@ diff -ruN a/sql/sql_class.cc b/sql/sql_class.cc
 diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc
 --- a/sql/sql_show.cc  2011-03-09 17:07:26.251706801 +0200
 +++ b/sql/sql_show.cc  2011-03-09 17:07:44.904163954 +0200
-@@ -1759,7 +1759,8 @@
+@@ -1766,7 +1766,8 @@
  
  /****************************************************************************
    Return info about all processes
@@ -29,7 +29,7 @@ diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc
  ****************************************************************************/
  
  class thread_info :public ilink {
-@@ -1777,6 +1778,7 @@
+@@ -1784,6 +1785,7 @@
    uint   command;
    const char *user,*host,*db,*proc_info,*state_info;
    CSET_STRING query_string;
@@ -37,7 +37,7 @@ diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc
  };
  
  #ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
-@@ -1829,6 +1831,15 @@
+@@ -1836,6 +1838,15 @@
    field->maybe_null=1;
    field_list.push_back(field=new Item_empty_string("Info",max_query_length));
    field->maybe_null=1;
@@ -53,7 +53,7 @@ diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc
    if (protocol->send_result_set_metadata(&field_list,
                              Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
      DBUG_VOID_RETURN;
-@@ -1882,6 +1893,9 @@
+@@ -1889,6 +1900,9 @@
            thd_info->query_string=
              CSET_STRING(q, q ? length : 0, tmp->query_charset());
          }
@@ -63,7 +63,7 @@ diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc
          mysql_mutex_unlock(&tmp->LOCK_thd_data);
          thd_info->start_time= tmp->start_time;
          thread_infos.append(thd_info);
-@@ -1910,6 +1924,9 @@
+@@ -1917,6 +1931,9 @@
      protocol->store(thd_info->state_info, system_charset_info);
      protocol->store(thd_info->query_string.str(),
                      thd_info->query_string.charset());
@@ -73,7 +73,7 @@ diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc
      if (protocol->write())
        break; /* purecov: inspected */
    }
-@@ -2020,6 +2037,15 @@
+@@ -2027,6 +2044,15 @@
        table->field[8]->store(((tmp->start_utime ?
                                 now_utime - tmp->start_utime : 0)/ 1000));
  
@@ -89,7 +89,7 @@ diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc
        if (schema_table_store_record(thd, table))
        {
          mysql_mutex_unlock(&LOCK_thread_count);
-@@ -7941,6 +7967,12 @@
+@@ -8082,6 +8108,12 @@
     SKIP_OPEN_TABLE},
    {"TIME_MS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG,
     0, 0, "Time_ms", SKIP_OPEN_TABLE},
index 8b3132c5e60ab24efdb446f61b57afebb289e0e1..94bccb126a3dbdca49d9d3e7946784cf2647e136 100644 (file)
@@ -27,7 +27,7 @@ diff -ruN /dev/null b/patch_info/query_cache_enhance.patch
 diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
 --- a/sql/mysqld.cc    2011-04-09 18:48:50.000000000 +0400
 +++ b/sql/mysqld.cc    2011-04-09 18:48:53.000000000 +0400
-@@ -903,6 +903,7 @@
+@@ -899,6 +899,7 @@
  #endif
  #ifdef HAVE_QUERY_CACHE
  ulong query_cache_min_res_unit= QUERY_CACHE_MIN_RESULT_DATA_SIZE;
@@ -464,7 +464,7 @@ diff -ruN a/sql/sql_class.h b/sql/sql_class.h
  
  class Reprepare_observer;
  class Relay_log_info;
-@@ -765,6 +768,9 @@
+@@ -760,6 +763,9 @@
      statement lifetime. FIXME: must be const
    */
     ulong id;
@@ -477,7 +477,7 @@ diff -ruN a/sql/sql_class.h b/sql/sql_class.h
 diff -ruN a/sql/sys_vars.cc b/sql/sys_vars.cc
 --- a/sql/sys_vars.cc  2011-04-09 18:48:50.000000000 +0400
 +++ b/sql/sys_vars.cc  2011-04-09 18:48:53.000000000 +0400
-@@ -1750,6 +1750,11 @@
+@@ -1786,6 +1786,11 @@
         NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
         ON_UPDATE(fix_query_cache_size));
  
index b826249925d96331cc66439aacb78a9112c923c8..65845255e3cf981e7a0f89d8540b472eae184443 100644 (file)
@@ -25,7 +25,7 @@ diff -ruN a/CMakeLists.txt b/CMakeLists.txt
 diff -ruN a/include/mysql_com.h b/include/mysql_com.h
 --- a/include/mysql_com.h      2011-03-31 17:36:18.000000000 +0400
 +++ b/include/mysql_com.h      2011-04-10 11:28:51.000000000 +0400
-@@ -137,10 +137,11 @@
+@@ -141,10 +141,11 @@
  #define REFRESH_FAST          32768   /* Intern flag */
  
  /* RESET (remove all queries) from query cache */
@@ -78,7 +78,7 @@ diff -ruN a/sql/CMakeLists.txt b/sql/CMakeLists.txt
 diff -ruN a/sql/handler.h b/sql/handler.h
 --- a/sql/handler.h    2011-04-09 19:11:54.000000000 +0400
 +++ b/sql/handler.h    2011-04-10 11:28:51.000000000 +0400
-@@ -578,6 +578,7 @@
+@@ -580,6 +580,7 @@
    SCH_PROFILES,
    SCH_REFERENTIAL_CONSTRAINTS,
    SCH_PROCEDURES,
@@ -109,7 +109,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
  #ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
  #include "../storage/perfschema/pfs_server.h"
  #endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */
-@@ -610,7 +612,7 @@
+@@ -606,7 +608,7 @@
  MY_LOCALE *my_default_lc_messages;
  MY_LOCALE *my_default_lc_time_names;
  
@@ -118,7 +118,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
  SHOW_COMP_OPTION have_geometry, have_rtree_keys;
  SHOW_COMP_OPTION have_crypt, have_compress;
  SHOW_COMP_OPTION have_profiling;
-@@ -911,6 +913,10 @@
+@@ -907,6 +909,10 @@
  my_bool opt_enable_shared_memory;
  HANDLE smem_event_connect_request= 0;
  #endif
@@ -129,7 +129,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
  
  my_bool opt_use_ssl  = 0;
  char *opt_ssl_ca= NULL, *opt_ssl_capath= NULL, *opt_ssl_cert= NULL,
-@@ -1482,6 +1488,9 @@
+@@ -1478,6 +1484,9 @@
    my_free(opt_bin_logname);
    bitmap_free(&temp_pool);
    free_max_user_conn();
@@ -139,7 +139,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
  #ifdef HAVE_REPLICATION
    end_slave_list();
  #endif
-@@ -3964,6 +3973,9 @@
+@@ -3960,6 +3969,9 @@
    if (!DEFAULT_ERRMSGS[0][0])
      unireg_abort(1);  
  
@@ -149,7 +149,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
    /* We have to initialize the storage engines before CSV logging */
    if (ha_init())
    {
-@@ -6852,6 +6864,11 @@
+@@ -6848,6 +6860,11 @@
  #else
    have_query_cache=SHOW_OPTION_NO;
  #endif
@@ -178,12 +178,8 @@ diff -ruN a/sql/mysqld.h b/sql/mysqld.h
 diff -ruN /dev/null b/sql/query_response_time.cc
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
 +++ b/sql/query_response_time.cc       2011-04-10 00:27:11.000000000 +0400
-@@ -0,0 +1,367 @@
+@@ -0,0 +1,310 @@
 +#include "mysql_version.h"
-+#ifdef __FreeBSD__
-+#include <sys/types.h>
-+#include <machine/atomic.h>
-+#endif // __FreeBSD__
 +#include "my_global.h"
 +#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION
 +#include "mysql_com.h"
@@ -337,98 +333,39 @@ diff -ruN /dev/null b/sql/query_response_time.cc
 +  }
 +  buffer[result_length]= 0;
 +}
-+#ifdef __x86_64__
-+typedef uint64 TimeCounter;
-+void add_time_atomic(TimeCounter* counter, uint64 time)
-+{
-+  __sync_fetch_and_add(counter,time);  
-+}
-+#endif // __x86_64__
-+#ifdef __i386__
-+inline uint32 get_high(uint64 value)
-+{
-+  return ((value >> 32) << 32);
-+}
-+inline uint32 get_low(uint64 value)
-+{
-+  return ((value << 32) >> 32);
-+}
-+#ifdef __FreeBSD__
-+inline bool compare_and_swap(volatile uint32 *target, uint32 old, uint32 new_value)
-+{
-+  return atomic_cmpset_32(target,old,new_value);
-+}
-+#else // __FreeBSD__
-+inline bool compare_and_swap(volatile uint32* target, uint32 old, uint32 new_value)
-+{
-+  return __sync_bool_compare_and_swap(target,old,new_value);
-+}
-+#endif // __FreeBSD__
-+class TimeCounter
++
++class time_collector
 +{
 +public:
-+  TimeCounter& operator=(uint64 time)
++  time_collector(utility& u) : m_utility(&u)
 +  {
-+    this->m_high= get_high(time);
-+    this->m_low=  get_low(time);
-+    return *this;
++    my_atomic_rwlock_init(&time_collector_lock);
 +  }
-+  operator uint64() const
++  ~time_collector()
 +  {
-+    return ((static_cast<uint64>(m_high) << 32) + static_cast<uint64>(m_low));
++    my_atomic_rwlock_destroy(&time_collector_lock);
 +  }
-+  void add(uint64 time)
++  uint32 count(uint index) const
 +  {
-+    uint32 time_high = get_high(time);
-+    uint32 time_low  = get_low(time);
-+    uint64 time_low64= time_low;
-+    while(true)
-+    {
-+      uint32 old_low= this->m_low;
-+      uint64 old_low64= old_low;
-+
-+      uint64 new_low64= old_low64 + time_low64;
-+      uint32 new_low= (get_low(new_low64));
-+      bool add_high= (get_high(new_low64) != 0);
-+
-+      if(!compare_and_swap(&m_low,old_low,new_low))
-+      {
-+      continue;
-+      }
-+      if(add_high)
-+      {
-+      ++time_high;
-+      }
-+      if(time_high > 0)
-+      {
-+        __sync_fetch_and_add(&m_high,time_high);
-+      }
-+      break;
-+    }
++    my_atomic_rwlock_rdlock(&time_collector_lock);
++    uint32 result= my_atomic_load32((volatile int32*)&m_count[index]);
++    my_atomic_rwlock_rdunlock(&time_collector_lock);
++    return result;
 +  }
-+private:
-+  uint32 m_low;
-+  uint32 m_high;
-+};
-+void add_time_atomic(TimeCounter* counter, uint64 time)
-+{
-+  counter->add(time);
-+}
-+#endif // __i386__
-+
-+class time_collector
-+{
-+public:
-+  time_collector(utility& u) : m_utility(&u)
++  uint64 total(uint index) const
 +  {
++    my_atomic_rwlock_rdlock(&time_collector_lock);
++    uint64 result= my_atomic_load64((volatile int64*)&m_total[index]);
++    my_atomic_rwlock_rdunlock(&time_collector_lock);
++    return result;
 +  }
-+  uint32 count(uint index) const { return m_count[index]; }
-+  uint64 total(uint index) const { return m_total[index]; }
 +public:
 +  void flush()
 +  {
-+    memset(&m_count,0,sizeof(m_count));
++    my_atomic_rwlock_wrlock(&time_collector_lock);
++    memset((void*)&m_count,0,sizeof(m_count));
 +    memset((void*)&m_total,0,sizeof(m_total));
++    my_atomic_rwlock_wrunlock(&time_collector_lock);
 +  }
 +  void collect(uint64 time)
 +  {
@@ -437,16 +374,22 @@ diff -ruN /dev/null b/sql/query_response_time.cc
 +    {
 +      if(m_utility->bound(i) > time)
 +      {
-+        __sync_fetch_and_add(&(m_count[i]),(uint32)1);
-+        add_time_atomic(&(m_total[i]),time);
++        my_atomic_rwlock_wrlock(&time_collector_lock);
++        my_atomic_add32((volatile int32*)(&m_count[i]), 1);
++        my_atomic_add64((volatile int64*)(&m_total[i]), time);
++        my_atomic_rwlock_wrunlock(&time_collector_lock);
 +        break;
 +      }
 +    }
 +  }
 +private:
 +  utility* m_utility;
-+  uint32   m_count[OVERALL_POWER_COUNT + 1];
-+  TimeCounter m_total[OVERALL_POWER_COUNT + 1];
++  /* The lock for atomic operations on m_count and m_total.  Only actually
++  used on architectures that do not have atomic implementation of atomic
++  operations. */
++  my_atomic_rwlock_t time_collector_lock;
++  volatile uint32   m_count[OVERALL_POWER_COUNT + 1];
++  volatile uint64   m_total[OVERALL_POWER_COUNT + 1];
 +};
 +
 +class collector
@@ -773,7 +716,7 @@ diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc
  #include "lock.h"                           // MYSQL_OPEN_IGNORE_FLUSH
  #include "debug_sync.h"
  #include "datadict.h"   // dd_frm_type()
-@@ -7689,6 +7690,14 @@
+@@ -7830,6 +7831,14 @@
  
  */
  
@@ -788,7 +731,7 @@ diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc
  ST_SCHEMA_TABLE schema_tables[]=
  {
    {"CHARACTER_SETS", charsets_fields_info, create_schema_table, 
-@@ -7742,6 +7751,13 @@
+@@ -7883,6 +7892,13 @@
     1, 9, 0, OPTIMIZE_I_S_TABLE|OPEN_TABLE_ONLY},
    {"ROUTINES", proc_fields_info, create_schema_table, 
     fill_schema_proc, make_proc_old_format, 0, -1, -1, 0, 0},
@@ -861,7 +804,7 @@ diff -ruN a/sql/sys_vars.cc b/sql/sys_vars.cc
  /*
    This forward declaration is needed because including sql_base.h
    causes further includes.  [TODO] Eliminate this forward declaration
-@@ -1801,6 +1802,26 @@
+@@ -1837,6 +1838,26 @@
         DEFAULT(FALSE));
  #endif /* HAVE_QUERY_CACHE */
  
index 34c2fbd0dd8d5f7b616748a74d4f428e428ea164..a68c6815364f896435aa106f53369509661d8907 100644 (file)
@@ -29,7 +29,7 @@ diff -ruN a/sql/lex.h b/sql/lex.h
 diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
 --- a/sql/mysqld.cc    2011-04-10 11:29:05.000000000 +0400
 +++ b/sql/mysqld.cc    2011-04-10 11:29:06.000000000 +0400
-@@ -3075,6 +3075,7 @@
+@@ -3071,6 +3071,7 @@
    {"show_relaylog_events", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_RELAYLOG_EVENTS]), SHOW_LONG_STATUS},
    {"show_slave_hosts",     (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_SLAVE_HOSTS]), SHOW_LONG_STATUS},
    {"show_slave_status",    (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_SLAVE_STAT]), SHOW_LONG_STATUS},
index 6862bafbf63d81288e256a7a633382db9ca465fc..1aca811ee793307a8fcf84ac05c13fe37e86b3d8 100644 (file)
@@ -8,7 +8,7 @@
 diff -ruN a/sql/handler.h b/sql/handler.h
 --- a/sql/handler.h    2011-04-09 19:11:53.000000000 +0400
 +++ b/sql/handler.h    2011-04-10 12:16:43.000000000 +0400
-@@ -567,6 +567,7 @@
+@@ -569,6 +569,7 @@
    SCH_EVENTS,
    SCH_FILES,
    SCH_GLOBAL_STATUS,
@@ -16,7 +16,7 @@ diff -ruN a/sql/handler.h b/sql/handler.h
    SCH_GLOBAL_VARIABLES,
    SCH_KEY_COLUMN_USAGE,
    SCH_OPEN_TABLES,
-@@ -588,6 +589,7 @@
+@@ -590,6 +591,7 @@
    SCH_TABLE_CONSTRAINTS,
    SCH_TABLE_NAMES,
    SCH_TABLE_PRIVILEGES,
@@ -27,7 +27,7 @@ diff -ruN a/sql/handler.h b/sql/handler.h
 diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
 --- a/sql/mysqld.cc    2011-04-09 19:11:52.000000000 +0400
 +++ b/sql/mysqld.cc    2011-04-10 12:16:44.000000000 +0400
-@@ -3055,6 +3055,7 @@
+@@ -3051,6 +3051,7 @@
    {"show_storage_engines", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_STORAGE_ENGINES]), SHOW_LONG_STATUS},
    {"show_table_status",    (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_TABLE_STATUS]), SHOW_LONG_STATUS},
    {"show_tables",          (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_TABLES]), SHOW_LONG_STATUS},
@@ -76,7 +76,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc
    case SQLCOM_SHOW_TRIGGERS:
    case SQLCOM_SHOW_TABLE_STATUS:
    case SQLCOM_SHOW_OPEN_TABLES:
-@@ -4797,6 +4803,8 @@
+@@ -4801,6 +4807,8 @@
  
    case SCH_TABLE_NAMES:
    case SCH_TABLES:
@@ -88,7 +88,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc
 diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc
 --- a/sql/sql_show.cc  2011-04-09 19:11:52.000000000 +0400
 +++ b/sql/sql_show.cc  2011-04-10 12:16:44.000000000 +0400
-@@ -2686,6 +2686,7 @@
+@@ -2693,6 +2693,7 @@
      break;
    case SQLCOM_SHOW_TABLES:
    case SQLCOM_SHOW_TABLE_STATUS:
@@ -96,7 +96,7 @@ diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc
    case SQLCOM_SHOW_TRIGGERS:
    case SQLCOM_SHOW_EVENTS:
      thd->make_lex_string(&lookup_field_values->db_value, 
-@@ -3174,6 +3175,228 @@
+@@ -3181,6 +3182,228 @@
    return (uint) OPEN_FULL_TABLE;
  }
  
@@ -325,7 +325,7 @@ diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc
  
  /**
     Try acquire high priority share metadata lock on a table (with
-@@ -6850,6 +7073,25 @@
+@@ -6991,6 +7214,25 @@
    {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
  };
  
@@ -351,7 +351,7 @@ diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc
  
  ST_FIELD_INFO columns_fields_info[]=
  {
-@@ -7464,6 +7706,9 @@
+@@ -7605,6 +7847,9 @@
     hton_fill_schema_table, 0, 0, -1, -1, 0, 0},
    {"GLOBAL_STATUS", variables_fields_info, create_schema_table,
     fill_status, make_old_format, 0, 0, -1, 0, 0},
@@ -361,7 +361,7 @@ diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc
    {"GLOBAL_VARIABLES", variables_fields_info, create_schema_table,
     fill_variables, make_old_format, 0, 0, -1, 0, 0},
    {"KEY_COLUMN_USAGE", key_column_usage_fields_info, create_schema_table,
-@@ -7513,6 +7758,9 @@
+@@ -7654,6 +7899,9 @@
     get_all_tables, make_table_names_old_format, 0, 1, 2, 1, 0},
    {"TABLE_PRIVILEGES", table_privileges_fields_info, create_schema_table,
     fill_schema_table_privileges, 0, 0, -1, -1, 0, 0},
diff --git a/slave_timeout_fix.patch b/slave_timeout_fix.patch
new file mode 100644 (file)
index 0000000..ae0865b
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/mysql-test/include/wait_for_slave_param.inc      2011-04-12 22:38:45.000000000 +1000
++++ b/mysql-test/include/wait_for_slave_param.inc      2011-06-21 22:59:13.804854682 +1000
+@@ -79,7 +79,7 @@
+ # mysqltest doesn't provide any better way to multiply by 10
+ --let $_wait_for_slave_param_zero= 0
+---let $_slave_timeout_counter= $_slave_timeout$zero
++--let $_slave_timeout_counter= $_slave_timeout$_wait_for_slave_param_zero
+ --let $_slave_continue= 1
+ while ($_slave_continue)
+ {
index adb69708ef2bc22b0b8a037006cd3f2bd4336d8a..a7e373dc18afc20209c8e3bd1913414df614f996 100644 (file)
@@ -424,18 +424,18 @@ diff -ruN a/sql/log.h b/sql/log.h
 diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
 --- a/sql/mysqld.cc    2011-04-09 18:48:20.000000000 +0400
 +++ b/sql/mysqld.cc    2011-04-09 18:48:50.000000000 +0400
-@@ -420,6 +420,10 @@
+@@ -416,6 +416,10 @@
  char* opt_secure_file_priv;
  my_bool opt_log_slow_admin_statements= 0;
  my_bool opt_log_slow_slave_statements= 0;
 +my_bool opt_log_slow_sp_statements= 0;
 +my_bool opt_slow_query_log_timestamp_always= 0;
 +ulonglong opt_slow_query_log_use_global_control= 0;
-+ulonglong opt_slow_query_log_timestamp_precision= 0;
++ulong opt_slow_query_log_timestamp_precision= 0;
  my_bool lower_case_file_system= 0;
  my_bool opt_large_pages= 0;
  my_bool opt_super_large_pages= 0;
-@@ -5839,10 +5843,10 @@
+@@ -5835,10 +5839,10 @@
     "Log slow OPTIMIZE, ANALYZE, ALTER and other administrative statements to "
     "the slow log if it is open.", &opt_log_slow_admin_statements,
     &opt_log_slow_admin_statements, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -448,7 +448,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
    {"log-slow-queries", OPT_SLOW_QUERY_LOG,
     "Log slow queries to a table or log file. Defaults logging to table "
     "mysql.slow_log or hostname-slow.log if --log-output=file is used. "
-@@ -7231,6 +7235,10 @@
+@@ -7227,6 +7231,10 @@
  
  C_MODE_END
  
@@ -459,7 +459,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
  /**
    Get server options from the command line,
    and perform related server initializations.
-@@ -7372,6 +7380,8 @@
+@@ -7376,6 +7384,8 @@
    global_system_variables.long_query_time= (ulonglong)
      (global_system_variables.long_query_time_double * 1e6);
  
@@ -478,7 +478,7 @@ diff -ruN a/sql/mysqld.h b/sql/mysqld.h
 +extern my_bool opt_log_slow_sp_statements;
 +extern my_bool opt_slow_query_log_timestamp_always;
 +extern ulonglong opt_slow_query_log_use_global_control;
-+extern ulonglong opt_slow_query_log_timestamp_precision;
++extern ulong opt_slow_query_log_timestamp_precision;
  extern my_bool sp_automatic_privileges, opt_noacl;
  extern my_bool opt_old_style_user_limits, trust_function_creators;
  extern uint opt_crash_binlog_innodb;
@@ -496,7 +496,7 @@ diff -ruN a/sql/slave.cc b/sql/slave.cc
 diff -ruN a/sql/sp_head.cc b/sql/sp_head.cc
 --- a/sql/sp_head.cc   2011-04-09 18:48:05.000000000 +0400
 +++ b/sql/sp_head.cc   2011-04-09 18:48:50.000000000 +0400
-@@ -2150,7 +2150,7 @@
+@@ -2151,7 +2151,7 @@
      DBUG_PRINT("info",(" %.*s: eval args done", (int) m_name.length, 
                         m_name.str));
    }
@@ -527,7 +527,7 @@ diff -ruN a/sql/sql_cache.cc b/sql/sql_cache.cc
 diff -ruN a/sql/sql_class.cc b/sql/sql_class.cc
 --- a/sql/sql_class.cc 2011-04-09 18:48:05.000000000 +0400
 +++ b/sql/sql_class.cc 2011-04-09 18:48:50.000000000 +0400
-@@ -368,6 +368,37 @@
+@@ -367,6 +367,37 @@
    thd->warning_info->inc_current_row_for_warning();
  }
  
@@ -565,7 +565,7 @@ diff -ruN a/sql/sql_class.cc b/sql/sql_class.cc
  
  /**
    Dumps a text description of a thread, its security context
-@@ -662,6 +693,7 @@
+@@ -661,6 +692,7 @@
      *cond_hdl= NULL;
      return FALSE;
    }
@@ -573,7 +573,7 @@ diff -ruN a/sql/sql_class.cc b/sql/sql_class.cc
  
    for (Internal_error_handler *error_handler= m_internal_handler;
         error_handler;
-@@ -3390,6 +3422,12 @@
+@@ -3385,6 +3417,12 @@
      first_successful_insert_id_in_prev_stmt;
    backup->first_successful_insert_id_in_cur_stmt= 
      first_successful_insert_id_in_cur_stmt;
@@ -586,7 +586,7 @@ diff -ruN a/sql/sql_class.cc b/sql/sql_class.cc
  
    if ((!lex->requires_prelocking() || is_update_query(lex->sql_command)) &&
        !is_current_stmt_binlog_format_row())
-@@ -3410,6 +3448,14 @@
+@@ -3405,6 +3443,14 @@
    cuted_fields= 0;
    transaction.savepoints= 0;
    first_successful_insert_id_in_cur_stmt= 0;
@@ -601,7 +601,7 @@ diff -ruN a/sql/sql_class.cc b/sql/sql_class.cc
  }
  
  
-@@ -3472,6 +3518,12 @@
+@@ -3467,6 +3513,12 @@
    */
    examined_row_count+= backup->examined_row_count;
    cuted_fields+=       backup->cuted_fields;
@@ -669,7 +669,7 @@ diff -ruN a/sql/sql_class.h b/sql/sql_class.h
    double long_query_time_double;
  
  } SV;
-@@ -1140,6 +1178,14 @@
+@@ -1135,6 +1173,14 @@
    uint in_sub_stmt;
    bool enable_slow_log;
    bool last_insert_id_used;
@@ -684,7 +684,7 @@ diff -ruN a/sql/sql_class.h b/sql/sql_class.h
    SAVEPOINT *savepoints;
    enum enum_check_fields count_cuted_fields;
  };
-@@ -1575,6 +1621,26 @@
+@@ -1583,6 +1629,26 @@
    thr_lock_type update_lock_default;
    Delayed_insert *di;
  
@@ -714,9 +714,7 @@ diff -ruN a/sql/sql_class.h b/sql/sql_class.h
 diff -ruN a/sql/sql_connect.cc b/sql/sql_connect.cc
 --- a/sql/sql_connect.cc       2011-04-09 18:48:05.000000000 +0400
 +++ b/sql/sql_connect.cc       2011-04-09 18:48:50.000000000 +0400
-@@ -764,6 +764,15 @@
-     prepare_new_connection_state(thd);
+@@ -764,4 +764,13 @@
  
 +    /* 
 +      If rate limiting of slow log writes is enabled, decide whether to log this 
@@ -727,9 +725,9 @@ diff -ruN a/sql/sql_connect.cc b/sql/sql_connect.cc
 +        (thd->thread_id % thd->variables.log_slow_rate_limit) == 0) 
 +         thd->write_to_slow_log= TRUE; 
 +
+     prepare_new_connection_state(thd);
      while (!net->error && net->vio != 0 &&
-            !(thd->killed == THD::KILL_CONNECTION))
-     {
 diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc
 --- a/sql/sql_parse.cc 2011-04-09 18:48:20.000000000 +0400
 +++ b/sql/sql_parse.cc 2011-04-09 18:48:50.000000000 +0400
@@ -794,7 +792,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc
    /*
      Reset warning count for each query that uses tables
      A better approach would be to reset this for any commands
-@@ -5248,6 +5286,21 @@
+@@ -5252,6 +5290,21 @@
    thd->rand_used= 0;
    thd->sent_row_count= thd->examined_row_count= 0;
  
@@ -819,7 +817,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc
 diff -ruN a/sql/sql_select.cc b/sql/sql_select.cc
 --- a/sql/sql_select.cc        2011-04-09 18:48:17.000000000 +0400
 +++ b/sql/sql_select.cc        2011-04-09 18:48:50.000000000 +0400
-@@ -6898,7 +6898,10 @@
+@@ -6902,7 +6902,10 @@
          {
            join->thd->server_status|=SERVER_QUERY_NO_INDEX_USED;
            if (statistics)
@@ -830,7 +828,7 @@ diff -ruN a/sql/sql_select.cc b/sql/sql_select.cc
          }
        }
        else
-@@ -6912,7 +6915,10 @@
+@@ -6916,7 +6919,10 @@
          {
            join->thd->server_status|=SERVER_QUERY_NO_INDEX_USED;
            if (statistics)
@@ -841,7 +839,7 @@ diff -ruN a/sql/sql_select.cc b/sql/sql_select.cc
          }
        }
        if (!table->no_keyread)
-@@ -10243,6 +10249,7 @@
+@@ -10247,6 +10253,7 @@
                (ulong) rows_limit,test(group)));
  
    status_var_increment(thd->status_var.created_tmp_tables);
@@ -849,7 +847,7 @@ diff -ruN a/sql/sql_select.cc b/sql/sql_select.cc
  
    if (use_temp_pool && !(test_flags & TEST_KEEP_TMP_TABLES))
      temp_pool_slot = bitmap_lock_set_next(&temp_pool);
-@@ -11141,6 +11148,7 @@
+@@ -11145,6 +11152,7 @@
      goto err;
    }
    status_var_increment(table->in_use->status_var.created_tmp_disk_tables);
@@ -857,7 +855,7 @@ diff -ruN a/sql/sql_select.cc b/sql/sql_select.cc
    share->db_record_offset= 1;
    DBUG_RETURN(0);
   err:
-@@ -11159,6 +11167,14 @@
+@@ -11163,6 +11171,14 @@
    save_proc_info=thd->proc_info;
    thd_proc_info(thd, "removing tmp table");
  
@@ -875,7 +873,7 @@ diff -ruN a/sql/sql_select.cc b/sql/sql_select.cc
 diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc
 --- a/sql/sql_show.cc  2011-04-09 18:48:20.000000000 +0400
 +++ b/sql/sql_show.cc  2011-04-09 18:48:50.000000000 +0400
-@@ -1943,8 +1943,17 @@
+@@ -1950,8 +1950,17 @@
          table->field[4]->store(command_name[tmp->command].str,
                                 command_name[tmp->command].length, cs);
        /* MYSQL_TIME */
@@ -898,7 +896,7 @@ diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc
 diff -ruN a/sql/sys_vars.cc b/sql/sys_vars.cc
 --- a/sql/sys_vars.cc  2011-04-09 18:48:19.000000000 +0400
 +++ b/sql/sys_vars.cc  2011-04-09 18:48:50.000000000 +0400
-@@ -2862,6 +2862,117 @@
+@@ -2898,6 +2898,117 @@
         DEFAULT(FALSE), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
         ON_UPDATE(fix_log_state));
  
@@ -1188,6 +1186,23 @@ diff -ruN a/sql/sql_profile.cc b/sql/sql_profile.cc
  /**
    Fill the information schema table, "query_profile", as defined in show.cc .
    There are two ways to get to this function:  Selecting from the information
+@@ -600,6 +728,8 @@
+ #ifdef HAVE_GETRUSAGE
++      if (enabled_getrusage())
++      {
+       my_decimal cpu_utime_decimal, cpu_stime_decimal;
+       double2my_decimal(E_DEC_FATAL_ERROR,
+@@ -687,6 +817,7 @@
+       table->field[14]->store((uint32)(entry->rusage.ru_nswap -
+                              previous->rusage.ru_nswap), true);
+       table->field[14]->set_notnull();
++      }
+ #else
+       /* TODO: Add swap info for non-BSD systems */
+ #endif
 diff -ruN a/sql/sql_profile.h b/sql/sql_profile.h
 --- a/sql/sql_profile.h        2011-04-09 18:48:05.000000000 +0400
 +++ b/sql/sql_profile.h        2011-04-09 18:48:50.000000000 +0400
index cc180b31b4de6b2838e774dadb45ef3d172b08e7..4b3049ace599e14caa2d595f933f1f6efdacc4f1 100644 (file)
@@ -144,10 +144,10 @@ diff -ruN a/sql/lex.h b/sql/lex.h
 diff -ruN a/sql/mysqld.h b/sql/mysqld.h
 --- a/sql/mysqld.h     2011-04-09 18:48:55.000000000 +0400
 +++ b/sql/mysqld.h     2011-04-09 18:48:58.000000000 +0400
-@@ -193,6 +193,8 @@
- extern ulong back_log;
+@@ -194,6 +194,8 @@
  extern char language[FN_REFLEN];
- extern ulong server_id, concurrency;
+ extern "C" MYSQL_PLUGIN_IMPORT ulong server_id;
+ extern ulong concurrency;
 +/* flashcache */
 +extern int cachedev_fd;
  extern time_t server_start_time, flush_status_time;
@@ -168,7 +168,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
  
  #include <thr_alarm.h>
  #include <ft_global.h>
-@@ -486,6 +491,11 @@
+@@ -482,6 +487,11 @@
  ulong binlog_cache_use= 0, binlog_cache_disk_use= 0;
  ulong binlog_stmt_cache_use= 0, binlog_stmt_cache_disk_use= 0;
  ulong max_connections, max_connect_errors;
@@ -180,7 +180,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
  /*
    Maximum length of parameter value which can be set through
    mysql_send_long_data() call.
-@@ -4206,6 +4216,97 @@
+@@ -4202,6 +4212,97 @@
  #define decrement_handler_count()
  #endif /* defined(_WIN32) || defined(HAVE_SMEM) */
  
@@ -278,7 +278,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
  
  #ifndef EMBEDDED_LIBRARY
  #ifndef DBUG_OFF
-@@ -4464,6 +4565,10 @@
+@@ -4460,6 +4561,10 @@
    test_lc_time_sz();
  #endif
  
@@ -289,7 +289,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
    /*
      We have enough space for fiddling with the argv, continue
    */
-@@ -4667,6 +4772,10 @@
+@@ -4663,6 +4768,10 @@
    }
  #endif
    clean_up(1);
@@ -300,7 +300,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
    mysqld_exit(0);
  }
  
-@@ -6500,6 +6609,7 @@
+@@ -6496,6 +6605,7 @@
    {"Delayed_errors",           (char*) &delayed_insert_errors,  SHOW_LONG},
    {"Delayed_insert_threads",   (char*) &delayed_insert_threads, SHOW_LONG_NOFLUSH},
    {"Delayed_writes",           (char*) &delayed_insert_writes,  SHOW_LONG},
@@ -322,7 +322,7 @@ diff -ruN a/sql/sql_lex.cc b/sql/sql_lex.cc
 diff -ruN a/sql/sql_lex.h b/sql/sql_lex.h
 --- a/sql/sql_lex.h    2011-04-09 18:48:20.000000000 +0400
 +++ b/sql/sql_lex.h    2011-04-09 18:48:58.000000000 +0400
-@@ -2291,6 +2291,7 @@
+@@ -2292,6 +2292,7 @@
  
    enum enum_yes_no_unknown tx_chain, tx_release;
    bool safe_to_cache_query;
index 8bf9b4b17c44d63519806b2b94de36b395001b57..3f50fd3158927cd49f13fe8f0424d7386fb91a49 100644 (file)
@@ -29,7 +29,7 @@ diff -ruN a/include/mysql_com.h b/include/mysql_com.h
  
  /*
    Maximum length of comments
-@@ -142,6 +143,11 @@
+@@ -146,6 +147,11 @@
  #define REFRESH_DES_KEY_FILE       0x40000L
  #define REFRESH_USER_RESOURCES             0x80000L
  #define REFRESH_QUERY_RESPONSE_TIME 0x100000L /* response time distibution */
@@ -91,7 +91,7 @@ diff -ruN a/sql/handler.cc b/sql/handler.cc
    DBUG_RETURN(error);
  }
  
-@@ -2169,6 +2174,8 @@
+@@ -2176,6 +2181,8 @@
        dup_ref=ref+ALIGN_SIZE(ref_length);
      cached_table_flags= table_flags();
    }
@@ -100,7 +100,7 @@ diff -ruN a/sql/handler.cc b/sql/handler.cc
    DBUG_RETURN(error);
  }
  
-@@ -3619,6 +3626,127 @@
+@@ -3626,6 +3633,127 @@
    return;
  }
  
@@ -231,7 +231,7 @@ diff -ruN a/sql/handler.cc b/sql/handler.cc
 diff -ruN a/sql/handler.h b/sql/handler.h
 --- a/sql/handler.h    2011-04-10 12:23:52.000000000 +0400
 +++ b/sql/handler.h    2011-04-10 12:24:34.000000000 +0400
-@@ -33,6 +33,10 @@
+@@ -35,6 +35,10 @@
  #include <ft_global.h>
  #include <keycache.h>
  
@@ -242,7 +242,7 @@ diff -ruN a/sql/handler.h b/sql/handler.h
  // the following is for checking tables
  
  #define HA_ADMIN_ALREADY_DONE   1
-@@ -559,10 +563,12 @@
+@@ -561,10 +565,12 @@
  enum enum_schema_tables
  {
    SCH_CHARSETS= 0,
@@ -255,7 +255,7 @@ diff -ruN a/sql/handler.h b/sql/handler.h
    SCH_ENGINES,
    SCH_EVENTS,
    SCH_FILES,
-@@ -590,9 +596,12 @@
+@@ -592,9 +598,12 @@
    SCH_TABLE_CONSTRAINTS,
    SCH_TABLE_NAMES,
    SCH_TABLE_PRIVILEGES,
@@ -268,7 +268,7 @@ diff -ruN a/sql/handler.h b/sql/handler.h
    SCH_VARIABLES,
    SCH_VIEWS
  };
-@@ -1207,6 +1216,9 @@
+@@ -1209,6 +1218,9 @@
    bool locked;
    bool implicit_emptied;                /* Can be !=0 only if HEAP */
    const COND *pushed_cond;
@@ -278,7 +278,7 @@ diff -ruN a/sql/handler.h b/sql/handler.h
    /**
      next_insert_id is the next value which should be inserted into the
      auto_increment column: in a inserting-multi-row statement (like INSERT
-@@ -1258,10 +1270,12 @@
+@@ -1260,10 +1272,12 @@
      ref_length(sizeof(my_off_t)),
      ft_handler(0), inited(NONE),
      locked(FALSE), implicit_emptied(0),
@@ -293,7 +293,7 @@ diff -ruN a/sql/handler.h b/sql/handler.h
    virtual ~handler(void)
    {
      DBUG_ASSERT(locked == FALSE);
-@@ -1384,6 +1398,8 @@
+@@ -1386,6 +1400,8 @@
    {
      table= table_arg;
      table_share= share;
@@ -302,7 +302,7 @@ diff -ruN a/sql/handler.h b/sql/handler.h
    }
    virtual double scan_time()
    { return ulonglong2double(stats.data_file_length) / IO_SIZE + 2; }
-@@ -1751,6 +1767,8 @@
+@@ -1753,6 +1769,8 @@
    virtual bool is_crashed() const  { return 0; }
    virtual bool auto_repair() const { return 0; }
  
@@ -490,7 +490,7 @@ diff -ruN a/sql/log.h b/sql/log.h
 diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
 --- a/sql/mysqld.cc    2011-04-10 12:23:56.000000000 +0400
 +++ b/sql/mysqld.cc    2011-04-10 12:24:34.000000000 +0400
-@@ -440,6 +440,7 @@
+@@ -436,6 +436,7 @@
  uint    opt_debug_sync_timeout= 0;
  #endif /* defined(ENABLED_DEBUG_SYNC) */
  my_bool opt_old_style_user_limits= 0, trust_function_creators= 0;
@@ -498,7 +498,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
  my_bool opt_optimizer_fix= 0;
  /*
    True if there is at least one per-hour limit for some user, so we should
-@@ -491,6 +492,7 @@
+@@ -487,6 +488,7 @@
  ulong binlog_cache_use= 0, binlog_cache_disk_use= 0;
  ulong binlog_stmt_cache_use= 0, binlog_stmt_cache_disk_use= 0;
  ulong max_connections, max_connect_errors;
@@ -506,7 +506,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
  
  /* flashcache */
  int cachedev_fd;
-@@ -640,7 +642,9 @@
+@@ -636,7 +638,9 @@
    LOCK_crypt,
    LOCK_global_system_variables,
    LOCK_user_conn, LOCK_slave_list, LOCK_active_mi,
@@ -517,7 +517,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
  /**
    The below lock protects access to two global server variables:
    max_prepared_stmt_count and prepared_stmt_count. These variables
-@@ -1503,6 +1507,11 @@
+@@ -1499,6 +1503,11 @@
  #ifdef HAVE_RESPONSE_TIME_DISTRIBUTION
    query_response_time_free();
  #endif // HAVE_RESPONSE_TIME_DISTRIBUTION
@@ -529,7 +529,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
  #ifdef HAVE_REPLICATION
    end_slave_list();
  #endif
-@@ -1606,6 +1615,10 @@
+@@ -1602,6 +1611,10 @@
    mysql_cond_destroy(&COND_thread_cache);
    mysql_cond_destroy(&COND_flush_thread_cache);
    mysql_cond_destroy(&COND_manager);
@@ -540,7 +540,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
  }
  #endif /*EMBEDDED_LIBRARY*/
  
-@@ -3042,6 +3055,7 @@
+@@ -3038,6 +3051,7 @@
    {"show_binlog_events",   (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_BINLOG_EVENTS]), SHOW_LONG_STATUS},
    {"show_binlogs",         (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_BINLOGS]), SHOW_LONG_STATUS},
    {"show_charsets",        (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_CHARSETS]), SHOW_LONG_STATUS},
@@ -548,7 +548,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
    {"show_collations",      (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_COLLATIONS]), SHOW_LONG_STATUS},
    {"show_contributors",    (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_CONTRIBUTORS]), SHOW_LONG_STATUS},
    {"show_create_db",       (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_CREATE_DB]), SHOW_LONG_STATUS},
-@@ -3062,6 +3076,7 @@
+@@ -3058,6 +3072,7 @@
  #endif
    {"show_function_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_STATUS_FUNC]), SHOW_LONG_STATUS},
    {"show_grants",          (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_GRANTS]), SHOW_LONG_STATUS},
@@ -556,7 +556,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
    {"show_keys",            (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_KEYS]), SHOW_LONG_STATUS},
    {"show_master_status",   (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_MASTER_STAT]), SHOW_LONG_STATUS},
    {"show_open_tables",     (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_OPEN_TABLES]), SHOW_LONG_STATUS},
-@@ -3080,10 +3095,13 @@
+@@ -3076,10 +3091,13 @@
    {"show_slave_status_nolock", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_SLAVE_NOLOCK_STAT]), SHOW_LONG_STATUS},
    {"show_status",          (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_STATUS]), SHOW_LONG_STATUS},
    {"show_storage_engines", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_STORAGE_ENGINES]), SHOW_LONG_STATUS},
@@ -570,7 +570,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
    {"show_variables",       (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_VARIABLES]), SHOW_LONG_STATUS},
    {"show_warnings",        (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_WARNS]), SHOW_LONG_STATUS},
    {"slave_start",          (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SLAVE_START]), SHOW_LONG_STATUS},
-@@ -3621,6 +3639,13 @@
+@@ -3617,6 +3635,13 @@
    mysql_mutex_init(key_LOCK_server_started,
                     &LOCK_server_started, MY_MUTEX_INIT_FAST);
    mysql_cond_init(key_COND_server_started, &COND_server_started, NULL);
@@ -584,7 +584,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
    sp_cache_init();
  #ifdef HAVE_EVENT_SCHEDULER
    Events::init_mutexes();
-@@ -3990,6 +4015,9 @@
+@@ -3986,6 +4011,9 @@
    query_response_time_init();
  #endif // HAVE_RESPONSE_TIME_DISTRIBUTION
    /* We have to initialize the storage engines before CSV logging */
@@ -594,7 +594,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
    if (ha_init())
    {
      sql_print_error("Can't init databases");
-@@ -4126,6 +4154,9 @@
+@@ -4122,6 +4150,9 @@
  
    init_max_user_conn();
    init_update_queries();
@@ -604,7 +604,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
    DBUG_RETURN(0);
  }
  
-@@ -5172,6 +5203,7 @@
+@@ -5168,6 +5199,7 @@
      {
        sql_print_warning("%s", ER_DEFAULT(ER_CON_COUNT_ERROR));
      }
@@ -612,7 +612,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
      delete thd;
      DBUG_VOID_RETURN;
    }
-@@ -7878,6 +7910,8 @@
+@@ -7882,6 +7914,8 @@
    key_delayed_insert_mutex, key_hash_filo_lock, key_LOCK_active_mi,
    key_LOCK_connection_count, key_LOCK_crypt, key_LOCK_delayed_create,
    key_LOCK_delayed_insert, key_LOCK_delayed_status, key_LOCK_error_log,
@@ -621,7 +621,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
    key_LOCK_gdl, key_LOCK_global_system_variables,
    key_LOCK_manager,
    key_LOCK_prepared_stmt_count,
-@@ -7917,6 +7951,13 @@
+@@ -7921,6 +7955,13 @@
    { &key_LOCK_delayed_insert, "LOCK_delayed_insert", PSI_FLAG_GLOBAL},
    { &key_LOCK_delayed_status, "LOCK_delayed_status", PSI_FLAG_GLOBAL},
    { &key_LOCK_error_log, "LOCK_error_log", PSI_FLAG_GLOBAL},
@@ -662,7 +662,7 @@ diff -ruN a/sql/mysqld.h b/sql/mysqld.h
  extern ulong what_to_log,flush_time;
  extern ulong max_prepared_stmt_count, prepared_stmt_count;
  extern ulong open_files_limit;
-@@ -208,6 +211,11 @@
+@@ -209,6 +212,11 @@
  extern struct system_variables max_system_variables;
  extern struct system_status_var global_status_var;
  extern struct rand_struct sql_rand;
@@ -674,7 +674,7 @@ diff -ruN a/sql/mysqld.h b/sql/mysqld.h
  extern const char *opt_date_time_formats[];
  extern handlerton *partition_hton;
  extern handlerton *myisam_hton;
-@@ -245,6 +253,8 @@
+@@ -246,6 +254,8 @@
    key_delayed_insert_mutex, key_hash_filo_lock, key_LOCK_active_mi,
    key_LOCK_connection_count, key_LOCK_crypt, key_LOCK_delayed_create,
    key_LOCK_delayed_insert, key_LOCK_delayed_status, key_LOCK_error_log,
@@ -683,7 +683,7 @@ diff -ruN a/sql/mysqld.h b/sql/mysqld.h
    key_LOCK_gdl, key_LOCK_global_system_variables,
    key_LOCK_logger, key_LOCK_manager,
    key_LOCK_prepared_stmt_count,
-@@ -344,7 +354,9 @@
+@@ -345,7 +355,9 @@
         LOCK_delayed_status, LOCK_delayed_create, LOCK_crypt, LOCK_timezone,
         LOCK_slave_list, LOCK_active_mi, LOCK_manager,
         LOCK_global_system_variables, LOCK_user_conn,
@@ -694,7 +694,7 @@ diff -ruN a/sql/mysqld.h b/sql/mysqld.h
  extern MYSQL_PLUGIN_IMPORT mysql_mutex_t LOCK_thread_count;
  #ifdef HAVE_OPENSSL
  extern mysql_mutex_t LOCK_des_key_file;
-@@ -456,6 +468,16 @@
+@@ -457,6 +469,16 @@
    return id;
  }
  
@@ -738,7 +738,7 @@ diff -ruN a/sql/sql_base.cc b/sql/sql_base.cc
 diff -ruN a/sql/sql_class.cc b/sql/sql_class.cc
 --- a/sql/sql_class.cc 2011-04-10 12:23:56.000000000 +0400
 +++ b/sql/sql_class.cc 2011-04-10 12:24:34.000000000 +0400
-@@ -602,6 +602,13 @@
+@@ -601,6 +601,13 @@
    mysys_var=0;
    binlog_evt_union.do_union= FALSE;
    enable_slow_log= 0;
@@ -752,7 +752,7 @@ diff -ruN a/sql/sql_class.cc b/sql/sql_class.cc
  #ifndef DBUG_OFF
    dbug_sentry=THD_SENTRY_MAGIC;
  #endif
-@@ -982,6 +989,7 @@
+@@ -977,6 +984,7 @@
      variables.option_bits|= OPTION_BIN_LOG;
    else
      variables.option_bits&= ~OPTION_BIN_LOG;
@@ -760,7 +760,7 @@ diff -ruN a/sql/sql_class.cc b/sql/sql_class.cc
  
  #if defined(ENABLED_DEBUG_SYNC)
    /* Initialize the Debug Sync Facility. See debug_sync.cc. */
-@@ -989,6 +997,94 @@
+@@ -984,6 +992,94 @@
  #endif /* defined(ENABLED_DEBUG_SYNC) */
  }
  
@@ -855,7 +855,7 @@ diff -ruN a/sql/sql_class.cc b/sql/sql_class.cc
  
  /*
    Init THD for query processing.
-@@ -1723,6 +1819,32 @@
+@@ -1718,6 +1814,32 @@
  }
  #endif
  
@@ -888,7 +888,7 @@ diff -ruN a/sql/sql_class.cc b/sql/sql_class.cc
  
  struct Item_change_record: public ilink
  {
-@@ -1899,6 +2021,7 @@
+@@ -1894,6 +2016,7 @@
    }
  
    thd->sent_row_count++;
@@ -896,7 +896,7 @@ diff -ruN a/sql/sql_class.cc b/sql/sql_class.cc
  
    if (thd->vio_ok())
      DBUG_RETURN(protocol->write());
-@@ -1991,6 +2114,7 @@
+@@ -1986,6 +2109,7 @@
  select_export::~select_export()
  {
    thd->sent_row_count=row_count;
@@ -904,7 +904,7 @@ diff -ruN a/sql/sql_class.cc b/sql/sql_class.cc
  }
  
  
-@@ -3014,6 +3138,7 @@
+@@ -3009,6 +3133,7 @@
    if (likely(thd != 0))
    { /* current_thd==0 when close_connection() calls net_send_error() */
      thd->status_var.bytes_sent+= length;
@@ -912,7 +912,7 @@ diff -ruN a/sql/sql_class.cc b/sql/sql_class.cc
    }
  }
  
-@@ -3021,6 +3146,7 @@
+@@ -3016,6 +3141,7 @@
  void thd_increment_bytes_received(ulong length)
  {
    current_thd->status_var.bytes_received+= length;
@@ -923,7 +923,7 @@ diff -ruN a/sql/sql_class.cc b/sql/sql_class.cc
 diff -ruN a/sql/sql_class.h b/sql/sql_class.h
 --- a/sql/sql_class.h  2011-04-10 12:23:56.000000000 +0400
 +++ b/sql/sql_class.h  2011-04-10 12:24:34.000000000 +0400
-@@ -1617,6 +1617,8 @@
+@@ -1625,6 +1625,8 @@
    */
    enum enum_server_command command;
    uint32     server_id;
@@ -932,7 +932,7 @@ diff -ruN a/sql/sql_class.h b/sql/sql_class.h
    uint32     file_id;                 // for LOAD DATA INFILE
    /* remote (peer) port */
    uint16 peer_port;
-@@ -2088,6 +2090,8 @@
+@@ -2096,6 +2098,8 @@
    */
    enum_tx_isolation tx_isolation;
    enum_check_fields count_cuted_fields;
@@ -941,7 +941,7 @@ diff -ruN a/sql/sql_class.h b/sql/sql_class.h
  
    DYNAMIC_ARRAY user_var_events;        /* For user variables replication */
    MEM_ROOT      *user_var_events_alloc; /* Allocate above array elements here */
-@@ -2183,6 +2187,49 @@
+@@ -2190,6 +2194,49 @@
    */
    LOG_INFO*  current_linfo;
    NET*       slave_net;                       // network connection from slave -> m.
@@ -991,7 +991,7 @@ diff -ruN a/sql/sql_class.h b/sql/sql_class.h
    /* Used by the sys_var class to store temporary values */
    union
    {
-@@ -2263,6 +2310,11 @@
+@@ -2270,6 +2317,11 @@
      alloc_root. 
    */
    void init_for_queries();
@@ -1003,7 +1003,7 @@ diff -ruN a/sql/sql_class.h b/sql/sql_class.h
    void change_user(void);
    void cleanup(void);
    void cleanup_after_query();
-@@ -2734,6 +2786,15 @@
+@@ -2741,6 +2793,15 @@
    }
    thd_scheduler scheduler;
  
@@ -1019,7 +1019,7 @@ diff -ruN a/sql/sql_class.h b/sql/sql_class.h
  public:
    inline Internal_error_handler *get_internal_handler()
    { return m_internal_handler; }
-@@ -2921,6 +2982,10 @@
+@@ -2929,6 +2990,10 @@
    LEX_STRING invoker_host;
  };
  
@@ -1838,7 +1838,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc
        my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), "SUPER");
        DBUG_RETURN(TRUE);
      }
-@@ -4753,6 +4774,7 @@
+@@ -4757,6 +4778,7 @@
        case ACL_INTERNAL_ACCESS_DENIED:
          if (! no_errors)
          {
@@ -1846,7 +1846,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc
            my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
                     sctx->priv_user, sctx->priv_host, db);
          }
-@@ -4803,6 +4825,7 @@
+@@ -4807,6 +4829,7 @@
      DBUG_PRINT("error",("No possible access"));
      if (!no_errors)
      {
@@ -1854,7 +1854,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc
        if (thd->password == 2)
          my_error(ER_ACCESS_DENIED_NO_PASSWORD_ERROR, MYF(0),
                   sctx->priv_user,
-@@ -4919,6 +4942,7 @@
+@@ -4923,6 +4946,7 @@
  
      if (!thd->col_access && check_grant_db(thd, dst_db_name))
      {
@@ -1862,7 +1862,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc
        my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
                 thd->security_ctx->priv_user,
                 thd->security_ctx->priv_host,
-@@ -5189,6 +5213,7 @@
+@@ -5193,6 +5217,7 @@
    if ((thd->security_ctx->master_access & want_access))
      return 0;
    get_privilege_desc(command, sizeof(command), want_access);
@@ -1870,7 +1870,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc
    my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), command);
    return 1;
  #else
-@@ -5570,6 +5595,32 @@
+@@ -5574,6 +5599,32 @@
    lex_start(thd);
    mysql_reset_thd_for_next_command(thd);
  
@@ -1903,7 +1903,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc
    if (query_cache_send_result_to_client(thd, rawbuf, length) <= 0)
    {
      LEX *lex= thd->lex;
-@@ -5638,6 +5689,52 @@
+@@ -5642,6 +5693,52 @@
      DBUG_ASSERT(thd->change_list.is_empty());
    }
  
@@ -2469,7 +2469,7 @@ diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc
      my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
               sctx->priv_user, sctx->host_or_ip, dbname);
      general_log_print(thd,COM_INIT_DB,ER(ER_DBACCESS_DENIED_ERROR),
-@@ -2352,6 +2390,284 @@
+@@ -2359,6 +2397,284 @@
    DBUG_RETURN(res);
  }
  
@@ -2754,7 +2754,7 @@ diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc
  
  /* collect status for all running threads */
  
-@@ -7513,6 +7829,104 @@
+@@ -7654,6 +7970,104 @@
  };
  
  
@@ -2859,7 +2859,7 @@ diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc
  ST_FIELD_INFO processlist_fields_info[]=
  {
    {"ID", 4, MYSQL_TYPE_LONGLONG, 0, 0, "Id", SKIP_OPEN_TABLE},
-@@ -7702,6 +8116,8 @@
+@@ -7843,6 +8257,8 @@
  {
    {"CHARACTER_SETS", charsets_fields_info, create_schema_table, 
     fill_schema_charsets, make_character_sets_old_format, 0, -1, -1, 0, 0},
@@ -2868,7 +2868,7 @@ diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc
    {"COLLATIONS", collation_fields_info, create_schema_table, 
     fill_schema_collation, make_old_format, 0, -1, -1, 0, 0},
    {"COLLATION_CHARACTER_SET_APPLICABILITY", coll_charset_app_fields_info,
-@@ -7711,6 +8127,8 @@
+@@ -7852,6 +8268,8 @@
     OPTIMIZE_I_S_TABLE|OPEN_VIEW_FULL},
    {"COLUMN_PRIVILEGES", column_privileges_fields_info, create_schema_table,
     fill_schema_column_privileges, 0, 0, -1, -1, 0, 0},
@@ -2877,7 +2877,7 @@ diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc
    {"ENGINES", engines_fields_info, create_schema_table,
     fill_schema_engines, make_old_format, 0, -1, -1, 0, 0},
  #ifdef HAVE_EVENT_SCHEDULER
-@@ -7783,14 +8201,20 @@
+@@ -7924,14 +8342,20 @@
     get_all_tables, make_table_names_old_format, 0, 1, 2, 1, 0},
    {"TABLE_PRIVILEGES", table_privileges_fields_info, create_schema_table,
     fill_schema_table_privileges, 0, 0, -1, -1, 0, 0},
@@ -3246,7 +3246,7 @@ diff -ruN a/sql/structs.h b/sql/structs.h
 diff -ruN a/sql/sys_vars.cc b/sql/sys_vars.cc
 --- a/sql/sys_vars.cc  2011-04-10 12:23:56.000000000 +0400
 +++ b/sql/sys_vars.cc  2011-04-10 12:24:34.000000000 +0400
-@@ -1573,6 +1573,17 @@
+@@ -1609,6 +1609,17 @@
         NO_MUTEX_GUARD, NOT_IN_BINLOG,
         ON_CHECK(check_read_only), ON_UPDATE(fix_read_only));
  
@@ -3267,7 +3267,7 @@ diff -ruN a/sql/sys_vars.cc b/sql/sys_vars.cc
 diff -ruN a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
 --- a/storage/myisam/ha_myisam.cc      2011-04-10 12:16:42.000000000 +0400
 +++ b/storage/myisam/ha_myisam.cc      2011-04-10 12:24:34.000000000 +0400
-@@ -768,6 +768,7 @@
+@@ -769,6 +769,7 @@
  
  int ha_myisam::write_row(uchar *buf)
  {
@@ -3275,7 +3275,7 @@ diff -ruN a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
    ha_statistic_increment(&SSV::ha_write_count);
  
    /* If we have a timestamp column, update it to the current time */
-@@ -780,11 +781,13 @@
+@@ -781,11 +782,13 @@
    */
    if (table->next_number_field && buf == table->record[0])
    {
@@ -3291,7 +3291,7 @@ diff -ruN a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
  }
  
  int ha_myisam::check(THD* thd, HA_CHECK_OPT* check_opt)
-@@ -1535,16 +1538,24 @@
+@@ -1536,16 +1539,24 @@
  
  int ha_myisam::update_row(const uchar *old_data, uchar *new_data)
  {
@@ -3318,7 +3318,7 @@ diff -ruN a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
  }
  
  int ha_myisam::index_read_map(uchar *buf, const uchar *key,
-@@ -1556,6 +1567,14 @@
+@@ -1557,6 +1568,14 @@
    ha_statistic_increment(&SSV::ha_read_key_count);
    int error=mi_rkey(file, buf, active_index, key, keypart_map, find_flag);
    table->status=error ? STATUS_NOT_FOUND: 0;
@@ -3333,7 +3333,7 @@ diff -ruN a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
    MYSQL_INDEX_READ_ROW_DONE(error);
    return error;
  }
-@@ -1568,6 +1587,14 @@
+@@ -1569,6 +1588,14 @@
    ha_statistic_increment(&SSV::ha_read_key_count);
    int error=mi_rkey(file, buf, index, key, keypart_map, find_flag);
    table->status=error ? STATUS_NOT_FOUND: 0;
@@ -3348,7 +3348,7 @@ diff -ruN a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
    MYSQL_INDEX_READ_ROW_DONE(error);
    return error;
  }
-@@ -1582,6 +1609,14 @@
+@@ -1583,6 +1610,14 @@
    int error=mi_rkey(file, buf, active_index, key, keypart_map,
                      HA_READ_PREFIX_LAST);
    table->status=error ? STATUS_NOT_FOUND: 0;
@@ -3363,7 +3363,7 @@ diff -ruN a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
    MYSQL_INDEX_READ_ROW_DONE(error);
    DBUG_RETURN(error);
  }
-@@ -1593,6 +1628,13 @@
+@@ -1594,6 +1629,13 @@
    ha_statistic_increment(&SSV::ha_read_next_count);
    int error=mi_rnext(file,buf,active_index);
    table->status=error ? STATUS_NOT_FOUND: 0;
@@ -3377,7 +3377,7 @@ diff -ruN a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
    MYSQL_INDEX_READ_ROW_DONE(error);
    return error;
  }
-@@ -1604,6 +1646,13 @@
+@@ -1605,6 +1647,13 @@
    ha_statistic_increment(&SSV::ha_read_prev_count);
    int error=mi_rprev(file,buf, active_index);
    table->status=error ? STATUS_NOT_FOUND: 0;
@@ -3391,7 +3391,7 @@ diff -ruN a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
    MYSQL_INDEX_READ_ROW_DONE(error);
    return error;
  }
-@@ -1615,6 +1664,14 @@
+@@ -1616,6 +1665,14 @@
    ha_statistic_increment(&SSV::ha_read_first_count);
    int error=mi_rfirst(file, buf, active_index);
    table->status=error ? STATUS_NOT_FOUND: 0;
@@ -3406,7 +3406,7 @@ diff -ruN a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
    MYSQL_INDEX_READ_ROW_DONE(error);
    return error;
  }
-@@ -1626,6 +1683,14 @@
+@@ -1627,6 +1684,14 @@
    ha_statistic_increment(&SSV::ha_read_last_count);
    int error=mi_rlast(file, buf, active_index);
    table->status=error ? STATUS_NOT_FOUND: 0;
@@ -3421,7 +3421,7 @@ diff -ruN a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
    MYSQL_INDEX_READ_ROW_DONE(error);
    return error;
  }
-@@ -1643,6 +1708,14 @@
+@@ -1644,6 +1709,14 @@
      error= mi_rnext_same(file,buf);
    } while (error == HA_ERR_RECORD_DELETED);
    table->status=error ? STATUS_NOT_FOUND: 0;
@@ -3436,7 +3436,7 @@ diff -ruN a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
    MYSQL_INDEX_READ_ROW_DONE(error);
    return error;
  }
-@@ -1662,6 +1735,8 @@
+@@ -1663,6 +1736,8 @@
    ha_statistic_increment(&SSV::ha_read_rnd_next_count);
    int error=mi_scan(file, buf);
    table->status=error ? STATUS_NOT_FOUND: 0;
@@ -3445,7 +3445,7 @@ diff -ruN a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
    MYSQL_READ_ROW_DONE(error);
    return error;
  }
-@@ -1678,6 +1753,8 @@
+@@ -1679,6 +1754,8 @@
    ha_statistic_increment(&SSV::ha_read_rnd_count);
    int error=mi_rrnd(file, buf, my_get_ptr(pos,ref_length));
    table->status=error ? STATUS_NOT_FOUND: 0;
This page took 0.53812 seconds and 4 git commands to generate.