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
-@@ -194,6 +194,19 @@
- #define HA_ONLINE_DROP_UNIQUE_INDEX (1L << 9) /*drop uniq. online*/
- #define HA_ONLINE_ADD_PK_INDEX (1L << 10)/*add prim. online*/
- #define HA_ONLINE_DROP_PK_INDEX (1L << 11)/*drop prim. online*/
+@@ -197,6 +197,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)
+
-+#define HA_ONLINE_ALTER_INDEX_MASK (HA_ONLINE_ADD_INDEX_NO_WRITES \
-+ | HA_ONLINE_DROP_INDEX_NO_WRITES \
-+ | HA_ONLINE_ADD_UNIQUE_INDEX_NO_WRITES \
-+ | HA_ONLINE_DROP_UNIQUE_INDEX_NO_WRITES \
-+ | HA_ONLINE_ADD_PK_INDEX_NO_WRITES \
-+ | HA_ONLINE_DROP_PK_INDEX_NO_WRITES \
-+ | HA_ONLINE_ADD_INDEX \
-+ | HA_ONLINE_DROP_INDEX \
-+ | HA_ONLINE_ADD_UNIQUE_INDEX \
-+ | HA_ONLINE_DROP_UNIQUE_INDEX \
-+ | HA_ONLINE_ADD_PK_INDEX \
-+ | HA_ONLINE_DROP_PK_INDEX)
++#define HA_INPLACE_ALTER_INDEX_MASK ((1L << 12) - 1)
/*
HA_PARTITION_FUNCTION_SUPPORTED indicates that the function is
supported at all.
+ flags= new_table->file->alter_table_flags(alter_info->flags);
+ if (!thd->variables.online_alter_index)
+ {
-+ flags&= ~((uint)HA_ONLINE_ALTER_INDEX_MASK);
++ flags&= ~((uint)HA_INPLACE_ALTER_INDEX_MASK);
+ }
+ if (!flags)
{
alter_flags= table->file->alter_table_flags(alter_info->flags);
+ if (!thd->variables.online_alter_index)
+ {
-+ alter_flags&= ~((ulong)HA_ONLINE_ALTER_INDEX_MASK);
++ alter_flags&= ~((ulong)HA_INPLACE_ALTER_INDEX_MASK);
+ }
DBUG_PRINT("info", ("alter_flags: %lu", alter_flags));
/* Check dropped indexes. */
diff -ruN a/storage/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c
--- a/storage/innobase/btr/btr0cur.c 2010-12-04 15:52:23.359513820 +0900
+++ b/storage/innobase/btr/btr0cur.c 2010-12-04 16:12:48.643551837 +0900
-@@ -486,7 +486,7 @@
+@@ -498,7 +498,7 @@
#ifdef UNIV_SEARCH_PERF_STAT
info->n_searches++;
#endif
&& latch_mode <= BTR_MODIFY_LEAF
&& info->last_hash_succ
&& !estimate
-@@ -522,7 +522,7 @@
+@@ -534,7 +534,7 @@
if (has_search_latch) {
/* Release possible search latch to obey latching order */
}
/* Store the position of the tree latch we push to mtr so that we
-@@ -844,7 +844,7 @@
+@@ -856,7 +856,7 @@
if (has_search_latch) {
}
}
-@@ -2060,7 +2060,7 @@
+@@ -1971,7 +1971,7 @@
btr_search_update_hash_on_delete(cursor);
}
}
if (!(flags & BTR_KEEP_SYS_FLAG)) {
-@@ -2074,7 +2074,7 @@
+@@ -1985,7 +1985,7 @@
row_upd_rec_in_place(rec, index, offsets, update, page_zip);
if (block->is_hashed) {
}
if (page_zip && !dict_index_is_clust(index)
-@@ -2852,7 +2852,7 @@
+@@ -2763,7 +2763,7 @@
}
if (block->is_hashed) {
}
page_zip = buf_block_get_page_zip(block);
-@@ -2867,7 +2867,7 @@
+@@ -2778,7 +2778,7 @@
}
if (block->is_hashed) {
}
btr_cur_del_mark_set_clust_rec_log(flags, rec, index, val, trx,
-@@ -2994,13 +2994,13 @@
+@@ -2905,13 +2905,13 @@
== dict_table_is_comp(cursor->index->table));
if (block->is_hashed) {
@@ -153,7 +158,7 @@
if (heap->free_block == NULL) {
- buf_block_t* block = buf_block_alloc(NULL, 0);
+ buf_block_t* block = buf_block_alloc(NULL);
- rw_lock_x_lock(&btr_search_latch);
+ rw_lock_x_lock(btr_search_get_latch(key));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(!btr_search_enabled);
-@@ -2635,6 +2640,7 @@
+@@ -2636,6 +2641,7 @@
{
block->check_index_page_at_flush = FALSE;
block->index = NULL;
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
-@@ -1810,7 +1810,7 @@
+@@ -1776,7 +1776,7 @@
UNIV_MEM_VALID(((buf_block_t*) bpage)->frame,
UNIV_PAGE_SIZE);
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
-@@ -1806,7 +1806,7 @@
+@@ -1812,7 +1812,7 @@
zero. */
for (;;) {
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
-@@ -11617,6 +11617,11 @@
+@@ -11671,6 +11671,11 @@
"Disable with --skip-innodb-adaptive-hash-index.",
NULL, innodb_adaptive_hash_index_update, TRUE);
static MYSQL_SYSVAR_ULONG(replication_delay, srv_replication_delay,
PLUGIN_VAR_RQCMDARG,
"Replication thread delay (ms) on the slave server if "
-@@ -11981,6 +11986,7 @@
+@@ -12041,6 +12046,7 @@
MYSQL_SYSVAR(use_sys_stats_table),
MYSQL_SYSVAR(stats_sample_pages),
MYSQL_SYSVAR(adaptive_hash_index),
+ MYSQL_SYSVAR(adaptive_hash_index_partitions),
+ MYSQL_SYSVAR(stats_method),
MYSQL_SYSVAR(replication_delay),
MYSQL_SYSVAR(status_file),
- MYSQL_SYSVAR(strict_mode),
diff -ruN a/storage/innobase/include/btr0sea.h b/storage/innobase/include/btr0sea.h
--- a/storage/innobase/include/btr0sea.h 2010-12-03 15:48:03.070987226 +0900
+++ b/storage/innobase/include/btr0sea.h 2010-12-04 16:12:48.707551382 +0900
@@ -4445,7 +4445,7 @@
#ifndef UNIV_HOTBACKUP
- temp_block = buf_block_alloc(buf_pool, 0);
+ temp_block = buf_block_alloc(buf_pool);
- btr_search_drop_page_hash_index(block);
+ btr_search_drop_page_hash_index(block, index);
block->check_index_page_at_flush = TRUE;
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
-@@ -2044,7 +2044,9 @@
+@@ -2048,7 +2048,9 @@
"-------------------------------------\n", file);
ibuf_print(file);
fprintf(file,
"%.2f hash searches/s, %.2f non-hash searches/s\n",
-@@ -2069,14 +2071,15 @@
+@@ -2073,14 +2075,15 @@
ut_total_allocated_memory,
mem_pool_get_reserved(mem_comm_pool));
/* Calcurate reserved memories */
lock_sys_subtotal = 0;
if (trx_sys) {
-@@ -2103,10 +2106,10 @@
+@@ -2107,10 +2110,10 @@
" Threads %lu \t(%lu + %lu)\n",
(ulong) (btr_search_sys
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
-@@ -1184,7 +1184,6 @@
+@@ -1177,7 +1177,6 @@
case SYNC_OUTER_ANY_LATCH:
case SYNC_FILE_FORMAT_TAG:
case SYNC_DOUBLEWRITE:
case SYNC_SEARCH_SYS_CONF:
case SYNC_TRX_LOCK_HEAP:
case SYNC_KERNEL:
-@@ -1205,6 +1204,7 @@
+@@ -1198,6 +1197,7 @@
ut_error;
}
break;
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
-@@ -11772,7 +11772,8 @@
+@@ -11833,7 +11833,8 @@
i_s_innodb_sys_foreign_cols,
i_s_innodb_sys_stats,
i_s_innodb_table_stats,
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
-@@ -12060,6 +12060,9 @@
+@@ -12121,6 +12121,9 @@
i_s_innodb_sys_stats,
i_s_innodb_table_stats,
i_s_innodb_index_stats,
static char* internal_innobase_data_file_path = NULL;
-@@ -2624,6 +2625,14 @@
+@@ -2643,6 +2644,14 @@
srv_buf_pool_size = (ulint) innobase_buffer_pool_size;
srv_buf_pool_instances = (ulint) innobase_buffer_pool_instances;
srv_mem_pool_size = (ulint) innobase_additional_mem_pool_size;
srv_n_file_io_threads = (ulint) innobase_file_io_threads;
-@@ -2640,6 +2649,7 @@
+@@ -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;
#ifdef HAVE_LARGE_PAGES
if ((os_use_large_pages = (ibool) my_use_large_pages))
-@@ -11648,6 +11658,16 @@
+@@ -11702,6 +11712,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_ULONG(commit_concurrency, innobase_commit_concurrency,
PLUGIN_VAR_RQCMDARG,
"Helps in performance tuning in heavily concurrent environments.",
-@@ -11939,6 +11959,8 @@
+@@ -12000,6 +12020,8 @@
MYSQL_SYSVAR(autoextend_increment),
MYSQL_SYSVAR(buffer_pool_size),
MYSQL_SYSVAR(buffer_pool_instances),
diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c
--- a/storage/innobase/srv/srv0start.c 2010-12-04 20:19:29.806482628 +0900
+++ b/storage/innobase/srv/srv0start.c 2010-12-07 16:10:14.964785346 +0900
-@@ -1835,6 +1835,8 @@
+@@ -1838,6 +1838,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. */
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
-@@ -668,6 +668,8 @@
+@@ -687,6 +687,8 @@
(char*) &export_vars.innodb_dblwr_pages_written, SHOW_LONG},
{"dblwr_writes",
(char*) &export_vars.innodb_dblwr_writes, SHOW_LONG},
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
-@@ -760,6 +760,7 @@
+@@ -774,6 +774,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 */
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
-@@ -469,6 +469,7 @@
+@@ -473,6 +473,7 @@
static ulint srv_n_rows_deleted_old = 0;
static ulint srv_n_rows_read_old = 0;
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;
-@@ -2287,6 +2288,7 @@
+@@ -2291,6 +2292,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;
/****************************************************************//**
If the given column name is reserved for InnoDB system columns, return
TRUE.
-@@ -1723,6 +1785,11 @@
+@@ -1729,6 +1791,11 @@
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
ut_ad(mutex_own(&(dict_sys->mutex)));
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
-@@ -656,6 +656,8 @@
+@@ -675,6 +675,8 @@
(char*) &export_vars.innodb_dblwr_pages_written, SHOW_LONG},
{"dblwr_writes",
(char*) &export_vars.innodb_dblwr_writes, SHOW_LONG},
{"have_atomic_builtins",
(char*) &export_vars.innodb_have_atomic_builtins, SHOW_BOOL},
{"log_waits",
-@@ -11536,6 +11538,11 @@
+@@ -11616,6 +11618,11 @@
"Number of extra user rollback segments which are used in a round-robin fashion.",
NULL, NULL, 127, 0, 127, 0);
static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(additional_mem_pool_size),
MYSQL_SYSVAR(autoextend_increment),
-@@ -11603,6 +11610,7 @@
+@@ -11684,6 +11691,7 @@
MYSQL_SYSVAR(read_ahead),
MYSQL_SYSVAR(adaptive_flushing_method),
MYSQL_SYSVAR(extra_rsegments),
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
-@@ -228,7 +228,7 @@
+@@ -233,7 +233,7 @@
extern ulint srv_adaptive_flushing_method;
extern ulint srv_extra_rsegments;
/*-------------------------------------------*/
extern ulint srv_n_rows_inserted;
-@@ -708,6 +708,7 @@
+@@ -726,6 +726,7 @@
ulint innodb_data_writes; /*!< I/O write requests */
ulint innodb_data_written; /*!< Data bytes written */
ulint innodb_data_reads; /*!< I/O read requests */
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
-@@ -416,6 +416,7 @@
+@@ -421,6 +421,7 @@
UNIV_INTERN ulint srv_adaptive_flushing_method = 0; /* 0: native 1: estimate 2: keep_average */
UNIV_INTERN ulint srv_extra_rsegments = 127; /* extra rseg for users */
/*-------------------------------------------*/
UNIV_INTERN ulong srv_n_spin_wait_rounds = 30;
UNIV_INTERN ulong srv_n_free_tickets_to_enter = 500;
-@@ -2226,6 +2227,7 @@
+@@ -2231,6 +2232,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;
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
-@@ -7337,6 +7337,14 @@
+@@ -7356,6 +7356,14 @@
err = row_discard_tablespace_for_mysql(dict_table->name, trx);
} else {
err = row_import_tablespace_for_mysql(dict_table->name, trx);
}
err = convert_error_code_to_mysql(err, dict_table->flags, NULL);
-@@ -11538,6 +11546,11 @@
+@@ -11618,6 +11626,11 @@
"Choose method of innodb_adaptive_flushing. (native, [estimate], keep_average)",
NULL, innodb_adaptive_flushing_method_update, 1, &adaptive_flushing_method_typelib);
static MYSQL_SYSVAR_ULONG(extra_rsegments, srv_extra_rsegments,
PLUGIN_VAR_RQCMDARG,
"Number of extra user rollback segments which are used in a round-robin fashion.",
-@@ -11614,6 +11627,7 @@
+@@ -11695,6 +11708,7 @@
MYSQL_SYSVAR(flush_neighbor_pages),
MYSQL_SYSVAR(read_ahead),
MYSQL_SYSVAR(adaptive_flushing_method),
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
-@@ -227,6 +227,8 @@
+@@ -232,6 +232,8 @@
extern ulint srv_read_ahead;
extern ulint srv_adaptive_flushing_method;
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
-@@ -415,6 +415,8 @@
+@@ -420,6 +420,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 */
/*
IMPLEMENTATION OF THE BUFFER POOL
-@@ -2397,11 +2431,19 @@
+@@ -2399,11 +2433,19 @@
mutex_t* block_mutex;
ibool must_read;
unsigned access_time;
buf_pool->stat.n_page_gets++;
for (;;) {
-@@ -2419,7 +2461,7 @@
+@@ -2421,7 +2463,7 @@
//buf_pool_mutex_exit(buf_pool);
rw_lock_s_unlock(&buf_pool->page_hash_latch);
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
ut_a(++buf_dbg_counter % 37 || buf_validate());
-@@ -2497,6 +2539,13 @@
+@@ -2498,6 +2540,13 @@
/* Let us wait until the read operation
completes */
for (;;) {
enum buf_io_fix io_fix;
-@@ -2511,6 +2560,12 @@
+@@ -2512,6 +2561,12 @@
break;
}
}
}
#ifdef UNIV_IBUF_COUNT_DEBUG
-@@ -2823,6 +2878,11 @@
+@@ -2824,6 +2879,11 @@
ibool must_read;
ulint retries = 0;
mutex_t* block_mutex = NULL;
buf_pool_t* buf_pool = buf_pool_get(space, offset);
ut_ad(mtr);
-@@ -2841,6 +2901,9 @@
+@@ -2842,6 +2902,9 @@
ut_ad(!ibuf_inside() || ibuf_page_low(space, zip_size, offset,
FALSE, file, line, NULL));
#endif
buf_pool->stat.n_page_gets++;
fold = buf_page_address_fold(space, offset);
loop:
-@@ -2914,7 +2977,7 @@
+@@ -2915,7 +2978,7 @@
return(NULL);
}
ut_ad(block);
ut_ad(mtr);
@@ -3363,13 +3444,17 @@
- #ifdef UNIV_DEBUG_FILE_ACCESSES
+ #if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
ut_a(block->page.file_page_was_freed == FALSE);
#endif
+ if (innobase_get_slow_log()) {
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
-@@ -1527,6 +1527,16 @@
+@@ -1546,6 +1546,16 @@
trx->check_unique_secondary = !thd_test_options(
thd, OPTION_RELAXED_UNIQUE_CHECKS);
DBUG_VOID_RETURN;
}
-@@ -1581,6 +1591,32 @@
+@@ -1600,6 +1610,32 @@
return(trx);
}
/*********************************************************************//**
Note that a transaction has been registered with MySQL.
@return true if transaction is registered with MySQL 2PC coordinator */
-@@ -9207,6 +9243,25 @@
+@@ -9280,6 +9316,25 @@
statement has ended */
if (trx->n_mysql_tables_in_use == 0) {
/* 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
-@@ -1253,6 +1256,10 @@
+@@ -1257,6 +1260,10 @@
ibool has_slept = FALSE;
srv_conc_slot_t* slot = NULL;
ulint i;
if (trx->mysql_thd != NULL
&& thd_is_replication_slave_thread(trx->mysql_thd)) {
-@@ -1329,6 +1336,7 @@
+@@ -1333,6 +1340,7 @@
switches. */
if (SRV_THREAD_SLEEP_DELAY > 0) {
os_thread_sleep(SRV_THREAD_SLEEP_DELAY);
}
trx->op_info = "";
-@@ -1384,6 +1392,13 @@
+@@ -1388,6 +1396,13 @@
/* Go to wait for the event; when a thread leaves InnoDB it will
release this thread */
trx->op_info = "waiting in InnoDB queue";
thd_wait_begin(trx->mysql_thd, THD_WAIT_ROW_TABLE_LOCK);
-@@ -1392,6 +1407,12 @@
+@@ -1396,6 +1411,12 @@
trx->op_info = "";
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
-@@ -11323,6 +11323,11 @@
+@@ -11403,6 +11403,11 @@
"Choose method of innodb_adaptive_flushing. (native, [estimate], keep_average)",
NULL, innodb_adaptive_flushing_method_update, 1, &adaptive_flushing_method_typelib);
static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(additional_mem_pool_size),
MYSQL_SYSVAR(autoextend_increment),
-@@ -11387,6 +11392,7 @@
+@@ -11468,6 +11473,7 @@
MYSQL_SYSVAR(flush_neighbor_pages),
MYSQL_SYSVAR(read_ahead),
MYSQL_SYSVAR(adaptive_flushing_method),
MYSQL_SYSVAR(use_sys_malloc),
MYSQL_SYSVAR(use_native_aio),
MYSQL_SYSVAR(change_buffering),
-@@ -11415,6 +11421,7 @@
+@@ -11496,6 +11502,7 @@
innobase_system_variables, /* system variables */
NULL /* reserved */
},
diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
--- a/storage/innobase/include/srv0srv.h 2010-12-03 15:18:48.894029379 +0900
+++ b/storage/innobase/include/srv0srv.h 2010-12-03 15:22:53.786986025 +0900
-@@ -225,6 +225,8 @@
+@@ -230,6 +230,8 @@
extern ulint srv_read_ahead;
extern ulint srv_adaptive_flushing_method;
diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
--- a/storage/innobase/srv/srv0srv.c 2010-12-03 15:18:48.913956140 +0900
+++ b/storage/innobase/srv/srv0srv.c 2010-12-03 15:22:53.789987037 +0900
-@@ -413,6 +413,8 @@
+@@ -418,6 +418,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 */
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;
-@@ -2574,6 +2575,7 @@
+@@ -2593,6 +2594,7 @@
srv_use_doublewrite_buf = (ibool) innobase_use_doublewrite;
srv_use_checksums = (ibool) innobase_use_checksums;
#ifdef HAVE_LARGE_PAGES
if ((os_use_large_pages = (ibool) my_use_large_pages))
-@@ -11324,6 +11326,15 @@
+@@ -11397,6 +11399,15 @@
"Disable with --skip-innodb-checksums.",
NULL, NULL, TRUE);
static MYSQL_SYSVAR_STR(data_home_dir, innobase_data_home_dir,
PLUGIN_VAR_READONLY,
"The common part for InnoDB table spaces.",
-@@ -11842,6 +11853,7 @@
+@@ -11903,6 +11914,7 @@
MYSQL_SYSVAR(buffer_pool_size),
MYSQL_SYSVAR(buffer_pool_instances),
MYSQL_SYSVAR(checksums),
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
-@@ -226,6 +226,7 @@
+@@ -227,6 +227,7 @@
extern ibool srv_use_doublewrite_buf;
extern ibool srv_use_checksums;
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
-@@ -414,6 +414,7 @@
+@@ -418,6 +418,7 @@
UNIV_INTERN ibool srv_use_doublewrite_buf = TRUE;
UNIV_INTERN ibool srv_use_checksums = TRUE;
static my_bool innobase_thread_concurrency_timer_based;
static long long innobase_buffer_pool_size, innobase_log_file_size;
-@@ -2270,6 +2273,65 @@
+@@ -2289,6 +2292,65 @@
}
#endif /* DBUG_OFF */
#ifndef MYSQL_SERVER
innodb_overwrite_relay_log_info = FALSE;
#endif
-@@ -7222,9 +7284,9 @@
+@@ -7241,9 +7303,9 @@
| DICT_TF_COMPACT
| DICT_TF_FORMAT_ZIP
<< DICT_TF_FORMAT_SHIFT;
}
}
-@@ -11335,6 +11397,16 @@
+@@ -11408,6 +11470,16 @@
"#### Attention: The checksum is not compatible for normal or disabled version! ####",
NULL, NULL, FALSE);
static MYSQL_SYSVAR_STR(data_home_dir, innobase_data_home_dir,
PLUGIN_VAR_READONLY,
"The common part for InnoDB table spaces.",
-@@ -11848,6 +11920,8 @@
+@@ -11909,6 +11981,8 @@
NULL, NULL, 0, &corrupt_table_action_typelib);
static struct st_mysql_sys_var* innobase_system_variables[]= {
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
-@@ -295,9 +295,13 @@
+@@ -296,9 +296,13 @@
*/
/* The 2-logarithm of UNIV_PAGE_SIZE: */
/* Maximum number of parallel threads in a parallelized operation */
#define UNIV_MAX_PARALLELISM 32
-@@ -416,7 +420,7 @@
+@@ -417,7 +421,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. */
/* Some macros to improve branch prediction and reduce cache misses */
#if defined(__GNUC__) && (__GNUC__ > 2) && ! defined(__INTEL_COMPILER)
-@@ -519,4 +523,6 @@
+@@ -520,4 +524,6 @@
UNIV_MEM_ALLOC(addr, size); \
} while (0)
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
-@@ -1553,11 +1553,13 @@
+@@ -1556,11 +1556,13 @@
}
#endif /* UNIV_LOG_ARCHIVE */
return(DB_ERROR);
}
-@@ -1566,7 +1568,7 @@
+@@ -1569,7 +1571,7 @@
for (i = 0; i < srv_n_data_files; i++) {
#ifndef __WIN__
/********************************************************************//**
Insert a compressed block into buf_pool->zip_clean in the LRU order. */
UNIV_INTERN
-@@ -1568,6 +1599,10 @@
+@@ -1538,6 +1569,10 @@
return(BUF_LRU_NOT_FREED);
}
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
-@@ -11919,6 +11919,12 @@
+@@ -11980,6 +11980,12 @@
"except for the deletion.",
NULL, NULL, 0, &corrupt_table_action_typelib);
static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(page_size),
MYSQL_SYSVAR(log_block_size),
-@@ -12009,6 +12015,7 @@
+@@ -12070,6 +12076,7 @@
MYSQL_SYSVAR(purge_threads),
MYSQL_SYSVAR(purge_batch_size),
MYSQL_SYSVAR(corrupt_table_action),
NULL
};
-@@ -12018,7 +12025,7 @@
+@@ -12079,7 +12086,7 @@
&innobase_storage_engine,
innobase_hton_name,
"Innobase Oy",
/* @} */
+ ibool space_was_being_deleted;
ibool is_corrupt;
- # ifdef UNIV_DEBUG_FILE_ACCESSES
+ # if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
ibool file_page_was_freed;
diff -ruN a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0buf.ic
--- a/storage/innobase/include/buf0buf.ic 2011-02-23 19:00:48.130659154 +0900
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 @@
+@@ -248,6 +248,8 @@
extern ulint srv_extra_rsegments;
extern ulint srv_dict_size_limit;
#define REFMAN "http://dev.mysql.com/doc/refman/" \
IB_TO_STR(MYSQL_MAJOR_VERSION) "." \
-diff -ruN a/storage/innobase/mtr/mtr0log.c b/storage/innobase/mtr/mtr0log.c
---- a/storage/innobase/mtr/mtr0log.c 2010-12-04 02:58:26.000000000 +0900
-+++ b/storage/innobase/mtr/mtr0log.c 2011-02-03 15:17:14.000000000 +0900
-@@ -408,7 +408,7 @@
- ptr += 2;
-
- if (UNIV_UNLIKELY(offset >= UNIV_PAGE_SIZE)
-- || UNIV_UNLIKELY(len + offset) > UNIV_PAGE_SIZE) {
-+ || UNIV_UNLIKELY(len + offset > UNIV_PAGE_SIZE)) {
- recv_sys->found_corrupt_log = TRUE;
-
- return(NULL);
diff -ruN a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c
--- a/storage/innobase/os/os0file.c 2011-02-23 19:00:47.928696481 +0900
+++ b/storage/innobase/os/os0file.c 2011-02-23 19:01:19.200696353 +0900
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
-@@ -442,6 +442,8 @@
+@@ -446,6 +446,8 @@
UNIV_INTERN ulint srv_extra_rsegments = 127; /* extra rseg for users */
UNIV_INTERN ulint srv_dict_size_limit = 0;
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
-@@ -2153,7 +2153,7 @@
+@@ -2156,7 +2156,7 @@
if (srv_print_verbose_log) {
ut_print_timestamp(stderr);
fprintf(stderr,
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
-@@ -1181,6 +1181,7 @@
+@@ -1174,6 +1174,7 @@
case SYNC_LOG_FLUSH_ORDER:
case SYNC_THR_LOCAL:
case SYNC_ANY_LATCH:
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
-@@ -426,6 +426,12 @@
+@@ -445,6 +445,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);
static handler *innobase_create_handler(handlerton *hton,
TABLE_SHARE *table,
-@@ -820,6 +826,17 @@
+@@ -839,6 +845,17 @@
}
}
/********************************************************************//**
Obtain the InnoDB transaction of a MySQL thread.
@return reference to transaction pointer */
-@@ -2391,6 +2408,9 @@
+@@ -2410,6 +2427,9 @@
srv_n_read_io_threads = (ulint) innobase_read_io_threads;
srv_n_write_io_threads = (ulint) innobase_write_io_threads;
srv_force_recovery = (ulint) innobase_force_recovery;
srv_use_doublewrite_buf = (ibool) innobase_use_doublewrite;
-@@ -10919,9 +10939,9 @@
+@@ -10992,9 +11012,9 @@
static MYSQL_SYSVAR_ULONG(purge_threads, srv_n_purge_threads,
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
0, /* Minimum value */
1, 0); /* Maximum value */
-@@ -10963,12 +10983,18 @@
+@@ -11036,12 +11056,18 @@
innodb_file_format_max_validate,
innodb_file_format_max_update, "Antelope");
static MYSQL_SYSVAR_STR(flush_method, innobase_file_flush_method,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
-@@ -11063,7 +11089,7 @@
+@@ -11136,7 +11162,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.",
static MYSQL_SYSVAR_LONG(buffer_pool_instances, innobase_buffer_pool_instances,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
-@@ -11208,6 +11234,95 @@
+@@ -11288,6 +11314,95 @@
"trigger a readahead.",
NULL, NULL, 56, 0, 64, 0);
static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(additional_mem_pool_size),
MYSQL_SYSVAR(autoextend_increment),
-@@ -11228,6 +11343,7 @@
+@@ -11308,6 +11423,7 @@
MYSQL_SYSVAR(file_format_check),
MYSQL_SYSVAR(file_format_max),
MYSQL_SYSVAR(flush_log_at_trx_commit),
MYSQL_SYSVAR(flush_method),
MYSQL_SYSVAR(force_recovery),
MYSQL_SYSVAR(locks_unsafe_for_binlog),
-@@ -11264,6 +11380,13 @@
+@@ -11345,6 +11461,13 @@
MYSQL_SYSVAR(show_verbose_locks),
MYSQL_SYSVAR(show_locks_held),
MYSQL_SYSVAR(version),
mutex_create(ibuf_pessimistic_insert_mutex_key,
&ibuf_pessimistic_insert_mutex,
-@@ -2729,9 +2731,11 @@
+@@ -2712,9 +2714,11 @@
size = ibuf->size;
max_size = ibuf->max_size;
extern char srv_adaptive_flushing;
-@@ -214,6 +215,16 @@
+@@ -219,6 +220,16 @@
extern ulong srv_max_purge_lag;
extern ulong srv_replication_delay;
/*-------------------------------------------*/
extern ulint srv_n_rows_inserted;
-@@ -389,8 +400,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 */
/* Try to flush dirty pages so as to avoid IO bursts at
the checkpoints. */
-@@ -401,6 +402,17 @@
+@@ -406,6 +407,17 @@
UNIV_INTERN ulong srv_replication_delay = 0;
/*-------------------------------------------*/
UNIV_INTERN ulong srv_n_spin_wait_rounds = 30;
UNIV_INTERN ulong srv_n_free_tickets_to_enter = 500;
-@@ -2737,6 +2749,7 @@
+@@ -2742,6 +2754,7 @@
ulint n_pages_purged = 0;
ulint n_bytes_merged;
ulint n_pages_flushed;
ulint n_bytes_archived;
ulint n_tables_to_drop;
ulint n_ios;
-@@ -2744,7 +2757,20 @@
+@@ -2749,7 +2762,20 @@
ulint n_ios_very_old;
ulint n_pend_ios;
ulint next_itr_time;
#ifdef UNIV_DEBUG_THREAD_CREATION
fprintf(stderr, "Master thread starts, id %lu\n",
-@@ -2766,6 +2792,9 @@
+@@ -2771,6 +2797,9 @@
mutex_exit(&kernel_mutex);
loop:
/*****************************************************************/
/* ---- When there is database activity by users, we cycle in this
-@@ -2796,9 +2825,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;
/* ALTER TABLE in MySQL requires on Unix that the table handler
can drop tables lazily after there no longer are SELECT
queries to them. */
-@@ -2822,6 +2855,7 @@
+@@ -2827,6 +2860,7 @@
srv_main_thread_op_info = "sleeping";
srv_main_1_second_loops++;
if (next_itr_time > cur_time
&& srv_shutdown_state == SRV_SHUTDOWN_NONE) {
-@@ -2832,10 +2866,26 @@
+@@ -2837,10 +2871,26 @@
(next_itr_time - cur_time)
* 1000));
srv_main_sleeps++;
/* Flush logs if needed */
srv_sync_log_buffer_in_background();
-@@ -2855,7 +2905,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";
/* Flush logs if needed */
srv_sync_log_buffer_in_background();
-@@ -2872,7 +2922,11 @@
+@@ -2877,7 +2927,11 @@
n_pages_flushed = buf_flush_list(
PCT_IO(100), IB_ULONGLONG_MAX);
/* Try to keep the rate of flushing of dirty
pages such that redo log generation does not
-@@ -2888,6 +2942,224 @@
+@@ -2893,6 +2947,224 @@
n_flush,
IB_ULONGLONG_MAX);
}
}
if (srv_activity_count == old_activity_count) {
-@@ -2936,7 +3208,7 @@
+@@ -2941,7 +3213,7 @@
even if the server were active */
srv_main_thread_op_info = "doing insert buffer merge";
/* Flush logs if needed */
srv_sync_log_buffer_in_background();
-@@ -3044,7 +3316,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,
}
srv_main_thread_op_info = "reserving kernel mutex";
-@@ -3190,6 +3462,7 @@
+@@ -3195,6 +3467,7 @@
srv_slot_t* slot;
ulint slot_no = ULINT_UNDEFINED;
ulint n_total_purged = ULINT_UNDEFINED;
ut_a(srv_n_purge_threads == 1);
-@@ -3212,9 +3485,12 @@
+@@ -3217,9 +3490,12 @@
mutex_exit(&kernel_mutex);
/* If there are very few records to purge or the last
purge didn't purge any records then wait for activity.
-@@ -3255,6 +3531,16 @@
+@@ -3260,6 +3536,16 @@
} while (n_pages_purged > 0 && !srv_fast_shutdown);
srv_sync_log_buffer_in_background();
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
-@@ -2258,6 +2258,284 @@
+@@ -2224,6 +2224,284 @@
memset(&buf_LRU_stat_cur, 0, sizeof buf_LRU_stat_cur);
}
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
-@@ -11706,6 +11706,12 @@
+@@ -11767,6 +11767,12 @@
"Limit the allocated memory for dictionary cache. (0: unlimited)",
NULL, NULL, 0, 0, LONG_MAX, 0);
static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(additional_mem_pool_size),
MYSQL_SYSVAR(autoextend_increment),
-@@ -11788,6 +11794,7 @@
+@@ -11849,6 +11855,7 @@
#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
MYSQL_SYSVAR(read_ahead_threshold),
MYSQL_SYSVAR(io_capacity),
diff -ruN a/storage/innobase/include/buf0lru.h b/storage/innobase/include/buf0lru.h
--- a/storage/innobase/include/buf0lru.h 2010-12-03 15:49:59.223956070 +0900
+++ b/storage/innobase/include/buf0lru.h 2010-12-04 15:33:37.681481467 +0900
-@@ -219,6 +219,18 @@
+@@ -215,6 +215,18 @@
void
buf_LRU_stat_update(void);
/*=====================*/
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
-@@ -356,6 +356,9 @@
+@@ -357,6 +357,9 @@
reading of a disk page */
extern ulint srv_buf_pool_reads;
/** Status variables to be passed to MySQL */
typedef struct export_var_struct export_struc;
-@@ -663,6 +666,16 @@
+@@ -677,6 +680,16 @@
/*=====================*/
void* arg); /*!< in: a dummy parameter required by
os_thread_create */
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
-@@ -329,6 +329,9 @@
+@@ -334,6 +334,9 @@
reading of a disk page */
UNIV_INTERN ulint srv_buf_pool_reads = 0;
/* structure to pass status variables to MySQL */
UNIV_INTERN export_struc export_vars;
-@@ -2697,6 +2700,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. */
/** 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. */
-@@ -1813,6 +1813,10 @@
+@@ -1816,6 +1816,10 @@
os_thread_create(&srv_monitor_thread, NULL,
thread_ids + 4 + SRV_MAX_N_IO_THREADS);
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
-@@ -1016,7 +1016,7 @@
+@@ -992,7 +992,7 @@
/* No free block was found: try to flush the LRU list */
++srv_buf_pool_wait_free;
os_aio_simulated_wake_handler_threads();
-@@ -1213,7 +1213,7 @@
+@@ -1189,7 +1189,7 @@
/* Remove the block from the LRU list */
UT_LIST_REMOVE(LRU, buf_pool->LRU, bpage);
buf_unzip_LRU_remove_block_if_needed(bpage);
-@@ -1292,7 +1292,7 @@
+@@ -1268,7 +1268,7 @@
ut_ad(!bpage->in_LRU_list);
UT_LIST_ADD_LAST(LRU, buf_pool->LRU, bpage);
if (UT_LIST_GET_LEN(buf_pool->LRU) > BUF_LRU_OLD_MIN_LEN) {
-@@ -1362,7 +1362,7 @@
+@@ -1338,7 +1338,7 @@
buf_pool->LRU_old_len++;
}
if (UT_LIST_GET_LEN(buf_pool->LRU) > BUF_LRU_OLD_MIN_LEN) {
-@@ -1617,7 +1617,7 @@
+@@ -1589,7 +1589,7 @@
buf_page_set_old(b, buf_page_is_old(b));
#endif /* UNIV_LRU_DEBUG */
} else {
static my_bool innobase_rollback_on_timeout = FALSE;
static my_bool innobase_create_status_file = FALSE;
static my_bool innobase_stats_on_metadata = TRUE;
-@@ -2202,6 +2222,89 @@
+@@ -2221,6 +2241,89 @@
}
#endif /* DBUG_OFF */
/* Check that values don't overflow on 32-bit systems. */
if (sizeof(ulint) == 4) {
if (innobase_buffer_pool_size > UINT_MAX32) {
-@@ -2500,6 +2603,76 @@
+@@ -2519,6 +2622,76 @@
goto mem_free_and_error;
}
innobase_old_blocks_pct = buf_LRU_old_ratio_update(
innobase_old_blocks_pct, TRUE);
-@@ -2612,6 +2785,25 @@
+@@ -2631,6 +2804,25 @@
trx_t* trx) /*!< in: transaction handle */
{
if (trx_is_started(trx)) {
trx_commit_for_mysql(trx);
}
-@@ -10917,6 +11109,12 @@
+@@ -10990,6 +11182,12 @@
"The common part for InnoDB table spaces.",
NULL, NULL, NULL);
static MYSQL_SYSVAR_BOOL(doublewrite, innobase_use_doublewrite,
PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
"Enable InnoDB doublewrite buffer (enabled by default). "
-@@ -11368,6 +11566,7 @@
+@@ -11448,6 +11646,7 @@
MYSQL_SYSVAR(old_blocks_pct),
MYSQL_SYSVAR(old_blocks_time),
MYSQL_SYSVAR(open_files),
diff -ruN a/storage/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c
--- a/storage/innobase/btr/btr0cur.c 2010-12-03 17:30:16.239038936 +0900
+++ b/storage/innobase/btr/btr0cur.c 2010-12-04 15:38:18.114551906 +0900
-@@ -238,6 +238,11 @@
+@@ -250,6 +250,11 @@
case BTR_MODIFY_LEAF:
mode = latch_mode == BTR_SEARCH_LEAF ? RW_S_LATCH : RW_X_LATCH;
get_block = btr_block_get(space, zip_size, page_no, mode, mtr);
#ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(get_block->frame) == page_is_comp(page));
#endif /* UNIV_BTR_DEBUG */
-@@ -251,6 +256,11 @@
+@@ -263,6 +268,11 @@
get_block = btr_block_get(space, zip_size,
left_page_no,
RW_X_LATCH, mtr);
#ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(get_block->frame)
== page_is_comp(page));
-@@ -262,6 +272,11 @@
+@@ -274,6 +284,11 @@
get_block = btr_block_get(space, zip_size, page_no,
RW_X_LATCH, mtr);
#ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(get_block->frame) == page_is_comp(page));
#endif /* UNIV_BTR_DEBUG */
-@@ -273,6 +288,11 @@
+@@ -285,6 +300,11 @@
get_block = btr_block_get(space, zip_size,
right_page_no,
RW_X_LATCH, mtr);
#ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(get_block->frame)
== page_is_comp(page));
-@@ -294,6 +314,11 @@
+@@ -306,6 +326,11 @@
get_block = btr_block_get(space, zip_size,
left_page_no, mode, mtr);
cursor->left_block = get_block;
#ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(get_block->frame)
== page_is_comp(page));
-@@ -304,6 +329,11 @@
+@@ -316,6 +341,11 @@
}
get_block = btr_block_get(space, zip_size, page_no, mode, mtr);
#ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(get_block->frame) == page_is_comp(page));
#endif /* UNIV_BTR_DEBUG */
-@@ -576,6 +606,19 @@
+@@ -588,6 +618,19 @@
file, line, mtr);
if (block == NULL) {
/* This must be a search to perform an insert/delete
mark/ delete; try using the insert/delete buffer */
-@@ -650,6 +693,16 @@
+@@ -662,6 +705,16 @@
block->check_index_page_at_flush = TRUE;
page = buf_block_get_frame(block);
if (rw_latch != RW_NO_LATCH) {
#ifdef UNIV_ZIP_DEBUG
const page_zip_des_t* page_zip
-@@ -854,6 +907,17 @@
+@@ -866,6 +919,17 @@
RW_NO_LATCH, NULL, BUF_GET,
file, line, mtr);
page = buf_block_get_frame(block);
ut_ad(index->id == btr_page_get_index_id(page));
block->check_index_page_at_flush = TRUE;
-@@ -974,6 +1038,14 @@
+@@ -986,6 +1050,14 @@
RW_NO_LATCH, NULL, BUF_GET,
file, line, mtr);
page = buf_block_get_frame(block);
ut_ad(index->id == btr_page_get_index_id(page));
if (height == ULINT_UNDEFINED) {
-@@ -1288,6 +1360,12 @@
+@@ -1199,6 +1271,12 @@
*big_rec = NULL;
block = btr_cur_get_block(cursor);
page = buf_block_get_frame(block);
index = cursor->index;
zip_size = buf_block_get_zip_size(block);
-@@ -3013,6 +3091,11 @@
+@@ -2924,6 +3002,11 @@
block = btr_cur_get_block(cursor);
ut_ad(page_is_leaf(buf_block_get_frame(block)));
rec = btr_cur_get_rec(cursor);
-@@ -3817,6 +3900,11 @@
+@@ -3627,6 +3710,11 @@
page = btr_cur_get_page(&cursor);
+ }
+ ut_a(page);
+
- supremum = page_get_supremum_rec(page);
- if (stats_method == SRV_STATS_METHOD_IGNORE_NULLS && is_first_page) {
- /* the cursor should be the first record of the page. */
+ rec = page_rec_get_next(page_get_infimum_rec(page));
+
+ if (!page_rec_is_supremum(rec)) {
diff -ruN a/storage/innobase/btr/btr0pcur.c b/storage/innobase/btr/btr0pcur.c
--- a/storage/innobase/btr/btr0pcur.c 2010-11-03 07:01:13.000000000 +0900
+++ b/storage/innobase/btr/btr0pcur.c 2010-12-04 15:38:18.116563877 +0900
if (!ready) {
return(block);
-@@ -2476,6 +2482,14 @@
+@@ -2478,6 +2484,14 @@
return(NULL);
}
block_mutex = buf_page_get_mutex_enter(bpage);
rw_lock_s_unlock(&buf_pool->page_hash_latch);
-@@ -3023,6 +3037,14 @@
+@@ -3024,6 +3038,14 @@
return(NULL);
}
bpage->oldest_modification = 0;
HASH_INVALIDATE(bpage, hash);
+ bpage->is_corrupt = FALSE;
- #ifdef UNIV_DEBUG_FILE_ACCESSES
+ #if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
bpage->file_page_was_freed = FALSE;
- #endif /* UNIV_DEBUG_FILE_ACCESSES */
+ #endif /* UNIV_DEBUG_FILE_ACCESSES || UNIV_DEBUG */
@@ -4200,7 +4223,8 @@
void
buf_page_io_complete(
goto next_loop;
cached_foreign_tables = 0;
-@@ -4327,6 +4328,12 @@
+@@ -4333,6 +4334,12 @@
heap = mem_heap_create(1000);
while (index) {
size = btr_get_size(index, BTR_TOTAL_SIZE);
index->stat_index_size = size;
-@@ -4446,6 +4453,12 @@
+@@ -4452,6 +4459,12 @@
heap = mem_heap_create(1000);
while (index) {
/*===========================================*/
{
dict_table_t* sys_stats;
-@@ -4611,6 +4624,12 @@
+@@ -4617,6 +4630,12 @@
|| (srv_force_recovery < SRV_FORCE_NO_LOG_REDO
&& dict_index_is_clust(index)))) {
ulint size;
size = btr_get_size(index, BTR_TOTAL_SIZE);
index->stat_index_size = size;
-@@ -5331,4 +5350,42 @@
+@@ -5341,4 +5360,42 @@
rw_lock_free(&dict_table_stats_latches[i]);
}
}
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
-@@ -3928,6 +3928,12 @@
+@@ -3947,6 +3947,12 @@
DBUG_RETURN(1);
}
/* 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
-@@ -3955,6 +3961,19 @@
+@@ -3974,6 +3980,19 @@
/* Get pointer to a table object in InnoDB dictionary cache */
ib_table = dict_table_get(norm_name, TRUE);
if (NULL == ib_table) {
if (is_part && retries < 10) {
++retries;
-@@ -5119,6 +5138,10 @@
+@@ -5138,6 +5157,10 @@
ha_statistic_increment(&SSV::ha_write_count);
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
table->timestamp_field->set_time();
-@@ -5336,6 +5359,10 @@
+@@ -5355,6 +5378,10 @@
func_exit:
innobase_active_small();
DBUG_RETURN(error_result);
}
-@@ -5512,6 +5539,10 @@
+@@ -5531,6 +5558,10 @@
ha_statistic_increment(&SSV::ha_update_count);
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
table->timestamp_field->set_time();
-@@ -5601,6 +5632,10 @@
+@@ -5620,6 +5651,10 @@
innobase_active_small();
DBUG_RETURN(error);
}
-@@ -5622,6 +5657,10 @@
+@@ -5641,6 +5676,10 @@
ha_statistic_increment(&SSV::ha_delete_count);
if (!prebuilt->upd_node) {
row_get_prebuilt_update_vector(prebuilt);
}
-@@ -5648,6 +5687,10 @@
+@@ -5667,6 +5706,10 @@
innobase_active_small();
DBUG_RETURN(error);
}
-@@ -5887,6 +5930,10 @@
+@@ -5906,6 +5949,10 @@
ha_statistic_increment(&SSV::ha_read_key_count);
index = prebuilt->index;
if (UNIV_UNLIKELY(index == NULL)) {
-@@ -5952,6 +5999,10 @@
+@@ -5971,6 +6018,10 @@
ret = DB_UNSUPPORTED;
}
switch (ret) {
case DB_SUCCESS:
error = 0;
-@@ -6067,6 +6118,10 @@
+@@ -6086,6 +6137,10 @@
{
DBUG_ENTER("change_active_index");
ut_ad(user_thd == ha_thd());
ut_a(prebuilt->trx == thd_to_trx(user_thd));
-@@ -6157,6 +6212,10 @@
+@@ -6176,6 +6231,10 @@
DBUG_ENTER("general_fetch");
ut_a(prebuilt->trx == thd_to_trx(user_thd));
innodb_srv_conc_enter_innodb(prebuilt->trx);
-@@ -6166,6 +6225,10 @@
+@@ -6185,6 +6244,10 @@
innodb_srv_conc_exit_innodb(prebuilt->trx);
switch (ret) {
case DB_SUCCESS:
error = 0;
-@@ -7436,10 +7499,18 @@
+@@ -7455,10 +7518,18 @@
update_thd(ha_thd());
error = convert_error_code_to_mysql(error, prebuilt->table->flags,
NULL);
-@@ -7944,6 +8015,16 @@
+@@ -7963,6 +8034,16 @@
return(ranges + (double) rows / (double) total_rows * time_for_scan);
}
/*********************************************************************//**
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
-@@ -8062,7 +8143,7 @@
+@@ -8140,7 +8221,7 @@
ib_table = prebuilt->table;
if (flag & HA_STATUS_TIME) {
/* In sql_show we call with this flag: update
then statistics so that they are up-to-date */
-@@ -8356,10 +8437,18 @@
+@@ -8429,10 +8510,18 @@
THD* thd, /*!< in: connection thread handle */
HA_CHECK_OPT* check_opt) /*!< in: currently ignored */
{
return(0);
}
-@@ -8541,6 +8630,10 @@
+@@ -8614,6 +8703,10 @@
my_error(ER_QUERY_INTERRUPTED, MYF(0));
}
DBUG_RETURN(is_ok ? HA_ADMIN_OK : HA_ADMIN_CORRUPT);
}
-@@ -9311,6 +9404,10 @@
+@@ -9384,6 +9477,10 @@
update_thd(thd);
if (prebuilt->table->ibd_file_missing && !thd_tablespace_op(thd)) {
ut_print_timestamp(stderr);
fprintf(stderr,
-@@ -11720,6 +11817,25 @@
+@@ -11781,6 +11878,25 @@
"0 (the default) disables automatic dumps.",
NULL, NULL, 0, 0, UINT_MAX32, 0);
static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(additional_mem_pool_size),
MYSQL_SYSVAR(autoextend_increment),
-@@ -11806,6 +11922,7 @@
+@@ -11867,6 +11983,7 @@
MYSQL_SYSVAR(buffer_pool_restore_at_startup),
MYSQL_SYSVAR(purge_threads),
MYSQL_SYSVAR(purge_batch_size),
in the buffer pool */
/* @} */
+ ibool is_corrupt;
- # ifdef UNIV_DEBUG_FILE_ACCESSES
+ # if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
ibool file_page_was_freed;
/*!< this is set to TRUE when fsp
diff -ruN a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0buf.ic
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
-@@ -619,6 +619,7 @@
+@@ -625,6 +625,7 @@
the AUTOINC lock on this table. */
/* @} */
/*----------------------*/
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
-@@ -242,6 +242,7 @@
+@@ -243,6 +243,7 @@
extern ulint srv_adaptive_flushing_method;
extern ulint srv_expand_import;
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
-@@ -430,6 +430,7 @@
+@@ -434,6 +434,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 */
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
-@@ -2141,6 +2141,13 @@
+@@ -2144,6 +2144,13 @@
os_fast_mutex_free(&srv_os_test_mutex);
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;
-@@ -2530,6 +2531,8 @@
+@@ -2549,6 +2550,8 @@
srv_force_recovery = (ulint) innobase_force_recovery;
srv_use_doublewrite_buf = (ibool) innobase_use_doublewrite;
srv_use_checksums = (ibool) innobase_use_checksums;
-@@ -11173,6 +11176,11 @@
+@@ -11246,6 +11249,11 @@
"The common part for InnoDB table spaces.",
NULL, NULL, NULL);
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 "
-@@ -11656,6 +11664,7 @@
+@@ -11717,6 +11725,7 @@
MYSQL_SYSVAR(data_file_path),
MYSQL_SYSVAR(data_home_dir),
MYSQL_SYSVAR(doublewrite),
/* 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
-@@ -2426,6 +2427,8 @@
+@@ -2445,6 +2446,8 @@
goto error;
}
srv_use_sys_stats_table = (ibool) innobase_use_sys_stats_table;
/* -------------- Log files ---------------------------*/
-@@ -11556,6 +11559,11 @@
+@@ -11610,6 +11613,11 @@
"Path to individual files and their sizes.",
NULL, NULL, NULL);
static MYSQL_SYSVAR_LONG(autoinc_lock_mode, innobase_autoinc_lock_mode,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"The AUTOINC lock modes supported by InnoDB: "
-@@ -11721,6 +11729,7 @@
+@@ -11782,6 +11790,7 @@
MYSQL_SYSVAR(commit_concurrency),
MYSQL_SYSVAR(concurrency_tickets),
MYSQL_SYSVAR(data_file_path),
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
-@@ -3421,7 +3421,7 @@
+@@ -3423,7 +3423,7 @@
/* Do not drop possible .ibd tablespace if something went
wrong: we do not want to delete valuable data of the user */
ibool log_file_created;
ibool log_created = FALSE;
ibool log_opened = FALSE;
-@@ -1453,6 +1592,7 @@
+@@ -1456,6 +1595,7 @@
}
err = open_or_create_data_files(&create_new_db,
#ifdef UNIV_LOG_ARCHIVE
&min_arch_log_no, &max_arch_log_no,
#endif /* UNIV_LOG_ARCHIVE */
-@@ -1620,6 +1760,14 @@
+@@ -1623,6 +1763,14 @@
after the double write buffer has been created. */
trx_sys_create();
dict_create();
srv_startup_is_before_trx_rollback_phase = FALSE;
-@@ -1653,6 +1801,13 @@
+@@ -1656,6 +1804,13 @@
recv_recovery_from_archive_finish();
#endif /* UNIV_LOG_ARCHIVE */
} else {
/* Check if we support the max format that is stamped
on the system tablespace.
-@@ -1739,6 +1894,17 @@
+@@ -1742,6 +1897,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();
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
-@@ -9498,8 +9498,8 @@
+@@ -9571,8 +9571,8 @@
rw_lock_wait_time += mutex->lspent_time;
}
#else /* UNIV_DEBUG */
buf2len= (uint) my_snprintf(buf2, sizeof(buf2), "os_waits=%lu",
(ulong) mutex->count_os_wait);
-@@ -9514,9 +9514,8 @@
+@@ -9587,9 +9587,8 @@
if (block_mutex) {
buf1len = (uint) my_snprintf(buf1, sizeof buf1,
buf2len = (uint) my_snprintf(buf2, sizeof buf2,
"os_waits=%lu",
(ulong) block_mutex_oswait_count);
-@@ -9545,8 +9544,8 @@
+@@ -9618,8 +9617,8 @@
continue;
}
buf2len = my_snprintf(buf2, sizeof buf2, "os_waits=%lu",
(ulong) lock->count_os_wait);
-@@ -9560,9 +9559,8 @@
+@@ -9633,9 +9632,8 @@
if (block_lock) {
buf1len = (uint) my_snprintf(buf1, sizeof buf1,
/******************************************************************//**
Calling this function is obligatory only if the memory buffer containing
the rw-lock is freed. Removes an rw-lock object from the global list. The
-@@ -610,7 +610,8 @@
+@@ -611,7 +611,8 @@
struct PSI_rwlock *pfs_psi;/*!< The instrumentation hook */
#endif
ulint count_os_wait; /*!< Count of os_waits. May not be accurate */
/* last s-lock file/line is not guaranteed to be correct */
const char* last_s_file_name;/*!< File name where last s-locked */
const char* last_x_file_name;/*!< File name where last x-locked */
-@@ -621,7 +622,7 @@
+@@ -622,7 +623,7 @@
are at the start of this struct, thus we can
peek this field without causing much memory
bus traffic */
unsigned last_s_line:14; /*!< Line number where last time s-locked */
unsigned last_x_line:14; /*!< Line number where last time x-locked */
#ifdef UNIV_DEBUG
-@@ -691,10 +692,10 @@
+@@ -692,10 +693,10 @@
# ifdef UNIV_SYNC_DEBUG
ulint level, /*!< in: level */
# endif /* UNIV_SYNC_DEBUG */
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
-@@ -250,13 +250,13 @@
+@@ -269,13 +269,13 @@
/*==============*/
mutex_t* mutex, /*!< in: pointer to memory */
#ifdef UNIV_DEBUG
{
#if defined(HAVE_ATOMIC_BUILTINS)
mutex_reset_lock_word(mutex);
-@@ -274,11 +274,13 @@
+@@ -293,11 +293,13 @@
mutex->file_name = "not yet reserved";
mutex->level = level;
#endif /* UNIV_SYNC_DEBUG */
mutex->count_using= 0;
mutex->mutex_type= 0;
mutex->lspent_time= 0;
-@@ -532,9 +534,9 @@
+@@ -551,9 +553,9 @@
#ifdef UNIV_SRV_PRINT_LATCH_WAITS
fprintf(stderr,
"Thread %lu spin wait mutex at %p"
#endif
mutex_spin_round_count += i;
-@@ -609,9 +611,9 @@
+@@ -628,9 +630,9 @@
#ifdef UNIV_SRV_PRINT_LATCH_WAITS
fprintf(stderr,
#endif
mutex_os_wait_count++;
-@@ -913,9 +915,8 @@
+@@ -878,8 +880,8 @@
- if (mutex->magic_n == MUTEX_MAGIC_N) {
- fprintf(stderr,
-- "Mutex created at %s %lu\n",
-- mutex->cfile_name,
-- (ulong) mutex->cline);
-+ "Mutex '%s'\n",
-+ mutex->cmutex_name);
+ if (mutex->magic_n == MUTEX_MAGIC_N) {
+ fprintf(stderr,
+- "Mutex created at %s %lu\n",
+- mutex->cfile_name, (ulong) mutex->cline);
++ "Mutex '%s'\n",
++ mutex->cmutex_name);
- if (mutex_get_lock_word(mutex) != 0) {
- const char* file_name;
+ if (mutex_get_lock_word(mutex) != 0) {
+ ulint line;
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
-@@ -585,6 +585,8 @@
+@@ -604,6 +604,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},
{"buffer_pool_pages_free",
(char*) &export_vars.innodb_buffer_pool_pages_free, SHOW_LONG},
#ifdef UNIV_DEBUG
-@@ -10977,6 +10979,16 @@
+@@ -11050,6 +11052,16 @@
"Force InnoDB to not use next-key locking, to use only row-level locking.",
NULL, NULL, FALSE);
#ifdef UNIV_LOG_ARCHIVE
static MYSQL_SYSVAR_STR(log_arch_dir, innobase_log_arch_dir,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
-@@ -11164,7 +11176,7 @@
+@@ -11237,7 +11249,7 @@
static MYSQL_SYSVAR_STR(version, innodb_version_str,
PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_READONLY,
static MYSQL_SYSVAR_BOOL(use_sys_malloc, srv_use_sys_malloc,
PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
-@@ -11249,6 +11261,8 @@
+@@ -11330,6 +11342,8 @@
MYSQL_SYSVAR(thread_concurrency),
MYSQL_SYSVAR(thread_sleep_delay),
MYSQL_SYSVAR(autoinc_lock_mode),
/* The sort order table of the MySQL latin1_swedish_ci character set
collation */
extern const byte* srv_latin1_ordering;
-@@ -318,6 +321,8 @@
+@@ -323,6 +326,8 @@
buffer pool to disk */
extern ulint srv_buf_pool_flushed;
/** Number of buffer pool reads that led to the
reading of a disk page */
extern ulint srv_buf_pool_reads;
-@@ -699,6 +704,7 @@
+@@ -717,6 +722,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 */
/** Maximum number of times allowed to conditionally acquire
mutex before switching to blocking wait on the mutex */
#define MAX_MUTEX_NOWAIT 20
-@@ -313,6 +317,7 @@
+@@ -318,6 +322,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;
/** Number of buffer pool reads that led to the
reading of a disk page */
-@@ -1821,6 +1826,13 @@
+@@ -1826,6 +1831,13 @@
ulint n_reserved;
ibool ret;
mutex_enter(&srv_innodb_monitor_mutex);
current_time = time(NULL);
-@@ -1869,31 +1881,6 @@
+@@ -1874,31 +1886,6 @@
mutex_exit(&dict_foreign_err_mutex);
fputs("--------\n"
"FILE I/O\n"
"--------\n", file);
-@@ -1924,10 +1911,84 @@
+@@ -1929,10 +1916,84 @@
"BUFFER POOL AND MEMORY\n"
"----------------------\n", file);
fprintf(file,
fprintf(file, "Dictionary memory allocated " ULINTPF "\n",
dict_sys->size);
-@@ -1943,6 +2004,16 @@
+@@ -1948,6 +2009,16 @@
fprintf(file, "%lu read views open inside InnoDB\n",
UT_LIST_GET_LEN(trx_sys->view_list));
n_reserved = fil_space_get_n_reserved_extents(0);
if (n_reserved > 0) {
fprintf(file,
-@@ -1986,6 +2057,31 @@
+@@ -1991,6 +2062,31 @@
srv_n_rows_deleted_old = srv_n_rows_deleted;
srv_n_rows_read_old = srv_n_rows_read;
fputs("----------------------------\n"
"END OF INNODB MONITOR OUTPUT\n"
"============================\n", file);
-@@ -2029,6 +2125,7 @@
+@@ -2034,6 +2130,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;
diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
--- a/storage/innobase/handler/ha_innodb.cc 2011-01-21 19:53:42.369599743 +0900
+++ b/storage/innobase/handler/ha_innodb.cc 2011-01-21 19:54:44.659599699 +0900
-@@ -619,6 +619,16 @@
+@@ -638,6 +638,16 @@
trx_t* trx); /*!< in: transaction handle */
static SHOW_VAR innodb_status_variables[]= {
{"buffer_pool_pages_data",
(char*) &export_vars.innodb_buffer_pool_pages_data, SHOW_LONG},
{"buffer_pool_pages_dirty",
-@@ -633,8 +643,14 @@
+@@ -652,8 +662,14 @@
{"buffer_pool_pages_latched",
(char*) &export_vars.innodb_buffer_pool_pages_latched, SHOW_LONG},
#endif /* UNIV_DEBUG */
{"buffer_pool_pages_total",
(char*) &export_vars.innodb_buffer_pool_pages_total, SHOW_LONG},
{"buffer_pool_read_ahead",
-@@ -649,6 +665,12 @@
+@@ -668,6 +684,12 @@
(char*) &export_vars.innodb_buffer_pool_wait_free, SHOW_LONG},
{"buffer_pool_write_requests",
(char*) &export_vars.innodb_buffer_pool_write_requests, SHOW_LONG},
{"data_fsyncs",
(char*) &export_vars.innodb_data_fsyncs, SHOW_LONG},
{"data_pending_fsyncs",
-@@ -675,12 +697,66 @@
+@@ -694,12 +716,66 @@
(char*) &export_vars.innodb_dict_tables, SHOW_LONG},
{"have_atomic_builtins",
(char*) &export_vars.innodb_have_atomic_builtins, SHOW_BOOL},
{"os_log_fsyncs",
(char*) &export_vars.innodb_os_log_fsyncs, SHOW_LONG},
{"os_log_pending_fsyncs",
-@@ -697,8 +773,14 @@
+@@ -716,8 +792,14 @@
(char*) &export_vars.innodb_pages_read, SHOW_LONG},
{"pages_written",
(char*) &export_vars.innodb_pages_written, SHOW_LONG},
{"row_lock_time",
(char*) &export_vars.innodb_row_lock_time, SHOW_LONGLONG},
{"row_lock_time_avg",
-@@ -715,8 +797,20 @@
+@@ -734,8 +816,20 @@
(char*) &export_vars.innodb_rows_read, SHOW_LONG},
{"rows_updated",
(char*) &export_vars.innodb_rows_updated, SHOW_LONG},
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
-@@ -737,6 +737,11 @@
+@@ -751,6 +751,11 @@
/** Status variables to be passed to MySQL */
struct export_var_struct{
ulint innodb_data_pending_reads; /*!< Pending reads */
ulint innodb_data_pending_writes; /*!< Pending writes */
ulint innodb_data_pending_fsyncs; /*!< Pending fsyncs */
-@@ -754,6 +759,9 @@
+@@ -768,6 +773,9 @@
#ifdef UNIV_DEBUG
ulint innodb_buffer_pool_pages_latched; /*!< Latched pages */
#endif /* UNIV_DEBUG */
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 */
-@@ -762,13 +770,43 @@
+@@ -776,13 +784,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*/
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 */
-@@ -777,6 +815,8 @@
+@@ -791,6 +829,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 */
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
-@@ -786,11 +826,18 @@
+@@ -800,11 +840,18 @@
/ srv_n_lock_wait_count */
ulint innodb_row_lock_time_max; /*!< srv_n_lock_max_wait_time
/ 1000 */
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
-@@ -2263,12 +2263,49 @@
+@@ -2267,12 +2267,49 @@
ulint LRU_len;
ulint free_len;
ulint flush_list_len;
export_vars.innodb_data_pending_reads
= os_n_pending_reads;
export_vars.innodb_data_pending_writes
-@@ -2305,6 +2342,92 @@
+@@ -2309,6 +2346,92 @@
export_vars.innodb_buffer_pool_pages_misc
= buf_pool_get_n_pages() - LRU_len - free_len;
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
-@@ -11665,7 +11665,14 @@
+@@ -11746,7 +11746,14 @@
i_s_innodb_cmp,
i_s_innodb_cmp_reset,
i_s_innodb_cmpmem,
diff -ruN a/storage/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c
--- a/storage/innobase/btr/btr0cur.c 2010-11-03 07:01:13.000000000 +0900
+++ b/storage/innobase/btr/btr0cur.c 2010-12-03 15:48:29.268957148 +0900
-@@ -3935,7 +3935,8 @@
+@@ -4066,7 +4066,8 @@
mtr_commit(mtr);
mutex_enter(&block->mutex);
/* Only free the block if it is still allocated to
-@@ -3946,17 +3947,22 @@
+@@ -4077,16 +4078,21 @@
&& buf_block_get_space(block) == space
&& buf_block_get_page_no(block) == page_no) {
-- if (buf_LRU_free_block(&block->page, all, NULL)
-+ if (buf_LRU_free_block(&block->page, all, NULL, TRUE)
- != BUF_LRU_FREED
+- if (buf_LRU_free_block(&block->page, all) != BUF_LRU_FREED
- && all && block->page.zip.data) {
++ if (buf_LRU_free_block(&block->page, all, TRUE) != BUF_LRU_FREED
+ && all && block->page.zip.data
+ /* Now, buf_LRU_free_block() may release mutex temporarily */
+ && buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE
/* Attempt to deallocate the uncompressed page
if the whole block cannot be deallocted. */
-- buf_LRU_free_block(&block->page, FALSE, NULL);
-+ buf_LRU_free_block(&block->page, FALSE, NULL, TRUE);
+- buf_LRU_free_block(&block->page, FALSE);
++ buf_LRU_free_block(&block->page, FALSE, TRUE);
}
}
+ if (have_page_hash_mutex) {
+ rw_lock_x_unlock(&buf_pool->page_hash_latch);
+ }
- block = buf_LRU_get_free_block(buf_pool, 0);
+ block = buf_LRU_get_free_block(buf_pool);
*lru = TRUE;
- buf_pool_mutex_enter(buf_pool);
+ //buf_pool_mutex_enter(buf_pool);
buf_LRU_make_block_old(&block->page);
dirty++;
-- } else if (buf_LRU_free_block(&block->page, TRUE, NULL)
-+ } else if (buf_LRU_free_block(&block->page, TRUE, NULL, TRUE)
+- } else if (buf_LRU_free_block(&block->page, TRUE)
++ } else if (buf_LRU_free_block(&block->page, TRUE, TRUE)
!= BUF_LRU_FREED) {
nonfree++;
}
bpage = buf_page_hash_get(buf_pool, space, offset);
-@@ -2257,7 +2337,8 @@
+@@ -2259,7 +2339,8 @@
bpage->file_page_was_freed = TRUE;
}
return(bpage);
}
-@@ -2278,7 +2359,8 @@
+@@ -2280,7 +2361,8 @@
buf_page_t* bpage;
buf_pool_t* buf_pool = buf_pool_get(space, offset);
bpage = buf_page_hash_get(buf_pool, space, offset);
-@@ -2287,7 +2369,8 @@
+@@ -2289,7 +2371,8 @@
bpage->file_page_was_freed = FALSE;
}
return(bpage);
}
-@@ -2322,8 +2405,9 @@
+@@ -2324,8 +2407,9 @@
buf_pool->stat.n_page_gets++;
for (;;) {
bpage = buf_page_hash_get(buf_pool, space, offset);
if (bpage) {
ut_ad(!buf_pool_watch_is_sentinel(buf_pool, bpage));
-@@ -2332,7 +2416,8 @@
+@@ -2334,7 +2418,8 @@
/* Page not in buf_pool: needs to be read from file */
buf_read_page(space, zip_size, offset);
-@@ -2344,10 +2429,15 @@
+@@ -2346,10 +2431,15 @@
if (UNIV_UNLIKELY(!bpage->zip.data)) {
/* There is no compressed page. */
err_exit:
ut_ad(!buf_pool_watch_is_sentinel(buf_pool, bpage));
switch (buf_page_get_state(bpage)) {
-@@ -2356,19 +2446,19 @@
+@@ -2358,19 +2448,19 @@
case BUF_BLOCK_MEMORY:
case BUF_BLOCK_REMOVE_HASH:
case BUF_BLOCK_ZIP_FREE:
+ ut_a(block_mutex == &((buf_block_t*) bpage)->mutex);
/* Discard the uncompressed page frame if possible. */
-- if (buf_LRU_free_block(bpage, FALSE, NULL)
-+ if (buf_LRU_free_block(bpage, FALSE, NULL, FALSE)
- == BUF_LRU_FREED) {
+- if (buf_LRU_free_block(bpage, FALSE) == BUF_LRU_FREED) {
++ if (buf_LRU_free_block(bpage, FALSE, FALSE) == BUF_LRU_FREED) {
mutex_exit(block_mutex);
-@@ -2387,7 +2477,7 @@
+ goto lookup;
+@@ -2388,7 +2478,7 @@
must_read = buf_page_get_io_fix(bpage) == BUF_IO_READ;
access_time = buf_page_is_accessed(bpage);
mutex_exit(block_mutex);
-@@ -2696,7 +2786,7 @@
+@@ -2697,7 +2787,7 @@
const buf_block_t* block) /*!< in: pointer to block,
not dereferenced */
{
if (UNIV_UNLIKELY((((ulint) block) % sizeof *block) != 0)) {
/* The pointer should be aligned. */
-@@ -2732,6 +2822,7 @@
+@@ -2733,6 +2823,7 @@
ulint fix_type;
ibool must_read;
ulint retries = 0;
buf_pool_t* buf_pool = buf_pool_get(space, offset);
ut_ad(mtr);
-@@ -2754,9 +2845,11 @@
+@@ -2755,9 +2846,11 @@
fold = buf_page_address_fold(space, offset);
loop:
block = guess;
/* 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
-@@ -2765,11 +2858,15 @@
+@@ -2766,11 +2859,15 @@
the guess may be pointing to a buffer pool chunk that
has been released when resizing the buffer pool. */
block = guess = NULL;
} else {
ut_ad(!block->page.in_zip_hash);
-@@ -2778,12 +2875,19 @@
+@@ -2779,12 +2876,19 @@
}
if (block == NULL) {
block = NULL;
}
-@@ -2795,12 +2899,14 @@
+@@ -2796,12 +2900,14 @@
space, offset, fold);
if (UNIV_LIKELY_NULL(block)) {
if (mode == BUF_GET_IF_IN_POOL
|| mode == BUF_GET_IF_IN_POOL_OR_WATCH) {
-@@ -2848,7 +2954,8 @@
+@@ -2849,7 +2955,8 @@
/* The page is being read to buffer pool,
but we cannot wait around for the read to
complete. */
return(NULL);
}
-@@ -2858,38 +2965,49 @@
+@@ -2859,38 +2966,49 @@
ibool success;
case BUF_BLOCK_FILE_PAGE:
+ //mutex_exit(&buf_pool->zip_mutex);
+ mutex_exit(block_mutex);
- block = buf_LRU_get_free_block(buf_pool, 0);
+ block = buf_LRU_get_free_block(buf_pool);
ut_a(block);
+ block_mutex = &block->mutex;
{
buf_page_t* hash_bpage;
-@@ -2902,35 +3020,47 @@
+@@ -2903,35 +3021,47 @@
while buf_pool->mutex was released.
Free the block that was allocated. */
buf_block_init_low(block);
block->lock_hash_val = lock_rec_hash(space, offset);
-@@ -2939,7 +3069,7 @@
+@@ -2940,7 +3070,7 @@
if (buf_page_get_state(&block->page)
== BUF_BLOCK_ZIP_PAGE) {
&block->page);
ut_ad(!block->page.in_flush_list);
} else {
-@@ -2956,19 +3086,24 @@
+@@ -2957,19 +3087,24 @@
/* Insert at the front of unzip_LRU list */
buf_unzip_LRU_add_block(block, FALSE);
/* Decompress the page and apply buffered operations
while not holding buf_pool->mutex or block->mutex. */
-@@ -2981,12 +3116,15 @@
+@@ -2982,12 +3117,15 @@
}
/* Unfix and unlatch the block. */
rw_lock_x_unlock(&block->lock);
break;
-@@ -3002,7 +3140,7 @@
+@@ -3003,7 +3141,7 @@
ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
#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
-@@ -3015,7 +3153,7 @@
+@@ -3016,7 +3154,7 @@
/* Try to evict the block from the buffer pool, to use the
insert buffer (change buffer) as much as possible. */
-- if (buf_LRU_free_block(&block->page, TRUE, NULL)
-+ if (buf_LRU_free_block(&block->page, TRUE, NULL, FALSE)
- == BUF_LRU_FREED) {
+- if (buf_LRU_free_block(&block->page, TRUE) == BUF_LRU_FREED) {
++ if (buf_LRU_free_block(&block->page, TRUE, FALSE) == BUF_LRU_FREED) {
mutex_exit(&block->mutex);
if (mode == BUF_GET_IF_IN_POOL_OR_WATCH) {
+ /* Set the watch, as it would have
@@ -3052,13 +3190,14 @@
buf_block_buf_fix_inc(block, file, line);
block = (buf_block_t*) buf_page_hash_get_low(
buf_pool, space, offset, fold);
@@ -3816,7 +3991,9 @@
- #endif /* UNIV_DEBUG_FILE_ACCESSES */
+ #endif /* UNIV_DEBUG_FILE_ACCESSES || UNIV_DEBUG */
/* Page can be found in buf_pool */
- buf_pool_mutex_exit(buf_pool);
ut_ad(block->page.in_LRU_list);
- mutex_enter(&block->mutex);
-- freed = buf_LRU_free_block(&block->page, FALSE, NULL);
-+ freed = buf_LRU_free_block(&block->page, FALSE, NULL, have_LRU_mutex);
+- freed = buf_LRU_free_block(&block->page, FALSE);
++ freed = buf_LRU_free_block(&block->page, FALSE, have_LRU_mutex);
mutex_exit(&block->mutex);
switch (freed) {
- mutex_enter(block_mutex);
accessed = buf_page_is_accessed(bpage);
-- freed = buf_LRU_free_block(bpage, TRUE, NULL);
-+ freed = buf_LRU_free_block(bpage, TRUE, NULL, have_LRU_mutex);
+- freed = buf_LRU_free_block(bpage, TRUE);
++ freed = buf_LRU_free_block(bpage, TRUE, have_LRU_mutex);
mutex_exit(block_mutex);
switch (freed) {
}
return(block);
-@@ -868,7 +940,7 @@
+@@ -866,7 +938,7 @@
ibool mon_value_was = FALSE;
ibool started_monitor = FALSE;
loop:
if (!recv_recovery_on && UT_LIST_GET_LEN(buf_pool->free)
+ UT_LIST_GET_LEN(buf_pool->LRU) < buf_pool->curr_size / 20) {
-@@ -951,8 +1023,10 @@
- ibool lru;
- page_zip_set_size(&block->page.zip, zip_size);
-
-+ mutex_enter(&buf_pool->LRU_list_mutex);
- block->page.zip.data = buf_buddy_alloc(
-- buf_pool, zip_size, &lru);
-+ buf_pool, zip_size, &lru, FALSE);
-+ mutex_exit(&buf_pool->LRU_list_mutex);
-
- UNIV_MEM_DESC(block->page.zip.data, zip_size, block);
- } else {
-@@ -960,7 +1034,7 @@
- block->page.zip.data = NULL;
- }
-
-- buf_pool_mutex_exit(buf_pool);
-+ //buf_pool_mutex_exit(buf_pool);
-
- if (started_monitor) {
- srv_print_innodb_monitor = mon_value_was;
-@@ -972,7 +1046,7 @@
- /* If no block was in the free list, search from the end of the LRU
- list and try to free a block there */
+@@ -934,7 +1006,7 @@
+ /* If there is a block in the free list, take it */
+ block = buf_LRU_get_free_only(buf_pool);
- buf_pool_mutex_exit(buf_pool);
+ //buf_pool_mutex_exit(buf_pool);
- freed = buf_LRU_search_and_free_block(buf_pool, n_iterations);
-
-@@ -1058,7 +1132,8 @@
+ if (block) {
+ ut_ad(buf_pool_from_block(block) == buf_pool);
+@@ -1034,7 +1106,8 @@
ulint new_len;
ut_a(buf_pool->LRU_old);
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)
-@@ -1124,7 +1199,8 @@
+@@ -1100,7 +1173,8 @@
{
buf_page_t* bpage;
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
-@@ -1159,13 +1235,14 @@
+@@ -1135,13 +1209,14 @@
ut_ad(buf_pool);
ut_ad(bpage);
ut_ad(buf_page_in_file(bpage));
UT_LIST_REMOVE(unzip_LRU, buf_pool->unzip_LRU, block);
}
-@@ -1183,7 +1260,8 @@
+@@ -1159,7 +1234,8 @@
ut_ad(buf_pool);
ut_ad(bpage);
ut_a(buf_page_in_file(bpage));
-@@ -1260,12 +1338,13 @@
+@@ -1236,12 +1312,13 @@
ut_ad(buf_pool);
ut_ad(block);
if (old) {
UT_LIST_ADD_LAST(unzip_LRU, buf_pool->unzip_LRU, block);
-@@ -1286,7 +1365,8 @@
+@@ -1262,7 +1339,8 @@
ut_ad(buf_pool);
ut_ad(bpage);
ut_a(buf_page_in_file(bpage));
-@@ -1337,7 +1417,8 @@
+@@ -1313,7 +1391,8 @@
ut_ad(buf_pool);
ut_ad(bpage);
ut_a(buf_page_in_file(bpage));
ut_ad(!bpage->in_LRU_list);
-@@ -1416,7 +1497,8 @@
+@@ -1392,7 +1471,8 @@
{
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
if (bpage->old) {
buf_pool->stat.n_pages_made_young++;
-@@ -1458,19 +1540,20 @@
+@@ -1432,17 +1512,18 @@
+ buf_LRU_free_block(
+ /*===============*/
buf_page_t* bpage, /*!< in: block to be freed */
- ibool zip, /*!< in: TRUE if should remove also the
+- ibool zip) /*!< in: TRUE if should remove also the
++ ibool zip, /*!< in: TRUE if should remove also the
compressed page of an uncompressed page */
-- ibool* buf_pool_mutex_released)
-+ ibool* buf_pool_mutex_released,
- /*!< in: pointer to a variable that will
- be assigned TRUE if buf_pool_mutex
- was temporarily released, or NULL */
+ ibool have_LRU_mutex)
{
buf_page_t* b = NULL;
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
-@@ -1479,7 +1562,7 @@
+@@ -1451,7 +1532,7 @@
UNIV_MEM_ASSERT_RW(bpage, sizeof *bpage);
#endif
/* Do not free buffer-fixed or I/O-fixed blocks. */
return(BUF_LRU_NOT_FREED);
-@@ -1511,15 +1594,15 @@
+@@ -1483,15 +1564,15 @@
If it cannot be allocated (without freeing a block
from the LRU list), refuse to free bpage. */
alloc:
}
#ifdef UNIV_DEBUG
-@@ -1530,6 +1613,39 @@
+@@ -1502,6 +1583,39 @@
}
#endif /* UNIV_DEBUG */
if (buf_LRU_block_remove_hashed_page(bpage, zip)
!= BUF_BLOCK_ZIP_FREE) {
ut_a(bpage->buf_fix_count == 0);
-@@ -1546,6 +1662,10 @@
+@@ -1518,6 +1632,10 @@
ut_a(!hash_b);
b->state = b->oldest_modification
? BUF_BLOCK_ZIP_DIRTY
: BUF_BLOCK_ZIP_PAGE;
-@@ -1642,7 +1762,9 @@
- *buf_pool_mutex_released = TRUE;
+@@ -1610,7 +1728,9 @@
+ b->io_fix = BUF_IO_READ;
}
- buf_pool_mutex_exit(buf_pool);
mutex_exit(block_mutex);
/* Remove possible adaptive hash index on the page.
-@@ -1674,7 +1796,9 @@
+@@ -1642,7 +1762,9 @@
: BUF_NO_CHECKSUM_MAGIC);
}
mutex_enter(block_mutex);
if (b) {
-@@ -1684,13 +1808,17 @@
+@@ -1652,13 +1774,17 @@
mutex_exit(&buf_pool->zip_mutex);
}
}
return(BUF_LRU_FREED);
-@@ -1702,13 +1830,14 @@
+@@ -1670,13 +1796,14 @@
void
buf_LRU_block_free_non_file_page(
/*=============================*/
ut_ad(mutex_own(&block->mutex));
switch (buf_block_get_state(block)) {
-@@ -1742,18 +1871,21 @@
+@@ -1710,18 +1837,21 @@
if (data) {
block->page.zip.data = NULL;
mutex_exit(&block->mutex);
UNIV_MEM_ASSERT_AND_FREE(block->frame, UNIV_PAGE_SIZE);
}
-@@ -1783,7 +1915,11 @@
+@@ -1751,7 +1881,11 @@
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
ut_ad(bpage);
ut_ad(mutex_own(buf_page_get_mutex(bpage)));
ut_a(buf_page_get_io_fix(bpage) == BUF_IO_NONE);
-@@ -1891,7 +2027,9 @@
+@@ -1859,7 +1993,9 @@
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
mutex_exit(buf_page_get_mutex(bpage));
buf_print();
buf_LRU_print();
buf_validate();
-@@ -1912,17 +2050,17 @@
+@@ -1880,17 +2016,17 @@
ut_a(bpage->zip.data);
ut_a(buf_page_get_zip_size(bpage));
UNIV_MEM_UNDESC(bpage);
return(BUF_BLOCK_ZIP_FREE);
-@@ -1945,13 +2083,13 @@
+@@ -1913,13 +2049,13 @@
ut_ad(!bpage->in_flush_list);
ut_ad(!bpage->in_LRU_list);
mutex_exit(&((buf_block_t*) bpage)->mutex);
mutex_enter(&((buf_block_t*) bpage)->mutex);
page_zip_set_size(&bpage->zip, 0);
}
-@@ -1977,18 +2115,19 @@
+@@ -1945,18 +2081,19 @@
void
buf_LRU_block_free_hashed_page(
/*===========================*/
}
/**********************************************************************//**
-@@ -2015,7 +2154,8 @@
+@@ -1983,7 +2120,8 @@
}
if (adjust) {
if (ratio != buf_pool->LRU_old_ratio) {
buf_pool->LRU_old_ratio = ratio;
-@@ -2027,7 +2167,8 @@
+@@ -1995,7 +2133,8 @@
}
}
} else {
buf_pool->LRU_old_ratio = ratio;
}
-@@ -2132,7 +2273,8 @@
+@@ -2100,7 +2239,8 @@
ulint new_len;
ut_ad(buf_pool);
if (UT_LIST_GET_LEN(buf_pool->LRU) >= BUF_LRU_OLD_MIN_LEN) {
-@@ -2193,16 +2335,22 @@
+@@ -2161,16 +2301,22 @@
ut_a(buf_pool->LRU_old_len == old_len);
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));
-@@ -2216,7 +2364,8 @@
+@@ -2184,7 +2330,8 @@
ut_a(buf_page_belongs_to_unzip_LRU(&block->page));
}
}
/**********************************************************************//**
-@@ -2252,7 +2401,8 @@
+@@ -2220,7 +2367,8 @@
const buf_page_t* bpage;
ut_ad(buf_pool);
bpage = UT_LIST_GET_FIRST(buf_pool->LRU);
-@@ -2309,7 +2459,8 @@
+@@ -2277,7 +2425,8 @@
bpage = UT_LIST_GET_NEXT(LRU, bpage);
}
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:48:03.048955897 +0900
+++ b/storage/innobase/handler/ha_innodb.cc 2010-12-03 15:48:29.304024564 +0900
-@@ -245,6 +245,10 @@
+@@ -264,6 +264,10 @@
# endif /* !PFS_SKIP_BUFFER_MUTEX_RWLOCK */
{&buf_pool_mutex_key, "buf_pool_mutex", 0},
{&buf_pool_zip_mutex_key, "buf_pool_zip_mutex", 0},
{&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},
-@@ -295,6 +299,7 @@
+@@ -314,6 +318,7 @@
{&archive_lock_key, "archive_lock", 0},
# endif /* UNIV_LOG_ARCHIVE */
{&btr_search_latch_key, "btr_search_latch", 0},
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
-@@ -3783,9 +3783,11 @@
+@@ -3766,9 +3766,11 @@
ulint fold = buf_page_address_fold(space, page_no);
buf_pool_t* buf_pool = buf_pool_get(space, page_no);
diff -ruN a/storage/innobase/include/buf0lru.h b/storage/innobase/include/buf0lru.h
--- a/storage/innobase/include/buf0lru.h 2010-11-03 07:01:13.000000000 +0900
+++ b/storage/innobase/include/buf0lru.h 2010-12-03 15:48:29.349024701 +0900
-@@ -113,10 +113,11 @@
+@@ -111,8 +111,9 @@
+ buf_LRU_free_block(
+ /*===============*/
buf_page_t* bpage, /*!< in: block to be freed */
- ibool zip, /*!< in: TRUE if should remove also the
+- ibool zip) /*!< in: TRUE if should remove also the
++ ibool zip, /*!< in: TRUE if should remove also the
compressed page of an uncompressed page */
-- ibool* buf_pool_mutex_released);
-+ ibool* buf_pool_mutex_released,
- /*!< in: pointer to a variable that will
- be assigned TRUE if buf_pool->mutex
- was temporarily released, or NULL */
-+ ibool have_LRU_mutex);
++ ibool have_LRU_mutex)
+ __attribute__((nonnull));
/******************************************************************//**
Try to free a replaceable block.
- @return TRUE if found and freed */
-@@ -163,7 +164,8 @@
+@@ -159,7 +160,8 @@
void
buf_LRU_block_free_non_file_page(
/*=============================*/
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
-@@ -3094,7 +3094,7 @@
+@@ -3099,7 +3099,7 @@
level += log_sys->max_checkpoint_age
- (lsn - oldest_modification);
}
n_blocks++;
}
-@@ -3180,7 +3180,7 @@
+@@ -3185,7 +3185,7 @@
found = TRUE;
break;
}
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
-@@ -265,7 +265,7 @@
+@@ -284,7 +284,7 @@
mutex->lock_word = 0;
#endif
mutex->event = os_event_create(NULL);
#ifdef UNIV_DEBUG
mutex->magic_n = MUTEX_MAGIC_N;
#endif /* UNIV_DEBUG */
-@@ -444,6 +444,15 @@
+@@ -463,6 +463,15 @@
mutex_t* mutex, /*!< in: mutex */
ulint n) /*!< in: value to set */
{
volatile ulint* ptr; /* declared volatile to ensure that
the value is stored to memory */
ut_ad(mutex);
-@@ -452,6 +461,7 @@
+@@ -471,6 +480,7 @@
*ptr = n; /* Here we assume that the write of a single
word in memory is atomic */
}
/******************************************************************//**
-@@ -1193,7 +1203,12 @@
+@@ -1185,7 +1195,12 @@
ut_error;
}
break;
case SYNC_BUF_POOL:
/* We can have multiple mutexes of this type therefore we
can only check whether the greater than condition holds. */
-@@ -1211,7 +1226,8 @@
+@@ -1203,7 +1218,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));
#!!! 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/btr0cur.c b/storage/innobase/btr/btr0cur.c
---- a/storage/innobase/btr/btr0cur.c 2010-12-03 15:49:59.165212710 +0900
-+++ b/storage/innobase/btr/btr0cur.c 2010-12-03 17:19:24.834126874 +0900
-@@ -1010,6 +1010,107 @@
- }
- }
-
-+/**********************************************************************//**
-+Positions a cursor at a randomly chosen position within a B-tree
-+after the given path
-+@return TRUE if the position is at the first page, and cursor must point
-+ the first record for used by the caller.*/
-+UNIV_INTERN
-+ibool
-+btr_cur_open_at_rnd_pos_after_path(
-+/*====================*/
-+ dict_index_t* index, /*!< in: index */
-+ ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */
-+ btr_path_t* first_rec_path,
-+ btr_cur_t* cursor, /*!< in/out: B-tree cursor */
-+ mtr_t* mtr) /*!< in: mtr */
-+{
-+ page_cur_t* page_cursor;
-+ btr_path_t* slot;
-+ ibool is_first_rec = TRUE;
-+ ulint page_no;
-+ ulint space;
-+ ulint zip_size;
-+ ulint height;
-+ rec_t* node_ptr;
-+ mem_heap_t* heap = NULL;
-+ ulint offsets_[REC_OFFS_NORMAL_SIZE];
-+ ulint* offsets = offsets_;
-+ rec_offs_init(offsets_);
-+
-+ if (latch_mode == BTR_MODIFY_TREE) {
-+ mtr_x_lock(dict_index_get_lock(index), mtr);
-+ } else {
-+ mtr_s_lock(dict_index_get_lock(index), mtr);
-+ }
-+
-+ page_cursor = btr_cur_get_page_cur(cursor);
-+ cursor->index = index;
-+
-+ space = dict_index_get_space(index);
-+ zip_size = dict_table_zip_size(index->table);
-+ page_no = dict_index_get_page(index);
-+
-+ height = ULINT_UNDEFINED;
-+ slot = first_rec_path;
-+
-+ for (;;) {
-+ buf_block_t* block;
-+ page_t* page;
-+
-+ block = buf_page_get_gen(space, zip_size, page_no,
-+ RW_NO_LATCH, NULL, BUF_GET,
-+ __FILE__, __LINE__, mtr);
-+ page = buf_block_get_frame(block);
-+ ut_ad(index->id == btr_page_get_index_id(page));
-+
-+ if (height == ULINT_UNDEFINED) {
-+ /* We are in the root node */
-+
-+ height = btr_page_get_level(page, mtr);
-+ }
-+
-+ if (height == 0) {
-+ btr_cur_latch_leaves(page, space, zip_size, page_no,
-+ latch_mode, cursor, mtr);
-+ }
-+
-+ if (is_first_rec && slot->nth_rec != ULINT_UNDEFINED) {
-+ if (height == 0) {
-+ /* must open the first rec */
-+ page_cur_open_on_nth_user_rec(block, page_cursor, slot->nth_rec);
-+ } else {
-+ is_first_rec = page_cur_open_on_rnd_user_rec_after_nth(block,
-+ page_cursor, slot->nth_rec);
-+ }
-+ } else {
-+ is_first_rec = FALSE;
-+ page_cur_open_on_rnd_user_rec(block, page_cursor);
-+ }
-+
-+ if (height == 0) {
-+ break;
-+ }
-+
-+ ut_ad(height > 0);
-+
-+ height--;
-+ slot++;
-+
-+ node_ptr = page_cur_get_rec(page_cursor);
-+ offsets = rec_get_offsets(node_ptr, cursor->index, offsets,
-+ ULINT_UNDEFINED, &heap);
-+ /* Go to the child node */
-+ page_no = btr_node_ptr_get_child_page_no(node_ptr, offsets);
-+ }
-+
-+ if (UNIV_LIKELY_NULL(heap)) {
-+ mem_heap_free(heap);
-+ }
-+
-+ return (is_first_rec);
-+}
-+
- /*==================== B-TREE INSERT =========================*/
-
- /*************************************************************//**
-@@ -3479,6 +3580,154 @@
- }
-
- /*******************************************************************//**
-+Estimates the number of pages which have not null value of the key of n_cols.
-+@return estimated number of pages */
-+UNIV_INTERN
-+ulint
-+btr_estimate_n_pages_not_null(
-+/*=========================*/
-+ dict_index_t* index, /*!< in: index */
-+ ulint n_cols, /*!< in: The cols should be not null */
-+ btr_path_t* path1) /*!< in: path1[BTR_PATH_ARRAY_N_SLOTS] */
-+{
-+ dtuple_t* tuple1;
-+ btr_path_t path2[BTR_PATH_ARRAY_N_SLOTS];
-+ btr_cur_t cursor;
-+ btr_path_t* slot1;
-+ btr_path_t* slot2;
-+ ibool diverged;
-+ ibool diverged_lot;
-+ ulint divergence_level;
-+ ulint n_pages;
-+ ulint i;
-+ mtr_t mtr;
-+ mem_heap_t* heap;
-+
-+ heap = mem_heap_create(n_cols * sizeof(dfield_t)
-+ + sizeof(dtuple_t));
-+
-+ /* make tuple1 (NULL,NULL,,,) from n_cols */
-+ tuple1 = dtuple_create(heap, n_cols);
-+ dict_index_copy_types(tuple1, index, n_cols);
-+
-+ for (i = 0; i < n_cols; i++) {
-+ dfield_set_null(dtuple_get_nth_field(tuple1, i));
-+ }
-+
-+ mtr_start(&mtr);
-+
-+ cursor.path_arr = path1;
-+
-+ btr_cur_search_to_nth_level(index, 0, tuple1, PAGE_CUR_G,
-+ BTR_SEARCH_LEAF | BTR_ESTIMATE,
-+ &cursor, 0, __FILE__, __LINE__, &mtr);
-+
-+ mtr_commit(&mtr);
-+
-+
-+
-+ mtr_start(&mtr);
-+
-+ cursor.path_arr = path2;
-+
-+ btr_cur_open_at_index_side(FALSE, index,
-+ BTR_SEARCH_LEAF | BTR_ESTIMATE,
-+ &cursor, &mtr);
-+
-+ mtr_commit(&mtr);
-+
-+ mem_heap_free(heap);
-+
-+ /* We have the path information for the range in path1 and path2 */
-+
-+ n_pages = 1;
-+ diverged = FALSE; /* This becomes true when the path is not
-+ the same any more */
-+ diverged_lot = FALSE; /* This becomes true when the paths are
-+ not the same or adjacent any more */
-+ divergence_level = 1000000; /* This is the level where paths diverged
-+ a lot */
-+ for (i = 0; ; i++) {
-+ ut_ad(i < BTR_PATH_ARRAY_N_SLOTS);
-+
-+ slot1 = path1 + i;
-+ slot2 = path2 + i;
-+
-+ if ((slot1 + 1)->nth_rec == ULINT_UNDEFINED
-+ || (slot2 + 1)->nth_rec == ULINT_UNDEFINED) {
-+
-+ if (i > divergence_level + 1) {
-+ /* In trees whose height is > 1 our algorithm
-+ tends to underestimate: multiply the estimate
-+ by 2: */
-+
-+ n_pages = n_pages * 2;
-+ }
-+
-+ /* Do not estimate the number of rows in the range
-+ to over 1 / 2 of the estimated rows in the whole
-+ table */
-+
-+ if (n_pages > index->stat_n_leaf_pages / 2) {
-+ n_pages = index->stat_n_leaf_pages / 2;
-+
-+ /* If there are just 0 or 1 rows in the table,
-+ then we estimate all rows are in the range */
-+
-+ if (n_pages == 0) {
-+ n_pages = index->stat_n_leaf_pages;
-+ }
-+ }
-+
-+ return(n_pages);
-+ }
-+
-+ if (!diverged && slot1->nth_rec != slot2->nth_rec) {
-+
-+ diverged = TRUE;
-+
-+ if (slot1->nth_rec < slot2->nth_rec) {
-+ n_pages = slot2->nth_rec - slot1->nth_rec;
-+
-+ if (n_pages > 1) {
-+ diverged_lot = TRUE;
-+ divergence_level = i;
-+ }
-+ } else {
-+ /* Maybe the tree has changed between
-+ searches */
-+
-+ return(10);
-+ }
-+
-+ } else if (diverged && !diverged_lot) {
-+
-+ if (slot1->nth_rec < slot1->n_recs
-+ || slot2->nth_rec > 1) {
-+
-+ diverged_lot = TRUE;
-+ divergence_level = i;
-+
-+ n_pages = 0;
-+
-+ if (slot1->nth_rec < slot1->n_recs) {
-+ n_pages += slot1->n_recs
-+ - slot1->nth_rec;
-+ }
-+
-+ if (slot2->nth_rec > 1) {
-+ n_pages += slot2->nth_rec - 1;
-+ }
-+ }
-+ } else if (diverged_lot) {
-+
-+ n_pages = (n_pages * (slot1->n_recs + slot2->n_recs))
-+ / 2;
-+ }
-+ }
-+}
-+
-+/*******************************************************************//**
- Estimates the number of different key values in a given index, for
- each n-column prefix of the index where n <= dict_index_get_n_unique(index).
- The estimates are stored in the array index->stat_n_diff_key_vals. */
-@@ -3507,18 +3756,38 @@
- ulint offsets_next_rec_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets_rec = offsets_rec_;
- ulint* offsets_next_rec= offsets_next_rec_;
-+ ulint stats_method = srv_stats_method;
-+ btr_path_t first_rec_path[BTR_PATH_ARRAY_N_SLOTS];
-+ ulint effective_pages; /* effective leaf pages */
- rec_offs_init(offsets_rec_);
- rec_offs_init(offsets_next_rec_);
-
- n_cols = dict_index_get_n_unique(index);
-
-+ if (stats_method == SRV_STATS_METHOD_IGNORE_NULLS) {
-+ /* estimate effective pages and path for the first effective record */
-+ /* TODO: make it work also for n_cols > 1. */
-+ effective_pages = btr_estimate_n_pages_not_null(index, 1 /*k*/, first_rec_path);
-+
-+ if (!effective_pages) {
-+ for (j = 0; j <= n_cols; j++) {
-+ index->stat_n_diff_key_vals[j] = (ib_int64_t)index->stat_n_leaf_pages;
-+ }
-+ return;
-+ } else if (effective_pages > index->stat_n_leaf_pages) {
-+ effective_pages = index->stat_n_leaf_pages;
-+ }
-+ } else {
-+ effective_pages = index->stat_n_leaf_pages;
-+ }
-+
- n_diff = mem_zalloc((n_cols + 1) * sizeof(ib_int64_t));
-
- /* It makes no sense to test more pages than are contained
- in the index, thus we lower the number if it is too high */
-- if (srv_stats_sample_pages > index->stat_index_size) {
-- if (index->stat_index_size > 0) {
-- n_sample_pages = index->stat_index_size;
-+ if (srv_stats_sample_pages > effective_pages) {
-+ if (effective_pages > 0) {
-+ n_sample_pages = effective_pages;
- } else {
- n_sample_pages = 1;
- }
-@@ -3530,9 +3799,15 @@
-
- for (i = 0; i < n_sample_pages; i++) {
- rec_t* supremum;
-+ ibool is_first_page = TRUE;
- mtr_start(&mtr);
-
-+ if (stats_method == SRV_STATS_METHOD_IGNORE_NULLS) {
-+ is_first_page = btr_cur_open_at_rnd_pos_after_path(index, BTR_SEARCH_LEAF,
-+ first_rec_path, &cursor, &mtr);
-+ } else {
- btr_cur_open_at_rnd_pos(index, BTR_SEARCH_LEAF, &cursor, &mtr);
-+ }
-
- /* Count the number of different key values for each prefix of
- the key on this index page. If the prefix does not determine
-@@ -3543,7 +3818,13 @@
- page = btr_cur_get_page(&cursor);
-
- supremum = page_get_supremum_rec(page);
-+ if (stats_method == SRV_STATS_METHOD_IGNORE_NULLS && is_first_page) {
-+ /* the cursor should be the first record of the page. */
-+ /* Counting should be started from here. */
-+ rec = btr_cur_get_rec(&cursor);
-+ } else {
- rec = page_rec_get_next(page_get_infimum_rec(page));
-+ }
-
- if (rec != supremum) {
- not_empty_flag = 1;
-@@ -3552,7 +3833,8 @@
- }
-
- while (rec != supremum) {
-- rec_t* next_rec = page_rec_get_next(rec);
-+ rec_t* next_rec;
-+ next_rec = page_rec_get_next(rec);
- if (next_rec == supremum) {
- break;
- }
-@@ -3566,7 +3848,10 @@
- cmp_rec_rec_with_match(rec, next_rec,
- offsets_rec, offsets_next_rec,
- index, &matched_fields,
-- &matched_bytes);
-+ &matched_bytes,
-+ (stats_method==SRV_STATS_METHOD_NULLS_NOT_EQUAL) ?
-+ SRV_STATS_METHOD_NULLS_NOT_EQUAL :
-+ SRV_STATS_METHOD_NULLS_EQUAL);
-
- for (j = matched_fields + 1; j <= n_cols; j++) {
- /* We add one if this index record has
-@@ -3627,7 +3912,7 @@
- for (j = 0; j <= n_cols; j++) {
- index->stat_n_diff_key_vals[j]
- = ((n_diff[j]
-- * (ib_int64_t)index->stat_n_leaf_pages
-+ * (ib_int64_t)effective_pages
- + n_sample_pages - 1
- + total_external_size
- + not_empty_flag)
-@@ -3642,7 +3927,7 @@
- different key values, or even more. Let us try to approximate
- that: */
-
-- add_on = index->stat_n_leaf_pages
-+ add_on = effective_pages
- / (10 * (n_sample_pages
- + total_external_size));
-
-@@ -3651,6 +3936,15 @@
- }
-
- index->stat_n_diff_key_vals[j] += add_on;
-+
-+ if (stats_method == SRV_STATS_METHOD_IGNORE_NULLS) {
-+ /* index->stat_n_diff_key_vals[k] is used for calc rec_per_key,
-+ as "stats.records / index->stat_n_diff_key_vals[x]".
-+ So it should be adjusted to the value which is based on whole of the index. */
-+ index->stat_n_diff_key_vals[j] =
-+ index->stat_n_diff_key_vals[j] * (ib_int64_t)index->stat_n_leaf_pages
-+ / (ib_int64_t)effective_pages;
-+ }
- }
-
- mem_free(n_diff);
diff -ruN a/storage/innobase/dict/dict0boot.c b/storage/innobase/dict/dict0boot.c
--- a/storage/innobase/dict/dict0boot.c 2010-12-03 15:48:03.034036843 +0900
+++ b/storage/innobase/dict/dict0boot.c 2010-12-03 17:19:24.835112632 +0900
}
return(table);
-@@ -4304,6 +4304,240 @@
+@@ -4310,6 +4310,240 @@
}
/*********************************************************************//**
Calculates new estimates for table and index statistics. The statistics
are used in query optimization. */
UNIV_INTERN
-@@ -4311,10 +4545,11 @@
+@@ -4317,10 +4551,11 @@
dict_update_statistics(
/*===================*/
dict_table_t* table, /*!< in/out: table */
{
dict_index_t* index;
ulint sum_of_index_sizes = 0;
-@@ -4331,6 +4566,27 @@
+@@ -4337,6 +4572,27 @@
return;
}
/* Find out the sizes of the indexes and how many different values
for the key they approximately have */
-@@ -4391,6 +4647,11 @@
+@@ -4401,6 +4657,11 @@
index = dict_table_get_next_index(index);
} while (index);
index = dict_table_get_first_index(table);
table->stat_n_rows = index->stat_n_diff_key_vals[
-@@ -4485,7 +4746,8 @@
+@@ -4495,7 +4756,8 @@
ut_ad(mutex_own(&(dict_sys->mutex)));
static char* internal_innobase_data_file_path = NULL;
-@@ -2388,6 +2389,8 @@
+@@ -2407,6 +2408,8 @@
goto error;
}
/* -------------- Log files ---------------------------*/
/* The default dir for log files is the datadir of MySQL */
-@@ -5192,6 +5195,10 @@
+@@ -5211,6 +5214,10 @@
error = row_insert_for_mysql((byte*) record, prebuilt);
/* Handle duplicate key errors */
if (auto_inc_used) {
ulint err;
-@@ -5528,6 +5535,10 @@
+@@ -5547,6 +5554,10 @@
}
}
innodb_srv_conc_exit_innodb(trx);
error = convert_error_code_to_mysql(error,
-@@ -5581,6 +5592,10 @@
+@@ -5600,6 +5611,10 @@
error = row_update_for_mysql((byte*) record, prebuilt);
innodb_srv_conc_exit_innodb(trx);
error = convert_error_code_to_mysql(
-@@ -5899,6 +5914,11 @@
+@@ -5918,6 +5933,11 @@
case DB_SUCCESS:
error = 0;
table->status = 0;
break;
case DB_RECORD_NOT_FOUND:
error = HA_ERR_KEY_NOT_FOUND;
-@@ -6108,6 +6128,11 @@
+@@ -6127,6 +6147,11 @@
case DB_SUCCESS:
error = 0;
table->status = 0;
break;
case DB_RECORD_NOT_FOUND:
error = HA_ERR_END_OF_FILE;
-@@ -7999,11 +8024,31 @@
+@@ -8077,11 +8102,31 @@
/* In sql_show we call with this flag: update
then statistics so that they are up-to-date */
prebuilt->trx->op_info = "returning various info to MySQL";
}
-@@ -8081,7 +8126,7 @@
+@@ -8159,7 +8204,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. */
|| !(flag & HA_STATUS_VARIABLE_EXTRA)) {
/* We do not update delete_length if no
locking is requested so the "old" value can
-@@ -11281,6 +11326,45 @@
+@@ -11354,6 +11399,26 @@
"The number of index pages to sample when calculating statistics (default 8)",
NULL, NULL, 8, 1, ~0ULL, 0);
-+const char *innobase_stats_method_names[]=
-+{
-+ "nulls_equal",
-+ "nulls_unequal",
-+ "nulls_ignored",
-+ NullS
-+};
-+TYPELIB innobase_stats_method_typelib=
-+{
-+ array_elements(innobase_stats_method_names) - 1, "innobase_stats_method_typelib",
-+ innobase_stats_method_names, NULL
-+};
-+static MYSQL_SYSVAR_ENUM(stats_method, srv_stats_method,
-+ PLUGIN_VAR_RQCMDARG,
-+ "Specifies how InnoDB index statistics collection code should threat NULLs. "
-+ "Possible values of name are same to for 'myisam_stats_method'. "
-+ "This is startup parameter.",
-+ NULL, NULL, 0, &innobase_stats_method_typelib);
-+
+static MYSQL_SYSVAR_ULONG(stats_auto_update, srv_stats_auto_update,
+ PLUGIN_VAR_RQCMDARG,
+ "Enable/Disable InnoDB's auto update statistics of indexes. "
static MYSQL_SYSVAR_BOOL(adaptive_hash_index, btr_search_enabled,
PLUGIN_VAR_OPCMDARG,
"Enable InnoDB adaptive hash index (enabled by default). "
-@@ -11604,6 +11688,10 @@
+@@ -11684,6 +11749,9 @@
MYSQL_SYSVAR(recovery_update_relay_log),
MYSQL_SYSVAR(rollback_on_timeout),
MYSQL_SYSVAR(stats_on_metadata),
-+ MYSQL_SYSVAR(stats_method),
+ MYSQL_SYSVAR(stats_auto_update),
+ MYSQL_SYSVAR(stats_update_need_lock),
+ MYSQL_SYSVAR(use_sys_stats_table),
MYSQL_SYSVAR(stats_sample_pages),
MYSQL_SYSVAR(adaptive_hash_index),
- MYSQL_SYSVAR(replication_delay),
-@@ -11672,7 +11760,10 @@
+ MYSQL_SYSVAR(stats_method),
+@@ -11753,7 +11821,10 @@
i_s_innodb_sys_columns,
i_s_innodb_sys_fields,
i_s_innodb_sys_foreign,
#ifndef UNIV_NONINL
#include "dict0load.ic"
#endif
-diff -ruN a/storage/innobase/include/page0cur.h b/storage/innobase/include/page0cur.h
---- a/storage/innobase/include/page0cur.h 2010-11-03 07:01:13.000000000 +0900
-+++ b/storage/innobase/include/page0cur.h 2010-12-03 17:19:24.891954511 +0900
-@@ -293,6 +293,22 @@
- /*==========================*/
- buf_block_t* block, /*!< in: page */
- page_cur_t* cursor);/*!< out: page cursor */
-+
-+UNIV_INTERN
-+void
-+page_cur_open_on_nth_user_rec(
-+/*==========================*/
-+ buf_block_t* block, /*!< in: page */
-+ page_cur_t* cursor, /*!< out: page cursor */
-+ ulint nth);
-+
-+UNIV_INTERN
-+ibool
-+page_cur_open_on_rnd_user_rec_after_nth(
-+/*==========================*/
-+ buf_block_t* block, /*!< in: page */
-+ page_cur_t* cursor, /*!< out: page cursor */
-+ ulint nth);
- #endif /* !UNIV_HOTBACKUP */
- /***********************************************************//**
- Parses a log record of a record insert on a page.
diff -ruN a/storage/innobase/include/que0que.h b/storage/innobase/include/que0que.h
--- a/storage/innobase/include/que0que.h 2010-11-03 07:01:13.000000000 +0900
+++ b/storage/innobase/include/que0que.h 2010-12-03 17:19:24.892947946 +0900
/* Query thread states */
#define QUE_THR_RUNNING 1
#define QUE_THR_PROCEDURE_WAIT 2
-diff -ruN a/storage/innobase/include/rem0cmp.h b/storage/innobase/include/rem0cmp.h
---- a/storage/innobase/include/rem0cmp.h 2010-11-03 07:01:13.000000000 +0900
-+++ b/storage/innobase/include/rem0cmp.h 2010-12-03 17:19:24.893953395 +0900
-@@ -169,10 +169,11 @@
- matched fields; when the function returns,
- contains the value the for current
- comparison */
-- ulint* matched_bytes);/*!< in/out: number of already matched
-+ ulint* matched_bytes, /*!< in/out: number of already matched
- bytes within the first field not completely
- matched; when the function returns, contains
- the value for the current comparison */
-+ ulint stats_method);
- /*************************************************************//**
- This function is used to compare two physical records. Only the common
- first fields are compared.
-diff -ruN a/storage/innobase/include/rem0cmp.ic b/storage/innobase/include/rem0cmp.ic
---- a/storage/innobase/include/rem0cmp.ic 2010-11-03 07:01:13.000000000 +0900
-+++ b/storage/innobase/include/rem0cmp.ic 2010-12-03 17:19:24.902983425 +0900
-@@ -87,5 +87,5 @@
- ulint match_b = 0;
-
- return(cmp_rec_rec_with_match(rec1, rec2, offsets1, offsets2, index,
-- &match_f, &match_b));
-+ &match_f, &match_b, 0));
- }
diff -ruN a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h
--- a/storage/innobase/include/row0mysql.h 2010-11-03 07:01:13.000000000 +0900
+++ b/storage/innobase/include/row0mysql.h 2010-12-03 17:19:24.904973020 +0900
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
-@@ -209,6 +209,13 @@
+@@ -214,6 +214,9 @@
extern ibool srv_innodb_status;
extern unsigned long long srv_stats_sample_pages;
-+extern ulint srv_stats_method;
-+#define SRV_STATS_METHOD_NULLS_EQUAL 0
-+#define SRV_STATS_METHOD_NULLS_NOT_EQUAL 1
-+#define SRV_STATS_METHOD_IGNORE_NULLS 2
+extern ulint srv_stats_auto_update;
+extern ulint srv_stats_update_need_lock;
+extern ibool srv_use_sys_stats_table;
extern ibool srv_use_doublewrite_buf;
extern ibool srv_use_checksums;
-diff -ruN a/storage/innobase/page/page0cur.c b/storage/innobase/page/page0cur.c
---- a/storage/innobase/page/page0cur.c 2010-11-03 07:01:13.000000000 +0900
-+++ b/storage/innobase/page/page0cur.c 2010-12-03 17:19:24.908973357 +0900
-@@ -564,6 +564,74 @@
- } while (rnd--);
- }
-
-+UNIV_INTERN
-+void
-+page_cur_open_on_nth_user_rec(
-+/*==========================*/
-+ buf_block_t* block, /*!< in: page */
-+ page_cur_t* cursor, /*!< out: page cursor */
-+ ulint nth)
-+{
-+ ulint n_recs = page_get_n_recs(buf_block_get_frame(block));
-+
-+ page_cur_set_before_first(block, cursor);
-+
-+ if (UNIV_UNLIKELY(n_recs == 0)) {
-+
-+ return;
-+ }
-+
-+ nth--;
-+
-+ if (nth >= n_recs) {
-+ nth = n_recs - 1;
-+ }
-+
-+ do {
-+ page_cur_move_to_next(cursor);
-+ } while (nth--);
-+}
-+
-+UNIV_INTERN
-+ibool
-+page_cur_open_on_rnd_user_rec_after_nth(
-+/*==========================*/
-+ buf_block_t* block, /*!< in: page */
-+ page_cur_t* cursor, /*!< out: page cursor */
-+ ulint nth)
-+{
-+ ulint rnd;
-+ ulint n_recs = page_get_n_recs(buf_block_get_frame(block));
-+ ibool ret;
-+
-+ page_cur_set_before_first(block, cursor);
-+
-+ if (UNIV_UNLIKELY(n_recs == 0)) {
-+
-+ return (FALSE);
-+ }
-+
-+ nth--;
-+
-+ if (nth >= n_recs) {
-+ nth = n_recs - 1;
-+ }
-+
-+ rnd = (ulint) (nth + page_cur_lcg_prng() % (n_recs - nth));
-+
-+ if (rnd == nth) {
-+ ret = TRUE;
-+ } else {
-+ ret = FALSE;
-+ }
-+
-+ do {
-+ page_cur_move_to_next(cursor);
-+ } while (rnd--);
-+
-+ return (ret);
-+}
-+
- /***********************************************************//**
- Writes the log record of a record insert on a page. */
- static
diff -ruN a/storage/innobase/que/que0que.c b/storage/innobase/que/que0que.c
--- a/storage/innobase/que/que0que.c 2010-11-03 07:01:13.000000000 +0900
+++ b/storage/innobase/que/que0que.c 2010-12-03 17:19:24.910953422 +0900
} else if (type == QUE_NODE_ROW_PRINTF) {
thr = row_printf_step(thr);
} else {
-diff -ruN a/storage/innobase/rem/rem0cmp.c b/storage/innobase/rem/rem0cmp.c
---- a/storage/innobase/rem/rem0cmp.c 2010-11-03 07:01:13.000000000 +0900
-+++ b/storage/innobase/rem/rem0cmp.c 2010-12-03 17:19:24.911953579 +0900
-@@ -866,10 +866,11 @@
- matched fields; when the function returns,
- contains the value the for current
- comparison */
-- ulint* matched_bytes) /*!< in/out: number of already matched
-+ ulint* matched_bytes, /*!< in/out: number of already matched
- bytes within the first field not completely
- matched; when the function returns, contains
- the value for the current comparison */
-+ ulint stats_method)
- {
- ulint rec1_n_fields; /* the number of fields in rec */
- ulint rec1_f_len; /* length of current field in rec */
-@@ -962,7 +963,11 @@
-
- if (rec1_f_len == rec2_f_len) {
-
-- goto next_field;
-+ if (stats_method == SRV_STATS_METHOD_NULLS_EQUAL) {
-+ goto next_field;
-+ } else {
-+ ret = -1;
-+ }
-
- } else if (rec2_f_len == UNIV_SQL_NULL) {
-
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
}
}
-@@ -2103,6 +2106,45 @@
+@@ -2105,6 +2108,45 @@
}
/*********************************************************************//**
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.
-@@ -3022,7 +3064,7 @@
+@@ -3024,7 +3066,7 @@
dict_table_autoinc_initialize(table, 1);
dict_table_autoinc_unlock(table);
dict_update_statistics(table, FALSE /* update even if stats are
trx_commit_for_mysql(trx);
-@@ -3324,6 +3366,8 @@
+@@ -3326,6 +3368,8 @@
" IF (SQL % NOTFOUND) THEN\n"
" found := 0;\n"
" ELSE\n"
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
-@@ -397,6 +397,10 @@
+@@ -402,6 +402,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;
-+UNIV_INTERN ulint srv_stats_method = 0;
+UNIV_INTERN ulint srv_stats_auto_update = 1;
+UNIV_INTERN ulint srv_stats_update_need_lock = 1;
+UNIV_INTERN ibool srv_use_sys_stats_table = FALSE;
static long long innobase_buffer_pool_size, innobase_log_file_size;
/** Percentage of the buffer pool to reserve for 'old' blocks.
-@@ -2497,6 +2498,9 @@
+@@ -2516,6 +2517,9 @@
srv_n_log_files = (ulint) innobase_log_files_in_group;
srv_log_file_size = (ulint) innobase_log_file_size;
#ifdef UNIV_LOG_ARCHIVE
srv_log_archive_on = (ulint) innobase_log_archive;
#endif /* UNIV_LOG_ARCHIVE */
-@@ -11371,6 +11375,12 @@
+@@ -11444,6 +11448,12 @@
"Maximum delay between polling for a spin lock (6 by default)",
NULL, NULL, 6L, 0L, ~0L, 0);
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.",
-@@ -11579,6 +11589,7 @@
+@@ -11660,6 +11670,7 @@
MYSQL_SYSVAR(spin_wait_delay),
MYSQL_SYSVAR(table_locks),
MYSQL_SYSVAR(thread_concurrency),
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
-@@ -346,6 +346,7 @@
+@@ -351,6 +351,7 @@
computer. Bigger computers need bigger values. Value 0 will disable the
concurrency check. */
UNIV_INTERN ulong srv_thread_concurrency = 0;
/* this mutex protects srv_conc data structures */
-@@ -1164,6 +1165,75 @@
+@@ -1169,6 +1170,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. */
UNIV_INTERN
void
srv_conc_enter_innodb(
-@@ -1194,6 +1264,13 @@
+@@ -1199,6 +1269,13 @@
return;
}
os_fast_mutex_lock(&srv_conc_mutex);
retry:
if (trx->declared_to_be_inside_innodb) {
-@@ -1339,6 +1416,14 @@
+@@ -1344,6 +1421,14 @@
}
ut_ad(srv_conc_n_threads >= 0);
os_fast_mutex_lock(&srv_conc_mutex);
-@@ -1372,6 +1457,13 @@
+@@ -1377,6 +1462,13 @@
return;
}
diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
--- a/sql/mysqld.cc 2010-07-28 16:47:47.105319218 +0400
+++ b/sql/mysqld.cc 2010-07-28 16:47:47.644101813 +0400
-@@ -4990,6 +4990,10 @@
+@@ -5011,6 +5011,10 @@
DBUG_PRINT("error",("Too many connections"));
close_connection(thd, ER_CON_COUNT_ERROR);
delete thd;
DBUG_VOID_RETURN;
}
-@@ -5370,6 +5374,10 @@
+@@ -5391,6 +5395,10 @@
if (!(thd->net.vio= vio_new_win32pipe(hConnectedPipe)) ||
my_net_init(&thd->net, thd->net.vio))
{
close_connection(thd, ER_OUT_OF_RESOURCES);
delete thd;
continue;
-@@ -5565,6 +5573,10 @@
+@@ -5586,6 +5594,10 @@
event_conn_closed)) ||
my_net_init(&thd->net, thd->net.vio))
{
diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
--- a/sql/mysqld.cc 2011-01-05 20:31:33.000000000 +0300
+++ b/sql/mysqld.cc 2011-01-05 20:32:34.000000000 +0300
-@@ -620,6 +620,8 @@
+@@ -621,6 +621,8 @@
SHOW_COMP_OPTION have_crypt, have_compress;
SHOW_COMP_OPTION have_profiling;
diff -ruN a/sql/sql_class.cc b/sql/sql_class.cc
--- a/sql/sql_class.cc 2011-01-05 20:31:32.000000000 +0300
+++ b/sql/sql_class.cc 2011-01-05 20:32:34.000000000 +0300
-@@ -4578,7 +4578,7 @@
+@@ -4579,7 +4579,7 @@
ER_BINLOG_UNSAFE_STATEMENT,
ER(ER_BINLOG_UNSAFE_STATEMENT),
ER(LEX::binlog_stmt_unsafe_errcode[unsafe_type]));
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
-@@ -1882,7 +1882,8 @@
+@@ -1883,7 +1883,8 @@
TABLE *table= tables->table;
CHARSET_INFO *cs= system_charset_info;
char *user;
DBUG_ENTER("fill_process_list");
user= thd->security_ctx->master_access & PROCESS_ACL ?
-@@ -1966,6 +1967,10 @@
+@@ -1967,6 +1968,10 @@
}
mysql_mutex_unlock(&tmp->LOCK_thd_data);
if (schema_table_store_record(thd, table))
{
mysql_mutex_unlock(&LOCK_thread_count);
-@@ -7267,6 +7272,8 @@
+@@ -7268,6 +7273,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},
Summary(uk.UTF-8): MySQL - швидкий SQL-сервер
Summary(zh_CN.UTF-8): MySQL数据库服务器
Name: mysql
-Version: 5.5.9
-Release: 7
+Version: 5.5.10
+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: 701c0c44b7f1c2300adc0dc45729f903
+# Source0-md5: ee604aff531ff85abeb10cf332c1355a
Source100: http://www.sphinxsearch.com/downloads/sphinx-0.9.9.tar.gz
# Source100-md5: 7b9b618cb9b378f949bb1b91ddcc4f54
Source1: %{name}.init
# <percona patches, updated with percona.sh>
Patch100: microsec_process.patch
Patch101: optimizer_fix.patch
-Patch102: %{name}_dump_ignore_ct.patch
+Patch102: mysql_dump_ignore_ct.patch
Patch103: control_online_alter_index.patch
Patch104: show_temp.patch
Patch105: innodb_show_status.patch
Patch132: percona_support.patch
Patch133: query_cache_enhance.patch
Patch134: log_connection_error.patch
-Patch135: %{name}_syslog.patch
+Patch135: mysql_syslog.patch
Patch136: response_time_distribution.patch
Patch137: error_pad.patch
Patch138: remove_fcntl_excessive_calls.patch
Patch141: log_warnings_suppress.patch
Patch142: userstat.patch
Patch143: bug580324.patch
-Patch144: %{name}_remove_eol_carret.patch
+Patch144: mysql_remove_eol_carret.patch
+Patch145: processlist_row_stats.patch
# </percona>
URL: http://www.mysql.com/products/community/
BuildRequires: bison
# <percona %patches>
%patch100 -p1
%patch101 -p1
-%patch102 -p1
+#%patch102 -p1
%patch103 -p1
%patch104 -p1
%patch105 -p1
%patch142 -p1
%patch143 -p1
%patch144 -p1
+%patch145 -p1
# </percona>
# to get these files rebuild
%endif
# symlinks point to the .so file, fix it
-ln -sf libmysqlclient.so.16 $RPM_BUILD_ROOT%{_libdir}/libmysqlclient_r.so.16
-ln -sf libmysqlclient.so.16.0.0 $RPM_BUILD_ROOT%{_libdir}/libmysqlclient_r.so.16.0.0
+ln -sf libmysqlclient.so.18 $RPM_BUILD_ROOT%{_libdir}/libmysqlclient_r.so.18
+ln -sf libmysqlclient.so.18.0.0 $RPM_BUILD_ROOT%{_libdir}/libmysqlclient_r.so.18.0.0
sed -i -e 's,/usr//usr,%{_prefix},g' $RPM_BUILD_ROOT%{_bindir}/mysql_config
sed -i -e '/libs/s/$ldflags//' $RPM_BUILD_ROOT%{_bindir}/mysql_config
%attr(751,root,root) %dir %{_sysconfdir}/mysql
%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/mysql-client.conf
%attr(755,root,root) %{_libdir}/libmysqlclient.so.*.*.*
-%attr(755,root,root) %ghost %{_libdir}/libmysqlclient.so.16
+%attr(755,root,root) %ghost %{_libdir}/libmysqlclient.so.18
%attr(755,root,root) %{_libdir}/libmysqlclient_r.so.*.*.*
-%attr(755,root,root) %ghost %{_libdir}/libmysqlclient_r.so.16
+%attr(755,root,root) %ghost %{_libdir}/libmysqlclient_r.so.18
%if %{with ndb}
%attr(755,root,root) %{_libdir}/libndbclient.so.*.*.*
%attr(755,root,root) %ghost %{_libdir}/libndbclient.so.3
#endif
OPT_PLUGIN_DIR,
+ OPT_NO_REMOVE_EOL_CARRET,
+ OPT_DEFAULT_AUTH,
OPT_DEFAULT_PLUGIN,
OPT_MAX_CLIENT_OPTION
- };
diff -ruN a/client/mysql.cc b/client/mysql.cc
--- a/client/mysql.cc 2010-06-03 08:50:02.000000000 -0700
+++ b/client/mysql.cc 2010-07-06 15:07:18.000000000 -0700
static MYSQL mysql; /* The connection */
static my_bool ignore_errors=0,wait_flag=0,quick=0,
connected=0,opt_raw_data=0,unbuffered=0,output_tables=0,
-@@ -1450,6 +1452,10 @@
+@@ -1452,6 +1454,10 @@
NO_ARG, 1, 0, 0, 0, 0, 0},
{"skip-line-numbers", 'L', "Don't write line number for errors.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
diff -ruN a/client/readline.cc b/client/readline.cc
--- a/client/readline.cc 2010-06-03 08:50:23.000000000 -0700
+++ b/client/readline.cc 2010-07-06 15:07:18.000000000 -0700
-@@ -20,6 +20,8 @@
- #include <m_string.h>
+@@ -21,6 +21,8 @@
+ #include <my_dir.h>
#include "my_readline.h"
+extern my_bool opt_no_remove_eol_carret;
static bool init_line_buffer(LINE_BUFFER *buffer,File file,ulong size,
ulong max_size);
static bool init_line_buffer_from_string(LINE_BUFFER *buffer,char * str);
-@@ -51,7 +53,7 @@
- if (!(pos=intern_read_line(line_buff,&out_length, truncated)))
+@@ -60,7 +62,7 @@
+ if (!(pos=intern_read_line(line_buff, &out_length)))
return 0;
if (out_length && pos[out_length-1] == '\n')
- if (--out_length && pos[out_length-1] == '\r') /* Remove '\n' */
+ OPT_SYSLOG,
+#endif
OPT_PLUGIN_DIR,
+ OPT_DEFAULT_AUTH,
OPT_DEFAULT_PLUGIN,
- OPT_MAX_CLIENT_OPTION
diff -ruN a/client/mysql.cc b/client/mysql.cc
--- a/client/mysql.cc 2010-12-03 20:58:26.000000000 +0300
+++ b/client/mysql.cc 2011-01-13 18:38:21.000000000 +0300
static void tee_print_sized_data(const char *, unsigned int, unsigned int, bool);
/* The names of functions that actually do the manipulation. */
static int get_options(int argc,char **argv);
-@@ -1561,6 +1567,10 @@
+@@ -1563,6 +1569,10 @@
{"show-warnings", OPT_SHOW_WARNINGS, "Show warnings after every statement.",
&show_warnings, &show_warnings, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.",
(uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-@@ -1665,6 +1675,11 @@
+@@ -1667,6 +1677,11 @@
opt->name);
#endif
break;
case OPT_SERVER_ARG:
#ifdef EMBEDDED_LIBRARY
/*
-@@ -2014,6 +2029,40 @@
+@@ -2020,6 +2035,40 @@
DBUG_RETURN((COMMANDS *) 0);
}
static bool add_line(String &buffer,char *line,char *in_string,
bool *ml_comment, bool truncated)
-@@ -2990,6 +3039,11 @@
+@@ -2996,6 +3045,11 @@
fix_history(buffer);
}
#endif
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
-@@ -427,6 +427,7 @@
+@@ -428,6 +428,7 @@
uint opt_debug_sync_timeout= 0;
#endif /* defined(ENABLED_DEBUG_SYNC) */
my_bool opt_old_style_user_limits= 0, trust_function_creators= 0;
--- /dev/null
+# name : processlist_row_stats.patch
+# introduced : 11 or before
+# maintainer : Oleg
+#
+#!!! notice !!!
+# Any small change to this file in the main branch
+# should be done or reviewed by the maintainer!
+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 @@
+
+ thd->sent_row_count++;
+ thd->sent_row_count_2++;
++ DEBUG_SYNC(thd, "sent_row");
+
+ if (thd->vio_ok())
+ DBUG_RETURN(protocol->write());
+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 @@
+
+ /****************************************************************************
+ Return info about all processes
+- returns for each thread: thread id, user, host, db, command, info
++ returns for each thread: thread id, user, host, db, command, info,
++ rows_sent, rows_examined, rows_read
+ ****************************************************************************/
+
+ class thread_info :public ilink {
+@@ -1777,6 +1778,7 @@
+ uint command;
+ const char *user,*host,*db,*proc_info,*state_info;
+ CSET_STRING query_string;
++ ulonglong rows_sent, rows_examined, rows_read;
+ };
+
+ #ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
+@@ -1829,6 +1831,15 @@
+ field->maybe_null=1;
+ field_list.push_back(field=new Item_empty_string("Info",max_query_length));
+ field->maybe_null=1;
++ field_list.push_back(field= new Item_return_int("Rows_sent",
++ MY_INT64_NUM_DECIMAL_DIGITS,
++ MYSQL_TYPE_LONGLONG));
++ field_list.push_back(field= new Item_return_int("Rows_examined",
++ MY_INT64_NUM_DECIMAL_DIGITS,
++ MYSQL_TYPE_LONGLONG));
++ field_list.push_back(field= new Item_return_int("Rows_read",
++ MY_INT64_NUM_DECIMAL_DIGITS,
++ MYSQL_TYPE_LONGLONG));
+ if (protocol->send_result_set_metadata(&field_list,
+ Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
+ DBUG_VOID_RETURN;
+@@ -1882,6 +1893,9 @@
+ thd_info->query_string=
+ CSET_STRING(q, q ? length : 0, tmp->query_charset());
+ }
++ thd_info->rows_sent= tmp->sent_row_count;
++ thd_info->rows_examined= tmp->examined_row_count;
++ thd_info->rows_read= tmp->warning_info->current_row_for_warning();
+ mysql_mutex_unlock(&tmp->LOCK_thd_data);
+ thd_info->start_time= tmp->start_time;
+ thread_infos.append(thd_info);
+@@ -1910,6 +1924,9 @@
+ protocol->store(thd_info->state_info, system_charset_info);
+ protocol->store(thd_info->query_string.str(),
+ thd_info->query_string.charset());
++ protocol->store(thd_info->rows_sent);
++ protocol->store(thd_info->rows_examined);
++ protocol->store(thd_info->rows_read);
+ if (protocol->write())
+ break; /* purecov: inspected */
+ }
+@@ -2020,6 +2037,15 @@
+ table->field[8]->store(((tmp->start_utime ?
+ now_utime - tmp->start_utime : 0)/ 1000));
+
++ mysql_mutex_lock(&tmp->LOCK_thd_data);
++ /* ROWS_SENT */
++ table->field[9]->store((ulonglong) tmp->sent_row_count);
++ /* ROWS_EXAMINED */
++ table->field[10]->store((ulonglong) tmp->examined_row_count);
++ /* ROWS_READ */
++ table->field[11]->store((ulonglong) tmp->warning_info->current_row_for_warning());
++ mysql_mutex_unlock(&tmp->LOCK_thd_data);
++
+ if (schema_table_store_record(thd, table))
+ {
+ mysql_mutex_unlock(&LOCK_thread_count);
+@@ -7941,6 +7967,12 @@
+ SKIP_OPEN_TABLE},
+ {"TIME_MS", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG,
+ 0, 0, "Time_ms", SKIP_OPEN_TABLE},
++ {"ROWS_SENT", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0,
++ MY_I_S_UNSIGNED, "Rows_sent", SKIP_OPEN_TABLE},
++ {"ROWS_EXAMINED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0,
++ MY_I_S_UNSIGNED, "Rows_examined", SKIP_OPEN_TABLE},
++ {"ROWS_READ", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0,
++ MY_I_S_UNSIGNED, "Rows_read", SKIP_OPEN_TABLE},
+ {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
+ };
+
diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
--- a/sql/mysqld.cc 2010-11-03 03:01:14.000000000 +0500
+++ b/sql/mysqld.cc 2010-11-13 15:34:40.000000000 +0500
-@@ -896,6 +896,7 @@
+@@ -897,6 +897,7 @@
#endif
#ifdef HAVE_QUERY_CACHE
ulong query_cache_min_res_unit= QUERY_CACHE_MIN_RESULT_DATA_SIZE;
diff -ruN a/sql/handler.h b/sql/handler.h
--- a/sql/handler.h 2011-01-16 18:53:33.000000000 +0300
+++ b/sql/handler.h 2011-01-16 18:54:00.000000000 +0300
-@@ -580,6 +580,7 @@
+@@ -572,6 +572,7 @@
SCH_PROFILES,
SCH_REFERENTIAL_CONSTRAINTS,
SCH_PROCEDURES,
#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
#include "../storage/perfschema/pfs_server.h"
#endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */
-@@ -603,7 +605,7 @@
+@@ -604,7 +606,7 @@
MY_LOCALE *my_default_lc_messages;
MY_LOCALE *my_default_lc_time_names;
SHOW_COMP_OPTION have_geometry, have_rtree_keys;
SHOW_COMP_OPTION have_crypt, have_compress;
SHOW_COMP_OPTION have_profiling;
-@@ -904,6 +906,10 @@
+@@ -905,6 +907,10 @@
my_bool opt_enable_shared_memory;
HANDLE smem_event_connect_request= 0;
#endif
my_bool opt_use_ssl = 0;
char *opt_ssl_ca= NULL, *opt_ssl_capath= NULL, *opt_ssl_cert= NULL,
-@@ -1472,6 +1478,9 @@
+@@ -1473,6 +1479,9 @@
my_free(opt_bin_logname);
bitmap_free(&temp_pool);
free_max_user_conn();
#ifdef HAVE_REPLICATION
end_slave_list();
#endif
-@@ -3925,6 +3934,9 @@
+@@ -3944,6 +3953,9 @@
if (!DEFAULT_ERRMSGS[0][0])
unireg_abort(1);
/* We have to initialize the storage engines before CSV logging */
if (ha_init())
{
-@@ -6797,6 +6809,11 @@
+@@ -6819,6 +6831,11 @@
#else
have_query_cache=SHOW_OPTION_NO;
#endif
#include "lock.h" // MYSQL_OPEN_IGNORE_FLUSH
#include "debug_sync.h"
#include "datadict.h" // dd_frm_type()
-@@ -7688,6 +7689,14 @@
+@@ -7689,6 +7690,14 @@
*/
ST_SCHEMA_TABLE schema_tables[]=
{
{"CHARACTER_SETS", charsets_fields_info, create_schema_table,
-@@ -7741,6 +7750,13 @@
+@@ -7742,6 +7751,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},
diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
--- a/sql/mysqld.cc 2010-12-29 20:27:19.000000000 +0300
+++ b/sql/mysqld.cc 2010-12-29 20:29:19.000000000 +0300
-@@ -3053,6 +3053,7 @@
+@@ -3067,6 +3067,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},
diff -ruN a/sql/handler.h b/sql/handler.h
--- a/sql/handler.h 2010-12-03 14:09:14.406955791 +0900
+++ b/sql/handler.h 2010-12-03 14:29:16.533356953 +0900
-@@ -569,6 +569,7 @@
+@@ -561,6 +561,7 @@
SCH_EVENTS,
SCH_FILES,
SCH_GLOBAL_STATUS,
SCH_GLOBAL_VARIABLES,
SCH_KEY_COLUMN_USAGE,
SCH_OPEN_TABLES,
-@@ -590,6 +591,7 @@
+@@ -582,6 +583,7 @@
SCH_TABLE_CONSTRAINTS,
SCH_TABLE_NAMES,
SCH_TABLE_PRIVILEGES,
diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
--- a/sql/mysqld.cc 2010-12-02 21:23:05.495293844 +0900
+++ b/sql/mysqld.cc 2010-12-03 14:25:40.317039327 +0900
-@@ -3033,6 +3033,7 @@
+@@ -3047,6 +3047,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},
diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc
--- a/sql/sql_show.cc 2010-12-03 13:38:47.493070606 +0900
+++ b/sql/sql_show.cc 2010-12-03 14:27:04.590939717 +0900
-@@ -2685,6 +2685,7 @@
+@@ -2686,6 +2686,7 @@
break;
case SQLCOM_SHOW_TABLES:
case SQLCOM_SHOW_TABLE_STATUS:
case SQLCOM_SHOW_TRIGGERS:
case SQLCOM_SHOW_EVENTS:
thd->make_lex_string(&lookup_field_values->db_value,
-@@ -3173,6 +3174,228 @@
+@@ -3174,6 +3175,228 @@
return (uint) OPEN_FULL_TABLE;
}
/**
Try acquire high priority share metadata lock on a table (with
-@@ -6849,6 +7072,25 @@
+@@ -6850,6 +7073,25 @@
{0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
};
ST_FIELD_INFO columns_fields_info[]=
{
-@@ -7463,6 +7705,9 @@
+@@ -7464,6 +7706,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},
{"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,
-@@ -7512,6 +7757,9 @@
+@@ -7513,6 +7758,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},
if (table_sort.buffpek && table_sort.buffpek_len < maxbuffer)
{
my_free(table_sort.buffpek);
-@@ -1197,6 +1199,7 @@
+@@ -1216,6 +1218,7 @@
DBUG_ENTER("merge_buffers");
status_var_increment(current_thd->status_var.filesort_merge_passes);
/* Note that my_b_write() assumes it knows the length for this */
if (my_b_write(&log_file, (uchar*) buff, buff_len))
-@@ -2711,12 +2752,69 @@
+@@ -2711,12 +2751,69 @@
sprintf(query_time_buff, "%.6f", ulonglong2double(query_utime)/1000000.0);
sprintf(lock_time_buff, "%.6f", ulonglong2double(lock_utime)/1000000.0);
if (my_b_printf(&log_file,
diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
--- a/sql/mysqld.cc 2011-02-21 22:57:24.442081625 +0200
+++ b/sql/mysqld.cc 2011-02-21 22:59:30.845699981 +0200
-@@ -418,6 +418,10 @@
+@@ -419,6 +419,10 @@
char* opt_secure_file_priv;
my_bool opt_log_slow_admin_statements= 0;
my_bool opt_log_slow_slave_statements= 0;
my_bool lower_case_file_system= 0;
my_bool opt_large_pages= 0;
my_bool opt_super_large_pages= 0;
-@@ -5784,10 +5788,10 @@
+@@ -5806,10 +5810,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},
{"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. "
-@@ -7179,6 +7183,10 @@
+@@ -7194,6 +7198,10 @@
C_MODE_END
/**
Get server options from the command line,
and perform related server initializations.
-@@ -7318,6 +7326,8 @@
+@@ -7335,6 +7343,8 @@
global_system_variables.long_query_time= (ulonglong)
(global_system_variables.long_query_time_double * 1e6);
diff -ruN a/sql/sql_class.cc b/sql/sql_class.cc
--- a/sql/sql_class.cc 2011-01-20 00:37:09.000000000 +0200
+++ b/sql/sql_class.cc 2011-02-21 22:57:48.843760997 +0200
-@@ -367,6 +367,37 @@
+@@ -368,6 +368,37 @@
thd->warning_info->inc_current_row_for_warning();
}
/**
Dumps a text description of a thread, its security context
-@@ -661,6 +692,7 @@
+@@ -662,6 +693,7 @@
*cond_hdl= NULL;
return FALSE;
}
for (Internal_error_handler *error_handler= m_internal_handler;
error_handler;
-@@ -3389,6 +3421,12 @@
+@@ -3390,6 +3422,12 @@
first_successful_insert_id_in_prev_stmt;
backup->first_successful_insert_id_in_cur_stmt=
first_successful_insert_id_in_cur_stmt;
if ((!lex->requires_prelocking() || is_update_query(lex->sql_command)) &&
!is_current_stmt_binlog_format_row())
-@@ -3409,6 +3447,14 @@
+@@ -3410,6 +3448,14 @@
cuted_fields= 0;
transaction.savepoints= 0;
first_successful_insert_id_in_cur_stmt= 0;
}
-@@ -3471,6 +3517,12 @@
+@@ -3472,6 +3518,12 @@
*/
examined_row_count+= backup->examined_row_count;
cuted_fields+= backup->cuted_fields;
diff -ruN a/sql/sql_select.cc b/sql/sql_select.cc
--- a/sql/sql_select.cc 2011-02-21 22:57:24.411087114 +0200
+++ b/sql/sql_select.cc 2011-02-21 22:57:48.867756749 +0200
-@@ -6872,7 +6872,10 @@
+@@ -6894,7 +6894,10 @@
{
join->thd->server_status|=SERVER_QUERY_NO_INDEX_USED;
if (statistics)
}
}
else
-@@ -6886,7 +6889,10 @@
+@@ -6908,7 +6911,10 @@
{
join->thd->server_status|=SERVER_QUERY_NO_INDEX_USED;
if (statistics)
}
}
if (!table->no_keyread)
-@@ -10217,6 +10223,7 @@
+@@ -10239,6 +10245,7 @@
(ulong) rows_limit,test(group)));
status_var_increment(thd->status_var.created_tmp_tables);
if (use_temp_pool && !(test_flags & TEST_KEEP_TMP_TABLES))
temp_pool_slot = bitmap_lock_set_next(&temp_pool);
-@@ -11115,6 +11122,7 @@
+@@ -11137,6 +11144,7 @@
goto err;
}
status_var_increment(table->in_use->status_var.created_tmp_disk_tables);
share->db_record_offset= 1;
DBUG_RETURN(0);
err:
-@@ -11133,6 +11141,14 @@
+@@ -11155,6 +11163,14 @@
save_proc_info=thd->proc_info;
thd_proc_info(thd, "removing tmp table");
diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc
--- a/sql/sql_show.cc 2011-02-21 22:57:24.456079146 +0200
+++ b/sql/sql_show.cc 2011-02-21 22:57:48.873755686 +0200
-@@ -1942,8 +1942,17 @@
+@@ -1943,8 +1943,17 @@
table->field[4]->store(command_name[tmp->command].str,
command_name[tmp->command].length, cs);
/* MYSQL_TIME */
+++ b/client/mysqldump.c 2010-07-28 16:47:59.604985656 +0400
@@ -139,6 +139,8 @@
static uint opt_protocol= 0;
- static char *opt_plugin_dir= 0, *opt_default_auth;
+ static char *opt_plugin_dir= 0, *opt_default_auth= 0;
+static my_bool server_supports_sql_no_fcache= FALSE;
+
/*
As we're going to set SQL_MODE, it would be lost on reconnect, so we
cannot reconnect.
-@@ -3158,7 +3171,12 @@
+@@ -3167,7 +3180,12 @@
/* now build the query string */
dynstr_append_checked(&query_string, filename);
dynstr_append_checked(&query_string, "'");
-@@ -3208,7 +3226,12 @@
+@@ -3217,7 +3235,12 @@
check_io(md_result_file);
}
#include <thr_alarm.h>
#include <ft_global.h>
-@@ -484,6 +489,11 @@
+@@ -485,6 +490,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;
/**
Limit of the total number of prepared statements in the server.
Is necessary to protect the server against out-of-memory attacks.
-@@ -4167,6 +4177,97 @@
+@@ -4186,6 +4196,97 @@
#define decrement_handler_count()
#endif /* defined(_WIN32) || defined(HAVE_SMEM) */
#ifndef EMBEDDED_LIBRARY
#ifndef DBUG_OFF
-@@ -4421,6 +4522,10 @@
+@@ -4442,6 +4543,10 @@
test_lc_time_sz();
#endif
/*
We have enough space for fiddling with the argv, continue
*/
-@@ -4624,6 +4729,10 @@
+@@ -4645,6 +4750,10 @@
}
#endif
clean_up(1);
mysqld_exit(0);
}
-@@ -6445,6 +6554,7 @@
+@@ -6467,6 +6576,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},
// the following is for checking tables
#define HA_ADMIN_ALREADY_DONE 1
-@@ -561,10 +565,12 @@
+@@ -553,10 +557,12 @@
enum enum_schema_tables
{
SCH_CHARSETS= 0,
SCH_ENGINES,
SCH_EVENTS,
SCH_FILES,
-@@ -592,9 +598,12 @@
+@@ -584,9 +590,12 @@
SCH_TABLE_CONSTRAINTS,
SCH_TABLE_NAMES,
SCH_TABLE_PRIVILEGES,
SCH_VARIABLES,
SCH_VIEWS
};
-@@ -1209,6 +1218,9 @@
+@@ -1201,6 +1210,9 @@
bool locked;
bool implicit_emptied; /* Can be !=0 only if HEAP */
const COND *pushed_cond;
/**
next_insert_id is the next value which should be inserted into the
auto_increment column: in a inserting-multi-row statement (like INSERT
-@@ -1260,10 +1272,12 @@
+@@ -1252,10 +1264,12 @@
ref_length(sizeof(my_off_t)),
ft_handler(0), inited(NONE),
locked(FALSE), implicit_emptied(0),
virtual ~handler(void)
{
DBUG_ASSERT(locked == FALSE);
-@@ -1386,6 +1400,8 @@
+@@ -1378,6 +1392,8 @@
{
table= table_arg;
table_share= share;
}
virtual double scan_time()
{ return ulonglong2double(stats.data_file_length) / IO_SIZE + 2; }
-@@ -1753,6 +1769,8 @@
+@@ -1745,6 +1761,8 @@
virtual bool is_crashed() const { return 0; }
virtual bool auto_repair() const { return 0; }
/*
Log error with all enabled log event handlers
-@@ -5042,6 +5049,8 @@
+@@ -5041,6 +5048,8 @@
thd->first_successful_insert_id_in_prev_stmt_for_binlog);
if (e.write(file))
goto err;
}
if (thd->auto_inc_intervals_in_cur_stmt_for_binlog.nb_elements() > 0)
{
-@@ -5053,12 +5062,16 @@
+@@ -5052,12 +5061,16 @@
minimum());
if (e.write(file))
goto err;
}
if (thd->user_var_events.elements)
{
-@@ -5081,6 +5094,8 @@
+@@ -5080,6 +5093,8 @@
flags);
if (e.write(file))
goto err;
}
}
}
-@@ -5092,6 +5107,8 @@
+@@ -5091,6 +5106,8 @@
if (event_info->write(file) ||
DBUG_EVALUATE_IF("injecting_fault_writing", 1, 0))
goto err;
error= 0;
err:
-@@ -5277,7 +5294,8 @@
+@@ -5276,7 +5293,8 @@
be reset as a READ_CACHE to be able to read the contents from it.
*/
{
Mutex_sentry sentry(lock_log ? &LOCK_log : NULL);
-@@ -5324,6 +5342,7 @@
+@@ -5323,6 +5341,7 @@
/* write the first half of the split header */
if (my_b_write(&log_file, header, carry))
return ER_ERROR_ON_WRITE;
/*
copy fixed second half of header to cache so the correct
-@@ -5392,6 +5411,7 @@
+@@ -5391,6 +5410,7 @@
/* Write data to the binary log file */
if (my_b_write(&log_file, cache->read_pos, length))
return ER_ERROR_ON_WRITE;
cache->read_pos=cache->read_end; // Mark buffer used up
} while ((length= my_b_fill(cache)));
-@@ -5506,20 +5526,23 @@
+@@ -5505,20 +5525,23 @@
Query_log_event qinfo(thd, STRING_WITH_LEN("BEGIN"), TRUE, FALSE, TRUE, 0);
if (qinfo.write(&log_file))
goto err;
diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
--- a/sql/mysqld.cc 2010-12-03 20:58:26.000000000 +0300
+++ b/sql/mysqld.cc 2010-12-30 02:04:50.000000000 +0300
-@@ -438,6 +438,7 @@
+@@ -439,6 +439,7 @@
uint opt_debug_sync_timeout= 0;
#endif /* defined(ENABLED_DEBUG_SYNC) */
my_bool opt_old_style_user_limits= 0, trust_function_creators= 0;
my_bool opt_optimizer_fix= 0;
/*
True if there is at least one per-hour limit for some user, so we should
-@@ -489,6 +490,7 @@
+@@ -490,6 +491,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;
/* flashcache */
int cachedev_fd;
-@@ -633,7 +635,9 @@
+@@ -634,7 +636,9 @@
LOCK_crypt,
LOCK_global_system_variables,
LOCK_user_conn, LOCK_slave_list, LOCK_active_mi,
/**
The below lock protects access to two global server variables:
max_prepared_stmt_count and prepared_stmt_count. These variables
-@@ -1493,6 +1497,11 @@
+@@ -1494,6 +1498,11 @@
#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION
query_response_time_free();
#endif // HAVE_RESPONSE_TIME_DISTRIBUTION
#ifdef HAVE_REPLICATION
end_slave_list();
#endif
-@@ -1596,6 +1605,10 @@
+@@ -1597,6 +1606,10 @@
mysql_cond_destroy(&COND_thread_cache);
mysql_cond_destroy(&COND_flush_thread_cache);
mysql_cond_destroy(&COND_manager);
}
#endif /*EMBEDDED_LIBRARY*/
-@@ -3019,6 +3032,7 @@
+@@ -3033,6 +3046,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},
{"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},
-@@ -3039,6 +3053,7 @@
+@@ -3053,6 +3067,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},
{"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_new_master", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_NEW_MASTER]), SHOW_LONG_STATUS},
-@@ -3058,10 +3073,13 @@
+@@ -3072,10 +3087,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},
{"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},
-@@ -3582,6 +3600,13 @@
+@@ -3601,6 +3619,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);
sp_cache_init();
#ifdef HAVE_EVENT_SCHEDULER
Events::init_mutexes();
-@@ -3951,6 +3976,9 @@
+@@ -3970,6 +3995,9 @@
query_response_time_init();
#endif // HAVE_RESPONSE_TIME_DISTRIBUTION
/* We have to initialize the storage engines before CSV logging */
if (ha_init())
{
sql_print_error("Can't init databases");
-@@ -4087,6 +4115,9 @@
+@@ -4106,6 +4134,9 @@
init_max_user_conn();
init_update_queries();
DBUG_RETURN(0);
}
-@@ -5118,6 +5149,7 @@
+@@ -5139,6 +5170,7 @@
{
sql_print_warning("%s", ER_DEFAULT(ER_CON_COUNT_ERROR));
}
delete thd;
DBUG_VOID_RETURN;
}
-@@ -7817,6 +7849,8 @@
+@@ -7834,6 +7866,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,
key_LOCK_gdl, key_LOCK_global_system_variables,
key_LOCK_manager,
key_LOCK_prepared_stmt_count,
-@@ -7854,6 +7888,13 @@
+@@ -7871,6 +7905,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},
extern MYSQL_PLUGIN_IMPORT mysql_mutex_t LOCK_thread_count;
#ifdef HAVE_OPENSSL
extern mysql_mutex_t LOCK_des_key_file;
-@@ -452,6 +464,16 @@
+@@ -451,6 +463,16 @@
return id;
}
diff -ruN a/sql/sql_class.cc b/sql/sql_class.cc
--- a/sql/sql_class.cc 2010-12-03 20:58:26.000000000 +0300
+++ b/sql/sql_class.cc 2010-12-30 02:41:40.000000000 +0300
-@@ -601,6 +601,13 @@
+@@ -602,6 +602,13 @@
mysys_var=0;
binlog_evt_union.do_union= FALSE;
enable_slow_log= 0;
#ifndef DBUG_OFF
dbug_sentry=THD_SENTRY_MAGIC;
#endif
-@@ -981,6 +988,7 @@
+@@ -982,6 +989,7 @@
variables.option_bits|= OPTION_BIN_LOG;
else
variables.option_bits&= ~OPTION_BIN_LOG;
#if defined(ENABLED_DEBUG_SYNC)
/* Initialize the Debug Sync Facility. See debug_sync.cc. */
-@@ -988,6 +996,94 @@
+@@ -989,6 +997,94 @@
#endif /* defined(ENABLED_DEBUG_SYNC) */
}
/*
Init THD for query processing.
-@@ -1722,6 +1818,32 @@
+@@ -1723,6 +1819,32 @@
}
#endif
struct Item_change_record: public ilink
{
-@@ -1898,6 +2020,7 @@
+@@ -1899,6 +2021,7 @@
}
thd->sent_row_count++;
if (thd->vio_ok())
DBUG_RETURN(protocol->write());
-@@ -1990,6 +2113,7 @@
+@@ -1991,6 +2114,7 @@
select_export::~select_export()
{
thd->sent_row_count=row_count;
}
-@@ -3013,6 +3137,7 @@
+@@ -3014,6 +3138,7 @@
if (likely(thd != 0))
{ /* current_thd==0 when close_connection() calls net_send_error() */
thd->status_var.bytes_sent+= length;
}
}
-@@ -3020,6 +3145,7 @@
+@@ -3021,6 +3146,7 @@
void thd_increment_bytes_received(ulong length)
{
current_thd->status_var.bytes_received+= length;
/***************************************************************************
** List all table types supported
***************************************************************************/
-@@ -799,6 +836,7 @@
+@@ -800,6 +837,7 @@
sctx->master_access);
if (!(db_access & DB_ACLS) && check_grant_db(thd,dbname))
{
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),
-@@ -2351,6 +2389,284 @@
+@@ -2352,6 +2390,284 @@
DBUG_RETURN(res);
}
/* collect status for all running threads */
-@@ -7512,6 +7828,104 @@
+@@ -7513,6 +7829,104 @@
};
ST_FIELD_INFO processlist_fields_info[]=
{
{"ID", 4, MYSQL_TYPE_LONGLONG, 0, 0, "Id", SKIP_OPEN_TABLE},
-@@ -7701,6 +8115,8 @@
+@@ -7702,6 +8116,8 @@
{
{"CHARACTER_SETS", charsets_fields_info, create_schema_table,
fill_schema_charsets, make_character_sets_old_format, 0, -1, -1, 0, 0},
{"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,
-@@ -7710,6 +8126,8 @@
+@@ -7711,6 +8127,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},
{"ENGINES", engines_fields_info, create_schema_table,
fill_schema_engines, make_old_format, 0, -1, -1, 0, 0},
#ifdef HAVE_EVENT_SCHEDULER
-@@ -7782,14 +8200,20 @@
+@@ -7783,14 +8201,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},