diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc
--- a/sql/sql_parse.cc 2011-01-11 21:35:26.000000000 +0300
+++ b/sql/sql_parse.cc 2011-01-11 21:48:50.000000000 +0300
-@@ -1110,11 +1110,18 @@
+@@ -1113,11 +1113,18 @@
break;
#else
{
/*
SHOW statements should not add the used tables to the list of tables
used in a transaction.
-@@ -1127,24 +1134,23 @@
+@@ -1130,24 +1137,23 @@
/*
We have name + wildcard in packet, separated by endzero
*/
mysql_reset_thd_for_next_command(thd);
lex_start(thd);
/* Must be before we init the table list. */
-@@ -1169,9 +1175,6 @@
+@@ -1172,9 +1178,6 @@
table_list.schema_table= schema_table;
}
diff -ruN a/sql/sql_partition.cc b/sql/sql_partition.cc
--- a/sql/sql_partition.cc 2010-11-03 07:01:14.000000000 +0900
+++ b/sql/sql_partition.cc 2010-12-03 13:59:56.444039002 +0900
-@@ -4635,7 +4635,12 @@
+@@ -4636,7 +4636,12 @@
alter_info->num_parts= curr_part_no - new_part_no;
}
}
diff -ruN a/sql/sql_table.cc b/sql/sql_table.cc
--- a/sql/sql_table.cc 2010-11-03 07:01:14.000000000 +0900
+++ b/sql/sql_table.cc 2010-12-03 13:51:04.768955495 +0900
-@@ -6107,6 +6107,10 @@
+@@ -6117,6 +6117,10 @@
uint *idx_end_p;
alter_flags= table->file->alter_table_flags(alter_info->flags);
diff -ruN a/sql/sys_vars.cc b/sql/sys_vars.cc
--- a/sql/sys_vars.cc 2010-12-02 21:23:05.569356468 +0900
+++ b/sql/sys_vars.cc 2010-12-03 14:05:28.857356603 +0900
-@@ -2124,6 +2124,13 @@
+@@ -2140,6 +2140,13 @@
GLOBAL_VAR(opt_optimizer_fix),
NO_CMD_LINE, DEFAULT(TRUE));
- DBUG_RETURN(0);
+ if (!(current_error= parse_padd_string(str, rcount)))
+ {
-+ fprintf(stderr, "Failed to parse the error padd string\n");
++ fprintf(stderr, "Failed to parse the error pad string\n");
+ DBUG_RETURN(0);
+ }
+ rcount= current_error->d_code - er_offset; /* Count number of unique errors */
- if (!(new_error->er_name= get_word(&str)))
+ if (!(d_code= parse_error_offset(start)))
+ {
-+ fprintf(stderr, "Failed to parse the error padd string '%s' '%s' (d_code doesn't parse)!\n",er_name,str);
++ fprintf(stderr, "Failed to parse the error pad string '%s' '%s' (d_code doesn't parse)!\n",er_name,str);
+ DBUG_RETURN(0);
+ }
+ if (d_code < (uint)(er_offset + er_count))
}
}
-@@ -2059,7 +2059,7 @@
+@@ -2060,7 +2060,7 @@
btr_search_update_hash_on_delete(cursor);
}
}
if (!(flags & BTR_KEEP_SYS_FLAG)) {
-@@ -2073,7 +2073,7 @@
+@@ -2074,7 +2074,7 @@
row_upd_rec_in_place(rec, index, offsets, update, page_zip);
if (block->is_hashed) {
}
if (page_zip && !dict_index_is_clust(index)
-@@ -2857,7 +2857,7 @@
- block = btr_cur_get_block(cursor);
+@@ -2852,7 +2852,7 @@
+ }
if (block->is_hashed) {
- rw_lock_x_lock(&btr_search_latch);
}
page_zip = buf_block_get_page_zip(block);
-@@ -2872,7 +2872,7 @@
+@@ -2867,7 +2867,7 @@
}
if (block->is_hashed) {
}
btr_cur_del_mark_set_clust_rec_log(flags, rec, index, val, trx,
-@@ -3003,13 +3003,13 @@
+@@ -2994,13 +2994,13 @@
== dict_table_is_comp(cursor->index->table));
if (block->is_hashed) {
#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
mem_free(folds);
-@@ -1215,10 +1281,10 @@
- mem_heap_t* heap = NULL;
+@@ -1216,9 +1282,9 @@
ulint* offsets;
+ ibool released_search_latch;
-- rw_lock_x_lock(&btr_search_latch);
-+ rw_lock_x_lock(btr_search_get_latch(index->id));
- //buf_pool_mutex_enter_all();
+- rw_lock_s_lock(&btr_search_latch);
++ rw_lock_s_lock(btr_search_get_latch(index->id));
- table = btr_search_sys->hash_index;
+ table = btr_search_get_hash_index(index->id);
for (j = 0; j < srv_buf_pool_instances; j++) {
buf_pool_t* buf_pool;
-@@ -1291,6 +1357,7 @@
+@@ -1252,7 +1318,7 @@
- block->is_hashed = FALSE;
- block->index = NULL;
-+ block->btr_search_latch = NULL;
-
+
+ /* keeping latch order */
+- rw_lock_s_unlock(&btr_search_latch);
++ rw_lock_s_unlock(btr_search_get_latch(index->id));
+ released_search_latch = TRUE;
+ rw_lock_x_lock(&block->lock);
+
+@@ -1304,7 +1370,7 @@
+ mem_heap_empty(heap);
+ }
+
+- rw_lock_x_lock(&btr_search_latch);
++ rw_lock_x_lock(btr_search_get_latch(index->id));
+
+ if (UNIV_UNLIKELY(!block->is_hashed)) {
+ goto cleanup;
+@@ -1314,12 +1380,12 @@
+
+ if (UNIV_UNLIKELY(block->curr_n_fields != n_fields)
+ || UNIV_UNLIKELY(block->curr_n_bytes != n_bytes)) {
+- rw_lock_x_unlock(&btr_search_latch);
++ rw_lock_x_unlock(btr_search_get_latch(index->id));
+ rw_lock_x_unlock(&block->lock);
+
+ mem_free(folds);
+
+- rw_lock_s_lock(&btr_search_latch);
++ rw_lock_s_lock(btr_search_get_latch(index->id));
+ goto retry;
+ }
+
+@@ -1333,6 +1399,7 @@
+
+ block->is_hashed = FALSE;
+ block->index = NULL;
++ block->btr_search_latch = NULL;
+
+ cleanup:
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
- if (UNIV_UNLIKELY(block->n_pointers)) {
-@@ -1313,7 +1380,7 @@
+@@ -1345,18 +1412,18 @@
+ index->name, (ulong) block->n_pointers);
+ }
+ #endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
+- rw_lock_x_unlock(&btr_search_latch);
++ rw_lock_x_unlock(btr_search_get_latch(index->id));
+ rw_lock_x_unlock(&block->lock);
+
+ mem_free(folds);
+
+- rw_lock_s_lock(&btr_search_latch);
++ rw_lock_s_lock(btr_search_get_latch(index->id));
+ }
+ }
+ } while (released_search_latch);
}
- //buf_pool_mutex_exit_all();
-- rw_lock_x_unlock(&btr_search_latch);
-+ rw_lock_x_unlock(btr_search_get_latch(index->id));
+- rw_lock_s_unlock(&btr_search_latch);
++ rw_lock_s_unlock(btr_search_get_latch(index->id));
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
-@@ -1360,7 +1427,7 @@
+@@ -1403,7 +1470,7 @@
buf_block_dbg_add_level(block, SYNC_TREE_NODE_FROM_HASH);
}
mtr_commit(&mtr);
-@@ -1402,26 +1469,26 @@
+@@ -1445,26 +1512,26 @@
ut_ad(index);
ut_a(!dict_index_is_ibuf(index));
}
n_recs = page_get_n_recs(page);
-@@ -1515,9 +1582,9 @@
+@@ -1558,9 +1625,9 @@
fold = next_fold;
}
if (UNIV_UNLIKELY(btr_search_fully_disabled)) {
goto exit_func;
-@@ -1545,6 +1612,7 @@
+@@ -1588,6 +1655,7 @@
block->curr_n_bytes = n_bytes;
block->curr_left_side = left_side;
block->index = index;
for (i = 0; i < n_cached; i++) {
-@@ -1552,7 +1620,7 @@
+@@ -1595,7 +1663,7 @@
}
exit_func:
mem_free(folds);
mem_free(recs);
-@@ -1591,13 +1659,13 @@
+@@ -1634,13 +1702,13 @@
ut_a(!(new_block->is_hashed || block->is_hashed)
|| !dict_index_is_ibuf(index));
return;
}
-@@ -1612,7 +1680,7 @@
+@@ -1655,7 +1723,7 @@
new_block->n_bytes = block->curr_n_bytes;
new_block->left_side = left_side;
ut_a(n_fields + n_bytes > 0);
-@@ -1624,7 +1692,7 @@
+@@ -1667,7 +1735,7 @@
return;
}
}
/********************************************************************//**
-@@ -1663,7 +1731,7 @@
+@@ -1706,7 +1774,7 @@
ut_a(block->curr_n_fields + block->curr_n_bytes > 0);
ut_a(!dict_index_is_ibuf(cursor->index));
index_id = cursor->index->id;
fold = rec_fold(rec, rec_get_offsets(rec, cursor->index, offsets_,
-@@ -1672,11 +1740,11 @@
+@@ -1715,11 +1783,11 @@
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
}
/********************************************************************//**
-@@ -1710,21 +1778,21 @@
+@@ -1753,21 +1821,21 @@
ut_a(block->index == cursor->index);
ut_a(!dict_index_is_ibuf(cursor->index));
btr_search_update_hash_on_insert(cursor);
}
-@@ -1759,9 +1827,9 @@
+@@ -1802,9 +1870,9 @@
ulint* offsets = offsets_;
rec_offs_init(offsets_);
rec = btr_cur_get_rec(cursor);
-@@ -1806,7 +1874,7 @@
+@@ -1849,7 +1917,7 @@
} else {
if (left_side) {
locked = TRUE;
-@@ -1820,7 +1888,7 @@
+@@ -1863,7 +1931,7 @@
if (!locked) {
locked = TRUE;
}
-@@ -1838,7 +1906,7 @@
+@@ -1881,7 +1949,7 @@
if (!left_side) {
if (!locked) {
locked = TRUE;
}
-@@ -1853,7 +1921,7 @@
+@@ -1896,7 +1964,7 @@
if (!locked) {
locked = TRUE;
}
-@@ -1876,7 +1944,7 @@
+@@ -1919,7 +1987,7 @@
mem_heap_free(heap);
}
if (locked) {
}
}
-@@ -1892,7 +1960,7 @@
+@@ -1935,7 +2003,7 @@
ha_node_t* node;
ulint n_page_dumps = 0;
ibool ok = TRUE;
ulint cell_count;
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
-@@ -1904,23 +1972,25 @@
+@@ -1947,23 +2015,25 @@
rec_offs_init(offsets_);
for (; node != NULL; node = node->next) {
const buf_block_t* block
-@@ -2029,19 +2099,21 @@
+@@ -2072,19 +2142,21 @@
give other queries a chance to run. */
if (i != 0) {
buf_pool_page_hash_x_unlock_all();
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
-@@ -1802,7 +1802,7 @@
+@@ -1806,7 +1806,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
-@@ -11611,6 +11611,11 @@
+@@ -11617,6 +11617,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 "
-@@ -11963,6 +11968,7 @@
+@@ -11964,6 +11969,7 @@
MYSQL_SYSVAR(use_sys_stats_table),
MYSQL_SYSVAR(stats_sample_pages),
MYSQL_SYSVAR(adaptive_hash_index),
diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
--- a/storage/innobase/include/buf0buf.h 2010-12-15 19:00:07.713604580 +0900
+++ b/storage/innobase/include/buf0buf.h 2010-12-15 20:58:03.546839883 +0900
-@@ -1473,7 +1473,7 @@
+@@ -1544,7 +1544,7 @@
pointers in the adaptive hash index
pointing to this frame */
#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
already been built on this
page; note that it does not
guarantee that the index is
-@@ -1487,6 +1487,7 @@
+@@ -1558,6 +1558,7 @@
unsigned curr_left_side:1;/*!< TRUE or FALSE in hash indexing */
dict_index_t* index; /*!< Index for which the adaptive
hash index has been created. */
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
-@@ -2008,7 +2008,9 @@
+@@ -2042,7 +2042,9 @@
"-------------------------------------\n", file);
ibuf_print(file);
fprintf(file,
"%.2f hash searches/s, %.2f non-hash searches/s\n",
-@@ -2033,14 +2035,15 @@
+@@ -2067,14 +2069,15 @@
ut_total_allocated_memory,
mem_pool_get_reserved(mem_comm_pool));
/* Calcurate reserved memories */
lock_sys_subtotal = 0;
if (trx_sys) {
-@@ -2067,10 +2070,10 @@
+@@ -2101,10 +2104,10 @@
" Threads %lu \t(%lu + %lu)\n",
(ulong) (btr_search_sys
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
-@@ -11775,7 +11775,8 @@
+@@ -11772,7 +11772,8 @@
i_s_innodb_sys_foreign_cols,
i_s_innodb_sys_stats,
i_s_innodb_table_stats,
diff -ruN a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
--- a/storage/innobase/handler/i_s.cc 2010-12-03 17:30:16.299955549 +0900
+++ b/storage/innobase/handler/i_s.cc 2010-12-03 17:32:35.425989972 +0900
-@@ -4162,3 +4162,139 @@
+@@ -4161,3 +4161,139 @@
STRUCT_FLD(system_vars, NULL),
STRUCT_FLD(__reserved1, NULL)
};
diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
--- a/storage/innobase/buf/buf0buf.c 2010-12-04 20:20:44.595483291 +0900
+++ b/storage/innobase/buf/buf0buf.c 2010-12-06 19:28:04.055227506 +0900
-@@ -4514,6 +4514,36 @@
+@@ -4515,6 +4515,36 @@
mutex_exit(block_mutex);
}
}
static const char plugin_author[] = "Innobase Oy";
-@@ -4329,3 +4330,701 @@
+@@ -4328,3 +4329,701 @@
STRUCT_FLD(system_vars, NULL),
STRUCT_FLD(__reserved1, NULL)
};
diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
--- a/storage/innobase/include/buf0buf.h 2010-12-04 19:46:40.197471531 +0900
+++ b/storage/innobase/include/buf0buf.h 2010-12-06 19:23:47.638195824 +0900
-@@ -1072,6 +1072,14 @@
+@@ -1143,6 +1143,14 @@
/*===========*/
const buf_pool_t* buf_pool) /*!< in: buffer pool */
__attribute__((nonnull, const));
/* prototypes for new functions added to ha_innodb.cc */
trx_t* innobase_get_trx();
@@ -342,6 +346,31 @@
- was allocated for the frames */
- buf_block_t* blocks; /*!< array of buffer control blocks */
- };
+ // was allocated for the frames */
+ // buf_block_t* blocks; /*!< array of buffer control blocks */
+ //};
+
+/* Buffer pool shared memory segment information */
+typedef struct buf_shm_info_struct buf_shm_info_t;
+
+ /* FIXME: This is vague id still */
+ binary_id = (ulint) ((byte*)mtr_commit - (byte*)btr_root_get)
-+ + (ulint) ((byte*)os_get_os_version - (byte*)buf_calc_page_new_checksum)
++ + (ulint) ((byte*)os_file_get_last_error - (byte*)buf_calc_page_new_checksum)
+ + (ulint) ((byte*)page_dir_find_owner_slot - (byte*)dfield_data_is_binary_equal)
+ + (ulint) ((byte*)que_graph_publish - (byte*)dict_casedn_str)
+ + (ulint) ((byte*)read_view_oldest_copy_or_open_new - (byte*)fil_space_get_version)
static char* internal_innobase_data_file_path = NULL;
-@@ -2620,6 +2621,14 @@
+@@ -2624,6 +2625,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;
-@@ -2636,6 +2645,7 @@
+@@ -2640,6 +2649,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))
-@@ -11642,6 +11652,16 @@
+@@ -11648,6 +11658,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.",
-@@ -11921,6 +11941,8 @@
+@@ -11922,6 +11942,8 @@
MYSQL_SYSVAR(autoextend_increment),
MYSQL_SYSVAR(buffer_pool_size),
MYSQL_SYSVAR(buffer_pool_instances),
/** @name Modes for buf_page_get_gen */
/* @{ */
-@@ -1520,9 +1521,12 @@
+@@ -1591,9 +1592,12 @@
/**********************************************************************//**
Compute the hash fold value for blocks in buf_pool->zip_hash. */
/* @{ */
+#define BUF_POOL_ZIP_FOLD_BPAGE(bpool, b) BUF_POOL_ZIP_FOLD(bpool, (buf_block_t*) (b))
/* @} */
- /** @brief The buffer pool statistics structure. */
+ /** A chunk of buffers. The buffer pool is allocated in chunks. */
diff -ruN a/storage/innobase/include/hash0hash.h b/storage/innobase/include/hash0hash.h
--- a/storage/innobase/include/hash0hash.h 2010-11-03 07:01:13.000000000 +0900
+++ b/storage/innobase/include/hash0hash.h 2010-12-07 17:56:28.324726446 +0900
diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
--- a/storage/innobase/srv/srv0srv.c 2010-12-04 20:20:44.687550693 +0900
+++ b/storage/innobase/srv/srv0srv.c 2010-12-07 16:10:14.962785720 +0900
-@@ -233,6 +233,11 @@
+@@ -235,6 +235,11 @@
UNIV_INTERN ulint srv_mem_pool_size = ULINT_MAX;
UNIV_INTERN ulint srv_lock_table_size = ULINT_MAX;
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
-@@ -1759,6 +1759,8 @@
+@@ -1835,6 +1835,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
-@@ -667,6 +667,8 @@
+@@ -668,6 +668,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
-@@ -750,6 +750,7 @@
+@@ -758,6 +758,7 @@
ulint innodb_buffer_pool_read_ahead_evicted;/*!< srv_read_ahead evicted*/
ulint innodb_dblwr_pages_written; /*!< srv_dblwr_pages_written */
ulint innodb_dblwr_writes; /*!< srv_dblwr_writes */
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
-@@ -465,6 +465,7 @@
+@@ -467,6 +467,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;
-@@ -2251,6 +2252,7 @@
+@@ -2285,6 +2286,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;
diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
--- a/storage/innobase/btr/btr0sea.c 2010-11-03 07:01:13.000000000 +0900
+++ b/storage/innobase/btr/btr0sea.c 2010-12-03 15:45:47.503988924 +0900
-@@ -1185,6 +1185,132 @@
+@@ -1185,6 +1185,179 @@
mem_free(folds);
}
+/*=====================================*/
+ dict_index_t* index) /* in: record descriptor */
+{
-+ buf_page_t* bpage;
++
+ hash_table_t* table;
+ buf_block_t* block;
+ ulint n_fields;
+ ulint i, j;
+ mem_heap_t* heap = NULL;
+ ulint* offsets;
++ ibool released_search_latch;
+
-+ rw_lock_x_lock(&btr_search_latch);
-+ buf_pool_mutex_enter_all();
++ rw_lock_s_lock(&btr_search_latch);
+
+ table = btr_search_sys->hash_index;
+
+
+ buf_pool = buf_pool_from_array(j);
+
-+ bpage = UT_LIST_GET_LAST(buf_pool->LRU);
++ do {
++ buf_chunk_t* chunks = buf_pool->chunks;
++ buf_chunk_t* chunk = chunks + buf_pool->n_chunks;
++
++ released_search_latch = FALSE;
++
++ while (--chunk >= chunks) {
++ block = chunk->blocks;
++ i = chunk->size;
++
++retry:
++ for (; i--; block++) {
++ if (buf_block_get_state(block)
++ != BUF_BLOCK_FILE_PAGE
++ || block->index != index
++ || !block->is_hashed) {
++ continue;
++ }
++
++ page = block->frame;
++
++ /* from btr_search_drop_page_hash_index() */
++ n_fields = block->curr_n_fields;
++ n_bytes = block->curr_n_bytes;
++
+
-+ while (bpage != NULL) {
-+ block = (buf_block_t*) bpage;
-+ if (block->index == index && block->is_hashed) {
-+ page = block->frame;
++ /* keeping latch order */
++ rw_lock_s_unlock(&btr_search_latch);
++ released_search_latch = TRUE;
++ rw_lock_x_lock(&block->lock);
+
-+ /* from btr_search_drop_page_hash_index() */
-+ n_fields = block->curr_n_fields;
-+ n_bytes = block->curr_n_bytes;
+
-+ ut_a(n_fields + n_bytes > 0);
++ ut_a(n_fields + n_bytes > 0);
+
-+ n_recs = page_get_n_recs(page);
++ n_recs = page_get_n_recs(page);
+
-+ /* Calculate and cache fold values into an array for fast deletion
-+ from the hash index */
++ /* Calculate and cache fold values into an array for fast deletion
++ from the hash index */
+
-+ folds = mem_alloc(n_recs * sizeof(ulint));
++ folds = mem_alloc(n_recs * sizeof(ulint));
+
-+ n_cached = 0;
++ n_cached = 0;
+
-+ rec = page_get_infimum_rec(page);
-+ rec = page_rec_get_next_low(rec, page_is_comp(page));
++ rec = page_get_infimum_rec(page);
++ rec = page_rec_get_next_low(rec, page_is_comp(page));
+
-+ index_id = btr_page_get_index_id(page);
++ index_id = btr_page_get_index_id(page);
+
-+ ut_a(index_id == index->id);
++ ut_a(index_id == index->id);
+
-+ prev_fold = 0;
++ prev_fold = 0;
+
-+ offsets = NULL;
++ offsets = NULL;
+
-+ while (!page_rec_is_supremum(rec)) {
-+ offsets = rec_get_offsets(rec, index, offsets,
-+ n_fields + (n_bytes > 0), &heap);
-+ ut_a(rec_offs_n_fields(offsets) == n_fields + (n_bytes > 0));
-+ fold = rec_fold(rec, offsets, n_fields, n_bytes, index_id);
++ while (!page_rec_is_supremum(rec)) {
++ offsets = rec_get_offsets(rec, index, offsets,
++ n_fields + (n_bytes > 0), &heap);
++ ut_a(rec_offs_n_fields(offsets) == n_fields + (n_bytes > 0));
++ fold = rec_fold(rec, offsets, n_fields, n_bytes, index_id);
+
-+ if (fold == prev_fold && prev_fold != 0) {
++ if (fold == prev_fold && prev_fold != 0) {
+
-+ goto next_rec;
-+ }
++ goto next_rec;
++ }
+
-+ /* Remove all hash nodes pointing to this page from the
-+ hash chain */
++ /* Remove all hash nodes pointing to this page from the
++ hash chain */
+
-+ folds[n_cached] = fold;
-+ n_cached++;
++ folds[n_cached] = fold;
++ n_cached++;
+next_rec:
-+ rec = page_rec_get_next_low(rec, page_rec_is_comp(rec));
-+ prev_fold = fold;
-+ }
++ rec = page_rec_get_next_low(rec, page_rec_is_comp(rec));
++ prev_fold = fold;
++ }
+
-+ for (i = 0; i < n_cached; i++) {
++ if (UNIV_LIKELY_NULL(heap)) {
++ mem_heap_empty(heap);
++ }
+
-+ ha_remove_all_nodes_to_page(table, folds[i], page);
-+ }
++ rw_lock_x_lock(&btr_search_latch);
+
-+ ut_a(index->search_info->ref_count > 0);
-+ index->search_info->ref_count--;
++ if (UNIV_UNLIKELY(!block->is_hashed)) {
++ goto cleanup;
++ }
+
-+ block->is_hashed = FALSE;
-+ block->index = NULL;
-+
++ ut_a(block->index == index);
++
++ if (UNIV_UNLIKELY(block->curr_n_fields != n_fields)
++ || UNIV_UNLIKELY(block->curr_n_bytes != n_bytes)) {
++ rw_lock_x_unlock(&btr_search_latch);
++ rw_lock_x_unlock(&block->lock);
++
++ mem_free(folds);
++
++ rw_lock_s_lock(&btr_search_latch);
++ goto retry;
++ }
++
++ for (i = 0; i < n_cached; i++) {
++
++ ha_remove_all_nodes_to_page(table, folds[i], page);
++ }
++
++ ut_a(index->search_info->ref_count > 0);
++ index->search_info->ref_count--;
++
++ block->is_hashed = FALSE;
++ block->index = NULL;
++
++cleanup:
+#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
-+ if (UNIV_UNLIKELY(block->n_pointers)) {
-+ /* Corruption */
-+ ut_print_timestamp(stderr);
-+ fprintf(stderr,
-+" InnoDB: Corruption of adaptive hash index. After dropping\n"
-+"InnoDB: the hash index to a page of %s, still %lu hash nodes remain.\n",
-+ index->name, (ulong) block->n_pointers);
-+ }
++ if (UNIV_UNLIKELY(block->n_pointers)) {
++ /* Corruption */
++ ut_print_timestamp(stderr);
++ fprintf(stderr,
++"InnoDB: The adaptive hash index is corrupted. After dropping\n"
++"InnoDB: the hash index to a page of %s, %lu hash nodes still remain.\n",
++ index->name, (ulong) block->n_pointers);
++ }
+#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
++ rw_lock_x_unlock(&btr_search_latch);
++ rw_lock_x_unlock(&block->lock);
+
-+ mem_free(folds);
-+ }
++ mem_free(folds);
+
-+ bpage = UT_LIST_GET_PREV(LRU, bpage);
-+ }
++ rw_lock_s_lock(&btr_search_latch);
++ }
++ }
++ } while (released_search_latch);
+ }
+
-+ buf_pool_mutex_exit_all();
-+ rw_lock_x_unlock(&btr_search_latch);
++ rw_lock_s_unlock(&btr_search_latch);
+
+ if (UNIV_LIKELY_NULL(heap)) {
+ mem_heap_free(heap);
/********************************************************************//**
Drops a page hash index when a page is freed from a fseg to the file system.
Drops possible hash index if the page happens to be in the buffer pool. */
+diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
+--- a/storage/innobase/buf/buf0buf.c 2011-02-01 18:00:03.000000000 +0900
++++ b/storage/innobase/buf/buf0buf.c 2011-02-01 18:01:59.000000000 +0900
+@@ -294,14 +294,14 @@
+ # endif /* !PFS_SKIP_BUFFER_MUTEX_RWLOCK */
+ #endif /* UNIV_PFS_MUTEX || UNIV_PFS_RWLOCK */
+
+-/** A chunk of buffers. The buffer pool is allocated in chunks. */
+-struct buf_chunk_struct{
+- ulint mem_size; /*!< allocated size of the chunk */
+- ulint size; /*!< size of frames[] and blocks[] */
+- void* mem; /*!< pointer to the memory area which
+- was allocated for the frames */
+- buf_block_t* blocks; /*!< array of buffer control blocks */
+-};
++/** A chunk of buffers. The buffer pool is allocated in chunks. (moved to buf0buf.h)*/
++//struct buf_chunk_struct{
++// ulint mem_size; /*!< allocated size of the chunk */
++// ulint size; /*!< size of frames[] and blocks[] */
++// void* mem; /*!< pointer to the memory area which
++// was allocated for the frames */
++// buf_block_t* blocks; /*!< array of buffer control blocks */
++//};
+ #endif /* !UNIV_HOTBACKUP */
+
+ /********************************************************************//**
diff -ruN a/storage/innobase/dict/dict0boot.c b/storage/innobase/dict/dict0boot.c
--- a/storage/innobase/dict/dict0boot.c 2010-11-03 07:01:13.000000000 +0900
+++ b/storage/innobase/dict/dict0boot.c 2010-12-03 15:45:47.503988924 +0900
diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.c
--- a/storage/innobase/dict/dict0dict.c 2010-11-03 07:01:13.000000000 +0900
+++ b/storage/innobase/dict/dict0dict.c 2010-12-03 15:45:47.525953769 +0900
-@@ -625,6 +625,8 @@
+@@ -627,6 +627,8 @@
table = dict_table_get_on_id_low(table_id);
mutex_exit(&(dict_sys->mutex));
return(table);
-@@ -743,6 +745,8 @@
+@@ -745,6 +747,8 @@
table->n_mysql_handles_opened++;
}
mutex_exit(&(dict_sys->mutex));
if (table != NULL) {
-@@ -1256,6 +1260,64 @@
+@@ -1260,6 +1264,64 @@
dict_mem_table_free(table);
}
/****************************************************************//**
If the given column name is reserved for InnoDB system columns, return
TRUE.
-@@ -1719,6 +1781,11 @@
+@@ -1723,6 +1785,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
-@@ -655,6 +655,8 @@
+@@ -656,6 +656,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",
-@@ -11543,6 +11545,11 @@
+@@ -11536,6 +11538,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),
-@@ -11611,6 +11618,7 @@
+@@ -11603,6 +11610,7 @@
+ MYSQL_SYSVAR(read_ahead),
MYSQL_SYSVAR(adaptive_flushing_method),
- MYSQL_SYSVAR(enable_unsafe_group_commit),
MYSQL_SYSVAR(extra_rsegments),
+ MYSQL_SYSVAR(dict_size_limit),
MYSQL_SYSVAR(use_sys_malloc),
/********************************************************************//**
Drops a page hash index when a page is freed from a fseg to the file system.
Drops possible hash index if the page happens to be in the buffer pool. */
+diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
+--- a/storage/innobase/include/buf0buf.h 2011-02-01 18:00:03.000000000 +0900
++++ b/storage/innobase/include/buf0buf.h 2011-02-01 18:03:29.000000000 +0900
+@@ -1553,6 +1553,15 @@
+ #define BUF_POOL_ZIP_FOLD_BPAGE(b) BUF_POOL_ZIP_FOLD((buf_block_t*) (b))
+ /* @} */
+
++/** A chunk of buffers. The buffer pool is allocated in chunks. */
++struct buf_chunk_struct{
++ ulint mem_size; /*!< allocated size of the chunk */
++ ulint size; /*!< size of frames[] and blocks[] */
++ void* mem; /*!< pointer to the memory area which
++ was allocated for the frames */
++ buf_block_t* blocks; /*!< array of buffer control blocks */
++};
++
+ /** @brief The buffer pool statistics structure. */
+ struct buf_pool_stat_struct{
+ ulint n_page_gets; /*!< number of page gets performed;
diff -ruN a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h
--- a/storage/innobase/include/dict0dict.h 2010-11-03 07:01:13.000000000 +0900
+++ b/storage/innobase/include/dict0dict.h 2010-12-03 15:45:47.558024515 +0900
/*-------------------------------------------*/
extern ulint srv_n_rows_inserted;
-@@ -700,6 +700,7 @@
+@@ -708,6 +708,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
-@@ -414,6 +414,7 @@
+@@ -416,6 +416,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;
-@@ -2192,6 +2193,7 @@
+@@ -2226,6 +2227,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;
#ifndef UNIV_HOTBACKUP
# include "buf0lru.h"
# include "ibuf0ibuf.h"
-@@ -3050,7 +3056,7 @@
+@@ -3078,7 +3084,7 @@
file = os_file_create_simple_no_error_handling(
innodb_file_data_key, filepath, OS_FILE_OPEN,
if (!success) {
/* The following call prints an error message */
os_file_get_last_error(TRUE);
-@@ -3097,6 +3103,466 @@
+@@ -3125,6 +3131,466 @@
space_id = fsp_header_get_space_id(page);
space_flags = fsp_header_get_flags(page);
-+ if (srv_expand_import
-+ && (space_id != id || space_flags != (flags & ~(~0 << DICT_TF_BITS)))) {
++ if (srv_expand_import) {
++
+ ibool file_is_corrupt = FALSE;
+ byte* buf3;
+ byte* descr_page;
+ info_file = os_file_create_simple_no_error_handling(innodb_file_data_key,
+ info_file_path, OS_FILE_OPEN, OS_FILE_READ_ONLY, &success);
+ if (!success) {
-+ fprintf(stderr, "InnoDB: cannot open %s\n", info_file_path);
++ fprintf(stderr, "InnoDB: Cannot open the file: %s\n", info_file_path);
+ file_is_corrupt = TRUE;
+ goto skip_info;
+ }
+ success = os_file_read(info_file, page, 0, 0, UNIV_PAGE_SIZE);
+ if (!success) {
-+ fprintf(stderr, "InnoDB: cannot read %s\n", info_file_path);
++ fprintf(stderr, "InnoDB: Cannot read the file: %s\n", info_file_path);
+ file_is_corrupt = TRUE;
+ goto skip_info;
+ }
+ if (mach_read_from_4(page) != 0x78706f72UL
+ || mach_read_from_4(page + 4) != 0x74696e66UL) {
-+ fprintf(stderr, "InnoDB: %s seems not to be a correct .exp file\n", info_file_path);
++ fprintf(stderr, "InnoDB: %s seems to be an incorrect .exp file.\n", info_file_path);
+ file_is_corrupt = TRUE;
+ goto skip_info;
+ }
+
-+ fprintf(stderr, "InnoDB: import: extended import of %s is started.\n", name);
++ fprintf(stderr, "InnoDB: Import: The extended import of %s is being started.\n", name);
+
+ n_index = mach_read_from_4(page + 8);
-+ fprintf(stderr, "InnoDB: import: %lu indexes are detected.\n", (ulong)n_index);
++ fprintf(stderr, "InnoDB: Import: %lu indexes have been detected.\n", (ulong)n_index);
+ for (i = 0; i < n_index; i++) {
+ new_id[i] =
+ dict_table_get_index_on_name(table,
+ size = (ulint)
+ (size_bytes
+ / dict_table_flags_to_zip_size(flags));
-+ fprintf(stderr, "InnoDB: import: table %s seems to be in newer format."
-+ " It may not be able to treated for now.\n", name);
++ fprintf(stderr, "InnoDB: Import: The table %s seems to be in a newer format."
++ " It may not be possible to process it.\n", name);
+ }
+ /* .exp file should be removed */
+ success = os_file_delete(info_file_path);
+ stderr);
+ ut_print_filename(stderr, filepath);
+ fprintf(stderr, " seems to be corrupt.\n"
-+ "InnoDB: anyway, all not corrupt pages were tried to be converted to salvage.\n"
++ "InnoDB: An attempt to convert and salvage all corrupt pages was not made.\n"
+ "InnoDB: ##### CAUTION #####\n"
-+ "InnoDB: ## The .ibd must cause to crash InnoDB, though re-import would seem to be succeeded.\n"
-+ "InnoDB: ## If you don't have knowledge about salvaging data from .ibd, you should not use the file.\n"
++ "InnoDB: ## The .ibd file may cause InnoDB to crash, even though its re-import seems to have succeeded.\n"
++ "InnoDB: ## If you don't know how to salvage data from a .ibd, you should not use the file.\n"
+ "InnoDB: ###################\n");
+ success = FALSE;
+
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
-@@ -7330,6 +7330,14 @@
+@@ -7337,6 +7337,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);
-@@ -11545,6 +11553,11 @@
- "Enable/Disable unsafe group commit when support_xa=OFF and use with binlog or other XA storage engine.",
- NULL, NULL, 0, 0, 1, 0);
+@@ -11538,6 +11546,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(expand_import, srv_expand_import,
+ PLUGIN_VAR_RQCMDARG,
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.",
-@@ -11622,6 +11635,7 @@
+@@ -11614,6 +11627,7 @@
+ MYSQL_SYSVAR(flush_neighbor_pages),
MYSQL_SYSVAR(read_ahead),
MYSQL_SYSVAR(adaptive_flushing_method),
- MYSQL_SYSVAR(enable_unsafe_group_commit),
+ MYSQL_SYSVAR(expand_import),
MYSQL_SYSVAR(extra_rsegments),
MYSQL_SYSVAR(dict_size_limit),
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
-@@ -413,6 +413,8 @@
+@@ -415,6 +415,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 */
+ block->page.offset, DPAH_SIZE << 3);
+ block_hash_byte = block_hash >> 3;
+ block_hash_offset = (byte) block_hash & 0x07;
-+ if (block_hash_byte < 0 || block_hash_byte >= DPAH_SIZE)
++ if (block_hash_byte >= DPAH_SIZE)
+ fprintf(stderr, "!!! block_hash_byte = %lu block_hash_offset = %d !!!\n", block_hash_byte, block_hash_offset);
-+ if (block_hash_offset < 0 || block_hash_offset > 7)
++ if (block_hash_offset > 7)
+ fprintf(stderr, "!!! block_hash_byte = %lu block_hash_offset = %d !!!\n", block_hash_byte, block_hash_offset);
+ if ((trx->distinct_page_access_hash[block_hash_byte] & ((byte) 0x01 << block_hash_offset)) == 0)
+ trx->distinct_page_access++;
buf_pool_t* buf_pool = buf_pool_get(space, offset);
ut_ad(mtr);
-@@ -2840,6 +2900,9 @@
- #ifndef UNIV_LOG_DEBUG
- ut_ad(!ibuf_inside() || ibuf_page(space, zip_size, offset, NULL));
+@@ -2841,6 +2901,9 @@
+ ut_ad(!ibuf_inside() || ibuf_page_low(space, zip_size, offset,
+ FALSE, file, line, NULL));
#endif
+ if (innobase_get_slow_log()) {
+ trx = innobase_get_trx();
buf_pool->stat.n_page_gets++;
fold = buf_page_address_fold(space, offset);
loop:
-@@ -2913,7 +2976,7 @@
+@@ -2914,7 +2977,7 @@
return(NULL);
}
retries = 0;
} else if (retries < BUF_PAGE_READ_MAX_RETRIES) {
++retries;
-@@ -3216,6 +3279,13 @@
+@@ -3217,6 +3280,13 @@
/* Let us wait until the read operation
completes */
for (;;) {
enum buf_io_fix io_fix;
-@@ -3230,6 +3300,12 @@
+@@ -3231,6 +3301,12 @@
break;
}
}
}
fix_type = MTR_MEMO_BUF_FIX;
-@@ -3255,13 +3331,17 @@
+@@ -3256,13 +3332,17 @@
/* In the case of a first access, try to apply linear
read-ahead */
return(block);
}
-@@ -3285,6 +3365,7 @@
+@@ -3286,6 +3366,7 @@
unsigned access_time;
ibool success;
ulint fix_type;
ut_ad(block);
ut_ad(mtr);
-@@ -3362,13 +3443,17 @@
+@@ -3363,13 +3444,17 @@
#ifdef UNIV_DEBUG_FILE_ACCESSES
ut_a(block->page.file_page_was_freed == FALSE);
#endif
}
#ifdef UNIV_IBUF_COUNT_DEBUG
-@@ -3378,6 +3463,9 @@
+@@ -3379,6 +3464,9 @@
buf_pool = buf_pool_from_block(block);
buf_pool->stat.n_page_gets++;
return(TRUE);
}
-@@ -3400,6 +3488,7 @@
+@@ -3401,6 +3489,7 @@
buf_pool_t* buf_pool;
ibool success;
ulint fix_type;
ut_ad(mtr);
ut_ad(mtr->state == MTR_ACTIVE);
-@@ -3486,6 +3575,11 @@
+@@ -3487,6 +3576,11 @@
#endif
buf_pool->stat.n_page_gets++;
diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
--- a/storage/innobase/fil/fil0fil.c 2010-12-03 15:53:54.610037199 +0900
+++ b/storage/innobase/fil/fil0fil.c 2010-12-03 17:42:42.079064198 +0900
-@@ -4395,7 +4395,7 @@
+@@ -4423,7 +4423,7 @@
node->name, node->handle, buf,
offset_low, offset_high,
page_size * n_pages,
#endif
if (success) {
node->size += n_pages;
-@@ -4722,7 +4722,7 @@
+@@ -4750,7 +4750,7 @@
i/o on a tablespace which does not exist */
UNIV_INTERN
ulint
/*===*/
ulint type, /*!< in: OS_FILE_READ or OS_FILE_WRITE,
ORed to OS_FILE_LOG, if a log i/o
-@@ -4747,8 +4747,9 @@
+@@ -4775,8 +4775,9 @@
void* buf, /*!< in/out: buffer where to store read data
or from where to write; in aio this must be
appropriately aligned */
{
ulint mode;
fil_space_t* space;
-@@ -4918,7 +4919,7 @@
+@@ -4946,7 +4947,7 @@
#else
/* Queue the aio request */
ret = os_aio(type, mode | wake_later, node->name, node->handle, buf,
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
-@@ -1526,6 +1526,16 @@
+@@ -1527,6 +1527,16 @@
trx->check_unique_secondary = !thd_test_options(
thd, OPTION_RELAXED_UNIQUE_CHECKS);
DBUG_VOID_RETURN;
}
-@@ -1580,6 +1590,32 @@
+@@ -1581,6 +1591,32 @@
return(trx);
}
/*********************************************************************//**
Note that a transaction has been registered with MySQL.
@return true if transaction is registered with MySQL 2PC coordinator */
-@@ -9200,6 +9236,25 @@
+@@ -9207,6 +9243,25 @@
statement has ended */
if (trx->n_mysql_tables_in_use == 0) {
# define os_file_read_no_error_handling(file, buf, offset, \
offset_high, n) \
-@@ -690,6 +698,7 @@
+@@ -692,6 +700,7 @@
ulint offset_high,/*!< in: most significant 32 bits of
offset */
ulint n, /*!< in: number of bytes to read */
const char* src_file,/*!< in: file name where func invoked */
ulint src_line);/*!< in: line where the func invoked */
-@@ -744,6 +753,7 @@
+@@ -746,6 +755,7 @@
(can be used to identify a completed
aio operation); ignored if mode is
OS_AIO_SYNC */
const char* src_file,/*!< in: file name where func invoked */
ulint src_line);/*!< in: line where the func invoked */
/*******************************************************************//**
-@@ -885,7 +895,8 @@
+@@ -887,7 +897,8 @@
offset where to read */
ulint offset_high,/*!< in: most significant 32 bits of
offset */
/*******************************************************************//**
Rewind file to its start, read at most size - 1 bytes from it to str, and
NUL-terminate str. All errors are silently ignored. This function is
-@@ -1044,10 +1055,11 @@
+@@ -1046,10 +1057,11 @@
(can be used to identify a completed
aio operation); ignored if mode is
OS_AIO_SYNC */
+/* prototypes for new functions added to ha_innodb.cc */
+ibool innobase_get_slow_log();
+
- /* This is set to TRUE if the MySQL user has set it in MySQL */
- extern ibool srv_lower_case_table_names;
+ /* This is set to the MySQL server value for this variable. */
+ extern uint srv_lower_case_table_names;
diff -ruN a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h
--- a/storage/innobase/include/trx0trx.h 2010-12-03 15:41:52.049372966 +0900
ut_a(que_thr_stop(thr));
-@@ -3692,6 +3698,8 @@
+@@ -3764,6 +3770,8 @@
{
lock_t* lock;
trx_t* trx;
ut_ad(mutex_own(&kernel_mutex));
-@@ -3747,6 +3755,10 @@
+@@ -3819,6 +3827,10 @@
return(DB_SUCCESS);
}
#include "log0recv.h"
#ifndef UNIV_HOTBACKUP
# include "os0sync.h"
-@@ -2177,13 +2179,18 @@
+@@ -2202,13 +2204,18 @@
ulint n, /*!< in: number of bytes to read */
ulint offset, /*!< in: least significant 32 bits of file
offset from where to read */
ut_a((offset & 0xFFFFFFFFUL) == offset);
-@@ -2204,6 +2211,15 @@
+@@ -2229,6 +2236,15 @@
os_n_file_reads++;
#if defined(HAVE_PREAD) && !defined(HAVE_BROKEN_PREAD)
os_mutex_enter(os_file_count_mutex);
os_file_n_pending_preads++;
-@@ -2217,6 +2233,13 @@
+@@ -2242,6 +2258,13 @@
os_n_pending_reads--;
os_mutex_exit(os_file_count_mutex);
return(n_bytes);
#else
{
-@@ -2253,6 +2276,13 @@
+@@ -2278,6 +2301,13 @@
os_n_pending_reads--;
os_mutex_exit(os_file_count_mutex);
return(ret);
}
#endif
-@@ -2393,7 +2423,8 @@
+@@ -2418,7 +2448,8 @@
offset where to read */
ulint offset_high, /*!< in: most significant 32 bits of
offset */
{
#ifdef __WIN__
BOOL ret;
-@@ -2468,7 +2499,7 @@
+@@ -2493,7 +2524,7 @@
os_bytes_read_since_printout += n;
try_again:
if ((ulint)ret == n) {
-@@ -2597,7 +2628,7 @@
+@@ -2622,7 +2653,7 @@
os_bytes_read_since_printout += n;
try_again:
if ((ulint)ret == n) {
-@@ -3619,7 +3650,8 @@
- offset */
- ulint offset_high, /*!< in: most significant 32 bits of
- offset */
-- ulint len) /*!< in: length of the block to read or write */
-+ ulint len, /*!< in: length of the block to read or write */
-+ trx_t* trx)
- {
- os_aio_slot_t* slot = NULL;
- #ifdef WIN_ASYNC_IO
-@@ -3991,10 +4023,11 @@
+@@ -4016,10 +4047,11 @@
(can be used to identify a completed
aio operation); ignored if mode is
OS_AIO_SYNC */
{
os_aio_array_t* array;
os_aio_slot_t* slot;
-@@ -4035,8 +4068,8 @@
+@@ -4060,8 +4092,8 @@
wait in the Windows case. */
if (type == OS_FILE_READ) {
}
ut_a(type == OS_FILE_WRITE);
-@@ -4074,8 +4107,13 @@
+@@ -4099,6 +4131,11 @@
ut_error;
}
+ trx->io_read += n;
+ }
slot = os_aio_array_reserve_slot(type, array, message1, message2, file,
-- name, buf, offset, offset_high, n);
-+ name, buf, offset, offset_high, n, trx);
+ name, buf, offset, offset_high, n);
if (type == OS_FILE_READ) {
- if (srv_use_native_aio) {
- os_n_file_reads++;
diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
--- a/storage/innobase/srv/srv0srv.c 2010-12-03 17:32:15.648024399 +0900
+++ b/storage/innobase/srv/srv0srv.c 2010-12-03 17:45:05.067023254 +0900
+/* prototypes for new functions added to ha_innodb.cc */
+ibool innobase_get_slow_log();
+
- /* This is set to TRUE if the MySQL user has set it in MySQL; currently
- affects only FOREIGN KEY definition parsing */
- UNIV_INTERN ibool srv_lower_case_table_names = FALSE;
-@@ -1219,6 +1222,10 @@
+ /* 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 @@
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)) {
-@@ -1295,6 +1302,7 @@
+@@ -1329,6 +1336,7 @@
switches. */
if (SRV_THREAD_SLEEP_DELAY > 0) {
os_thread_sleep(SRV_THREAD_SLEEP_DELAY);
}
trx->op_info = "";
-@@ -1350,6 +1358,13 @@
+@@ -1384,6 +1392,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);
-@@ -1358,6 +1373,12 @@
+@@ -1392,6 +1407,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
-@@ -11330,6 +11330,11 @@
- "Enable/Disable unsafe group commit when support_xa=OFF and use with binlog or other XA storage engine.",
- NULL, NULL, 0, 0, 1, 0);
+@@ -11323,6 +11323,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,
static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(additional_mem_pool_size),
MYSQL_SYSVAR(autoextend_increment),
-@@ -11395,6 +11400,7 @@
+@@ -11387,6 +11392,7 @@
+ MYSQL_SYSVAR(flush_neighbor_pages),
MYSQL_SYSVAR(read_ahead),
MYSQL_SYSVAR(adaptive_flushing_method),
- MYSQL_SYSVAR(enable_unsafe_group_commit),
+ MYSQL_SYSVAR(extra_rsegments),
MYSQL_SYSVAR(use_sys_malloc),
MYSQL_SYSVAR(use_native_aio),
MYSQL_SYSVAR(change_buffering),
-@@ -11423,6 +11429,7 @@
+@@ -11415,6 +11421,7 @@
innobase_system_variables, /* system variables */
NULL /* reserved */
},
}
static const char plugin_author[] = "Innobase Oy";
-@@ -1782,3 +1784,166 @@
+@@ -1781,3 +1783,166 @@
DBUG_RETURN(0);
}
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
-@@ -411,6 +411,8 @@
+@@ -413,6 +413,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 */
diff -ruN a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c
--- a/storage/innobase/buf/buf0flu.c 2010-12-04 15:37:50.555568346 +0900
+++ b/storage/innobase/buf/buf0flu.c 2010-12-04 15:53:45.015513917 +0900
-@@ -1027,7 +1027,9 @@
+@@ -1055,7 +1055,9 @@
mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM,
srv_use_checksums
diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
--- a/storage/innobase/fil/fil0fil.c 2010-12-04 15:52:23.406513743 +0900
+++ b/storage/innobase/fil/fil0fil.c 2010-12-04 15:53:45.020513800 +0900
-@@ -3171,7 +3171,9 @@
+@@ -3199,7 +3199,9 @@
mach_write_to_8(page + FIL_PAGE_FILE_FLUSH_LSN, current_lsn);
mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM,
srv_use_checksums
: BUF_NO_CHECKSUM_MAGIC);
mach_write_to_4(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,
srv_use_checksums
-@@ -3303,7 +3305,8 @@
+@@ -3331,7 +3333,8 @@
page_is_corrupt = TRUE;
}
&& checksum_field != BUF_NO_CHECKSUM_MAGIC
&& checksum_field
!= buf_calc_page_new_checksum(page)) {
-@@ -3311,6 +3314,17 @@
+@@ -3339,6 +3342,17 @@
page_is_corrupt = TRUE;
}
/* if it is free page, inconsistency is acceptable */
if (!offset) {
/* header page*/
-@@ -3456,7 +3470,9 @@
+@@ -3484,7 +3498,9 @@
mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM,
srv_use_checksums
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;
-@@ -2573,6 +2574,7 @@
+@@ -2574,6 +2575,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))
-@@ -11321,6 +11323,15 @@
+@@ -11324,6 +11326,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.",
-@@ -11833,6 +11844,7 @@
+@@ -11831,6 +11842,7 @@
MYSQL_SYSVAR(buffer_pool_size),
MYSQL_SYSVAR(buffer_pool_instances),
MYSQL_SYSVAR(checksums),
diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
--- a/storage/innobase/include/buf0buf.h 2010-12-04 15:52:23.458514045 +0900
+++ b/storage/innobase/include/buf0buf.h 2010-12-04 15:53:45.044514150 +0900
-@@ -531,6 +531,11 @@
+@@ -602,6 +602,11 @@
buf_calc_page_new_checksum(
/*=======================*/
const byte* page); /*!< in: buffer page */
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
-@@ -412,6 +412,7 @@
+@@ -414,6 +414,7 @@
UNIV_INTERN ibool srv_use_doublewrite_buf = TRUE;
UNIV_INTERN ibool srv_use_checksums = TRUE;
diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
--- a/storage/innobase/fil/fil0fil.c 2010-12-04 15:55:21.358513751 +0900
+++ b/storage/innobase/fil/fil0fil.c 2010-12-04 15:55:58.243481131 +0900
-@@ -4800,9 +4800,9 @@
+@@ -729,7 +729,7 @@
+ ut_a(space->purpose != FIL_LOG);
+ ut_a(!trx_sys_sys_space(space->id));
+
+- if (size_bytes < FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE) {
++ if (size_bytes < FIL_IBD_FILE_INITIAL_SIZE * (lint)UNIV_PAGE_SIZE) {
+ fprintf(stderr,
+ "InnoDB: Error: the size of single-table"
+ " tablespace file %s\n"
+@@ -3216,7 +3216,7 @@
+
+ if (size_bytes < free_limit_bytes) {
+ free_limit_bytes = size_bytes;
+- if (size_bytes >= FSP_EXTENT_SIZE * UNIV_PAGE_SIZE) {
++ if (size_bytes >= (lint)FSP_EXTENT_SIZE * (lint)UNIV_PAGE_SIZE) {
+ fprintf(stderr, "InnoDB: free limit of %s is larger than its real size.\n", filepath);
+ file_is_corrupt = TRUE;
+ }
+@@ -3830,7 +3830,7 @@
+
+ size = (((ib_int64_t)size_high) << 32) + (ib_int64_t)size_low;
+ #ifndef UNIV_HOTBACKUP
+- if (size < FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE) {
++ if (size < FIL_IBD_FILE_INITIAL_SIZE * (lint)UNIV_PAGE_SIZE) {
+ fprintf(stderr,
+ "InnoDB: Error: the size of single-table tablespace"
+ " file %s\n"
+@@ -3850,7 +3850,7 @@
+ /* Align the memory for file i/o if we might have O_DIRECT set */
+ page = ut_align(buf2, UNIV_PAGE_SIZE);
+
+- if (size >= FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE) {
++ if (size >= FIL_IBD_FILE_INITIAL_SIZE * (lint)UNIV_PAGE_SIZE) {
+ success = os_file_read(file, page, 0, 0, UNIV_PAGE_SIZE);
+
+ /* We have to read the tablespace id from the file */
+@@ -4828,9 +4828,9 @@
ut_ad(ut_is_2pow(zip_size));
ut_ad(buf);
ut_ad(len > 0);
+//#if (1 << UNIV_PAGE_SIZE_SHIFT) != UNIV_PAGE_SIZE
+//# error "(1 << UNIV_PAGE_SIZE_SHIFT) != UNIV_PAGE_SIZE"
+//#endif
- ut_ad(fil_validate());
+ ut_ad(fil_validate_skip());
#ifndef UNIV_HOTBACKUP
# ifndef UNIV_LOG_DEBUG
diff -ruN a/storage/innobase/fsp/fsp0fsp.c b/storage/innobase/fsp/fsp0fsp.c
--- a/storage/innobase/fsp/fsp0fsp.c 2010-12-04 15:52:23.411513754 +0900
+++ b/storage/innobase/fsp/fsp0fsp.c 2010-12-04 15:55:58.244514273 +0900
-@@ -657,15 +657,16 @@
+@@ -656,16 +656,18 @@
+ 0 for uncompressed pages */
ulint offset) /*!< in: page offset */
{
- #ifndef DOXYGEN /* Doxygen gets confused of these */
+-#ifndef DOXYGEN /* Doxygen gets confused of these */
-# if UNIV_PAGE_SIZE <= XDES_ARR_OFFSET \
- + (UNIV_PAGE_SIZE / FSP_EXTENT_SIZE) * XDES_SIZE
-# error
-# endif
+-# if PAGE_ZIP_MIN_SIZE <= XDES_ARR_OFFSET \
+- + (PAGE_ZIP_MIN_SIZE / FSP_EXTENT_SIZE) * XDES_SIZE
+-# error
+-# endif
+-#endif /* !DOXYGEN */
++//#ifndef DOXYGEN /* Doxygen gets confused of these */
+//# if UNIV_PAGE_SIZE <= XDES_ARR_OFFSET
+// + (UNIV_PAGE_SIZE / FSP_EXTENT_SIZE) * XDES_SIZE
+//# error
+//# endif
- # if PAGE_ZIP_MIN_SIZE <= XDES_ARR_OFFSET \
- + (PAGE_ZIP_MIN_SIZE / FSP_EXTENT_SIZE) * XDES_SIZE
- # error
- # endif
- #endif /* !DOXYGEN */
++//# if PAGE_ZIP_MIN_SIZE <= XDES_ARR_OFFSET
++// + (PAGE_ZIP_MIN_SIZE / FSP_EXTENT_SIZE) * XDES_SIZE
++//# error
++//# endif
++//#endif /* !DOXYGEN */
+ ut_a(UNIV_PAGE_SIZE > XDES_ARR_OFFSET + (UNIV_PAGE_SIZE / FSP_EXTENT_SIZE) * XDES_SIZE);
++ ut_a(PAGE_ZIP_MIN_SIZE > XDES_ARR_OFFSET + (PAGE_ZIP_MIN_SIZE / FSP_EXTENT_SIZE) * XDES_SIZE);
ut_ad(ut_is_2pow(zip_size));
if (!zip_size) {
-@@ -1464,12 +1465,12 @@
+@@ -1464,12 +1466,12 @@
mtr);
xdes_init(descr, mtr);
static my_bool innobase_thread_concurrency_timer_based;
static long long innobase_buffer_pool_size, innobase_log_file_size;
-@@ -2269,6 +2272,62 @@
+@@ -2270,6 +2273,65 @@
}
- #endif /* UNIV_DEBUG */
+ #endif /* DBUG_OFF */
+ srv_page_size = 0;
+ srv_page_size_shift = 0;
+
+ if (!srv_page_size_shift) {
+ fprintf(stderr,
-+ "InnoDB: Error: %lu is not valid value for innodb_page_size.\n",
++ "InnoDB: Error: %lu is not a valid value for innodb_page_size.\n"
++ "InnoDB: Error: Valid values are 4096, 8192, and 16384 (default=16384).\n",
+ innobase_page_size);
+ goto error;
+ }
+
+ if (!srv_log_block_size) {
+ fprintf(stderr,
-+ "InnoDB: Error: %lu is not valid value for innodb_log_block_size.\n",
++ "InnoDB: Error: %lu is not a valid value for innodb_log_block_size.\n"
++ "InnoDB: Error: A valid value for innodb_log_block_size is\n"
++ "InnoDB: Error: a power of 2 from 512 to 16384.\n",
+ innobase_log_block_size);
+ goto error;
+ }
#ifndef MYSQL_SERVER
innodb_overwrite_relay_log_info = FALSE;
#endif
-@@ -7212,9 +7271,9 @@
+@@ -7222,9 +7284,9 @@
| DICT_TF_COMPACT
| DICT_TF_FORMAT_ZIP
<< DICT_TF_FORMAT_SHIFT;
}
}
-@@ -11332,6 +11391,16 @@
+@@ -11335,6 +11397,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.",
-@@ -11839,6 +11908,8 @@
+@@ -11837,6 +11909,8 @@
NULL, NULL, 0, 0, 1, 0);
static struct st_mysql_sys_var* innobase_system_variables[]= {
diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
--- a/storage/innobase/include/buf0buf.h 2010-12-04 15:55:21.375482937 +0900
+++ b/storage/innobase/include/buf0buf.h 2010-12-04 15:55:58.258469088 +0900
-@@ -1602,7 +1602,7 @@
+@@ -1682,7 +1682,7 @@
time_t last_printout_time;
/*!< when buf_print_io was last time
called */
/*!< Statistics of buddy system,
indexed by block size */
buf_pool_stat_t stat; /*!< current statistics */
-@@ -1698,7 +1698,7 @@
+@@ -1778,7 +1778,7 @@
/* @{ */
UT_LIST_BASE_NODE_T(buf_page_t) zip_clean;
/*!< unmodified compressed pages */
/*!< buddy free lists */
buf_page_t watch[BUF_POOL_WATCH_SIZE];
-@@ -1706,9 +1706,9 @@
+@@ -1786,9 +1786,9 @@
pool watches. Protected by
buf_pool->mutex. */
diff -ruN a/storage/innobase/include/buf0types.h b/storage/innobase/include/buf0types.h
--- a/storage/innobase/include/buf0types.h 2010-11-03 07:01:13.000000000 +0900
+++ b/storage/innobase/include/buf0types.h 2010-12-04 15:55:58.259482590 +0900
-@@ -72,6 +72,7 @@
+@@ -72,12 +72,13 @@
buddy system; must be at least
sizeof(buf_page_t) */
#define BUF_BUDDY_SIZES (UNIV_PAGE_SIZE_SHIFT - BUF_BUDDY_LOW_SHIFT)
/*!< number of buddy sizes */
/** twice the maximum block size of the buddy system;
+ the underlying memory is aligned by this amount:
+ this must be equal to UNIV_PAGE_SIZE */
+-#define BUF_BUDDY_HIGH (BUF_BUDDY_LOW << BUF_BUDDY_SIZES)
++#define BUF_BUDDY_HIGH ((ulint)BUF_BUDDY_LOW << BUF_BUDDY_SIZES)
+ /* @} */
+
+ #endif
+diff -ruN a/storage/innobase/include/fsp0types.h b/storage/innobase/include/fsp0types.h
+--- a/storage/innobase/include/fsp0types.h 2010-12-04 02:58:26.000000000 +0900
++++ b/storage/innobase/include/fsp0types.h 2011-02-03 15:14:21.000000000 +0900
+@@ -42,7 +42,7 @@
+ /* @} */
+
+ /** File space extent size (one megabyte) in pages */
+-#define FSP_EXTENT_SIZE (1 << (20 - UNIV_PAGE_SIZE_SHIFT))
++#define FSP_EXTENT_SIZE ((ulint)1 << (20 - UNIV_PAGE_SIZE_SHIFT))
+
+ /** On a page of any file segment, data may be put starting from this
+ offset */
diff -ruN a/storage/innobase/include/log0log.h b/storage/innobase/include/log0log.h
--- a/storage/innobase/include/log0log.h 2010-11-03 07:01:13.000000000 +0900
+++ b/storage/innobase/include/log0log.h 2010-12-09 18:16:47.737728305 +0900
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
-@@ -292,9 +292,13 @@
+@@ -295,9 +295,13 @@
*/
/* The 2-logarithm of UNIV_PAGE_SIZE: */
/* Maximum number of parallel threads in a parallelized operation */
#define UNIV_MAX_PARALLELISM 32
-@@ -401,7 +405,7 @@
+@@ -416,7 +420,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)
-@@ -504,4 +508,6 @@
+@@ -519,4 +523,6 @@
UNIV_MEM_ALLOC(addr, size); \
} while (0)
diff -ruN a/storage/innobase/log/log0log.c b/storage/innobase/log/log0log.c
--- a/storage/innobase/log/log0log.c 2010-12-03 15:18:48.899986203 +0900
+++ b/storage/innobase/log/log0log.c 2010-12-04 15:55:58.266551567 +0900
-@@ -603,7 +603,9 @@
+@@ -604,7 +604,9 @@
offset = (gr_lsn_size_offset + difference) % group_size;
/* fprintf(stderr,
"Offset is %lu gr_lsn_offset is %lu difference is %lu\n",
-@@ -1200,6 +1202,9 @@
+@@ -1201,6 +1203,9 @@
/* Wipe over possible label of ibbackup --restore */
memcpy(buf + LOG_FILE_WAS_CREATED_BY_HOT_BACKUP, " ", 4);
dest_offset = nth_file * group->file_size;
#ifdef UNIV_DEBUG
-@@ -1793,9 +1798,7 @@
+@@ -1794,9 +1799,7 @@
ulint i;
ut_ad(mutex_own(&(log_sys->mutex)));
buf = group->checkpoint_buf;
-@@ -1809,6 +1812,7 @@
+@@ -1810,6 +1813,7 @@
mach_write_to_4(buf + LOG_CHECKPOINT_LOG_BUF_SIZE, log_sys->buf_size);
#ifdef UNIV_LOG_ARCHIVE
if (log_sys->archiving_state == LOG_ARCH_OFF) {
archived_lsn = IB_ULONGLONG_MAX;
} else {
-@@ -1822,7 +1826,9 @@
+@@ -1823,7 +1827,9 @@
mach_write_to_8(buf + LOG_CHECKPOINT_ARCHIVED_LSN, archived_lsn);
#else /* UNIV_LOG_ARCHIVE */
ib_uint64_t checkpoint_lsn;
ib_uint64_t checkpoint_no;
ib_uint64_t old_scanned_lsn;
-@@ -3056,6 +3071,20 @@
+@@ -3056,6 +3071,21 @@
log_hdr_buf, max_cp_group);
}
+ if (log_hdr_log_block_size != srv_log_block_size) {
+ fprintf(stderr,
+ "InnoDB: Error: The block size of ib_logfile (%lu) "
-+ "is not equal to innodb_log_block_size.\n",
++ "is not equal to innodb_log_block_size.\n"
++ "InnoDB: Error: Suggestion - Recreate log files.\n",
+ log_hdr_log_block_size);
+ return(DB_ERROR);
+ }
diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
--- a/storage/innobase/srv/srv0srv.c 2010-12-04 15:55:21.384486344 +0900
+++ b/storage/innobase/srv/srv0srv.c 2010-12-04 15:55:58.282550845 +0900
-@@ -239,6 +239,13 @@
+@@ -241,6 +241,13 @@
UNIV_INTERN ulint srv_n_read_io_threads = ULINT_MAX;
UNIV_INTERN ulint srv_n_write_io_threads = ULINT_MAX;
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
-@@ -1521,10 +1521,12 @@
+@@ -1553,11 +1553,13 @@
}
#endif /* UNIV_LOG_ARCHIVE */
+ if (sizeof(ulint) == 4
+ && srv_n_log_files * srv_log_file_size
+ >= ((ulint)1 << (32 - UNIV_PAGE_SIZE_SHIFT))) {
+ ut_print_timestamp(stderr);
fprintf(stderr,
- "InnoDB: Error: combined size of log files"
+ " InnoDB: Error: combined size of log files"
- " must be < 4 GB\n");
+ " must be < 4 GB on 32-bit systems\n");
return(DB_ERROR);
}
-@@ -1533,7 +1535,7 @@
+@@ -1566,7 +1568,7 @@
for (i = 0; i < srv_n_data_files; i++) {
#ifndef __WIN__
- if (sizeof(off_t) < 5 && srv_data_file_sizes[i] >= 262144) {
+ if (sizeof(off_t) < 5 && srv_data_file_sizes[i] >= ((ulint)1 << (32 - UNIV_PAGE_SIZE_SHIFT))) {
+ ut_print_timestamp(stderr);
fprintf(stderr,
- "InnoDB: Error: file size must be < 4 GB"
- " with this MySQL binary\n"
+ " InnoDB: Error: file size must be < 4 GB"
diff -ruN a/storage/innobase/dict/dict0load.c b/storage/innobase/dict/dict0load.c
--- a/storage/innobase/dict/dict0load.c 2010-12-04 15:37:50.559480289 +0900
+++ b/storage/innobase/dict/dict0load.c 2010-12-04 15:57:53.078513745 +0900
-@@ -1851,6 +1851,8 @@
+@@ -1868,6 +1868,8 @@
ut_ad(mutex_own(&(dict_sys->mutex)));
/* NOTE that the operation of this function is protected by
the dictionary mutex, and therefore no deadlocks can occur
with other dictionary operations. */
-@@ -1877,15 +1879,17 @@
+@@ -1894,15 +1896,17 @@
BTR_SEARCH_LEAF, &pcur, &mtr);
rec = btr_pcur_get_rec(&pcur);
}
/*---------------------------------------------------*/
-@@ -1898,12 +1902,7 @@
+@@ -1915,12 +1919,7 @@
/* Check if the table id in record is the one searched for */
if (table_id != mach_read_from_8(field)) {
}
/* Now we get the table name from the record */
-@@ -1911,7 +1910,7 @@
+@@ -1928,7 +1927,7 @@
/* Load the table definition to memory */
table = dict_load_table(mem_heap_strdupl(heap, (char*) field, len),
TRUE);
diff -ruN a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i
--- a/storage/innobase/include/univ.i 2010-12-04 15:57:13.050485224 +0900
+++ b/storage/innobase/include/univ.i 2010-12-04 15:57:53.091592933 +0900
-@@ -48,6 +48,11 @@
+@@ -53,6 +53,11 @@
#define INNODB_VERSION_MINOR 1
- #define INNODB_VERSION_BUGFIX 4
+ #define INNODB_VERSION_BUGFIX 5
+#ifndef PERCONA_INNODB_VERSION
+#define PERCONA_INNODB_VERSION 12.1
/* The following is the InnoDB version as shown in
SELECT plugin_version FROM information_schema.plugins;
calculated in make_version_string() in sql/sql_show.cc like this:
-@@ -58,13 +63,15 @@
- (INNODB_VERSION_MAJOR << 8 | INNODB_VERSION_MINOR)
-
- /* auxiliary macros to help creating the version as string */
--#define __INNODB_VERSION(a, b, c) (#a "." #b "." #c)
--#define _INNODB_VERSION(a, b, c) __INNODB_VERSION(a, b, c)
-+#define __INNODB_VERSION(a, b, c, d) (#a "." #b "." #c "-" #d)
-+#define _INNODB_VERSION(a, b, c, d) __INNODB_VERSION(a, b, c, d)
-+
-
+@@ -65,7 +70,8 @@
#define INNODB_VERSION_STR \
- _INNODB_VERSION(INNODB_VERSION_MAJOR, \
- INNODB_VERSION_MINOR, \
-- INNODB_VERSION_BUGFIX)
-+ INNODB_VERSION_BUGFIX, \
-+ PERCONA_INNODB_VERSION)
-
- #define REFMAN "http://dev.mysql.com/doc/refman/5.1/en/"
-
+ IB_TO_STR(INNODB_VERSION_MAJOR) "." \
+ IB_TO_STR(INNODB_VERSION_MINOR) "." \
+- IB_TO_STR(INNODB_VERSION_BUGFIX)
++ IB_TO_STR(INNODB_VERSION_BUGFIX) "-" \
++ IB_TO_STR(PERCONA_INNODB_VERSION)
+
+ #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/row/row0mysql.c b/storage/innobase/row/row0mysql.c
--- a/storage/innobase/row/row0mysql.c 2010-12-04 15:37:50.598481116 +0900
+++ b/storage/innobase/row/row0mysql.c 2010-12-04 15:57:53.092563335 +0900
-@@ -1194,6 +1194,13 @@
+@@ -51,6 +51,7 @@
+ #include "btr0sea.h"
+ #include "fil0fil.h"
+ #include "ibuf0ibuf.h"
++#include "ha_prototypes.h"
+
+ /** Provide optional 4.x backwards compatibility for 5.0 and above */
+ UNIV_INTERN ibool row_rollback_on_timeout = FALSE;
+@@ -1194,6 +1195,13 @@
thr = que_fork_get_first_thr(prebuilt->ins_graph);
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
-@@ -2032,7 +2032,7 @@
+@@ -2153,7 +2153,7 @@
if (srv_print_verbose_log) {
ut_print_timestamp(stderr);
fprintf(stderr,
-- " InnoDB: %s started; "
+- " InnoDB: %s started; "
+ " Percona XtraDB (http://www.percona.com) %s started; "
"log sequence number %llu\n",
INNODB_VERSION_STR, srv_start_lsn);
diff -ruN a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c
--- a/storage/innobase/buf/buf0flu.c 2010-11-03 07:01:13.000000000 +0900
+++ b/storage/innobase/buf/buf0flu.c 2010-12-03 15:10:08.934990091 +0900
-@@ -1348,7 +1348,7 @@
+@@ -1376,7 +1376,7 @@
ut_ad(flush_type == BUF_FLUSH_LRU || flush_type == 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-03 15:09:51.283956391 +0900
+++ b/storage/innobase/handler/ha_innodb.cc 2010-12-03 15:10:08.963980444 +0900
-@@ -425,6 +425,12 @@
+@@ -426,6 +426,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,
-@@ -819,6 +825,17 @@
+@@ -820,6 +826,17 @@
}
}
/********************************************************************//**
Obtain the InnoDB transaction of a MySQL thread.
@return reference to transaction pointer */
-@@ -2390,6 +2407,9 @@
+@@ -2391,6 +2408,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;
-@@ -10107,6 +10127,10 @@
- && (all
- || !thd_test_options(
- thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) {
-+ if (srv_enable_unsafe_group_commit && !THDVAR(thd, support_xa)) {
-+ /* choose group commit rather than binlog order */
-+ return(error);
-+ }
-
- /* For ibbackup to work the order of transactions in binlog
- and InnoDB must be the same. Consider the situation
-@@ -10917,9 +10941,9 @@
+@@ -10919,9 +10939,9 @@
static MYSQL_SYSVAR_ULONG(purge_threads, srv_n_purge_threads,
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
0, /* Minimum value */
1, 0); /* Maximum value */
-@@ -10961,12 +10985,18 @@
+@@ -10963,12 +10983,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,
-@@ -11061,7 +11091,7 @@
+@@ -11063,7 +11089,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,
-@@ -11206,6 +11236,100 @@
+@@ -11208,6 +11234,95 @@
"trigger a readahead.",
NULL, NULL, 56, 0, 64, 0);
+ PLUGIN_VAR_RQCMDARG,
+ "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(enable_unsafe_group_commit, srv_enable_unsafe_group_commit,
-+ PLUGIN_VAR_RQCMDARG,
-+ "Enable/Disable unsafe group commit when support_xa=OFF and use with binlog or other XA storage engine.",
-+ NULL, NULL, 0, 0, 1, 0);
+
static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(additional_mem_pool_size),
MYSQL_SYSVAR(autoextend_increment),
-@@ -11226,6 +11350,7 @@
+@@ -11228,6 +11343,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),
-@@ -11262,6 +11387,14 @@
+@@ -11264,6 +11380,13 @@
MYSQL_SYSVAR(show_verbose_locks),
MYSQL_SYSVAR(show_locks_held),
MYSQL_SYSVAR(version),
+ MYSQL_SYSVAR(flush_neighbor_pages),
+ MYSQL_SYSVAR(read_ahead),
+ MYSQL_SYSVAR(adaptive_flushing_method),
-+ MYSQL_SYSVAR(enable_unsafe_group_commit),
MYSQL_SYSVAR(use_sys_malloc),
MYSQL_SYSVAR(use_native_aio),
MYSQL_SYSVAR(change_buffering),
mutex_create(ibuf_pessimistic_insert_mutex_key,
&ibuf_pessimistic_insert_mutex,
-@@ -2651,9 +2653,11 @@
+@@ -2729,9 +2731,11 @@
size = ibuf->size;
max_size = ibuf->max_size;
diff -ruN a/storage/innobase/log/log0log.c b/storage/innobase/log/log0log.c
--- a/storage/innobase/log/log0log.c 2010-11-03 07:01:13.000000000 +0900
+++ b/storage/innobase/log/log0log.c 2010-12-03 15:10:09.084023562 +0900
-@@ -359,6 +359,33 @@
+@@ -48,6 +48,7 @@
+ #include "srv0start.h"
+ #include "trx0sys.h"
+ #include "trx0trx.h"
++#include "ha_prototypes.h"
+
+ /*
+ General philosophy of InnoDB redo-logs:
+@@ -359,6 +360,33 @@
}
/************************************************************//**
Closes the log.
@return lsn */
UNIV_INTERN
-@@ -427,7 +454,7 @@
+@@ -427,7 +455,7 @@
}
}
goto function_exit;
}
-@@ -435,8 +462,8 @@
+@@ -435,8 +463,8 @@
oldest_lsn = buf_pool_get_oldest_modification();
if (!oldest_lsn
log->check_flush_or_checkpoint = TRUE;
}
-@@ -1100,6 +1127,7 @@
+@@ -1100,6 +1128,7 @@
group = (log_group_t*)((ulint)group - 1);
if (srv_unix_file_flush_method != SRV_UNIX_O_DSYNC
&& srv_unix_file_flush_method != SRV_UNIX_NOSYNC) {
fil_flush(group->space_id);
-@@ -1121,8 +1149,9 @@
+@@ -1121,8 +1150,9 @@
logs and cannot end up here! */
if (srv_unix_file_flush_method != SRV_UNIX_O_DSYNC
fil_flush(group->space_id);
}
-@@ -1501,7 +1530,8 @@
+@@ -1501,7 +1531,8 @@
mutex_exit(&(log_sys->mutex));
/* O_DSYNC means the OS did not buffer the log file at all:
so we have also flushed to disk what we have written */
-@@ -2120,10 +2150,10 @@
+@@ -2120,10 +2151,10 @@
sync = TRUE;
advance = 2 * (age - log->max_modified_age_sync);
} else {
advance = 0;
}
-@@ -2137,7 +2167,7 @@
+@@ -2137,7 +2168,7 @@
do_checkpoint = TRUE;
/* A checkpoint is not urgent: do it asynchronously */
do_checkpoint = TRUE;
-@@ -3349,6 +3379,17 @@
+@@ -3349,6 +3380,17 @@
log_sys->flushed_to_disk_lsn,
log_sys->last_checkpoint_lsn);
diff -ruN a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c
--- a/storage/innobase/os/os0file.c 2010-11-03 07:01:13.000000000 +0900
+++ b/storage/innobase/os/os0file.c 2010-12-03 15:10:09.093023540 +0900
-@@ -1399,7 +1399,7 @@
+@@ -1424,7 +1424,7 @@
#endif
#ifdef UNIV_NON_BUFFERED_IO
# ifndef UNIV_HOTBACKUP
/* Do not use unbuffered i/o to log files because
value 2 denotes that we do not flush the log at every
commit, but only once per second */
-@@ -1415,7 +1415,7 @@
+@@ -1440,7 +1440,7 @@
attributes = 0;
#ifdef UNIV_NON_BUFFERED_IO
# ifndef UNIV_HOTBACKUP
/* Do not use unbuffered i/o to log files because
value 2 denotes that we do not flush the log at every
commit, but only once per second */
-@@ -1560,6 +1560,11 @@
+@@ -1585,6 +1585,11 @@
os_file_set_nocache(file, name, mode_str);
}
diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
--- a/storage/innobase/srv/srv0srv.c 2010-12-03 15:09:51.301987792 +0900
+++ b/storage/innobase/srv/srv0srv.c 2010-12-03 15:13:29.369986988 +0900
-@@ -188,7 +188,8 @@
+@@ -190,7 +190,8 @@
UNIV_INTERN ulint srv_log_file_size = ULINT_MAX;
/* size in database pages */
UNIV_INTERN ulint srv_log_buffer_size = ULINT_MAX;
/* Try to flush dirty pages so as to avoid IO bursts at
the checkpoints. */
-@@ -399,6 +400,17 @@
+@@ -401,6 +402,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;
-@@ -2703,6 +2715,7 @@
+@@ -2737,6 +2749,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;
-@@ -2710,7 +2723,20 @@
+@@ -2744,7 +2757,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",
-@@ -2732,6 +2758,9 @@
+@@ -2766,6 +2792,9 @@
mutex_exit(&kernel_mutex);
loop:
/*****************************************************************/
/* ---- When there is database activity by users, we cycle in this
-@@ -2762,9 +2791,13 @@
+@@ -2796,9 +2825,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. */
-@@ -2788,6 +2821,7 @@
+@@ -2822,6 +2855,7 @@
srv_main_thread_op_info = "sleeping";
srv_main_1_second_loops++;
if (next_itr_time > cur_time
&& srv_shutdown_state == SRV_SHUTDOWN_NONE) {
-@@ -2798,10 +2832,26 @@
+@@ -2832,10 +2866,26 @@
(next_itr_time - cur_time)
* 1000));
srv_main_sleeps++;
/* Flush logs if needed */
srv_sync_log_buffer_in_background();
-@@ -2821,7 +2871,7 @@
+@@ -2855,7 +2905,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();
-@@ -2838,7 +2888,11 @@
+@@ -2872,7 +2922,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
-@@ -2854,6 +2908,223 @@
+@@ -2888,6 +2942,224 @@
n_flush,
IB_ULONGLONG_MAX);
}
+
+ if (prev_adaptive_flushing_method == 2) {
+ lint n_flush;
-+ lint blocks_sum, new_blocks_sum, flushed_blocks_sum;
++ lint blocks_sum;
++ ulint new_blocks_sum, flushed_blocks_sum;
+
+ blocks_sum = new_blocks_sum = flushed_blocks_sum = 0;
+
}
if (srv_activity_count == old_activity_count) {
-@@ -2902,7 +3173,7 @@
+@@ -2936,7 +3208,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();
-@@ -3010,7 +3281,7 @@
+@@ -3044,7 +3316,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";
-@@ -3156,6 +3427,7 @@
+@@ -3190,6 +3462,7 @@
srv_slot_t* slot;
ulint slot_no = ULINT_UNDEFINED;
ulint n_total_purged = ULINT_UNDEFINED;
ut_a(srv_n_purge_threads == 1);
-@@ -3178,9 +3450,12 @@
+@@ -3212,9 +3485,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.
-@@ -3221,6 +3496,16 @@
+@@ -3255,6 +3531,16 @@
} while (n_pages_purged > 0 && !srv_fast_shutdown);
srv_sync_log_buffer_in_background();
diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c
--- a/storage/innobase/srv/srv0start.c 2010-11-03 07:01:13.000000000 +0900
+++ b/storage/innobase/srv/srv0start.c 2010-12-03 15:10:09.103023543 +0900
-@@ -1184,6 +1184,9 @@
+@@ -1212,6 +1212,9 @@
} else if (0 == ut_strcmp(srv_file_flush_method_str, "O_DIRECT")) {
srv_unix_file_flush_method = SRV_UNIX_O_DIRECT;
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
-@@ -2250,6 +2250,285 @@
+@@ -2258,6 +2258,284 @@
memset(&buf_LRU_stat_cur, 0, sizeof buf_LRU_stat_cur);
}
+ if (strstr(srv_data_file_names[i], LRU_DUMP_FILE) != NULL) {
+ fprintf(stderr,
+ " InnoDB: The name '%s' seems to be used for"
-+ " innodb_data_file_path. Dumping LRU list is not"
-+ " done for safeness.\n", LRU_DUMP_FILE);
++ " innodb_data_file_path. For safety, dumping of the LRU list"
++ " is not being done.\n", LRU_DUMP_FILE);
+ goto end;
+ }
+ }
+ UNIV_PAGE_SIZE);
+ if (!success) {
+ fprintf(stderr,
-+ " InnoDB: cannot read page %lu of %s,"
-+ " or meet unexpected terminal.\n",
++ " InnoDB: either could not read page %lu of %s,"
++ " or terminated unexpectedly.\n",
+ buffers, LRU_DUMP_FILE);
+ goto end;
+ }
+ continue;
+ }
+
-+ if (fil_area_is_exist(space_id, zip_size, page_no, 0,
-+ zip_size ? zip_size : UNIV_PAGE_SIZE)) {
++ if (fil_is_exist(space_id, page_no)) {
+
+ tablespace_version = fil_space_get_version(space_id);
+
diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
--- a/storage/innobase/fil/fil0fil.c 2010-12-03 17:49:11.581025127 +0900
+++ b/storage/innobase/fil/fil0fil.c 2010-12-04 15:33:37.632482885 +0900
-@@ -4939,6 +4939,78 @@
+@@ -4967,6 +4967,70 @@
return(DB_SUCCESS);
}
+Confirm whether the parameters are valid or not */
+UNIV_INTERN
+ibool
-+fil_area_is_exist(
++fil_is_exist(
+/*==============*/
+ ulint space_id, /*!< in: space id */
-+ ulint zip_size, /*!< in: compressed page size in bytes;
-+ 0 for uncompressed pages */
-+ ulint block_offset, /*!< in: offset in number of blocks */
-+ ulint byte_offset, /*!< in: remainder of offset in bytes; in
-+ aio this must be divisible by the OS block
-+ size */
-+ ulint len) /*!< in: how many bytes to read or write; this
-+ must not cross a file boundary; in aio this
-+ must be a block size multiple */
++ ulint block_offset) /*!< in: offset in number of blocks */
+{
+ fil_space_t* space;
+ fil_node_t* node;
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
-@@ -11708,6 +11708,12 @@
+@@ -11706,6 +11706,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),
-@@ -11791,6 +11797,7 @@
+@@ -11788,6 +11794,7 @@
#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
MYSQL_SYSVAR(read_ahead_threshold),
MYSQL_SYSVAR(io_capacity),
}
static const char plugin_author[] = "Innobase Oy";
-@@ -4255,6 +4256,36 @@
+@@ -4254,6 +4255,36 @@
"Hello!");
goto end_func;
}
+ else if (!strncasecmp("XTRA_LRU_DUMP", ptr, 13)) {
+ ut_print_timestamp(stderr);
-+ fprintf(stderr, " InnoDB: administration command 'XTRA_LRU_DUMP'"
++ fprintf(stderr, " InnoDB: Administrative command 'XTRA_LRU_DUMP'"
+ " was detected.\n");
+
+ if (buf_LRU_file_dump()) {
+ }
+ else if (!strncasecmp("XTRA_LRU_RESTORE", ptr, 16)) {
+ ut_print_timestamp(stderr);
-+ fprintf(stderr, " InnoDB: administration command 'XTRA_LRU_RESTORE'"
++ fprintf(stderr, " InnoDB: Administrative command 'XTRA_LRU_RESTORE'"
+ " was detected.\n");
+
+ if (buf_LRU_file_restore()) {
diff -ruN a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h
--- a/storage/innobase/include/fil0fil.h 2010-12-03 17:49:11.597953501 +0900
+++ b/storage/innobase/include/fil0fil.h 2010-12-04 15:33:37.684551372 +0900
-@@ -644,6 +644,22 @@
+@@ -644,6 +644,14 @@
void* message, /*!< in: message for aio handler if non-sync
aio used, else ignored */
trx_t* trx);
+Confirm whether the parameters are valid or not */
+UNIV_INTERN
+ibool
-+fil_area_is_exist(
++fil_is_exist(
+/*==============*/
+ ulint space_id, /*!< in: space id */
-+ ulint zip_size, /*!< in: compressed page size in bytes;
-+ 0 for uncompressed pages */
-+ ulint block_offset, /*!< in: offset in number of blocks */
-+ ulint byte_offset, /*!< in: remainder of offset in bytes; in
-+ aio this must be divisible by the OS block
-+ size */
-+ ulint len); /*!< in: how many bytes to read or write; this
-+ must not cross a file boundary; in aio this
-+ must be a block size multiple */
++ ulint block_offset); /*!< in: offset in number of blocks */
/**********************************************************************//**
Waits for an aio operation to complete. This function is used to write the
handler for completed requests. The aio array of pending requests is divided
/** Status variables to be passed to MySQL */
typedef struct export_var_struct export_struc;
-@@ -655,6 +658,16 @@
+@@ -663,6 +666,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
-@@ -327,6 +327,9 @@
+@@ -329,6 +329,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;
-@@ -2663,6 +2666,56 @@
+@@ -2697,6 +2700,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. */
+ time_t time_elapsed;
+
+#ifdef UNIV_DEBUG_THREAD_CREATION
-+ fprintf(stderr, "LRU dump/restore thread starts, id %lu\n",
++ fprintf(stderr, "The LRU dump/restore thread has started, id %lu\n",
+ os_thread_pf(os_thread_get_curr_id()));
+#endif
+
/** 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. */
-@@ -1737,6 +1737,10 @@
+@@ -1813,6 +1813,10 @@
os_thread_create(&srv_monitor_thread, NULL,
thread_ids + 4 + SRV_MAX_N_IO_THREADS);
ut_d(bpage->in_page_hash = FALSE);
/* relocate buf_pool->LRU */
-@@ -3729,8 +3729,8 @@
+@@ -3730,8 +3730,8 @@
bpage->in_zip_hash = FALSE;
bpage->in_flush_list = FALSE;
bpage->in_free_list = FALSE;
ut_d(bpage->in_page_hash = TRUE);
-@@ -3893,7 +3893,7 @@
+@@ -3894,7 +3894,7 @@
ibuf_merge_or_delete_for_page(NULL, space, offset, zip_size, TRUE);
/* Flush pages from the end of the LRU list if necessary */
diff -ruN a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c
--- a/storage/innobase/buf/buf0flu.c 2010-12-03 15:18:48.868953442 +0900
+++ b/storage/innobase/buf/buf0flu.c 2010-12-03 15:20:49.599986956 +0900
-@@ -403,19 +403,21 @@
+@@ -431,19 +431,21 @@
buf_page_in_file(bpage) and in the LRU list */
{
#ifdef UNIV_DEBUG
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Error: buffer block state %lu"
-@@ -423,6 +425,7 @@
+@@ -451,6 +453,7 @@
(ulong) buf_page_get_state(bpage));
ut_print_buf(stderr, bpage, sizeof(buf_page_t));
putc('\n', stderr);
return(FALSE);
}
-@@ -1955,8 +1958,14 @@
+@@ -1983,8 +1986,14 @@
buf_page_t* bpage;
ulint n_replaceable;
ulint distance = 0;
n_replaceable = UT_LIST_GET_LEN(buf_pool->free);
-@@ -1967,7 +1976,13 @@
+@@ -1995,7 +2004,13 @@
+ BUF_FLUSH_EXTRA_MARGIN(buf_pool))
&& (distance < BUF_LRU_FREE_SEARCH_LEN(buf_pool))) {
mutex_enter(block_mutex);
-@@ -1982,11 +1997,18 @@
+@@ -2010,11 +2025,18 @@
bpage = UT_LIST_GET_PREV(LRU, bpage);
}
}
return(BUF_FLUSH_FREE_BLOCK_MARGIN(buf_pool)
-@@ -2004,7 +2026,8 @@
+@@ -2032,7 +2054,8 @@
void
buf_flush_free_margin(
/*==================*/
{
ulint n_to_flush;
-@@ -2015,7 +2038,7 @@
+@@ -2043,7 +2066,7 @@
n_flushed = buf_flush_LRU(buf_pool, n_to_flush);
/* There was an LRU type flush batch already running;
let us wait for it to end */
-@@ -2028,8 +2051,9 @@
+@@ -2056,8 +2079,9 @@
Flushes pages from the end of all the LRU lists. */
UNIV_INTERN
void
{
ulint i;
-@@ -2038,7 +2062,7 @@
+@@ -2066,7 +2090,7 @@
buf_pool = buf_pool_from_array(i);
diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
--- a/storage/innobase/include/buf0buf.h 2010-11-03 07:01:13.000000000 +0900
+++ b/storage/innobase/include/buf0buf.h 2010-12-03 15:20:49.608986590 +0900
-@@ -1314,11 +1314,11 @@
+@@ -1385,11 +1385,11 @@
UT_LIST_NODE_T(buf_page_t) LRU;
/*!< node of the LRU list */
static my_bool innobase_rollback_on_timeout = FALSE;
static my_bool innobase_create_status_file = FALSE;
static my_bool innobase_stats_on_metadata = TRUE;
-@@ -2201,6 +2221,89 @@
+@@ -2202,6 +2222,89 @@
}
- #endif /* UNIV_DEBUG */
+ #endif /* DBUG_OFF */
+#ifndef MYSQL_SERVER
+ innodb_overwrite_relay_log_info = FALSE;
+
+ fprintf(stderr,
+ "InnoDB: Warning: innodb_overwrite_relay_log_info is enabled."
-+ " Updates in other storage engines may have problem with consistency.\n");
++ " Updates by other storage engines may not be synchronized.\n");
+
+ bzero((char*) &info_file, sizeof(info_file));
+ fn_format(fname, relay_log_info_file, mysql_data_home, "", 4+32);
/* Check that values don't overflow on 32-bit systems. */
if (sizeof(ulint) == 4) {
if (innobase_buffer_pool_size > UINT_MAX32) {
-@@ -2499,6 +2602,76 @@
+@@ -2500,6 +2603,76 @@
goto mem_free_and_error;
}
+ /* If InnoDB progressed from relay-log.info, overwrite it */
+ if (fname[0] == '\0') {
+ fprintf(stderr,
-+ "InnoDB: something wrong with relay-info.log. InnoDB will not overwrite it.\n");
++ "InnoDB: Something is wrong with the file relay-info.log. InnoDB will not overwrite it.\n");
+ } else if (0 != strcmp(fname, trx_sys_mysql_master_log_name)
+ || pos != trx_sys_mysql_master_log_pos) {
+ /* Overwrite relay-log.info */
+skip_overwrite:
+ if (error) {
+ fprintf(stderr,
-+ "InnoDB: ERROR: error occured during overwriting relay-log.info.\n");
++ "InnoDB: ERROR: An error occurred while overwriting relay-log.info.\n");
+ } else {
+ fprintf(stderr,
-+ "InnoDB: relay-log.info was overwritten.\n");
++ "InnoDB: The file relay-log.info was successfully overwritten.\n");
+ }
+ } else {
+ fprintf(stderr,
innobase_old_blocks_pct = buf_LRU_old_ratio_update(
innobase_old_blocks_pct, TRUE);
-@@ -2611,6 +2784,25 @@
+@@ -2612,6 +2785,25 @@
trx_t* trx) /*!< in: transaction handle */
{
if (trx_is_started(trx)) {
trx_commit_for_mysql(trx);
}
-@@ -10919,6 +11111,12 @@
+@@ -10917,6 +11109,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). "
-@@ -11375,6 +11573,7 @@
+@@ -11368,6 +11566,7 @@
MYSQL_SYSVAR(old_blocks_pct),
MYSQL_SYSVAR(old_blocks_time),
MYSQL_SYSVAR(open_files),
page = buf_block_get_frame(block);
index = cursor->index;
zip_size = buf_block_get_zip_size(block);
-@@ -3022,6 +3100,11 @@
+@@ -3013,6 +3091,11 @@
block = btr_cur_get_block(cursor);
ut_ad(page_is_leaf(buf_block_get_frame(block)));
rec = btr_cur_get_rec(cursor);
-@@ -3826,6 +3909,11 @@
+@@ -3817,6 +3900,11 @@
page = btr_cur_get_page(&cursor);
block_mutex = buf_page_get_mutex_enter(bpage);
rw_lock_s_unlock(&buf_pool->page_hash_latch);
-@@ -3022,6 +3036,14 @@
+@@ -3023,6 +3037,14 @@
return(NULL);
}
switch (buf_block_get_state(block)) {
buf_page_t* bpage;
ibool success;
-@@ -3689,6 +3711,7 @@
+@@ -3690,6 +3712,7 @@
bpage->newest_modification = 0;
bpage->oldest_modification = 0;
HASH_INVALIDATE(bpage, hash);
#ifdef UNIV_DEBUG_FILE_ACCESSES
bpage->file_page_was_freed = FALSE;
#endif /* UNIV_DEBUG_FILE_ACCESSES */
-@@ -4199,7 +4222,8 @@
+@@ -4200,7 +4223,8 @@
void
buf_page_io_complete(
/*=================*/
{
enum buf_io_fix io_type;
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
-@@ -4278,6 +4302,7 @@
+@@ -4279,6 +4303,7 @@
(ulong) bpage->offset);
}
/* From version 3.23.38 up we store the page checksum
to the 4 first bytes of the page end lsn field */
-@@ -4319,6 +4344,19 @@
- REFMAN "forcing-recovery.html\n"
+@@ -4320,6 +4345,19 @@
+ REFMAN "forcing-innodb-recovery.html\n"
"InnoDB: about forcing recovery.\n", stderr);
+ if (srv_pass_corrupt_table && !trx_sys_sys_space(bpage->space)
if (srv_force_recovery < SRV_FORCE_IGNORE_CORRUPT) {
fputs("InnoDB: Ending processing because of"
" a corrupt database page.\n",
-@@ -4326,6 +4364,7 @@
+@@ -4327,6 +4365,7 @@
exit(1);
}
}
if (recv_recovery_is_on()) {
/* Pages must be uncompressed for crash recovery. */
-@@ -4335,8 +4374,11 @@
+@@ -4336,8 +4375,11 @@
if (uncompressed && !recv_no_ibuf_operations) {
ibuf_merge_or_delete_for_page(
diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.c
--- a/storage/innobase/dict/dict0dict.c 2010-12-03 17:30:16.248987063 +0900
+++ b/storage/innobase/dict/dict0dict.c 2010-12-04 15:45:23.808513973 +0900
-@@ -54,6 +54,7 @@
- #include "row0merge.h"
+@@ -55,6 +55,7 @@
+ #include "srv0srv.h" /* srv_lower_case_table_names */
#include "m_ctype.h" /* my_isspace() */
- #include "ha_prototypes.h" /* innobase_strcasecmp() */
+ #include "ha_prototypes.h" /* innobase_strcasecmp(), innobase_casedn_str()*/
+#include "srv0start.h" /* SRV_LOG_SPACE_FIRST_ID */
#include <ctype.h>
-@@ -749,7 +750,7 @@
+@@ -751,7 +752,7 @@
mutex_exit(&(dict_sys->mutex));
/* If table->ibd_file_missing == TRUE, this will
print an error message and return without doing
anything. */
-@@ -1290,7 +1291,7 @@
+@@ -1294,7 +1295,7 @@
+ dict_sys->size) > srv_dict_size_limit ) {
prev_table = UT_LIST_GET_PREV(table_LRU, table);
goto next_loop;
cached_foreign_tables = 0;
-@@ -4314,6 +4315,12 @@
+@@ -4327,6 +4328,12 @@
heap = mem_heap_create(1000);
while (index) {
size = btr_get_size(index, BTR_TOTAL_SIZE);
index->stat_index_size = size;
-@@ -4433,6 +4440,12 @@
+@@ -4446,6 +4453,12 @@
heap = mem_heap_create(1000);
while (index) {
/*===========================================*/
{
dict_table_t* sys_stats;
-@@ -4598,6 +4611,12 @@
+@@ -4611,6 +4624,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;
-@@ -5318,4 +5337,42 @@
+@@ -5331,4 +5350,42 @@
rw_lock_free(&dict_table_stats_latches[i]);
}
}
diff -ruN a/storage/innobase/dict/dict0mem.c b/storage/innobase/dict/dict0mem.c
--- a/storage/innobase/dict/dict0mem.c 2010-11-03 07:01:13.000000000 +0900
+++ b/storage/innobase/dict/dict0mem.c 2010-12-04 15:38:18.126549463 +0900
-@@ -92,6 +92,8 @@
+@@ -94,6 +94,8 @@
/* The number of transactions that are either waiting on the
AUTOINC lock or have been granted the lock. */
table->n_waiting_or_granted_auto_inc_locks = 0;
UT_LIST_NODE_T(fil_space_t) space_list;
/*!< list of all spaces */
ulint magic_n;/*!< FIL_SPACE_MAGIC_N */
-@@ -1263,6 +1264,8 @@
+@@ -1291,6 +1292,8 @@
ut_fold_string(name), space);
space->is_in_unflushed_spaces = FALSE;
UT_LIST_ADD_LAST(space_list, fil_system->space_list, space);
mutex_exit(&fil_system->mutex);
-@@ -4917,6 +4920,22 @@
+@@ -4945,6 +4948,22 @@
ut_a(byte_offset % OS_FILE_LOG_BLOCK_SIZE == 0);
ut_a((len % OS_FILE_LOG_BLOCK_SIZE) == 0);
#ifdef UNIV_HOTBACKUP
/* In ibbackup do normal i/o, not aio */
if (type == OS_FILE_READ) {
-@@ -4931,6 +4950,8 @@
+@@ -4959,6 +4978,8 @@
ret = os_aio(type, mode | wake_later, node->name, node->handle, buf,
offset_low, offset_high, len, node, message, trx);
#endif
ut_a(ret);
if (mode == OS_AIO_SYNC) {
-@@ -5080,7 +5101,7 @@
+@@ -5100,7 +5121,7 @@
if (fil_node->space->purpose == FIL_TABLESPACE) {
srv_set_io_thread_op_info(segment, "complete io for buf page");
} else {
srv_set_io_thread_op_info(segment, "complete io for log");
log_io_complete(message);
-@@ -5434,3 +5455,46 @@
+@@ -5454,3 +5475,46 @@
return 0;
}
}
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
-@@ -3926,6 +3926,12 @@
+@@ -3928,6 +3928,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
-@@ -3953,6 +3959,19 @@
+@@ -3955,6 +3961,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;
-@@ -5117,6 +5136,10 @@
+@@ -5119,6 +5138,10 @@
ha_statistic_increment(&SSV::ha_write_count);
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
table->timestamp_field->set_time();
-@@ -5334,6 +5357,10 @@
+@@ -5336,6 +5359,10 @@
func_exit:
innobase_active_small();
DBUG_RETURN(error_result);
}
-@@ -5510,6 +5537,10 @@
+@@ -5512,6 +5539,10 @@
ha_statistic_increment(&SSV::ha_update_count);
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
table->timestamp_field->set_time();
-@@ -5599,6 +5630,10 @@
+@@ -5601,6 +5632,10 @@
innobase_active_small();
DBUG_RETURN(error);
}
-@@ -5620,6 +5655,10 @@
+@@ -5622,6 +5657,10 @@
ha_statistic_increment(&SSV::ha_delete_count);
if (!prebuilt->upd_node) {
row_get_prebuilt_update_vector(prebuilt);
}
-@@ -5646,6 +5685,10 @@
+@@ -5648,6 +5687,10 @@
innobase_active_small();
DBUG_RETURN(error);
}
-@@ -5885,6 +5928,10 @@
+@@ -5887,6 +5930,10 @@
ha_statistic_increment(&SSV::ha_read_key_count);
index = prebuilt->index;
if (UNIV_UNLIKELY(index == NULL)) {
-@@ -5950,6 +5997,10 @@
+@@ -5952,6 +5999,10 @@
ret = DB_UNSUPPORTED;
}
switch (ret) {
case DB_SUCCESS:
error = 0;
-@@ -6060,6 +6111,10 @@
+@@ -6067,6 +6118,10 @@
{
DBUG_ENTER("change_active_index");
ut_ad(user_thd == ha_thd());
ut_a(prebuilt->trx == thd_to_trx(user_thd));
-@@ -6150,6 +6205,10 @@
+@@ -6157,6 +6212,10 @@
DBUG_ENTER("general_fetch");
ut_a(prebuilt->trx == thd_to_trx(user_thd));
innodb_srv_conc_enter_innodb(prebuilt->trx);
-@@ -6159,6 +6218,10 @@
+@@ -6166,6 +6225,10 @@
innodb_srv_conc_exit_innodb(prebuilt->trx);
switch (ret) {
case DB_SUCCESS:
error = 0;
-@@ -7424,10 +7487,18 @@
+@@ -7436,10 +7499,18 @@
update_thd(ha_thd());
error = convert_error_code_to_mysql(error, prebuilt->table->flags,
NULL);
-@@ -7940,6 +8011,16 @@
+@@ -7944,6 +8015,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
-@@ -8058,7 +8139,7 @@
+@@ -8062,7 +8143,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 */
-@@ -8349,10 +8430,18 @@
+@@ -8356,10 +8437,18 @@
THD* thd, /*!< in: connection thread handle */
HA_CHECK_OPT* check_opt) /*!< in: currently ignored */
{
return(0);
}
-@@ -8534,6 +8623,10 @@
+@@ -8541,6 +8630,10 @@
my_error(ER_QUERY_INTERRUPTED, MYF(0));
}
DBUG_RETURN(is_ok ? HA_ADMIN_OK : HA_ADMIN_CORRUPT);
}
-@@ -9304,6 +9397,10 @@
+@@ -9311,6 +9404,10 @@
update_thd(thd);
if (prebuilt->table->ibd_file_missing && !thd_tablespace_op(thd)) {
ut_print_timestamp(stderr);
fprintf(stderr,
-@@ -11722,6 +11819,14 @@
+@@ -11720,6 +11817,14 @@
"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),
-@@ -11809,6 +11914,7 @@
+@@ -11806,6 +11911,7 @@
MYSQL_SYSVAR(auto_lru_dump),
MYSQL_SYSVAR(purge_threads),
MYSQL_SYSVAR(purge_batch_size),
diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
--- a/storage/innobase/include/buf0buf.h 2010-12-03 15:49:59.218956083 +0900
+++ b/storage/innobase/include/buf0buf.h 2010-12-04 15:38:18.164513667 +0900
-@@ -913,7 +913,7 @@
+@@ -984,7 +984,7 @@
const buf_block_t* block) /*!< in: pointer to the control block */
__attribute__((pure));
#else /* UNIV_DEBUG */
#endif /* UNIV_DEBUG */
/*********************************************************************//**
Gets the space id of a block.
-@@ -1045,7 +1045,8 @@
+@@ -1116,7 +1116,8 @@
void
buf_page_io_complete(
/*=================*/
/********************************************************************//**
Calculates a folded value of a file page address to use in the page hash
table.
-@@ -1360,6 +1361,7 @@
+@@ -1431,6 +1432,7 @@
0 if the block was never accessed
in the buffer pool */
/* @} */
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
-@@ -595,6 +595,7 @@
+@@ -619,6 +619,7 @@
the AUTOINC lock on this table. */
/* @} */
/*----------------------*/
diff -ruN a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h
--- a/storage/innobase/include/fil0fil.h 2010-12-04 15:35:29.175520016 +0900
+++ b/storage/innobase/include/fil0fil.h 2010-12-04 15:38:18.172483391 +0900
-@@ -757,6 +757,19 @@
+@@ -749,6 +749,19 @@
fil_system_hash_nodes(void);
/*========================*/
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
-@@ -428,6 +428,7 @@
+@@ -430,6 +430,7 @@
UNIV_INTERN ulint srv_adaptive_flushing_method = 0; /* 0: native 1: estimate 2: keep_average */
UNIV_INTERN ulint srv_expand_import = 0; /* 0:disable 1:enable */
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
-@@ -2020,6 +2020,13 @@
+@@ -2141,6 +2141,13 @@
os_fast_mutex_free(&srv_os_test_mutex);
+ if (!srv_file_per_table_original_value
+ && srv_pass_corrupt_table) {
+ fprintf(stderr, "InnoDB: Warning:"
-+ " innodb_file_per_table is diabled."
-+ " So innodb_pass_corrupt_table doesn't make sence\n");
++ " The option innodb_file_per_table is disabled,"
++ " so using the option innodb_pass_corrupt_table doesn't make sense.\n");
+ }
+
if (srv_print_verbose_log) {
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;
-@@ -2529,6 +2530,8 @@
+@@ -2530,6 +2531,8 @@
srv_force_recovery = (ulint) innobase_force_recovery;
srv_use_doublewrite_buf = (ibool) innobase_use_doublewrite;
srv_use_checksums = (ibool) innobase_use_checksums;
-@@ -11170,6 +11173,11 @@
+@@ -11173,6 +11176,11 @@
"The common part for InnoDB table spaces.",
NULL, NULL, NULL);
static MYSQL_SYSVAR_BOOL(overwrite_relay_log_info, innobase_overwrite_relay_log_info,
PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
"During InnoDB crash recovery on slave overwrite relay-log.info "
-@@ -11658,6 +11666,7 @@
+@@ -11656,6 +11664,7 @@
MYSQL_SYSVAR(data_file_path),
MYSQL_SYSVAR(data_home_dir),
MYSQL_SYSVAR(doublewrite),
+ ulint i;
+
+ fprintf(stderr,
-+ "InnoDB: Applying log records was done. Its statistics are followings.\n");
++ "InnoDB: Log records have been applied. The statistics that were gathered follow.\n");
+
+ fprintf(stderr,
+ "============================================================\n"
#ifndef UNIV_HOTBACKUP
# include "os0sync.h"
# include "os0thread.h"
-@@ -4237,6 +4238,18 @@
+@@ -4262,6 +4263,18 @@
os_thread_exit(NULL);
}
diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
--- a/storage/innobase/srv/srv0srv.c 2010-12-03 17:30:16.339955597 +0900
+++ b/storage/innobase/srv/srv0srv.c 2010-12-03 17:30:41.604958138 +0900
-@@ -165,6 +165,8 @@
+@@ -167,6 +167,8 @@
/* size in database pages */
UNIV_INTERN ulint* srv_data_file_sizes = NULL;
diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
--- a/storage/innobase/buf/buf0buf.c 2010-12-03 17:49:11.574962867 +0900
+++ b/storage/innobase/buf/buf0buf.c 2010-12-04 15:35:58.624514033 +0900
-@@ -4247,7 +4247,8 @@
+@@ -4248,7 +4248,8 @@
read_space_id = mach_read_from_4(
frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
diff -ruN a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c
--- a/storage/innobase/buf/buf0flu.c 2010-12-03 15:49:59.179956111 +0900
+++ b/storage/innobase/buf/buf0flu.c 2010-12-04 15:35:58.624514033 +0900
-@@ -763,7 +763,8 @@
+@@ -791,7 +791,8 @@
write_buf = trx_doublewrite->write_buf;
i = 0;
trx_doublewrite->block1, 0, len,
(void*) write_buf, NULL);
-@@ -800,7 +801,8 @@
+@@ -828,7 +829,8 @@
+ TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE;
ut_ad(i == TRX_SYS_DOUBLEWRITE_BLOCK_SIZE);
trx_doublewrite->block2, 0, len,
(void*) write_buf, NULL);
-@@ -830,7 +832,7 @@
+@@ -858,7 +860,7 @@
flush:
/* Now flush the doublewrite buffer data to disk */
diff -ruN a/storage/innobase/dict/dict0load.c b/storage/innobase/dict/dict0load.c
--- a/storage/innobase/dict/dict0load.c 2010-12-03 17:30:16.252956569 +0900
+++ b/storage/innobase/dict/dict0load.c 2010-12-04 15:35:58.627482825 +0900
-@@ -781,7 +781,7 @@
+@@ -41,6 +41,7 @@
+ #include "srv0start.h"
+ #include "srv0srv.h"
+ #include "ha_prototypes.h" /* innobase_casedn_str() */
++#include "trx0sys.h"
+
+
+ /** Following are six InnoDB system tables */
+@@ -797,7 +798,7 @@
mtr_commit(&mtr);
/* The system tablespace always exists. */
} else if (in_crash_recovery) {
/* Check that the tablespace (the .ibd file) really
-@@ -1578,7 +1578,7 @@
+@@ -1594,7 +1595,7 @@
space = mach_read_from_4(field);
/* Check if the tablespace exists and has the right name */
flags = dict_sys_tables_get_flags(rec);
if (UNIV_UNLIKELY(flags == ULINT_UNDEFINED)) {
-@@ -1728,7 +1728,7 @@
+@@ -1744,7 +1745,7 @@
goto err_exit;
}
diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
--- a/storage/innobase/fil/fil0fil.c 2010-12-04 15:35:29.143813775 +0900
+++ b/storage/innobase/fil/fil0fil.c 2010-12-04 15:35:58.628498870 +0900
-@@ -627,7 +627,7 @@
+@@ -655,7 +655,7 @@
UT_LIST_ADD_LAST(chain, space->chain, node);
fil_system->max_assigned_id = id;
}
-@@ -691,14 +691,14 @@
+@@ -719,14 +719,14 @@
size_bytes = (((ib_int64_t)size_high) << 32)
+ (ib_int64_t)size_low;
#ifdef UNIV_HOTBACKUP
if (size_bytes < FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE) {
fprintf(stderr,
-@@ -744,7 +744,7 @@
+@@ -772,7 +772,7 @@
}
if (UNIV_UNLIKELY(space_id == ULINT_UNDEFINED
fprintf(stderr,
"InnoDB: Error: tablespace id %lu"
" in file %s is not sensible\n",
-@@ -812,7 +812,7 @@
+@@ -840,7 +840,7 @@
system->n_open++;
/* Put the node to the LRU list */
UT_LIST_ADD_FIRST(LRU, system->LRU, node);
}
-@@ -845,7 +845,7 @@
+@@ -873,7 +873,7 @@
ut_a(system->n_open > 0);
system->n_open--;
ut_a(UT_LIST_GET_LEN(system->LRU) > 0);
/* The node is in the LRU list, remove it */
-@@ -931,7 +931,7 @@
+@@ -959,7 +959,7 @@
retry:
mutex_enter(&fil_system->mutex);
/* We keep log files and system tablespace files always open;
this is important in preventing deadlocks in this module, as
a page read completion often performs another read from the
-@@ -1162,7 +1162,7 @@
+@@ -1190,7 +1190,7 @@
" tablespace memory cache!\n",
(ulong) space->id);
mutex_exit(&fil_system->mutex);
-@@ -1224,6 +1224,7 @@
+@@ -1252,6 +1252,7 @@
space->mark = FALSE;
if (UNIV_LIKELY(purpose == FIL_TABLESPACE && !recv_recovery_on)
&& UNIV_UNLIKELY(id > fil_system->max_assigned_id)) {
if (!fil_system->space_id_reuse_warned) {
fil_system->space_id_reuse_warned = TRUE;
-@@ -1307,7 +1308,7 @@
+@@ -1335,7 +1336,7 @@
(ulong) SRV_LOG_SPACE_FIRST_ID);
}
if (success) {
*space_id = fil_system->max_assigned_id = id;
-@@ -1570,6 +1571,8 @@
+@@ -1598,6 +1599,8 @@
UT_LIST_INIT(fil_system->LRU);
fil_system->max_n_open = max_n_open;
}
/*******************************************************************//**
-@@ -1591,7 +1594,7 @@
+@@ -1619,7 +1622,7 @@
space = UT_LIST_GET_FIRST(fil_system->space_list);
while (space != NULL) {
node = UT_LIST_GET_FIRST(space->chain);
while (node != NULL) {
-@@ -1681,6 +1684,10 @@
+@@ -1709,6 +1712,10 @@
ut_error;
}
mutex_enter(&fil_system->mutex);
if (fil_system->max_assigned_id < max_id) {
-@@ -1699,6 +1706,7 @@
+@@ -1727,6 +1734,7 @@
ulint
fil_write_lsn_and_arch_no_to_file(
/*==============================*/
ulint sum_of_sizes, /*!< in: combined size of previous files
in space, in database pages */
ib_uint64_t lsn, /*!< in: lsn to write */
-@@ -1708,14 +1716,16 @@
+@@ -1736,14 +1744,16 @@
byte* buf1;
byte* buf;
mem_free(buf1);
-@@ -1751,7 +1761,7 @@
+@@ -1779,7 +1789,7 @@
always open. */
if (space->purpose == FIL_TABLESPACE
sum_of_sizes = 0;
node = UT_LIST_GET_FIRST(space->chain);
-@@ -1759,7 +1769,7 @@
+@@ -1787,7 +1797,7 @@
mutex_exit(&fil_system->mutex);
err = fil_write_lsn_and_arch_no_to_file(
if (err != DB_SUCCESS) {
return(err);
-@@ -3806,7 +3816,7 @@
+@@ -3834,7 +3844,7 @@
}
#ifndef UNIV_HOTBACKUP
fprintf(stderr,
"InnoDB: Error: tablespace id %lu in file %s"
" is not sensible\n",
-@@ -3815,7 +3825,7 @@
+@@ -3843,7 +3853,7 @@
goto func_exit;
}
#else
char* new_path;
fprintf(stderr,
-@@ -4636,7 +4646,7 @@
+@@ -4664,7 +4674,7 @@
}
if (node->n_pending == 0 && space->purpose == FIL_TABLESPACE
/* The node is in the LRU list, remove it */
ut_a(UT_LIST_GET_LEN(system->LRU) > 0);
-@@ -4682,7 +4692,7 @@
+@@ -4710,7 +4720,7 @@
}
if (node->n_pending == 0 && node->space->purpose == FIL_TABLESPACE
/* The node must be put back to the LRU list */
UT_LIST_ADD_FIRST(LRU, system->LRU, node);
}
-@@ -5298,7 +5308,7 @@
+@@ -5318,7 +5328,7 @@
ut_a(fil_node->n_pending == 0);
ut_a(fil_node->open);
ut_a(fil_node->space->purpose == FIL_TABLESPACE);
/* 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
-@@ -2425,6 +2426,8 @@
+@@ -2426,6 +2427,8 @@
goto error;
}
srv_use_sys_stats_table = (ibool) innobase_use_sys_stats_table;
/* -------------- Log files ---------------------------*/
-@@ -11553,6 +11556,11 @@
+@@ -11556,6 +11559,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: "
-@@ -11723,6 +11731,7 @@
+@@ -11721,6 +11729,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
-@@ -3423,7 +3423,7 @@
+@@ -3421,7 +3421,7 @@
/* Do not drop possible .ibd tablespace if something went
wrong: we do not want to delete valuable data of the user */
diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
--- a/storage/innobase/srv/srv0srv.c 2010-12-04 15:35:29.180483212 +0900
+++ b/storage/innobase/srv/srv0srv.c 2010-12-04 15:35:58.656550107 +0900
-@@ -168,6 +168,8 @@
+@@ -170,6 +170,8 @@
/* size in database pages */
UNIV_INTERN ulint* srv_data_file_sizes = NULL;
+ srv_normalize_path_for_win(srv_doublewrite_file);
+
+ fprintf(stderr,
-+ "InnoDB: Notice: innodb_doublewrite_file is specified.\n"
-+ "InnoDB: This is for expert only. Don't use if you don't understand what is it 'WELL'.\n"
-+ "InnoDB: ### Don't specify older file than the last checkpoint ###\n"
-+ "InnoDB: otherwise the older doublewrite buffer will break your data during recovery!\n");
++ "InnoDB: Note: The innodb_doublewrite_file option has been specified.\n"
++ "InnoDB: This option is for experts only. Don't use it unless you understand WELL what it is.\n"
++ "InnoDB: ### Don't specify a file older than the last checkpoint. ###\n"
++ "InnoDB: Otherwise, the older doublewrite buffer will break your data during recovery!\n");
+
+ strcpy(name, srv_doublewrite_file);
+
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: Doublewrite buffer file %s did not"
-+ " exist: new to be created\n",
++ " exist. It will be be created.\n",
+ name);
+
+ if (*create_new_db == FALSE) {
ibool log_file_created;
ibool log_created = FALSE;
ibool log_opened = FALSE;
-@@ -1416,6 +1555,7 @@
+@@ -1453,6 +1592,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 */
-@@ -1545,6 +1685,14 @@
+@@ -1620,6 +1760,14 @@
after the double write buffer has been created. */
trx_sys_create();
dict_create();
srv_startup_is_before_trx_rollback_phase = FALSE;
-@@ -1577,6 +1725,13 @@
+@@ -1653,6 +1801,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.
-@@ -1663,6 +1818,17 @@
+@@ -1739,6 +1894,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();
+ } else {
+ fprintf(stderr,
+ "InnoDB: Doublewrite buffer not found in the doublewrite file:"
-+ " creating new\n");
++ " creating new doublewrite buffer.\n");
+
+ if (buf_pool_get_curr_size()
+ < ((2 * TRX_SYS_DOUBLEWRITE_BLOCK_SIZE
+ + FSP_EXTENT_SIZE / 2 + 100)
+ * UNIV_PAGE_SIZE)) {
+ fprintf(stderr,
-+ "InnoDB: Cannot create doublewrite buffer:"
-+ " you must\n"
++ "InnoDB: Cannot create the doublewrite buffer:"
++ " You must\n"
+ "InnoDB: increase your buffer pool size.\n"
-+ "InnoDB: Cannot continue operation.\n");
++ "InnoDB: Cannot continue processing.\n");
+
+ exit(1);
+ }
+
+ if (block2 == NULL) {
+ fprintf(stderr,
-+ "InnoDB: Cannot create doublewrite buffer:"
-+ " you must\n"
++ "InnoDB: Cannot create the doublewrite buffer:"
++ " You must\n"
+ "InnoDB: increase your tablespace size.\n"
-+ "InnoDB: Cannot continue operation.\n");
++ "InnoDB: Cannot continue processing.\n");
+
+ /* We exit without committing the mtr to prevent
+ its modifications to the database getting to disk */
+ FSP_UP, &mtr);
+ if (page_no == FIL_NULL) {
+ fprintf(stderr,
-+ "InnoDB: Cannot create doublewrite"
-+ " buffer: you must\n"
++ "InnoDB: Cannot create the doublewrite"
++ " buffer: You must\n"
+ "InnoDB: increase your"
+ " tablespace size.\n"
+ "InnoDB: Cannot continue operation.\n"
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
-@@ -9491,8 +9491,8 @@
+@@ -9498,8 +9498,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);
-@@ -9507,9 +9507,8 @@
+@@ -9514,9 +9514,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);
-@@ -9538,8 +9537,8 @@
+@@ -9545,8 +9544,8 @@
continue;
}
buf2len = my_snprintf(buf2, sizeof buf2, "os_waits=%lu",
(ulong) lock->count_os_wait);
-@@ -9553,9 +9552,8 @@
+@@ -9560,9 +9559,8 @@
if (block_lock) {
buf1len = (uint) my_snprintf(buf1, sizeof buf1,
diff -ruN a/storage/innobase/include/sync0rw.h b/storage/innobase/include/sync0rw.h
--- a/storage/innobase/include/sync0rw.h 2010-12-03 15:49:59.225953164 +0900
+++ b/storage/innobase/include/sync0rw.h 2010-12-03 17:35:12.978024458 +0900
-@@ -144,7 +144,7 @@
+@@ -138,14 +138,14 @@
+ # ifdef UNIV_DEBUG
+ # ifdef UNIV_SYNC_DEBUG
+ # define rw_lock_create(K, L, level) \
+- rw_lock_create_func((L), (level), #L, __FILE__, __LINE__)
++ rw_lock_create_func((L), (level), __FILE__, __LINE__, #L)
+ # else /* UNIV_SYNC_DEBUG */
+ # define rw_lock_create(K, L, level) \
+- rw_lock_create_func((L), #L, __FILE__, __LINE__)
++ rw_lock_create_func((L), __FILE__, __LINE__, #L)
# endif/* UNIV_SYNC_DEBUG */
# else /* UNIV_DEBUG */
# define rw_lock_create(K, L, level) \
- rw_lock_create_func((L), __FILE__, __LINE__)
-+ rw_lock_create_func((L), #L, NULL, 0)
++ rw_lock_create_func((L), #L)
# endif /* UNIV_DEBUG */
/**************************************************************//**
-@@ -197,7 +197,7 @@
+@@ -191,14 +191,14 @@
+ # ifdef UNIV_DEBUG
+ # ifdef UNIV_SYNC_DEBUG
+ # define rw_lock_create(K, L, level) \
+- pfs_rw_lock_create_func((K), (L), (level), #L, __FILE__, __LINE__)
++ pfs_rw_lock_create_func((K), (L), (level), __FILE__, __LINE__, #L)
+ # else /* UNIV_SYNC_DEBUG */
+ # define rw_lock_create(K, L, level) \
+- pfs_rw_lock_create_func((K), (L), #L, __FILE__, __LINE__)
++ pfs_rw_lock_create_func((K), (L), __FILE__, __LINE__, #L)
# endif/* UNIV_SYNC_DEBUG */
# else /* UNIV_DEBUG */
# define rw_lock_create(K, L, level) \
- pfs_rw_lock_create_func((K), (L), __FILE__, __LINE__)
-+ pfs_rw_lock_create_func((K), (L), #L, NULL, 0)
++ pfs_rw_lock_create_func((K), (L), #L)
# endif /* UNIV_DEBUG */
/******************************************************************
-@@ -255,8 +255,8 @@
+@@ -256,10 +256,10 @@
# ifdef UNIV_SYNC_DEBUG
ulint level, /*!< in: level */
# endif /* UNIV_SYNC_DEBUG */
- const char* cmutex_name, /*!< in: mutex name */
- #endif /* UNIV_DEBUG */
-+ const char* cmutex_name, /*!< in: mutex name */
+-#endif /* UNIV_DEBUG */
const char* cfile_name, /*!< in: file name where created */
- ulint cline); /*!< in: file line where created */
+- ulint cline); /*!< in: file line where created */
++ ulint cline, /*!< in: file line where created */
++#endif /* UNIV_DEBUG */
++ const char* cmutex_name); /*!< in: mutex name */
/******************************************************************//**
-@@ -609,7 +609,8 @@
+ 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 @@
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 */
-@@ -620,7 +621,7 @@
+@@ -621,7 +622,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
-@@ -690,8 +691,8 @@
+@@ -691,10 +692,10 @@
# ifdef UNIV_SYNC_DEBUG
ulint level, /*!< in: level */
# endif /* UNIV_SYNC_DEBUG */
- const char* cmutex_name, /*!< in: mutex name */
- #endif /* UNIV_DEBUG */
-+ const char* cmutex_name, /*!< in: mutex name */
+-#endif /* UNIV_DEBUG */
const char* cfile_name, /*!< in: file name where created */
- ulint cline); /*!< in: file line where created */
+- ulint cline); /*!< in: file line where created */
++ ulint cline, /*!< in: file line where created */
++#endif /* UNIV_DEBUG */
++ const char* cmutex_name); /*!< in: mutex name */
+ /******************************************************************//**
+ Performance schema instrumented wrap function for rw_lock_x_lock_func()
diff -ruN a/storage/innobase/include/sync0rw.ic b/storage/innobase/include/sync0rw.ic
--- a/storage/innobase/include/sync0rw.ic 2010-11-03 07:01:13.000000000 +0900
+++ b/storage/innobase/include/sync0rw.ic 2010-12-03 17:35:12.980024605 +0900
-@@ -640,8 +640,8 @@
+@@ -640,10 +640,10 @@
# ifdef UNIV_SYNC_DEBUG
ulint level, /*!< in: level */
# endif /* UNIV_SYNC_DEBUG */
- const char* cmutex_name, /*!< in: mutex name */
- # endif /* UNIV_DEBUG */
-+ const char* cmutex_name, /*!< in: mutex name */
+-# endif /* UNIV_DEBUG */
const char* cfile_name, /*!< in: file name where created */
- ulint cline) /*!< in: file line where created */
+- ulint cline) /*!< in: file line where created */
++ ulint cline, /*!< in: file line where created */
++# endif /* UNIV_DEBUG */
++ const char* cmutex_name) /*!< in: mutex name */
{
-@@ -656,8 +656,8 @@
+ /* Initialize the rwlock for performance schema */
+ lock->pfs_psi = (PSI_server && PFS_IS_INSTRUMENTED(key))
+@@ -656,10 +656,10 @@
# ifdef UNIV_SYNC_DEBUG
level,
# endif /* UNIV_SYNC_DEBUG */
- cmutex_name,
- # endif /* UNIV_DEBUG */
-+ cmutex_name,
+-# endif /* UNIV_DEBUG */
cfile_name,
- cline);
+- cline);
++ cline,
++# endif /* UNIV_DEBUG */
++ cmutex_name);
}
+ /******************************************************************//**
+ Performance schema instrumented wrap function for rw_lock_x_lock_func()
diff -ruN a/storage/innobase/include/sync0sync.h b/storage/innobase/include/sync0sync.h
--- a/storage/innobase/include/sync0sync.h 2010-12-03 15:49:59.227955503 +0900
+++ b/storage/innobase/include/sync0sync.h 2010-12-03 17:35:12.982023946 +0900
-@@ -166,7 +166,7 @@
+@@ -159,14 +159,14 @@
+ # ifdef UNIV_DEBUG
+ # ifdef UNIV_SYNC_DEBUG
+ # define mutex_create(K, M, level) \
+- pfs_mutex_create_func((K), (M), #M, (level), __FILE__, __LINE__)
++ pfs_mutex_create_func((K), (M), (level), __FILE__, __LINE__, #M)
+ # else
+ # define mutex_create(K, M, level) \
+- pfs_mutex_create_func((K), (M), #M, __FILE__, __LINE__)
++ pfs_mutex_create_func((K), (M), __FILE__, __LINE__, #M)
# endif/* UNIV_SYNC_DEBUG */
# else
# define mutex_create(K, M, level) \
- pfs_mutex_create_func((K), (M), __FILE__, __LINE__)
-+ pfs_mutex_create_func((K), (M), #M, NULL, 0)
++ pfs_mutex_create_func((K), (M), #M)
# endif /* UNIV_DEBUG */
# define mutex_enter(M) \
-@@ -193,7 +193,7 @@
+@@ -186,14 +186,14 @@
+ # ifdef UNIV_DEBUG
+ # ifdef UNIV_SYNC_DEBUG
+ # define mutex_create(K, M, level) \
+- mutex_create_func((M), #M, (level), __FILE__, __LINE__)
++ mutex_create_func((M), (level), __FILE__, __LINE__, #M)
+ # else /* UNIV_SYNC_DEBUG */
+ # define mutex_create(K, M, level) \
+- mutex_create_func((M), #M, __FILE__, __LINE__)
++ mutex_create_func((M), __FILE__, __LINE__, #M)
# endif /* UNIV_SYNC_DEBUG */
# else /* UNIV_DEBUG */
# define mutex_create(K, M, level) \
- mutex_create_func((M), __FILE__, __LINE__)
-+ mutex_create_func((M), #M, NULL, 0)
++ mutex_create_func((M), #M)
# endif /* UNIV_DEBUG */
# define mutex_enter(M) mutex_enter_func((M), __FILE__, __LINE__)
-@@ -217,8 +217,8 @@
- mutex_create_func(
+@@ -218,13 +218,13 @@
/*==============*/
mutex_t* mutex, /*!< in: pointer to memory */
--#ifdef UNIV_DEBUG
- const char* cmutex_name, /*!< in: mutex name */
-+#ifdef UNIV_DEBUG
+ #ifdef UNIV_DEBUG
+- const char* cmutex_name, /*!< in: mutex name */
# ifdef UNIV_SYNC_DEBUG
ulint level, /*!< in: level */
# endif /* UNIV_SYNC_DEBUG */
-@@ -291,8 +291,8 @@
- /*==================*/
+-#endif /* UNIV_DEBUG */
+ const char* cfile_name, /*!< in: file name where created */
+- ulint cline); /*!< in: file line where created */
++ ulint cline, /*!< in: file line where created */
++#endif /* UNIV_DEBUG */
++ const char* cmutex_name); /*!< in: mutex name */
+
+ /******************************************************************//**
+ NOTE! Use the corresponding macro mutex_free(), not directly this function!
+@@ -292,13 +292,13 @@
PSI_mutex_key key, /*!< in: Performance Schema key */
mutex_t* mutex, /*!< in: pointer to memory */
--# ifdef UNIV_DEBUG
- const char* cmutex_name, /*!< in: mutex name */
-+# ifdef UNIV_DEBUG
+ # ifdef UNIV_DEBUG
+- const char* cmutex_name, /*!< in: mutex name */
# ifdef UNIV_SYNC_DEBUG
ulint level, /*!< in: level */
# endif /* UNIV_SYNC_DEBUG */
+-# endif /* UNIV_DEBUG */
+ const char* cfile_name, /*!< in: file name where created */
+- ulint cline); /*!< in: file line where created */
++ ulint cline, /*!< in: file line where created */
++# endif /* UNIV_DEBUG */
++ const char* cmutex_name);
+ /******************************************************************//**
+ NOTE! Please use the corresponding macro mutex_enter(), not directly
+ this function!
@@ -723,9 +723,9 @@
ulint line; /*!< Line where the mutex was locked */
ulint level; /*!< Level in the global latching order */
diff -ruN a/storage/innobase/include/sync0sync.ic b/storage/innobase/include/sync0sync.ic
--- a/storage/innobase/include/sync0sync.ic 2010-11-03 07:01:13.000000000 +0900
+++ b/storage/innobase/include/sync0sync.ic 2010-12-03 17:35:12.984024599 +0900
-@@ -320,8 +320,8 @@
- /*==================*/
+@@ -321,13 +321,13 @@
mysql_pfs_key_t key, /*!< in: Performance Schema key */
mutex_t* mutex, /*!< in: pointer to memory */
--# ifdef UNIV_DEBUG
- const char* cmutex_name, /*!< in: mutex name */
-+# ifdef UNIV_DEBUG
+ # ifdef UNIV_DEBUG
+- const char* cmutex_name, /*!< in: mutex name */
# ifdef UNIV_SYNC_DEBUG
ulint level, /*!< in: level */
# endif /* UNIV_SYNC_DEBUG */
-@@ -334,8 +334,8 @@
- : NULL;
+-# endif /* UNIV_DEBUG */
+ const char* cfile_name, /*!< in: file name where created */
+- ulint cline) /*!< in: file line where created */
++ ulint cline, /*!< in: file line where created */
++# endif /* UNIV_DEBUG */
++ const char* cmutex_name) /*!< in: mutex name */
+ {
+ mutex->pfs_psi = (PSI_server && PFS_IS_INSTRUMENTED(key))
+ ? PSI_server->init_mutex(key, mutex)
+@@ -335,13 +335,13 @@
mutex_create_func(mutex,
--# ifdef UNIV_DEBUG
- cmutex_name,
-+# ifdef UNIV_DEBUG
+ # ifdef UNIV_DEBUG
+- cmutex_name,
# ifdef UNIV_SYNC_DEBUG
level,
# endif /* UNIV_SYNC_DEBUG */
+-# endif /* UNIV_DEBUG */
+ cfile_name,
+- cline);
++ cline,
++# endif /* UNIV_DEBUG */
++ cmutex_name);
+ }
+ /******************************************************************//**
+ NOTE! Please use the corresponding macro mutex_free(), not directly
diff -ruN a/storage/innobase/sync/sync0arr.c b/storage/innobase/sync/sync0arr.c
--- a/storage/innobase/sync/sync0arr.c 2010-12-03 15:09:51.304953409 +0900
+++ b/storage/innobase/sync/sync0arr.c 2010-12-03 17:35:12.985024561 +0900
diff -ruN a/storage/innobase/sync/sync0rw.c b/storage/innobase/sync/sync0rw.c
--- a/storage/innobase/sync/sync0rw.c 2010-11-03 07:01:13.000000000 +0900
+++ b/storage/innobase/sync/sync0rw.c 2010-12-03 17:35:12.987029059 +0900
-@@ -241,8 +241,8 @@
+@@ -241,10 +241,10 @@
# ifdef UNIV_SYNC_DEBUG
ulint level, /*!< in: level */
# endif /* UNIV_SYNC_DEBUG */
- const char* cmutex_name, /*!< in: mutex name */
- #endif /* UNIV_DEBUG */
-+ const char* cmutex_name, /*!< in: mutex name */
+-#endif /* UNIV_DEBUG */
const char* cfile_name, /*!< in: file name where created */
- ulint cline) /*!< in: file line where created */
+- ulint cline) /*!< in: file line where created */
++ ulint cline, /*!< in: file line where created */
++#endif /* UNIV_DEBUG */
++ const char* cmutex_name) /*!< in: mutex name */
{
+ /* If this is the very first time a synchronization object is
+ created, then the following call initializes the sync system. */
@@ -253,14 +253,15 @@
mutex_create(rw_lock_mutex_key, rw_lock_get_mutex(lock),
SYNC_NO_ORDER_CHECK);
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
-@@ -249,8 +249,8 @@
- mutex_create_func(
+@@ -250,13 +250,13 @@
/*==============*/
mutex_t* mutex, /*!< in: pointer to memory */
--#ifdef UNIV_DEBUG
- const char* cmutex_name, /*!< in: mutex name */
-+#ifdef UNIV_DEBUG
+ #ifdef UNIV_DEBUG
+- const char* cmutex_name, /*!< in: mutex name */
# ifdef UNIV_SYNC_DEBUG
ulint level, /*!< in: level */
# endif /* UNIV_SYNC_DEBUG */
+-#endif /* UNIV_DEBUG */
+ const char* cfile_name, /*!< in: file name where created */
+- ulint cline) /*!< in: file line where created */
++ ulint cline, /*!< in: file line where created */
++#endif /* UNIV_DEBUG */
++ const char* cmutex_name) /*!< in: mutex name */
+ {
+ #if defined(HAVE_ATOMIC_BUILTINS)
+ mutex_reset_lock_word(mutex);
@@ -274,11 +274,13 @@
mutex->file_name = "not yet reserved";
mutex->level = level;
diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
--- a/storage/innobase/buf/buf0buf.c 2010-11-03 07:01:13.000000000 +0900
+++ b/storage/innobase/buf/buf0buf.c 2010-12-03 15:07:31.786968193 +0900
-@@ -4812,14 +4812,16 @@
- buf_flush_list_mutex_enter(buf_pool);
+@@ -4814,6 +4814,7 @@
+ }
+
+ total_info->pool_size += pool_info->pool_size;
++ total_info->pool_size_bytes += pool_info->pool_size_bytes;
+ total_info->lru_len += pool_info->lru_len;
+ total_info->old_lru_len += pool_info->old_lru_len;
+ total_info->free_list_len += pool_info->free_list_len;
+@@ -4877,6 +4878,8 @@
+
+ pool_info->pool_size = buf_pool->curr_size;
+
++ pool_info->pool_size_bytes = buf_pool->curr_pool_size;
++
+ pool_info->lru_len = UT_LIST_GET_LEN(buf_pool->LRU);
+
+ pool_info->old_lru_len = buf_pool->LRU_old_len;
+@@ -4993,14 +4996,16 @@
+ ut_ad(pool_info);
fprintf(file,
- "Buffer pool size %lu\n"
+ "Modified db pages %lu\n"
"Pending reads %lu\n"
"Pending writes: LRU %lu, flush list %lu, single page %lu\n",
- (ulong) buf_pool->curr_size,
-+ (ulong) buf_pool->curr_size * UNIV_PAGE_SIZE,
- (ulong) UT_LIST_GET_LEN(buf_pool->free),
- (ulong) UT_LIST_GET_LEN(buf_pool->LRU),
- (ulong) buf_pool->LRU_old_len,
+ pool_info->pool_size,
++ pool_info->pool_size_bytes,
+ pool_info->free_list_len,
+ pool_info->lru_len,
+ pool_info->old_lru_len,
diff -ruN a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c
--- a/storage/innobase/buf/buf0flu.c 2010-12-03 20:58:26.000000000 +0300
+++ b/storage/innobase/buf/buf0flu.c 2011-01-07 03:37:41.000000000 +0300
diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
--- a/storage/innobase/fil/fil0fil.c 2010-11-03 07:01:13.000000000 +0900
+++ b/storage/innobase/fil/fil0fil.c 2010-12-03 15:07:31.790357112 +0900
-@@ -4858,3 +4858,30 @@
+@@ -4886,3 +4886,30 @@
fil_system = NULL;
}
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
-@@ -584,6 +584,8 @@
+@@ -585,6 +585,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
-@@ -10975,6 +10977,16 @@
+@@ -10977,6 +10979,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,
-@@ -11162,7 +11174,7 @@
+@@ -11164,7 +11176,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,
-@@ -11247,6 +11259,8 @@
+@@ -11249,6 +11261,8 @@
MYSQL_SYSVAR(thread_concurrency),
MYSQL_SYSVAR(thread_sleep_delay),
MYSQL_SYSVAR(autoinc_lock_mode),
MYSQL_SYSVAR(version),
MYSQL_SYSVAR(use_sys_malloc),
MYSQL_SYSVAR(use_native_aio),
+diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
+--- a/storage/innobase/include/buf0buf.h 2011-01-20 07:37:08.000000000 +0900
++++ b/storage/innobase/include/buf0buf.h 2011-02-14 15:25:20.859126532 +0900
+@@ -123,6 +123,7 @@
+ /* General buffer pool info */
+ ulint pool_unique_id; /*!< Buffer Pool ID */
+ ulint pool_size; /*!< Buffer Pool size in pages */
++ ulint pool_size_bytes;
+ ulint lru_len; /*!< Length of buf_pool->LRU */
+ ulint old_lru_len; /*!< buf_pool->LRU_old_len */
+ ulint free_list_len; /*!< Length of buf_pool->free list */
diff -ruN a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h
--- a/storage/innobase/include/fil0fil.h 2010-11-03 07:01:13.000000000 +0900
+++ b/storage/innobase/include/fil0fil.h 2010-12-03 15:07:31.812028575 +0900
/** Number of buffer pool reads that led to the
reading of a disk page */
extern ulint srv_buf_pool_reads;
-@@ -691,6 +696,7 @@
+@@ -699,6 +704,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 */
diff -ruN a/storage/innobase/lock/lock0lock.c b/storage/innobase/lock/lock0lock.c
--- a/storage/innobase/lock/lock0lock.c 2010-11-03 07:01:13.000000000 +0900
+++ b/storage/innobase/lock/lock0lock.c 2010-12-03 15:07:31.819023998 +0900
-@@ -4302,6 +4302,7 @@
+@@ -4374,6 +4374,7 @@
putc('\n', file);
block = buf_page_try_get(space, page_no, &mtr);
for (i = 0; i < lock_rec_get_n_bits(lock); ++i) {
-@@ -4328,6 +4329,7 @@
+@@ -4400,6 +4401,7 @@
putc('\n', file);
}
mtr_commit(&mtr);
if (UNIV_LIKELY_NULL(heap)) {
-@@ -4511,7 +4513,7 @@
+@@ -4583,7 +4585,7 @@
}
}
nth_trx++;
goto loop;
}
-@@ -4583,8 +4585,8 @@
+@@ -4655,8 +4657,8 @@
nth_lock++;
#include "mysql/plugin.h"
#include "mysql/service_thd_wait.h"
-@@ -193,6 +194,9 @@
+@@ -195,6 +196,9 @@
the checkpoints. */
UNIV_INTERN char srv_adaptive_flushing = TRUE;
/** Maximum number of times allowed to conditionally acquire
mutex before switching to blocking wait on the mutex */
#define MAX_MUTEX_NOWAIT 20
-@@ -311,6 +315,7 @@
+@@ -313,6 +317,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 */
-@@ -1787,6 +1792,13 @@
+@@ -1821,6 +1826,13 @@
ulint n_reserved;
ibool ret;
mutex_enter(&srv_innodb_monitor_mutex);
current_time = time(NULL);
-@@ -1835,31 +1847,6 @@
+@@ -1869,31 +1881,6 @@
mutex_exit(&dict_foreign_err_mutex);
fputs("--------\n"
"FILE I/O\n"
"--------\n", file);
-@@ -1890,10 +1877,84 @@
+@@ -1924,10 +1911,84 @@
"BUFFER POOL AND MEMORY\n"
"----------------------\n", file);
fprintf(file,
fprintf(file, "Dictionary memory allocated " ULINTPF "\n",
dict_sys->size);
-@@ -1909,6 +1970,16 @@
+@@ -1943,6 +2004,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,
-@@ -1952,6 +2023,31 @@
+@@ -1986,6 +2057,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);
-@@ -1995,6 +2091,7 @@
+@@ -2029,6 +2125,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
-@@ -618,6 +618,16 @@
+@@ -619,6 +619,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",
-@@ -632,8 +642,14 @@
+@@ -633,8 +643,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",
-@@ -648,6 +664,12 @@
+@@ -649,6 +665,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",
-@@ -674,12 +696,66 @@
+@@ -675,12 +697,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",
-@@ -696,8 +772,14 @@
+@@ -697,8 +773,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",
-@@ -714,8 +796,20 @@
+@@ -715,8 +797,20 @@
(char*) &export_vars.innodb_rows_read, SHOW_LONG},
{"rows_updated",
(char*) &export_vars.innodb_rows_updated, SHOW_LONG},
{NullS, NullS, SHOW_LONG}
};
+diff -ruN a/storage/innobase/ibuf/ibuf0ibuf.c b/storage/innobase/ibuf/ibuf0ibuf.c
+--- a/storage/innobase/ibuf/ibuf0ibuf.c 2011-02-03 15:05:04.000000000 +0900
++++ b/storage/innobase/ibuf/ibuf0ibuf.c 2011-02-03 15:19:47.000000000 +0900
+@@ -479,6 +479,45 @@
+ }
+
+ /******************************************************************//**
++Function to pass ibuf status variables */
++UNIV_INTERN
++void
++ibuf_export_ibuf_status(
++/*====================*/
++ ulint* size,
++ ulint* free_list,
++ ulint* segment_size,
++ ulint* merges,
++ ulint* merged_inserts,
++ ulint* merged_delete_marks,
++ ulint* merged_deletes,
++ ulint* discarded_inserts,
++ ulint* discarded_delete_marks,
++ ulint* discarded_deletes)
++{
++ *size
++ = ibuf->size;
++ *free_list
++ = ibuf->free_list_len;
++ *segment_size
++ = ibuf->seg_size;
++ *merges
++ = ibuf->n_merges;
++ *merged_inserts
++ = ibuf->n_merged_ops[IBUF_OP_INSERT];
++ *merged_delete_marks
++ = ibuf->n_merged_ops[IBUF_OP_DELETE_MARK];
++ *merged_deletes
++ = ibuf->n_merged_ops[IBUF_OP_DELETE];
++ *discarded_inserts
++ = ibuf->n_discarded_ops[IBUF_OP_INSERT];
++ *discarded_delete_marks
++ = ibuf->n_discarded_ops[IBUF_OP_DELETE_MARK];
++ *discarded_deletes
++ = ibuf->n_discarded_ops[IBUF_OP_DELETE];
++}
++
++/******************************************************************//**
+ Updates the size information of the ibuf, assuming the segment size has not
+ changed. */
+ static
+diff -ruN a/storage/innobase/include/ibuf0ibuf.h b/storage/innobase/include/ibuf0ibuf.h
+--- a/storage/innobase/include/ibuf0ibuf.h 2010-12-04 02:58:26.000000000 +0900
++++ b/storage/innobase/include/ibuf0ibuf.h 2011-02-03 15:19:47.000000000 +0900
+@@ -420,6 +420,22 @@
+ void
+ ibuf_close(void);
+ /*============*/
++/******************************************************************//**
++Function to pass ibuf status variables */
++UNIV_INTERN
++void
++ibuf_export_ibuf_status(
++/*====================*/
++ ulint* size,
++ ulint* free_list,
++ ulint* segment_size,
++ ulint* merges,
++ ulint* merged_inserts,
++ ulint* merged_delete_marks,
++ ulint* merged_deletes,
++ ulint* discarded_inserts,
++ ulint* discarded_delete_marks,
++ ulint* discarded_deletes);
+
+ #define IBUF_HEADER_PAGE_NO FSP_IBUF_HEADER_PAGE_NO
+ #define IBUF_TREE_ROOT_PAGE_NO FSP_IBUF_TREE_ROOT_PAGE_NO
diff -ruN a/storage/innobase/include/lock0lock.h b/storage/innobase/include/lock0lock.h
--- a/storage/innobase/include/lock0lock.h 2011-01-21 19:52:38.967683738 +0900
+++ b/storage/innobase/include/lock0lock.h 2011-01-21 19:54:44.660599140 +0900
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
-@@ -727,6 +727,11 @@
+@@ -735,6 +735,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 */
-@@ -744,6 +749,9 @@
+@@ -752,6 +757,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 */
-@@ -752,13 +760,43 @@
+@@ -760,13 +768,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 */
-@@ -767,6 +805,8 @@
+@@ -775,6 +813,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
-@@ -776,11 +816,18 @@
+@@ -784,11 +824,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
-@@ -2227,12 +2227,49 @@
+@@ -2261,12 +2261,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
-@@ -2269,6 +2306,101 @@
+@@ -2303,6 +2340,92 @@
export_vars.innodb_buffer_pool_pages_misc
= buf_pool_get_n_pages() - LRU_len - free_len;
+ : log_sys->max_checkpoint_age_async;
+ export_vars.innodb_history_list_length
+ = trx_sys->rseg_history_len;
-+ export_vars.innodb_ibuf_size
-+ = ibuf->size;
-+ export_vars.innodb_ibuf_free_list
-+ = ibuf->free_list_len;
-+ export_vars.innodb_ibuf_segment_size
-+ = ibuf->seg_size;
-+ export_vars.innodb_ibuf_merges
-+ = ibuf->n_merges;
-+ export_vars.innodb_ibuf_merged_inserts
-+ = ibuf->n_merged_ops[IBUF_OP_INSERT];
-+ export_vars.innodb_ibuf_merged_delete_marks
-+ = ibuf->n_merged_ops[IBUF_OP_DELETE_MARK];
-+ export_vars.innodb_ibuf_merged_deletes
-+ = ibuf->n_merged_ops[IBUF_OP_DELETE];
-+ export_vars.innodb_ibuf_discarded_inserts
-+ = ibuf->n_discarded_ops[IBUF_OP_INSERT];
-+ export_vars.innodb_ibuf_discarded_delete_marks
-+ = ibuf->n_discarded_ops[IBUF_OP_DELETE_MARK];
-+ export_vars.innodb_ibuf_discarded_deletes
-+ = ibuf->n_discarded_ops[IBUF_OP_DELETE];
++ ibuf_export_ibuf_status(
++ &export_vars.innodb_ibuf_size,
++ &export_vars.innodb_ibuf_free_list,
++ &export_vars.innodb_ibuf_segment_size,
++ &export_vars.innodb_ibuf_merges,
++ &export_vars.innodb_ibuf_merged_inserts,
++ &export_vars.innodb_ibuf_merged_delete_marks,
++ &export_vars.innodb_ibuf_merged_deletes,
++ &export_vars.innodb_ibuf_discarded_inserts,
++ &export_vars.innodb_ibuf_discarded_delete_marks,
++ &export_vars.innodb_ibuf_discarded_deletes);
+ export_vars.innodb_lsn_current
+ = log_sys->lsn;
+ export_vars.innodb_lsn_flushed
#!!! notice !!!
# Any small change to this file in the main branch
# should be done or reviewed by the maintainer!
+diff -ruN a/storage/innobase/dict/dict0load.c b/storage/innobase/dict/dict0load.c
+--- a/storage/innobase/dict/dict0load.c 2011-01-20 07:37:08.000000000 +0900
++++ b/storage/innobase/dict/dict0load.c 2011-02-14 18:59:40.774162959 +0900
+@@ -437,7 +437,7 @@
+
+ }
+
+-#ifdef FOREIGN_NOT_USED
++//#ifdef FOREIGN_NOT_USED
+ /********************************************************************//**
+ This function parses a SYS_FOREIGN record and populate a dict_foreign_t
+ structure with the information from the record. For detail information
+@@ -513,9 +513,9 @@
+
+ return(NULL);
+ }
+-#endif /* FOREIGN_NOT_USED */
++//#endif /* FOREIGN_NOT_USED */
+
+-#ifdef FOREIGN_NOT_USED
++//#ifdef FOREIGN_NOT_USED
+ /********************************************************************//**
+ This function parses a SYS_FOREIGN_COLS record and extract necessary
+ information from the record and return to caller.
+@@ -579,7 +579,7 @@
+
+ return(NULL);
+ }
+-#endif /* FOREIGN_NOT_USED */
++//#endif /* FOREIGN_NOT_USED */
+
+ /********************************************************************//**
+ Determine the flags of a table described in SYS_TABLES.
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
-@@ -11673,7 +11673,14 @@
+@@ -11665,7 +11665,14 @@
i_s_innodb_cmp,
i_s_innodb_cmp_reset,
i_s_innodb_cmpmem,
#include "dict0mem.h"
#include "dict0types.h"
#include "ha_prototypes.h" /* for innobase_convert_name() */
-@@ -1787,6 +1789,1675 @@
+@@ -1786,6 +1788,1675 @@
DBUG_RETURN(0);
}
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
-@@ -4039,7 +4039,8 @@
+@@ -3935,7 +3935,8 @@
mtr_commit(mtr);
mutex_enter(&block->mutex);
/* Only free the block if it is still allocated to
-@@ -4050,17 +4051,22 @@
+@@ -3946,17 +3947,22 @@
&& buf_block_get_space(block) == space
&& buf_block_get_page_no(block) == page_no) {
diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
--- a/storage/innobase/btr/btr0sea.c 2010-12-03 15:48:03.033037049 +0900
+++ b/storage/innobase/btr/btr0sea.c 2010-12-03 15:48:29.271024260 +0900
-@@ -1211,7 +1211,7 @@
- ulint* offsets;
-
- rw_lock_x_lock(&btr_search_latch);
-- buf_pool_mutex_enter_all();
-+ //buf_pool_mutex_enter_all();
-
- table = btr_search_sys->hash_index;
-
-@@ -1220,6 +1220,8 @@
-
- buf_pool = buf_pool_from_array(j);
-
-+ mutex_enter(&buf_pool->LRU_list_mutex);
-+
- bpage = UT_LIST_GET_LAST(buf_pool->LRU);
-
- while (bpage != NULL) {
-@@ -1301,9 +1303,11 @@
-
- bpage = UT_LIST_GET_PREV(LRU, bpage);
- }
-+
-+ mutex_exit(&buf_pool->LRU_list_mutex);
- }
-
-- buf_pool_mutex_exit_all();
-+ //buf_pool_mutex_exit_all();
- rw_lock_x_unlock(&btr_search_latch);
-
- if (UNIV_LIKELY_NULL(heap)) {
-@@ -1896,7 +1900,7 @@
+@@ -1943,7 +1943,7 @@
rec_offs_init(offsets_);
rw_lock_x_lock(&btr_search_latch);
cell_count = hash_get_n_cells(btr_search_sys->hash_index);
-@@ -1904,11 +1908,11 @@
+@@ -1951,11 +1951,11 @@
/* We release btr_search_latch every once in a while to
give other queries a chance to run. */
if ((i != 0) && ((i % chunk_size) == 0)) {
}
node = hash_get_nth_cell(btr_search_sys->hash_index, i)->node;
-@@ -2019,11 +2023,11 @@
+@@ -2066,11 +2066,11 @@
/* We release btr_search_latch every once in a while to
give other queries a chance to run. */
if (i != 0) {
}
if (!ha_validate(btr_search_sys->hash_index, i, end_index)) {
-@@ -2031,7 +2035,7 @@
+@@ -2078,7 +2078,7 @@
}
}
ut_ad(!mutex_own(&buf_pool->zip_mutex));
ut_ad(!ut_align_offset(src, size));
ut_ad(!ut_align_offset(dst, size));
-@@ -438,6 +479,12 @@
+@@ -437,6 +478,13 @@
+ if (size >= PAGE_ZIP_MIN_SIZE) {
/* This is a compressed page. */
mutex_t* mutex;
-
++ ulint space, page_no;
++
+ if (!have_page_hash_mutex) {
+ mutex_exit(&buf_pool->zip_free_mutex);
+ mutex_enter(&buf_pool->LRU_list_mutex);
+ rw_lock_x_lock(&buf_pool->page_hash_latch);
+ }
-+
+
/* The src block may be split into smaller blocks,
some of which may be free. Thus, the
- mach_read_from_4() calls below may attempt to read
-@@ -462,6 +509,11 @@
+@@ -446,9 +494,9 @@
+ pool), so there is nothing wrong about this. The
+ mach_read_from_4() calls here will only trigger bogus
+ Valgrind memcheck warnings in UNIV_DEBUG_VALGRIND builds. */
+- ulint space = mach_read_from_4(
++ space = mach_read_from_4(
+ (const byte*) src + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
+- ulint page_no = mach_read_from_4(
++ page_no = mach_read_from_4(
+ (const byte*) src + FIL_PAGE_OFFSET);
+ /* Suppress Valgrind warnings about conditional jump
+ on uninitialized value. */
+@@ -462,6 +510,11 @@
added to buf_pool->page_hash yet. Obviously,
it cannot be relocated. */
return(FALSE);
}
-@@ -473,18 +525,27 @@
+@@ -473,18 +526,27 @@
For the sake of simplicity, give up. */
ut_ad(page_zip_get_size(&bpage->zip) < size);
/* Relocate the compressed page. */
ut_a(bpage->zip.data == src);
memcpy(dst, src, size);
-@@ -499,10 +560,22 @@
+@@ -499,10 +561,22 @@
buddy_stat->relocated_usec
+= ut_time_us(NULL) - usec;
}
} else if (i == buf_buddy_get_slot(sizeof(buf_page_t))) {
/* This must be a buf_page_t object. */
#if UNIV_WORD_SIZE == 4
-@@ -511,10 +584,31 @@
+@@ -511,10 +585,31 @@
about uninitialized pad bytes. */
UNIV_MEM_ASSERT_RW(src, size);
#endif
}
return(FALSE);
-@@ -529,13 +623,15 @@
+@@ -529,13 +624,15 @@
buf_pool_t* buf_pool, /*!< in: buffer pool instance */
void* buf, /*!< in: block to be freed, must not be
pointed to by the buffer pool */
ut_ad(!mutex_own(&buf_pool->zip_mutex));
ut_ad(i <= BUF_BUDDY_SIZES);
ut_ad(buf_pool->buddy_stat[i].used > 0);
-@@ -546,7 +642,9 @@
+@@ -546,7 +643,9 @@
ut_d(((buf_page_t*) buf)->state = BUF_BLOCK_ZIP_FREE);
if (i == BUF_BUDDY_SIZES) {
return;
}
-@@ -591,7 +689,7 @@
+@@ -591,7 +690,7 @@
ut_a(bpage != buf);
{
UNIV_MEM_ASSERT_AND_FREE(bpage, BUF_BUDDY_LOW << i);
bpage = next;
}
-@@ -600,13 +698,13 @@
+@@ -600,13 +699,13 @@
#ifndef UNIV_DEBUG_VALGRIND
buddy_nonfree:
/* Valgrind would complain about accessing free memory. */
if (bpage) {
/* Remove the block from the free list, because a successful
-@@ -616,7 +714,7 @@
+@@ -616,7 +715,7 @@
buf_buddy_remove_from_free(buf_pool, bpage, i);
/* Try to relocate the buddy of buf to the free block. */
ut_d(buddy->state = BUF_BLOCK_ZIP_FREE);
goto buddy_free2;
-@@ -636,14 +734,14 @@
+@@ -636,14 +735,14 @@
(Parts of the buddy can be free in
buf_pool->zip_free[j] with j < i.) */
buf_pool_t* buf_pool = buf_pool_get(space, offset);
ut_ad(mtr);
-@@ -2753,9 +2844,11 @@
+@@ -2754,9 +2845,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
-@@ -2764,11 +2857,15 @@
+@@ -2765,11 +2858,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);
-@@ -2777,12 +2874,19 @@
+@@ -2778,12 +2875,19 @@
}
if (block == NULL) {
block = NULL;
}
-@@ -2794,12 +2898,14 @@
+@@ -2795,12 +2899,14 @@
space, offset, fold);
if (UNIV_LIKELY_NULL(block)) {
if (mode == BUF_GET_IF_IN_POOL
|| mode == BUF_GET_IF_IN_POOL_OR_WATCH) {
-@@ -2847,7 +2953,8 @@
+@@ -2848,7 +2954,8 @@
/* The page is being read to buffer pool,
but we cannot wait around for the read to
complete. */
return(NULL);
}
-@@ -2857,38 +2964,49 @@
+@@ -2858,38 +2965,49 @@
ibool success;
case BUF_BLOCK_FILE_PAGE:
{
buf_page_t* hash_bpage;
-@@ -2901,35 +3019,47 @@
+@@ -2902,35 +3020,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);
-@@ -2938,7 +3068,7 @@
+@@ -2939,7 +3069,7 @@
if (buf_page_get_state(&block->page)
== BUF_BLOCK_ZIP_PAGE) {
&block->page);
ut_ad(!block->page.in_flush_list);
} else {
-@@ -2955,19 +3085,24 @@
+@@ -2956,19 +3086,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. */
-@@ -2980,12 +3115,15 @@
+@@ -2981,12 +3116,15 @@
}
/* Unfix and unlatch the block. */
rw_lock_x_unlock(&block->lock);
break;
-@@ -3001,7 +3139,7 @@
+@@ -3002,7 +3140,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
-@@ -3014,7 +3152,7 @@
+@@ -3015,7 +3153,7 @@
/* Try to evict the block from the buffer pool, to use the
insert buffer (change buffer) as much as possible. */
== BUF_LRU_FREED) {
mutex_exit(&block->mutex);
if (mode == BUF_GET_IF_IN_POOL_OR_WATCH) {
-@@ -3051,13 +3189,14 @@
+@@ -3052,13 +3190,14 @@
buf_block_buf_fix_inc(block, file, line);
buf_page_set_accessed_make_young(&block->page, access_time);
-@@ -3290,9 +3429,11 @@
+@@ -3291,9 +3430,11 @@
buf_pool = buf_pool_from_block(block);
if (mode == BUF_MAKE_YOUNG && buf_page_peek_if_too_old(&block->page)) {
} else if (!buf_page_is_accessed(&block->page)) {
/* Above, we do a dirty read on purpose, to avoid
mutex contention. The field buf_page_t::access_time
-@@ -3300,9 +3441,11 @@
+@@ -3301,9 +3442,11 @@
field must be protected by mutex, however. */
ulint time_ms = ut_time_ms();
}
ut_ad(!ibuf_inside() || (mode == BUF_KEEP_OLD));
-@@ -3369,18 +3512,21 @@
+@@ -3370,18 +3513,21 @@
ut_ad(mtr);
ut_ad(mtr->state == MTR_ACTIVE);
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
ut_a(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
-@@ -3469,7 +3615,10 @@
+@@ -3470,7 +3616,10 @@
buf_page_t* hash_page;
buf_pool_t* buf_pool = buf_pool_get(space, offset);
ut_ad(mutex_own(&(block->mutex)));
ut_a(buf_block_get_state(block) != BUF_BLOCK_FILE_PAGE);
-@@ -3498,11 +3647,14 @@
+@@ -3499,11 +3648,14 @@
if (UNIV_LIKELY(!hash_page)) {
} else if (buf_pool_watch_is_sentinel(buf_pool, hash_page)) {
/* Preserve the reference count. */
} else {
fprintf(stderr,
"InnoDB: Error: page %lu %lu already found"
-@@ -3512,7 +3664,8 @@
+@@ -3513,7 +3665,8 @@
(const void*) hash_page, (const void*) block);
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
mutex_exit(&block->mutex);
buf_print();
buf_LRU_print();
buf_validate();
-@@ -3596,7 +3749,9 @@
+@@ -3597,7 +3750,9 @@
fold = buf_page_address_fold(space, offset);
watch_page = buf_page_hash_get_low(buf_pool, space, offset, fold);
if (watch_page && !buf_pool_watch_is_sentinel(buf_pool, watch_page)) {
-@@ -3605,9 +3760,15 @@
+@@ -3606,9 +3761,15 @@
err_exit:
if (block) {
mutex_enter(&block->mutex);
bpage = NULL;
goto func_exit;
-@@ -3630,6 +3791,8 @@
+@@ -3631,6 +3792,8 @@
buf_page_init(space, offset, fold, block);
/* The block must be put to the LRU list, to the old blocks */
buf_LRU_add_block(bpage, TRUE/* to old blocks */);
-@@ -3657,7 +3820,7 @@
+@@ -3658,7 +3821,7 @@
been added to buf_pool->LRU and
buf_pool->page_hash. */
mutex_exit(&block->mutex);
mutex_enter(&block->mutex);
block->page.zip.data = data;
-@@ -3670,6 +3833,7 @@
+@@ -3671,6 +3834,7 @@
buf_unzip_LRU_add_block(block, TRUE);
}
mutex_exit(&block->mutex);
} else {
/* Defer buf_buddy_alloc() until after the block has
-@@ -3681,8 +3845,8 @@
+@@ -3682,8 +3846,8 @@
control block (bpage), in order to avoid the
invocation of buf_buddy_relocate_block() on
uninitialized data. */
/* Initialize the buf_pool pointer. */
bpage->buf_pool_index = buf_pool_index(buf_pool);
-@@ -3701,8 +3865,11 @@
+@@ -3702,8 +3866,11 @@
/* The block was added by some other thread. */
watch_page = NULL;
bpage = NULL;
goto func_exit;
-@@ -3746,18 +3913,24 @@
+@@ -3747,18 +3914,24 @@
HASH_INSERT(buf_page_t, hash, buf_pool->page_hash, fold,
bpage);
if (mode == BUF_READ_IBUF_PAGES_ONLY) {
-@@ -3799,7 +3972,9 @@
+@@ -3800,7 +3973,9 @@
fold = buf_page_address_fold(space, offset);
block = (buf_block_t*) buf_page_hash_get_low(
buf_pool, space, offset, fold);
-@@ -3815,7 +3990,9 @@
+@@ -3816,7 +3991,9 @@
#endif /* UNIV_DEBUG_FILE_ACCESSES */
/* Page can be found in buf_pool */
buf_block_free(free_block);
-@@ -3837,6 +4014,7 @@
+@@ -3838,6 +4015,7 @@
mutex_enter(&block->mutex);
buf_page_init(space, offset, fold, block);
/* The block must be put to the LRU list */
buf_LRU_add_block(&block->page, FALSE);
-@@ -3863,7 +4041,7 @@
+@@ -3864,7 +4042,7 @@
the reacquisition of buf_pool->mutex. We also must
defer this operation until after the block descriptor
has been added to buf_pool->LRU and buf_pool->page_hash. */
mutex_enter(&block->mutex);
block->page.zip.data = data;
-@@ -3881,7 +4059,8 @@
+@@ -3882,7 +4060,8 @@
buf_page_set_accessed(&block->page, time_ms);
mtr_memo_push(mtr, block, MTR_MEMO_BUF_FIX);
-@@ -3932,6 +4111,8 @@
+@@ -3933,6 +4112,8 @@
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
const ibool uncompressed = (buf_page_get_state(bpage)
== BUF_BLOCK_FILE_PAGE);
ut_a(buf_page_in_file(bpage));
-@@ -4065,8 +4246,26 @@
+@@ -4066,8 +4247,26 @@
}
}
#ifdef UNIV_IBUF_COUNT_DEBUG
if (io_type == BUF_IO_WRITE || uncompressed) {
-@@ -4089,6 +4288,7 @@
+@@ -4090,6 +4289,7 @@
the x-latch to this OS thread: do not let this confuse you in
debugging! */
ut_ad(buf_pool->n_pend_reads > 0);
buf_pool->n_pend_reads--;
buf_pool->stat.n_pages_read++;
-@@ -4106,6 +4306,9 @@
+@@ -4107,6 +4307,9 @@
buf_flush_write_complete(bpage);
if (uncompressed) {
rw_lock_s_unlock_gen(&((buf_block_t*) bpage)->lock,
BUF_IO_WRITE);
-@@ -4128,8 +4331,8 @@
+@@ -4129,8 +4332,8 @@
}
#endif /* UNIV_DEBUG */
}
/*********************************************************************//**
-@@ -4146,7 +4349,9 @@
+@@ -4147,7 +4350,9 @@
ut_ad(buf_pool);
chunk = buf_pool->chunks;
-@@ -4163,7 +4368,9 @@
+@@ -4164,7 +4369,9 @@
}
}
return(TRUE);
}
-@@ -4211,7 +4418,8 @@
+@@ -4212,7 +4419,8 @@
freed = buf_LRU_search_and_free_block(buf_pool, 100);
}
ut_ad(UT_LIST_GET_LEN(buf_pool->LRU) == 0);
ut_ad(UT_LIST_GET_LEN(buf_pool->unzip_LRU) == 0);
-@@ -4224,7 +4432,8 @@
+@@ -4225,7 +4433,8 @@
memset(&buf_pool->stat, 0x00, sizeof(buf_pool->stat));
buf_refresh_io_stats(buf_pool);
}
/*********************************************************************//**
-@@ -4266,7 +4475,10 @@
+@@ -4267,7 +4476,10 @@
ut_ad(buf_pool);
chunk = buf_pool->chunks;
-@@ -4361,7 +4573,7 @@
+@@ -4362,7 +4574,7 @@
/* Check clean compressed-only blocks. */
for (b = UT_LIST_GET_FIRST(buf_pool->zip_clean); b;
ut_a(buf_page_get_state(b) == BUF_BLOCK_ZIP_PAGE);
switch (buf_page_get_io_fix(b)) {
case BUF_IO_NONE:
-@@ -4392,7 +4604,7 @@
+@@ -4393,7 +4605,7 @@
buf_flush_list_mutex_enter(buf_pool);
for (b = UT_LIST_GET_FIRST(buf_pool->flush_list); b;
ut_ad(b->in_flush_list);
ut_a(b->oldest_modification);
n_flush++;
-@@ -4451,6 +4663,8 @@
+@@ -4452,6 +4664,8 @@
}
ut_a(UT_LIST_GET_LEN(buf_pool->LRU) == n_lru);
if (UT_LIST_GET_LEN(buf_pool->free) != n_free) {
fprintf(stderr, "Free list len %lu, free blocks %lu\n",
(ulong) UT_LIST_GET_LEN(buf_pool->free),
-@@ -4461,8 +4675,11 @@
+@@ -4462,8 +4676,11 @@
ut_a(buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE] == n_single_flush);
ut_a(buf_pool->n_flush[BUF_FLUSH_LIST] == n_list_flush);
ut_a(buf_pool->n_flush[BUF_FLUSH_LRU] == n_lru_flush);
ut_a(buf_LRU_validate());
ut_a(buf_flush_validate(buf_pool));
-@@ -4518,7 +4735,9 @@
+@@ -4519,7 +4736,9 @@
index_ids = mem_alloc(size * sizeof *index_ids);
counts = mem_alloc(sizeof(ulint) * size);
buf_flush_list_mutex_enter(buf_pool);
fprintf(stderr,
-@@ -4587,7 +4806,9 @@
+@@ -4588,7 +4807,9 @@
}
}
for (i = 0; i < n_found; i++) {
index = dict_index_get_if_in_cache(index_ids[i]);
-@@ -4644,7 +4865,7 @@
+@@ -4645,7 +4866,7 @@
buf_chunk_t* chunk;
ulint fixed_pages_number = 0;
chunk = buf_pool->chunks;
-@@ -4678,7 +4899,7 @@
+@@ -4679,7 +4900,7 @@
/* Traverse the lists of clean and dirty compressed-only blocks. */
for (b = UT_LIST_GET_FIRST(buf_pool->zip_clean); b;
ut_a(buf_page_get_state(b) == BUF_BLOCK_ZIP_PAGE);
ut_a(buf_page_get_io_fix(b) != BUF_IO_WRITE);
-@@ -4690,7 +4911,7 @@
+@@ -4691,7 +4912,7 @@
buf_flush_list_mutex_enter(buf_pool);
for (b = UT_LIST_GET_FIRST(buf_pool->flush_list); b;
ut_ad(b->in_flush_list);
switch (buf_page_get_state(b)) {
-@@ -4716,7 +4937,7 @@
+@@ -4717,7 +4938,7 @@
buf_flush_list_mutex_exit(buf_pool);
mutex_exit(&buf_pool->zip_mutex);
return(fixed_pages_number);
}
-@@ -4810,6 +5031,8 @@
-
- ut_ad(buf_pool);
+@@ -4873,6 +5094,8 @@
+ /* Find appropriate pool_info to store stats for this buffer pool */
+ pool_info = &all_pool_info[pool_id];
+ mutex_enter(&buf_pool->LRU_list_mutex);
+ mutex_enter(&buf_pool->free_list_mutex);
buf_pool_mutex_enter(buf_pool);
buf_flush_list_mutex_enter(buf_pool);
-@@ -4913,6 +5136,8 @@
- buf_LRU_stat_sum.unzip, buf_LRU_stat_cur.unzip);
+@@ -4983,6 +5206,8 @@
+ pool_info->unzip_cur = buf_LRU_stat_cur.unzip;
buf_refresh_io_stats(buf_pool);
+ mutex_exit(&buf_pool->LRU_list_mutex);
buf_pool_mutex_exit(buf_pool);
}
-@@ -5032,11 +5257,13 @@
+@@ -5224,11 +5449,13 @@
{
ulint len;
diff -ruN a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c
--- a/storage/innobase/buf/buf0flu.c 2010-12-03 15:22:36.318955693 +0900
+++ b/storage/innobase/buf/buf0flu.c 2010-12-03 15:48:29.289024083 +0900
-@@ -279,7 +279,7 @@
+@@ -307,7 +307,7 @@
ut_d(block->page.in_flush_list = TRUE);
block->page.oldest_modification = lsn;
#ifdef UNIV_DEBUG_VALGRIND
{
-@@ -373,14 +373,14 @@
+@@ -401,14 +401,14 @@
> block->page.oldest_modification) {
ut_ad(b->in_flush_list);
prev_b = b;
prev_b, &block->page);
}
-@@ -406,7 +406,7 @@
+@@ -434,7 +434,7 @@
//buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
//ut_ad(buf_pool_mutex_own(buf_pool));
#endif
//ut_ad(bpage->in_LRU_list);
if (UNIV_LIKELY(bpage->in_LRU_list && buf_page_in_file(bpage))) {
-@@ -442,14 +442,14 @@
+@@ -470,14 +470,14 @@
enum buf_flush flush_type)/*!< in: BUF_FLUSH_LRU or BUF_FLUSH_LIST */
{
#ifdef UNIV_DEBUG
&& buf_page_get_io_fix(bpage) == BUF_IO_NONE) {
ut_ad(bpage->in_flush_list);
-@@ -480,7 +480,7 @@
+@@ -508,7 +508,7 @@
{
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
ut_ad(mutex_own(buf_page_get_mutex(bpage)));
ut_ad(bpage->in_flush_list);
-@@ -498,11 +498,11 @@
+@@ -526,11 +526,11 @@
return;
case BUF_BLOCK_ZIP_DIRTY:
buf_page_set_state(bpage, BUF_BLOCK_ZIP_PAGE);
break;
}
-@@ -546,7 +546,7 @@
+@@ -574,7 +574,7 @@
buf_page_t* prev_b = NULL;
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
/* Must reside in the same buffer pool. */
ut_ad(buf_pool == buf_pool_from_bpage(dpage));
-@@ -575,18 +575,18 @@
+@@ -603,18 +603,18 @@
because we assert on in_flush_list in comparison function. */
ut_d(bpage->in_flush_list = FALSE);
buf_pool->flush_list,
dpage);
}
-@@ -1055,7 +1055,7 @@
+@@ -1083,7 +1083,7 @@
#ifdef UNIV_DEBUG
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
#endif
#ifdef UNIV_LOG_DEBUG
-@@ -1069,7 +1069,8 @@
+@@ -1097,7 +1097,8 @@
io_fixed and oldest_modification != 0. Thus, it cannot be
relocated in the buffer pool or removed from flush_list or
LRU_list. */
ut_ad(!buf_flush_list_mutex_own(buf_pool));
ut_ad(!mutex_own(buf_page_get_mutex(bpage)));
ut_ad(buf_page_get_io_fix(bpage) == BUF_IO_WRITE);
-@@ -1232,12 +1233,18 @@
+@@ -1260,12 +1261,18 @@
ibool is_uncompressed;
ut_ad(flush_type == BUF_FLUSH_LRU || flush_type == BUF_FLUSH_LIST);
ut_ad(buf_flush_ready_for_flush(bpage, flush_type));
buf_page_set_io_fix(bpage, BUF_IO_WRITE);
-@@ -1399,14 +1406,16 @@
+@@ -1427,14 +1434,16 @@
buf_pool = buf_pool_get(space, i);
continue;
}
-@@ -1418,11 +1427,9 @@
+@@ -1446,11 +1455,9 @@
if (flush_type != BUF_FLUSH_LRU
|| i == offset
|| buf_page_is_old(bpage)) {
&& (i == offset || !bpage->buf_fix_count)) {
/* We only try to flush those
neighbors != offset where the buf fix
-@@ -1438,11 +1445,12 @@
+@@ -1466,11 +1473,12 @@
ut_ad(!buf_pool_mutex_own(buf_pool));
count++;
continue;
}
return(count);
-@@ -1475,21 +1483,25 @@
+@@ -1503,21 +1511,25 @@
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
#endif /* UNIV_DEBUG */
/* These fields are protected by both the
buffer pool mutex and block mutex. */
-@@ -1505,13 +1517,18 @@
+@@ -1533,13 +1545,18 @@
*count,
n_to_flush);
return(flushed);
}
-@@ -1532,7 +1549,8 @@
+@@ -1560,7 +1577,8 @@
buf_page_t* bpage;
ulint count = 0;
do {
/* Start from the end of the list looking for a
-@@ -1554,7 +1572,8 @@
+@@ -1582,7 +1600,8 @@
should be flushed, we factor in this value. */
buf_lru_flush_page_count += count;
return(count);
}
-@@ -1582,9 +1601,10 @@
+@@ -1610,9 +1629,10 @@
{
ulint len;
buf_page_t* bpage;
/* If we have flushed enough, leave the loop */
do {
-@@ -1603,6 +1623,7 @@
+@@ -1631,6 +1651,7 @@
if (bpage) {
ut_a(bpage->oldest_modification > 0);
}
if (!bpage || bpage->oldest_modification >= lsn_limit) {
-@@ -1644,9 +1665,17 @@
+@@ -1672,9 +1693,17 @@
break;
}
buf_flush_list_mutex_exit(buf_pool);
-@@ -1655,7 +1684,7 @@
+@@ -1683,7 +1712,7 @@
} while (count < min_n && bpage != NULL && len > 0);
return(count);
}
-@@ -1694,13 +1723,15 @@
+@@ -1722,13 +1751,15 @@
|| sync_thread_levels_empty_gen(TRUE));
#endif /* UNIV_SYNC_DEBUG */
break;
case BUF_FLUSH_LIST:
count = buf_flush_flush_list_batch(buf_pool, min_n, lsn_limit);
-@@ -1709,7 +1740,7 @@
+@@ -1737,7 +1768,7 @@
ut_error;
}
buf_flush_buffered_writes();
-@@ -1965,7 +1996,7 @@
+@@ -1993,7 +2024,7 @@
retry:
//buf_pool_mutex_enter(buf_pool);
if (have_LRU_mutex)
n_replaceable = UT_LIST_GET_LEN(buf_pool->free);
-@@ -1982,15 +2013,15 @@
+@@ -2010,15 +2041,15 @@
bpage = UT_LIST_GET_LAST(buf_pool->LRU);
continue;
}
distance++;
-@@ -1999,7 +2030,7 @@
+@@ -2027,7 +2058,7 @@
//buf_pool_mutex_exit(buf_pool);
if (have_LRU_mutex)
if (n_replaceable >= BUF_FLUSH_FREE_BLOCK_MARGIN(buf_pool)) {
-@@ -2198,7 +2229,7 @@
+@@ -2226,7 +2257,7 @@
ut_ad(buf_flush_list_mutex_own(buf_pool));
ut_ad(ut_list_node_313->in_flush_list));
bpage = UT_LIST_GET_FIRST(buf_pool->flush_list);
-@@ -2238,7 +2269,7 @@
+@@ -2266,7 +2297,7 @@
rnode = rbt_next(buf_pool->flush_rbt, rnode);
}
} else {
buf_pool->LRU_old_ratio = ratio;
}
-@@ -2124,7 +2265,8 @@
+@@ -2132,7 +2273,8 @@
ulint new_len;
ut_ad(buf_pool);
if (UT_LIST_GET_LEN(buf_pool->LRU) >= BUF_LRU_OLD_MIN_LEN) {
-@@ -2185,16 +2327,22 @@
+@@ -2193,16 +2335,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));
-@@ -2208,7 +2356,8 @@
+@@ -2216,7 +2364,8 @@
ut_a(buf_page_belongs_to_unzip_LRU(&block->page));
}
}
/**********************************************************************//**
-@@ -2244,7 +2393,8 @@
+@@ -2252,7 +2401,8 @@
const buf_page_t* bpage;
ut_ad(buf_pool);
bpage = UT_LIST_GET_FIRST(buf_pool->LRU);
-@@ -2301,7 +2451,8 @@
+@@ -2309,7 +2459,8 @@
bpage = UT_LIST_GET_NEXT(LRU, bpage);
}
diff -ruN a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
--- a/storage/innobase/handler/i_s.cc 2010-12-03 15:37:45.517105700 +0900
+++ b/storage/innobase/handler/i_s.cc 2010-12-03 15:48:29.331024462 +0900
-@@ -1566,7 +1566,8 @@
+@@ -1565,7 +1565,8 @@
buf_pool = buf_pool_from_array(i);
for (uint x = 0; x <= BUF_BUDDY_SIZES; x++) {
buf_buddy_stat_t* buddy_stat;
-@@ -1596,7 +1597,8 @@
+@@ -1595,7 +1596,8 @@
}
}
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
-@@ -3705,9 +3705,11 @@
+@@ -3783,9 +3783,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/buf0buf.h b/storage/innobase/include/buf0buf.h
--- a/storage/innobase/include/buf0buf.h 2010-12-03 15:22:36.327954660 +0900
+++ b/storage/innobase/include/buf0buf.h 2010-12-03 15:48:29.343024683 +0900
-@@ -132,6 +132,20 @@
+@@ -203,6 +203,20 @@
/*==========================*/
/********************************************************************//**
Creates the buffer pool.
@return own: buf_pool object, NULL if not enough memory or error */
UNIV_INTERN
-@@ -761,6 +775,15 @@
+@@ -832,6 +846,15 @@
const buf_page_t* bpage) /*!< in: pointer to control block */
__attribute__((pure));
/*********************************************************************//**
Get the flush type of a page.
@return flush type */
-@@ -1242,7 +1265,7 @@
+@@ -1313,7 +1336,7 @@
All these are protected by buf_pool->mutex. */
/* @{ */
/*!< based on state, this is a
list node, protected either by
buf_pool->mutex or by
-@@ -1270,6 +1293,10 @@
+@@ -1341,6 +1364,10 @@
BUF_BLOCK_REMOVE_HASH or
BUF_BLOCK_READY_IN_USE. */
#ifdef UNIV_DEBUG
ibool in_flush_list; /*!< TRUE if in buf_pool->flush_list;
when buf_pool->flush_list_mutex is
-@@ -1362,11 +1389,11 @@
+@@ -1433,11 +1460,11 @@
a block is in the unzip_LRU list
if page.state == BUF_BLOCK_FILE_PAGE
and page.zip.data != NULL */
mutex_t mutex; /*!< mutex protecting this block:
state (also protected by the buffer
pool mutex), io_fix, buf_fix_count,
-@@ -1532,6 +1559,11 @@
+@@ -1612,6 +1639,11 @@
pool instance, protects compressed
only pages (of type buf_page_t, not
buf_block_t */
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
-@@ -3060,7 +3060,7 @@
+@@ -3094,7 +3094,7 @@
level += log_sys->max_checkpoint_age
- (lsn - oldest_modification);
}
n_blocks++;
}
-@@ -3145,7 +3145,7 @@
+@@ -3180,7 +3180,7 @@
found = TRUE;
break;
}
/*==================== B-TREE INSERT =========================*/
/*************************************************************//**
-@@ -3488,6 +3589,154 @@
+@@ -3479,6 +3580,154 @@
}
/*******************************************************************//**
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. */
-@@ -3516,18 +3765,38 @@
+@@ -3507,18 +3756,38 @@
ulint offsets_next_rec_[REC_OFFS_NORMAL_SIZE];
ulint* offsets_rec = offsets_rec_;
ulint* offsets_next_rec= offsets_next_rec_;
} else {
n_sample_pages = 1;
}
-@@ -3539,9 +3808,15 @@
+@@ -3530,9 +3799,15 @@
for (i = 0; i < n_sample_pages; i++) {
rec_t* supremum;
/* Count the number of different key values for each prefix of
the key on this index page. If the prefix does not determine
-@@ -3552,7 +3827,13 @@
+@@ -3543,7 +3818,13 @@
page = btr_cur_get_page(&cursor);
supremum = page_get_supremum_rec(page);
if (rec != supremum) {
not_empty_flag = 1;
-@@ -3561,7 +3842,8 @@
+@@ -3552,7 +3833,8 @@
}
while (rec != supremum) {
if (next_rec == supremum) {
break;
}
-@@ -3575,7 +3857,10 @@
+@@ -3566,7 +3848,10 @@
cmp_rec_rec_with_match(rec, next_rec,
offsets_rec, offsets_next_rec,
index, &matched_fields,
for (j = matched_fields + 1; j <= n_cols; j++) {
/* We add one if this index record has
-@@ -3636,7 +3921,7 @@
+@@ -3627,7 +3912,7 @@
for (j = 0; j <= n_cols; j++) {
index->stat_n_diff_key_vals[j]
= ((n_diff[j]
+ n_sample_pages - 1
+ total_external_size
+ not_empty_flag)
-@@ -3651,7 +3936,7 @@
+@@ -3642,7 +3927,7 @@
different key values, or even more. Let us try to approximate
that: */
/ (10 * (n_sample_pages
+ total_external_size));
-@@ -3660,6 +3945,15 @@
+@@ -3651,6 +3936,15 @@
}
index->stat_n_diff_key_vals[j] += add_on;
diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.c
--- a/storage/innobase/dict/dict0dict.c 2010-12-03 15:48:03.040222428 +0900
+++ b/storage/innobase/dict/dict0dict.c 2010-12-03 17:19:24.841947690 +0900
-@@ -754,7 +754,7 @@
+@@ -756,7 +756,7 @@
print an error message and return without doing
anything. */
dict_update_statistics(table, TRUE /* only update stats
}
return(table);
-@@ -4291,6 +4291,240 @@
+@@ -4304,6 +4304,240 @@
}
/*********************************************************************//**
+ != index->id) {
+ /* not found: even 1 if not found should not be alowed */
+ fprintf(stderr, "InnoDB: Warning: stats for %s/%s (%lu/%lu)"
-+ " not fonund in SYS_STATS\n",
++ " not found in SYS_STATS\n",
+ index->table_name, index->name, i, n_cols);
+ btr_pcur_close(&pcur);
+ mtr_commit(&mtr);
+ || mach_read_from_8(rec_get_nth_field_old(rec, 0, &len))
+ != index->id) {
+ /* not found */
-+ btr_pcur_close(&pcur);
-+ mtr_commit(&mtr);
++
++
+ break;
+ }
+
Calculates new estimates for table and index statistics. The statistics
are used in query optimization. */
UNIV_INTERN
-@@ -4298,10 +4532,11 @@
+@@ -4311,10 +4545,11 @@
dict_update_statistics(
/*===================*/
dict_table_t* table, /*!< in/out: table */
{
dict_index_t* index;
ulint sum_of_index_sizes = 0;
-@@ -4318,6 +4553,27 @@
+@@ -4331,6 +4566,27 @@
return;
}
+ if (dict_reload_statistics(table, &sum_of_index_sizes)) {
+ /* success */
+#ifdef UNIV_DEBUG
-+ fprintf(stderr, "InnoDB: DEBUG: reload_statistics is scceeded for %s.\n",
++ fprintf(stderr, "InnoDB: DEBUG: reload_statistics succeeded for %s.\n",
+ table->name);
+#endif
+ goto end;
/* Find out the sizes of the indexes and how many different values
for the key they approximately have */
-@@ -4378,6 +4634,11 @@
+@@ -4391,6 +4647,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[
-@@ -4472,7 +4733,8 @@
+@@ -4485,7 +4746,8 @@
ut_ad(mutex_own(&(dict_sys->mutex)));
diff -ruN a/storage/innobase/dict/dict0load.c b/storage/innobase/dict/dict0load.c
--- a/storage/innobase/dict/dict0load.c 2010-11-03 07:01:13.000000000 +0900
+++ b/storage/innobase/dict/dict0load.c 2010-12-03 17:19:24.845947460 +0900
-@@ -49,7 +49,8 @@
+@@ -50,7 +50,8 @@
"SYS_COLUMNS",
"SYS_FIELDS",
"SYS_FOREIGN",
};
/****************************************************************//**
Compare the name of an index column.
-@@ -342,12 +343,13 @@
+@@ -343,12 +344,13 @@
}
if ((status & DICT_TABLE_UPDATE_STATS)
}
return(NULL);
-@@ -565,6 +567,61 @@
+@@ -582,6 +584,61 @@
+ //#endif /* FOREIGN_NOT_USED */
- return(NULL);
- }
-+/********************************************************************//**
+ /********************************************************************//**
+This function parses a SYS_STATS record and extract necessary
+information from the record and return to caller.
+@return error message, or NULL on success */
+const char*
+dict_process_sys_stats_rec(
+/*=============================*/
-+ mem_heap_t* heap, /*!< in/out: heap memory */
++ mem_heap_t* heap __attribute__((unused)), /*!< in/out: heap memory */
+ const rec_t* rec, /*!< in: current SYS_STATS rec */
+ index_id_t* index_id, /*!< out: INDEX_ID */
+ ulint* key_cols, /*!< out: KEY_COLS */
+
+ return(NULL);
+}
- /********************************************************************//**
++/********************************************************************//**
Determine the flags of a table described in SYS_TABLES.
@return compressed page size in kilobytes; or 0 if the tablespace is
+ uncompressed, ULINT_UNDEFINED on error */
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:17:03.665960357 +0900
+++ b/storage/innobase/handler/ha_innodb.cc 2010-12-03 17:22:21.586939783 +0900
static char* internal_innobase_data_file_path = NULL;
-@@ -2387,6 +2388,8 @@
+@@ -2388,6 +2389,8 @@
goto error;
}
/* -------------- Log files ---------------------------*/
/* The default dir for log files is the datadir of MySQL */
-@@ -5190,6 +5193,10 @@
+@@ -5192,6 +5195,10 @@
error = row_insert_for_mysql((byte*) record, prebuilt);
/* Handle duplicate key errors */
if (auto_inc_used) {
ulint err;
-@@ -5526,6 +5533,10 @@
+@@ -5528,6 +5535,10 @@
}
}
innodb_srv_conc_exit_innodb(trx);
error = convert_error_code_to_mysql(error,
-@@ -5579,6 +5590,10 @@
+@@ -5581,6 +5592,10 @@
error = row_update_for_mysql((byte*) record, prebuilt);
innodb_srv_conc_exit_innodb(trx);
error = convert_error_code_to_mysql(
-@@ -6106,6 +6121,11 @@
+@@ -5899,6 +5914,11 @@
+ case DB_SUCCESS:
+ error = 0;
+ table->status = 0;
++#ifdef EXTENDED_FOR_USERSTAT
++ rows_read++;
++ if (active_index >= 0 && active_index < MAX_KEY)
++ index_rows_read[active_index]++;
++#endif
+ break;
+ case DB_RECORD_NOT_FOUND:
+ error = HA_ERR_KEY_NOT_FOUND;
+@@ -6108,6 +6128,11 @@
case DB_SUCCESS:
error = 0;
table->status = 0;
break;
case DB_RECORD_NOT_FOUND:
error = HA_ERR_END_OF_FILE;
-@@ -8000,11 +8020,31 @@
+@@ -7999,11 +8024,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";
}
-@@ -8082,7 +8122,7 @@
+@@ -8081,7 +8126,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. */
-- if (flag & HA_STATUS_NO_LOCK) {
-+ if (flag & HA_STATUS_NO_LOCK || !srv_stats_update_need_lock) {
+- if (flag & HA_STATUS_NO_LOCK
++ if (flag & HA_STATUS_NO_LOCK || !srv_stats_update_need_lock
+ || !(flag & HA_STATUS_VARIABLE_EXTRA)) {
/* We do not update delete_length if no
locking is requested so the "old" value can
- remain. delete_length is initialized to 0 in
-@@ -11283,6 +11323,45 @@
+@@ -11281,6 +11326,45 @@
"The number of index pages to sample when calculating statistics (default 8)",
NULL, NULL, 8, 1, ~0ULL, 0);
static MYSQL_SYSVAR_BOOL(adaptive_hash_index, btr_search_enabled,
PLUGIN_VAR_OPCMDARG,
"Enable InnoDB adaptive hash index (enabled by default). "
-@@ -11611,6 +11690,10 @@
+@@ -11604,6 +11688,10 @@
MYSQL_SYSVAR(overwrite_relay_log_info),
MYSQL_SYSVAR(rollback_on_timeout),
MYSQL_SYSVAR(stats_on_metadata),
MYSQL_SYSVAR(stats_sample_pages),
MYSQL_SYSVAR(adaptive_hash_index),
MYSQL_SYSVAR(replication_delay),
-@@ -11680,7 +11763,10 @@
+@@ -11672,7 +11760,10 @@
i_s_innodb_sys_columns,
i_s_innodb_sys_fields,
i_s_innodb_sys_foreign,
}
static const char plugin_author[] = "Innobase Oy";
-@@ -3458,6 +3459,203 @@
+@@ -3457,6 +3458,203 @@
STRUCT_FLD(__reserved1, NULL)
};
/***********************************************************************
*/
static ST_FIELD_INFO i_s_innodb_rseg_fields_info[] =
-@@ -3620,3 +3818,347 @@
+@@ -3619,3 +3817,347 @@
/* void* */
STRUCT_FLD(__reserved1, NULL)
};
}
}
-@@ -2105,6 +2108,45 @@
+@@ -2103,6 +2106,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.
-@@ -3024,7 +3066,7 @@
+@@ -3022,7 +3064,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);
-@@ -3326,6 +3368,8 @@
+@@ -3324,6 +3366,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
-@@ -395,6 +395,10 @@
+@@ -397,6 +397,10 @@
/* 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;
static long long innobase_buffer_pool_size, innobase_log_file_size;
/** Percentage of the buffer pool to reserve for 'old' blocks.
-@@ -2496,6 +2497,9 @@
+@@ -2497,6 +2498,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 */
-@@ -11373,6 +11377,12 @@
+@@ -11371,6 +11375,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.",
-@@ -11586,6 +11596,7 @@
+@@ -11579,6 +11589,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
-@@ -344,6 +344,7 @@
+@@ -346,6 +346,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 */
-@@ -1130,6 +1131,75 @@
+@@ -1164,6 +1165,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(
-@@ -1160,6 +1230,13 @@
+@@ -1194,6 +1264,13 @@
return;
}
os_fast_mutex_lock(&srv_conc_mutex);
retry:
if (trx->declared_to_be_inside_innodb) {
-@@ -1305,6 +1382,14 @@
+@@ -1339,6 +1416,14 @@
}
ut_ad(srv_conc_n_threads >= 0);
os_fast_mutex_lock(&srv_conc_mutex);
-@@ -1338,6 +1423,13 @@
+@@ -1372,6 +1457,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
-@@ -4995,6 +4995,10 @@
+@@ -4990,6 +4990,10 @@
DBUG_PRINT("error",("Too many connections"));
- close_connection(thd, ER_CON_COUNT_ERROR, 1);
+ close_connection(thd, ER_CON_COUNT_ERROR);
+ if (global_system_variables.log_warnings)
+ {
+ sql_print_warning("%s", ER_DEFAULT(ER_CON_COUNT_ERROR));
delete thd;
DBUG_VOID_RETURN;
}
-@@ -5375,6 +5379,10 @@
+@@ -5370,6 +5374,10 @@
if (!(thd->net.vio= vio_new_win32pipe(hConnectedPipe)) ||
my_net_init(&thd->net, thd->net.vio))
{
+ {
+ sql_print_warning("%s", ER_DEFAULT(ER_OUT_OF_RESOURCES));
+ }
- close_connection(thd, ER_OUT_OF_RESOURCES, 1);
+ close_connection(thd, ER_OUT_OF_RESOURCES);
delete thd;
continue;
-@@ -5570,6 +5578,10 @@
+@@ -5565,6 +5573,10 @@
event_conn_closed)) ||
my_net_init(&thd->net, thd->net.vio))
{
+ {
+ sql_print_warning("%s", ER_DEFAULT(ER_OUT_OF_RESOURCES));
+ }
- close_connection(thd, ER_OUT_OF_RESOURCES, 1);
+ close_connection(thd, ER_OUT_OF_RESOURCES);
errmsg= 0;
goto errorconn;
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
-@@ -617,6 +617,8 @@
+@@ -620,6 +620,8 @@
SHOW_COMP_OPTION have_crypt, have_compress;
SHOW_COMP_OPTION have_profiling;
diff -ruN a/sql/mysqld.h b/sql/mysqld.h
--- a/sql/mysqld.h 2011-01-05 20:31:33.000000000 +0300
+++ b/sql/mysqld.h 2011-01-05 20:32:35.000000000 +0300
-@@ -224,6 +224,8 @@
+@@ -226,6 +226,8 @@
extern TYPELIB thread_handling_typelib;
extern my_decimal decimal_zero;
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
-@@ -4544,7 +4544,7 @@
+@@ -4578,7 +4578,7 @@
ER_BINLOG_UNSAFE_STATEMENT,
ER(ER_BINLOG_UNSAFE_STATEMENT),
ER(LEX::binlog_stmt_unsafe_errcode[unsafe_type]));
diff -ruN a/sql/sys_vars.cc b/sql/sys_vars.cc
--- a/sql/sys_vars.cc 2011-01-05 20:31:33.000000000 +0300
+++ b/sql/sys_vars.cc 2011-01-05 20:32:38.000000000 +0300
-@@ -1408,6 +1408,15 @@
+@@ -1424,6 +1424,15 @@
READ_ONLY GLOBAL_VAR(mysqld_port), CMD_LINE(REQUIRED_ARG, 'P'),
VALID_RANGE(0, UINT_MAX32), DEFAULT(0), BLOCK_SIZE(1));
if (schema_table_store_record(thd, table))
{
mysql_mutex_unlock(&LOCK_thread_count);
-@@ -7220,6 +7225,8 @@
+@@ -7267,6 +7272,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},
create database `inf%`;
create database mbase;
diff -ruN a/mysql-test/r/mysqld--help-notwin.result b/mysql-test/r/mysqld--help-notwin.result
---- a/mysql-test/r/mysqld--help-notwin.result 2010-12-03 20:58:24.000000000 +0300
-+++ b/mysql-test/r/mysqld--help-notwin.result 2011-01-10 23:34:28.000000000 +0300
-@@ -125,6 +125,9 @@
- --div-precision-increment=#
- Precision of the result of '/' operator will be increased
- on that value
-+ --enable-query-response-time-stats
-+ Enable or disable query response time statisics
-+ collecting
- --engine-condition-pushdown
- Push supported query conditions to the storage engine.
- Deprecated, use --optimizer-switch instead.
-@@ -244,21 +247,43 @@
+--- a/mysql-test/r/mysqld--help-notwin.result 2011-01-20 00:37:09.000000000 +0200
++++ b/mysql-test/r/mysqld--help-notwin.result 2011-02-18 13:14:44.701736864 +0200
+@@ -249,21 +249,43 @@
--log-slow-admin-statements
Log slow OPTIMIZE, ANALYZE, ALTER and other
administrative statements to the slow log if it is open.
+ Choose how verbose the messages to your slow log will be.
+ Multiple flags allowed in a comma-separated string.
+ [microtime, query_plan, innodb, profiling,
-+ profiling_get_rusage]
++ profiling_use_getrusage]
--log-tc=name Path to transaction coordinator log (used for
transactions that affect more than one storage engine,
when binary log is disabled).
--long-query-time=# Log all queries that have taken more than long_query_time
seconds to execute to file. The argument will be treated
as a decimal value with microsecond precision
-@@ -464,6 +489,10 @@
+@@ -470,6 +492,10 @@
The minimum size for blocks allocated by the query cache
--query-cache-size=#
The memory allocated to store results from old queries
--query-cache-type=name
OFF = Don't cache or retrieve results. ON = Cache all
results except SELECT SQL_NO_CACHE ... queries. DEMAND =
-@@ -472,6 +501,9 @@
+@@ -478,6 +504,12 @@
Invalidate queries in query cache on LOCK for write
--query-prealloc-size=#
Persistent buffer for query parsing and execution
+ --query-response-time-range-base=#
+ Select base of log for query_response_time ranges.
+ WARNING: variable change affect only after flush
++ --query-response-time-stats
++ Enable or disable query response time statisics
++ collecting
--range-alloc-block-size=#
Allocation block size for storing ranges during
optimization
-@@ -649,6 +681,9 @@
+@@ -655,6 +687,9 @@
Log slow queries to given log file. Defaults logging to
hostname-slow.log. Must be enabled to activate other slow
log options
--socket=name Socket file to use for connection
--sort-buffer-size=#
Each thread that needs to do a sort allocates a buffer of
-@@ -691,6 +726,8 @@
+@@ -697,6 +732,8 @@
Define threads usage for handling queries, one of
one-thread-per-connection, no-threads, loaded-dynamically
--thread-stack=# The stack size for each thread
--time-format=name The TIME format (ignored)
--timed-mutexes Specify whether to time mutexes (only InnoDB mutexes are
currently supported)
-@@ -715,11 +752,24 @@
+@@ -721,11 +758,24 @@
Prohibit update of a VIEW, which does not contain a key
of the underlying table and the query uses a LIMIT clause
(usually get from GUI tools)
Variables (--variable-name=value)
abort-slave-event-count 0
-@@ -756,6 +806,7 @@
- delayed-queue-size 1000
- disconnect-slave-event-count 0
- div-precision-increment 4
-+enable-query-response-time-stats FALSE
- engine-condition-pushdown TRUE
- event-scheduler OFF
- expire-logs-days 0
-@@ -800,10 +851,16 @@
+@@ -807,10 +857,16 @@
log-short-format FALSE
log-slave-updates FALSE
log-slow-admin-statements FALSE
long-query-time 10
low-priority-updates FALSE
lower-case-table-names 1
-@@ -877,9 +934,11 @@
+@@ -885,9 +941,12 @@
query-cache-limit 1048576
query-cache-min-res-unit 4096
query-cache-size 0
query-cache-wlock-invalidate FALSE
query-prealloc-size 8192
+query-response-time-range-base 10
++query-response-time-stats FALSE
range-alloc-block-size 4096
read-buffer-size 131072
read-only FALSE
-@@ -914,6 +973,7 @@
+@@ -922,6 +981,7 @@
slave-type-conversions
slow-launch-time 2
slow-query-log FALSE
sort-buffer-size 2097152
sporadic-binlog-dump-fail FALSE
sql-mode
-@@ -931,6 +991,7 @@
+@@ -939,6 +999,7 @@
thread-cache-size 0
thread-handling one-thread-per-connection
thread-stack 262144
time-format %H:%i:%s
timed-mutexes FALSE
tmp-table-size 16777216
-@@ -938,8 +999,11 @@
+@@ -946,8 +1007,11 @@
transaction-isolation REPEATABLE-READ
transaction-prealloc-size 4096
updatable-views-with-limit YES
diff -ruN a/mysql-test/suite/innodb/r/innodb.result b/mysql-test/suite/innodb/r/innodb.result
--- a/mysql-test/suite/innodb/r/innodb.result 2010-11-03 07:01:12.000000000 +0900
+++ b/mysql-test/suite/innodb/r/innodb.result 2010-12-10 16:48:11.026994635 +0900
-@@ -1661,7 +1661,7 @@
+@@ -1664,7 +1664,7 @@
drop table t1;
SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_pages_total';
variable_value
variable_value
16384
diff -ruN a/mysql-test/suite/sys_vars/r/all_vars.result b/mysql-test/suite/sys_vars/r/all_vars.result
---- a/mysql-test/suite/sys_vars/r/all_vars.result 2010-12-03 20:58:25.000000000 +0300
-+++ b/mysql-test/suite/sys_vars/r/all_vars.result 2011-01-10 23:09:13.000000000 +0300
+--- a/mysql-test/suite/sys_vars/r/all_vars.result 2011-01-20 00:37:09.000000000 +0200
++++ b/mysql-test/suite/sys_vars/r/all_vars.result 2011-02-18 13:04:56.205855418 +0200
@@ -11,7 +11,99 @@
select variable_name as `There should be *no* variables listed below:` from t2
left join t1 on variable_name=test_name where test_name is null;
There should be *no* variables listed below:
-+INNODB_BUFFER_POOL_SHM_KEY
++QUERY_CACHE_STRIP_COMMENTS
+LOG_SLOW_SP_STATEMENTS
-+INNODB_DOUBLEWRITE_FILE
+INNODB_THREAD_CONCURRENCY_TIMER_BASED
+LOG_SLOW_TIMESTAMP_EVERY
++INNODB_LOG_BLOCK_SIZE
++THREAD_STATISTICS
+INNODB_READ_AHEAD
++INNODB_USE_GLOBAL_FLUSH_LOG_AT_TRX_COMMIT
+INNODB_PASS_CORRUPT_TABLE
-+INNODB_RECOVERY_STATS
++QUERY_RESPONSE_TIME_STATS
+INNODB_FLUSH_NEIGHBOR_PAGES
+INNODB_BUFFER_POOL_SHM_CHECKSUM
-+INNODB_FLUSH_LOG_AT_TRX_COMMIT_SESSION
+LOG_SLOW_VERBOSITY
-+ENABLE_QUERY_RESPONSE_TIME_STATS
-+OPTIMIZER_FIX
-+INNODB_ADAPTIVE_CHECKPOINT
+INNODB_SHOW_LOCKS_HELD
+INNODB_IBUF_ACCEL_RATE
+INNODB_EXPAND_IMPORT
-+QUERY_CACHE_STRIP_COMMENTS
+INNODB_CHECKPOINT_AGE_TARGET
++INNODB_ADAPTIVE_FLUSHING_METHOD
+INNODB_STATS_METHOD
++HAVE_RESPONSE_TIME_DISTRIBUTION
+LOG_SLOW_RATE_LIMIT
++OPTIMIZER_FIX
+INNODB_PAGE_SIZE
-+USERSTAT_RUNNING
+FAST_INDEX_CREATION
+USE_GLOBAL_LOG_SLOW_CONTROL
-+INNODB_ENABLE_UNSAFE_GROUP_COMMIT
-+INNODB_SHOW_VERBOSE_LOCKS
++INNODB_IBUF_MAX_SIZE
+INNODB_ADAPTIVE_HASH_INDEX_PARTITIONS
+SLOW_QUERY_LOG_MICROSECONDS_TIMESTAMP
-+INNODB_LOG_BLOCK_SIZE
++INNODB_BUFFER_POOL_SHM_KEY
++INNODB_FAST_CHECKSUM
+INNODB_USE_SYS_STATS_TABLE
+INNODB_STATS_UPDATE_NEED_LOCK
++INNODB_RECOVERY_STATS
++USERSTAT_RUNNING
+QUERY_RESPONSE_TIME_RANGE_BASE
-+INNODB_STATS_AUTO_UPDATE
+INNODB_IBUF_ACTIVE_CONTRACT
- INNODB_FILE_FORMAT_MAX
+INNODB_AUTO_LRU_DUMP
++INNODB_DOUBLEWRITE_FILE
++INNODB_STATS_AUTO_UPDATE
++INNODB_DICT_SIZE_LIMIT
+ INNODB_FILE_FORMAT_MAX
+LOG_WARNINGS_SILENCE
+LOG_SLOW_FILTER
-+INNODB_DICT_SIZE_LIMIT
-+INNODB_IBUF_MAX_SIZE
-+INNODB_FAST_CHECKSUM
-+LOG_SLOW_SLAVE_STATEMENTS
-+INNODB_OVERWRITE_RELAY_LOG_INFO
++INNODB_SHOW_VERBOSE_LOCKS
+INNODB_EXTRA_RSEGMENTS
-+THREAD_STATISTICS
-+INNODB_BUFFER_POOL_SHM_KEY
++INNODB_OVERWRITE_RELAY_LOG_INFO
++LOG_SLOW_SLAVE_STATEMENTS
++QUERY_CACHE_STRIP_COMMENTS
+LOG_SLOW_SP_STATEMENTS
-+INNODB_DOUBLEWRITE_FILE
+INNODB_THREAD_CONCURRENCY_TIMER_BASED
+LOG_SLOW_TIMESTAMP_EVERY
++INNODB_LOG_BLOCK_SIZE
++THREAD_STATISTICS
+INNODB_READ_AHEAD
++INNODB_USE_GLOBAL_FLUSH_LOG_AT_TRX_COMMIT
+INNODB_PASS_CORRUPT_TABLE
-+INNODB_RECOVERY_STATS
++QUERY_RESPONSE_TIME_STATS
+INNODB_FLUSH_NEIGHBOR_PAGES
+INNODB_BUFFER_POOL_SHM_CHECKSUM
-+INNODB_FLUSH_LOG_AT_TRX_COMMIT_SESSION
+LOG_SLOW_VERBOSITY
-+ENABLE_QUERY_RESPONSE_TIME_STATS
-+OPTIMIZER_FIX
-+INNODB_ADAPTIVE_CHECKPOINT
+INNODB_SHOW_LOCKS_HELD
+INNODB_IBUF_ACCEL_RATE
+INNODB_EXPAND_IMPORT
-+QUERY_CACHE_STRIP_COMMENTS
+INNODB_CHECKPOINT_AGE_TARGET
++INNODB_ADAPTIVE_FLUSHING_METHOD
+INNODB_STATS_METHOD
++HAVE_RESPONSE_TIME_DISTRIBUTION
+LOG_SLOW_RATE_LIMIT
++OPTIMIZER_FIX
+INNODB_PAGE_SIZE
-+USERSTAT_RUNNING
+FAST_INDEX_CREATION
+USE_GLOBAL_LOG_SLOW_CONTROL
-+INNODB_ENABLE_UNSAFE_GROUP_COMMIT
-+INNODB_SHOW_VERBOSE_LOCKS
++INNODB_IBUF_MAX_SIZE
+INNODB_ADAPTIVE_HASH_INDEX_PARTITIONS
+SLOW_QUERY_LOG_MICROSECONDS_TIMESTAMP
-+INNODB_LOG_BLOCK_SIZE
++INNODB_BUFFER_POOL_SHM_KEY
++INNODB_FAST_CHECKSUM
+INNODB_USE_SYS_STATS_TABLE
+INNODB_STATS_UPDATE_NEED_LOCK
++INNODB_RECOVERY_STATS
++USERSTAT_RUNNING
+QUERY_RESPONSE_TIME_RANGE_BASE
-+INNODB_STATS_AUTO_UPDATE
+INNODB_IBUF_ACTIVE_CONTRACT
- INNODB_FILE_FORMAT_MAX
+INNODB_AUTO_LRU_DUMP
++INNODB_DOUBLEWRITE_FILE
++INNODB_STATS_AUTO_UPDATE
++INNODB_DICT_SIZE_LIMIT
+ INNODB_FILE_FORMAT_MAX
+LOG_WARNINGS_SILENCE
+LOG_SLOW_FILTER
-+INNODB_DICT_SIZE_LIMIT
-+INNODB_IBUF_MAX_SIZE
-+INNODB_FAST_CHECKSUM
-+LOG_SLOW_SLAVE_STATEMENTS
-+INNODB_OVERWRITE_RELAY_LOG_INFO
++INNODB_SHOW_VERBOSE_LOCKS
+INNODB_EXTRA_RSEGMENTS
-+THREAD_STATISTICS
++INNODB_OVERWRITE_RELAY_LOG_INFO
++LOG_SLOW_SLAVE_STATEMENTS
drop table t1;
drop table t2;
diff -ruN a/mysql-test/suite/sys_vars/r/innodb_adaptive_flushing_basic.result b/mysql-test/suite/sys_vars/r/innodb_adaptive_flushing_basic.result
Summary(uk.UTF-8): MySQL - швидкий SQL-сервер
Summary(zh_CN.UTF-8): MySQL数据库服务器
Name: mysql
-Version: 5.5.8
-Release: 2
+Version: 5.5.9
+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: 42e866302b61f5e213afd33e04677017
+# Source0-md5: 701c0c44b7f1c2300adc0dc45729f903
Source100: http://www.sphinxsearch.com/downloads/sphinx-0.9.9.tar.gz
# Source100-md5: 7b9b618cb9b378f949bb1b91ddcc4f54
Source1: %{name}.init
opt_alltspcs=0, opt_notspcs= 0;
static my_bool insert_pat_inited= 0, debug_info_flag= 0, debug_check_flag= 0;
static ulong opt_max_allowed_packet, opt_net_buffer_length;
-@@ -349,6 +349,9 @@
+@@ -350,6 +350,9 @@
{"insert-ignore", OPT_INSERT_IGNORE, "Insert rows with INSERT IGNORE.",
&opt_ignore, &opt_ignore, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"lines-terminated-by", OPT_LTB,
"Lines in the output file are terminated by the given string.",
&lines_terminated, &lines_terminated, 0, GET_STR,
-@@ -2278,13 +2281,21 @@
+@@ -2293,13 +2296,21 @@
/* Make an sql-file, if path was given iow. option -T was given */
char buff[20+FN_REFLEN];
MYSQL_FIELD *field;
static bool add_line(String &buffer,char *line,char *in_string,
bool *ml_comment, bool truncated)
-@@ -2986,6 +3035,11 @@
+@@ -2990,6 +3039,11 @@
fix_history(buffer);
}
#endif
diff -ruN a/sql/sql_select.cc b/sql/sql_select.cc
--- a/sql/sql_select.cc 2010-11-03 07:01:14.000000000 +0900
+++ b/sql/sql_select.cc 2010-12-02 20:47:55.813953789 +0900
-@@ -2610,6 +2610,11 @@
+@@ -2611,6 +2611,11 @@
table->reginfo.impossible_range=1;
DBUG_RETURN(0);
}
diff -ruN a/sql/sys_vars.cc b/sql/sys_vars.cc
--- a/sql/sys_vars.cc 2010-12-02 20:31:56.208023606 +0900
+++ b/sql/sys_vars.cc 2010-12-02 21:17:44.618120277 +0900
-@@ -2118,6 +2118,12 @@
+@@ -2134,6 +2134,12 @@
VALID_RANGE(1, IF_WIN(INT_MAX32/1000, LONG_TIMEOUT)),
DEFAULT(NET_WAIT_TIMEOUT), BLOCK_SIZE(1));
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
-@@ -893,6 +893,7 @@
+@@ -896,6 +896,7 @@
#endif
#ifdef HAVE_QUERY_CACHE
ulong query_cache_min_res_unit= QUERY_CACHE_MIN_RESULT_DATA_SIZE;
diff -ruN a/sql/sys_vars.cc b/sql/sys_vars.cc
--- a/sql/sys_vars.cc 2010-11-03 03:01:14.000000000 +0500
+++ b/sql/sys_vars.cc 2010-11-13 15:34:59.000000000 +0500
-@@ -1724,6 +1724,11 @@
+@@ -1740,6 +1740,11 @@
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_query_cache_size));
if (!(test_flags & TEST_BLOCKING))
{
my_bool old_mode;
-@@ -642,7 +642,7 @@
+@@ -632,7 +632,7 @@
if ((long) (length= vio_write(net->vio,pos,(size_t) (end-pos))) <= 0)
{
my_bool interrupted = vio_should_retry(net->vio);
if ((interrupted || length == 0) && !thr_alarm_in_use(&alarmed))
{
if (!thr_alarm(&alarmed, net->write_timeout, &alarm_buff))
-@@ -680,7 +680,7 @@
+@@ -670,7 +670,7 @@
my_progname);
#endif /* EXTRA_DEBUG */
}
if (vio_errno(net->vio) == SOCKET_EINTR)
{
DBUG_PRINT("warning",("Interrupted write. Retrying..."));
-@@ -698,7 +698,7 @@
+@@ -688,7 +688,7 @@
pos+=length;
update_statistics(thd_increment_bytes_sent(length));
}
end:
#endif
#ifdef HAVE_COMPRESS
-@@ -830,6 +830,7 @@
+@@ -820,6 +820,7 @@
thr_alarm(&alarmed,net->read_timeout,&alarm_buff);
#else
/* Read timeout is set in my_net_set_read_timeout */
#endif /* NO_ALARM */
pos = net->buff + net->where_b; /* net->packet -4 */
-@@ -844,7 +845,7 @@
+@@ -834,7 +835,7 @@
DBUG_PRINT("info",("vio_read returned %ld errno: %d",
(long) length, vio_errno(net->vio)));
/*
We got an error that there was no data on the socket. We now set up
an alarm to not 'read forever', change the socket to non blocking
-@@ -891,7 +892,7 @@
+@@ -881,7 +882,7 @@
my_progname,vio_errno(net->vio));
#endif /* EXTRA_DEBUG */
}
diff -ruN a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt 2010-12-03 20:58:24.000000000 +0300
+++ b/CMakeLists.txt 2011-01-16 20:11:28.000000000 +0300
-@@ -171,7 +171,12 @@
+@@ -165,7 +165,12 @@
OPTION (WITH_UNIT_TESTS "Compile MySQL with unit tests" ON)
MARK_AS_ADVANCED(CYBOZU BACKUP_TEST WITHOUT_SERVER DISABLE_SHARED)
#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
#include "../storage/perfschema/pfs_server.h"
#endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */
-@@ -600,7 +602,7 @@
+@@ -603,7 +605,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;
-@@ -901,6 +903,10 @@
+@@ -904,6 +906,10 @@
my_bool opt_enable_shared_memory;
HANDLE smem_event_connect_request= 0;
#endif
+#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION
+ulong opt_query_response_time_range_base = QRT_DEFAULT_BASE;
-+my_bool opt_enable_query_response_time_stats= 0;
++my_bool opt_query_response_time_stats= 0;
+#endif // HAVE_RESPONSE_TIME_DISTRIBUTION
my_bool opt_use_ssl = 0;
char *opt_ssl_ca= NULL, *opt_ssl_capath= NULL, *opt_ssl_cert= NULL,
-@@ -1469,6 +1475,9 @@
+@@ -1472,6 +1478,9 @@
my_free(opt_bin_logname);
bitmap_free(&temp_pool);
free_max_user_conn();
#ifdef HAVE_REPLICATION
end_slave_list();
#endif
-@@ -3930,6 +3939,9 @@
+@@ -3925,6 +3934,9 @@
if (!DEFAULT_ERRMSGS[0][0])
unireg_abort(1);
/* We have to initialize the storage engines before CSV logging */
if (ha_init())
{
-@@ -6800,6 +6812,11 @@
+@@ -6797,6 +6809,11 @@
#else
have_query_cache=SHOW_OPTION_NO;
#endif
extern bool opt_ignore_builtin_innodb;
+#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION
+extern ulong opt_query_response_time_range_base;
-+extern my_bool opt_enable_query_response_time_stats;
++extern my_bool opt_query_response_time_stats;
+#endif // HAVE_RESPONSE_TIME_DISTRIBUTION
extern my_bool opt_character_set_client_handshake;
extern bool volatile abort_loop;
#include "transaction.h"
#include "sql_audit.h"
#include "sql_prepare.h"
-@@ -1476,22 +1477,36 @@
+@@ -1483,22 +1484,36 @@
Do not log administrative statements unless the appropriate option is
set.
*/
+ #ifdef HAVE_RESPONSE_TIME_DISTRIBUTION
-+ if (opt_enable_query_response_time_stats || thd->enable_slow_log)
++ if (opt_query_response_time_stats || thd->enable_slow_log)
+#else // HAVE_RESPONSE_TIME_DISTRIBUTION
if (thd->enable_slow_log)
+#endif // HAVE_RESPONSE_TIME_DISTRIBUTION
+ ulonglong end_utime_of_query = thd->current_utime();
+ ulonglong query_execution_time = end_utime_of_query - thd->utime_after_lock;
+#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION
-+ if(opt_enable_query_response_time_stats)
++ if(opt_query_response_time_stats)
+ {
+ query_response_time_collect(query_execution_time);
+ }
}
}
DBUG_VOID_RETURN;
-@@ -1610,6 +1625,7 @@
+@@ -1617,6 +1632,7 @@
case SCH_CHARSETS:
case SCH_ENGINES:
case SCH_COLLATIONS:
/**
Reload/resets privileges and the different caches.
-@@ -274,6 +274,12 @@
+@@ -282,6 +282,12 @@
#endif
if (options & REFRESH_USER_RESOURCES)
reset_mqh((LEX_USER *) NULL, 0); /* purecov: inspected */
+ query_response_time_flush();
+ }
+#endif // HAVE_RESPONSE_TIME_DISTRIBUTION
- *write_to_binlog= tmp_write_to_binlog;
+ if (*write_to_binlog != -1)
+ *write_to_binlog= tmp_write_to_binlog;
/*
- If the query was killed then this function must fail.
diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc
--- a/sql/sql_show.cc 2011-01-16 18:53:35.000000000 +0300
+++ b/sql/sql_show.cc 2011-01-17 02:17:44.000000000 +0300
#include "lock.h" // MYSQL_OPEN_IGNORE_FLUSH
#include "debug_sync.h"
#include "datadict.h" // dd_frm_type()
-@@ -7641,6 +7642,14 @@
+@@ -7688,6 +7689,14 @@
*/
ST_SCHEMA_TABLE schema_tables[]=
{
{"CHARACTER_SETS", charsets_fields_info, create_schema_table,
-@@ -7694,6 +7703,13 @@
+@@ -7741,6 +7750,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},
/*
This forward declaration is needed because including sql_base.h
causes further includes. [TODO] Eliminate this forward declaration
-@@ -1775,6 +1776,26 @@
+@@ -1791,6 +1792,26 @@
DEFAULT(FALSE));
#endif /* HAVE_QUERY_CACHE */
+ READ_ONLY GLOBAL_VAR(have_response_time_distribution), NO_CMD_LINE);
+
+#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION
-+static Sys_var_mybool Sys_enable_query_response_time_stats(
-+ "enable_query_response_time_stats", "Enable or disable query response time statisics collecting",
-+ GLOBAL_VAR(opt_enable_query_response_time_stats), CMD_LINE(OPT_ARG),
++static Sys_var_mybool Sys_query_response_time_stats(
++ "query_response_time_stats", "Enable or disable query response time statisics collecting",
++ GLOBAL_VAR(opt_query_response_time_stats), CMD_LINE(OPT_ARG),
+ DEFAULT(FALSE));
+
+static Sys_var_ulong Sys_query_response_time_range_base(
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
-@@ -3058,6 +3058,7 @@
+@@ -3053,6 +3053,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},
sql_command_flags[SQLCOM_SHOW_CREATE_PROC]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_CREATE_FUNC]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_CREATE_TRIGGER]= CF_STATUS_COMMAND;
-@@ -2262,12 +2263,16 @@
+@@ -2269,12 +2270,16 @@
mysql_mutex_unlock(&LOCK_active_mi);
break;
}
if (active_mi != NULL)
{
res = show_master_info(thd, active_mi);
-@@ -2278,7 +2283,10 @@
+@@ -2285,7 +2290,10 @@
WARN_NO_MASTER_INFO, ER(WARN_NO_MASTER_INFO));
my_ok(thd);
}
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
-@@ -3038,6 +3038,7 @@
+@@ -3033,6 +3033,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},
sql_command_flags[SQLCOM_SHOW_TABLE_STATUS]= (CF_STATUS_COMMAND |
CF_SHOW_TABLE_COMMAND |
CF_REEXECUTION_FRAGILE);
-@@ -1504,6 +1507,8 @@
+@@ -1511,6 +1514,8 @@
case SCH_TABLE_NAMES:
case SCH_TABLES:
case SCH_VIEWS:
case SCH_TRIGGERS:
case SCH_EVENTS:
-@@ -2011,6 +2016,7 @@
+@@ -2018,6 +2023,7 @@
}
case SQLCOM_SHOW_DATABASES:
case SQLCOM_SHOW_TABLES:
case SQLCOM_SHOW_TRIGGERS:
case SQLCOM_SHOW_TABLE_STATUS:
case SQLCOM_SHOW_OPEN_TABLES:
-@@ -4787,6 +4793,8 @@
+@@ -4807,6 +4813,8 @@
case SCH_TABLE_NAMES:
case SCH_TABLES:
/**
Try acquire high priority share metadata lock on a table (with
-@@ -6802,6 +7025,25 @@
+@@ -6849,6 +7072,25 @@
{0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
};
ST_FIELD_INFO columns_fields_info[]=
{
-@@ -7416,6 +7658,9 @@
+@@ -7463,6 +7705,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,
-@@ -7465,6 +7710,9 @@
+@@ -7512,6 +7757,9 @@
get_all_tables, make_table_names_old_format, 0, 1, 2, 1, 0},
{"TABLE_PRIVILEGES", table_privileges_fields_info, create_schema_table,
fill_schema_table_privileges, 0, 0, -1, -1, 0, 0},
diff -ruN a/scripts/mysqldumpslow.sh b/scripts/mysqldumpslow.sh
--- a/scripts/mysqldumpslow.sh 2010-11-03 01:01:13.000000000 +0300
+++ b/scripts/mysqldumpslow.sh 2010-12-16 04:27:46.000000000 +0300
-@@ -83,8 +83,8 @@
+@@ -101,8 +101,8 @@
s/^#? Time: \d{6}\s+\d+:\d+:\d+.*\n//;
my ($user,$host) = s/^#? User\@Host:\s+(\S+)\s+\@\s+(\S+).*\n// ? ($1,$2) : ('','');
diff -ruN a/sql/filesort.cc b/sql/filesort.cc
--- a/sql/filesort.cc 2010-11-03 01:01:14.000000000 +0300
+++ b/sql/filesort.cc 2010-12-16 04:27:46.000000000 +0300
-@@ -197,6 +197,7 @@
+@@ -193,6 +193,7 @@
{
status_var_increment(thd->status_var.filesort_scan_count);
}
#ifdef CAN_TRUST_RANGE
if (select && select->quick && select->quick->records > 0L)
{
-@@ -262,6 +263,7 @@
+@@ -258,6 +259,7 @@
}
else
{
if (table_sort.buffpek && table_sort.buffpek_len < maxbuffer)
{
my_free(table_sort.buffpek);
-@@ -1201,6 +1203,7 @@
+@@ -1197,6 +1199,7 @@
DBUG_ENTER("merge_buffers");
status_var_increment(current_thd->status_var.filesort_merge_passes);
diff -ruN a/sql/log.cc b/sql/log.cc
--- a/sql/log.cc 2010-11-03 07:01:14.000000000 +0900
+++ b/sql/log.cc 2010-12-02 19:28:31.337989417 +0900
-@@ -630,11 +630,13 @@
+@@ -715,11 +715,13 @@
*/
bool Log_to_csv_event_handler::
TABLE_LIST table_list;
TABLE *table;
bool result= TRUE;
-@@ -850,14 +852,14 @@
+@@ -935,14 +937,14 @@
/** Wrapper around MYSQL_LOG::write() for slow log. */
bool Log_to_file_event_handler::
user_host, user_host_len,
query_utime, lock_utime, is_command,
sql_text, sql_text_len);
-@@ -1131,7 +1133,7 @@
+@@ -1216,7 +1218,7 @@
/* fill in user_host value: the format is "%s[%s] @ %s [%s]" */
user_host_len= (strxnmov(user_host_buff, MAX_USER_HOST_SIZE,
sctx->priv_user ? sctx->priv_user : "", "[",
sctx->host ? sctx->host : "", " [",
sctx->ip ? sctx->ip : "", "]", NullS) -
user_host_buff);
-@@ -1139,8 +1141,22 @@
+@@ -1224,8 +1226,22 @@
current_time= my_time_possible_from_micro(current_utime);
if (thd->start_utime)
{
}
else
{
-@@ -1154,8 +1170,20 @@
+@@ -1239,8 +1255,20 @@
query_length= command_name[thd->command].length;
}
user_host_buff, user_host_len,
query_utime, lock_utime, is_command,
query, query_length) || error;
-@@ -2539,12 +2567,13 @@
+@@ -2656,12 +2684,13 @@
TRUE - error occured
*/
bool error= 0;
DBUG_ENTER("MYSQL_QUERY_LOG::write");
-@@ -2566,17 +2595,28 @@
+@@ -2683,17 +2712,28 @@
if (!(specialflag & SPECIAL_SHORT_LOG_FORMAT))
{
/* Note that my_b_write() assumes it knows the length for this */
if (my_b_write(&log_file, (uchar*) buff, buff_len))
-@@ -2594,12 +2634,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,
my_bool lower_case_file_system= 0;
my_bool opt_large_pages= 0;
my_bool opt_super_large_pages= 0;
-@@ -5789,10 +5793,10 @@
+@@ -5784,10 +5788,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. "
-@@ -7182,6 +7186,10 @@
+@@ -7179,6 +7183,10 @@
C_MODE_END
/**
Get server options from the command line,
and perform related server initializations.
-@@ -7321,6 +7329,8 @@
+@@ -7318,6 +7326,8 @@
global_system_variables.long_query_time= (ulonglong)
(global_system_variables.long_query_time_double * 1e6);
diff -ruN a/sql/slave.cc b/sql/slave.cc
--- a/sql/slave.cc 2010-11-03 01:01:14.000000000 +0300
+++ b/sql/slave.cc 2010-12-16 04:27:46.000000000 +0300
-@@ -2037,6 +2037,7 @@
+@@ -2038,6 +2038,7 @@
+ MAX_LOG_EVENT_HEADER; /* note, incr over the global not session var */
thd->slave_thread = 1;
thd->enable_slow_log= opt_log_slow_slave_statements;
for (Internal_error_handler *error_handler= m_internal_handler;
error_handler;
-@@ -3355,6 +3387,12 @@
+@@ -3389,6 +3421,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())
-@@ -3375,6 +3413,14 @@
+@@ -3409,6 +3447,14 @@
cuted_fields= 0;
transaction.savepoints= 0;
first_successful_insert_id_in_cur_stmt= 0;
}
-@@ -3437,6 +3483,12 @@
+@@ -3471,6 +3517,12 @@
*/
examined_row_count+= backup->examined_row_count;
cuted_fields+= backup->cuted_fields;
diff -ruN a/sql/sql_connect.cc b/sql/sql_connect.cc
--- a/sql/sql_connect.cc 2010-11-03 01:01:14.000000000 +0300
+++ b/sql/sql_connect.cc 2010-12-16 04:27:46.000000000 +0300
-@@ -738,6 +738,15 @@
+@@ -741,6 +741,15 @@
prepare_new_connection_state(thd);
diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc
--- a/sql/sql_parse.cc 2010-12-16 04:27:10.000000000 +0300
+++ b/sql/sql_parse.cc 2010-12-16 04:47:41.000000000 +0300
-@@ -1424,7 +1424,6 @@
+@@ -1431,7 +1431,6 @@
DBUG_RETURN(error);
}
void log_slow_statement(THD *thd)
{
DBUG_ENTER("log_slow_statement");
-@@ -1437,6 +1436,42 @@
+@@ -1444,6 +1443,42 @@
if (unlikely(thd->in_sub_stmt))
DBUG_VOID_RETURN; // Don't set time for sub stmt
/*
Do not log administrative statements unless the appropriate option is
set.
-@@ -1812,6 +1847,9 @@
+@@ -1819,6 +1854,9 @@
context.resolve_in_table_list_only(select_lex->
table_list.first);
/*
Reset warning count for each query that uses tables
A better approach would be to reset this for any commands
-@@ -5238,6 +5276,21 @@
+@@ -5258,6 +5296,21 @@
thd->rand_used= 0;
thd->sent_row_count= thd->examined_row_count= 0;
diff -ruN a/sql/sql_select.cc b/sql/sql_select.cc
--- a/sql/sql_select.cc 2010-12-16 04:27:10.000000000 +0300
+++ b/sql/sql_select.cc 2010-12-16 04:27:47.000000000 +0300
-@@ -6870,7 +6870,10 @@
+@@ -6872,7 +6872,10 @@
{
join->thd->server_status|=SERVER_QUERY_NO_INDEX_USED;
if (statistics)
}
}
else
-@@ -6884,7 +6887,10 @@
+@@ -6886,7 +6889,10 @@
{
join->thd->server_status|=SERVER_QUERY_NO_INDEX_USED;
if (statistics)
}
}
if (!table->no_keyread)
-@@ -10210,6 +10216,7 @@
+@@ -10217,6 +10223,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);
-@@ -11107,6 +11114,7 @@
+@@ -11115,6 +11122,7 @@
goto err;
}
status_var_increment(table->in_use->status_var.created_tmp_disk_tables);
share->db_record_offset= 1;
DBUG_RETURN(0);
err:
-@@ -11125,6 +11133,14 @@
+@@ -11133,6 +11141,14 @@
save_proc_info=thd->proc_info;
thd_proc_info(thd, "removing tmp table");
diff -ruN a/sql/sys_vars.cc b/sql/sys_vars.cc
--- a/sql/sys_vars.cc 2010-12-16 04:27:10.000000000 +0300
+++ b/sql/sys_vars.cc 2010-12-16 04:36:12.000000000 +0300
-@@ -2836,6 +2836,116 @@
+@@ -2852,6 +2852,116 @@
DEFAULT(FALSE), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_log_state));
diff -ruN a/client/mysqldump.c b/client/mysqldump.c
--- a/client/mysqldump.c 2010-07-28 16:47:58.264067653 +0400
+++ b/client/mysqldump.c 2010-07-28 16:47:59.604985656 +0400
-@@ -138,6 +138,8 @@
- #endif
+@@ -139,6 +139,8 @@
static uint opt_protocol= 0;
+ static char *opt_plugin_dir= 0, *opt_default_auth;
+static my_bool server_supports_sql_no_fcache= FALSE;
+
/*
Dynamic_string wrapper functions. In this file use these
wrappers, they will terminate the process if there is
-@@ -1471,6 +1473,17 @@
+@@ -1486,6 +1488,17 @@
/* Don't switch charsets for 4.1 and earlier. (bug#34192). */
server_supports_switching_charsets= FALSE;
}
/*
As we're going to set SQL_MODE, it would be lost on reconnect, so we
cannot reconnect.
-@@ -3143,7 +3156,12 @@
+@@ -3158,7 +3171,12 @@
/* now build the query string */
dynstr_append_checked(&query_string, filename);
dynstr_append_checked(&query_string, "'");
-@@ -3193,7 +3211,12 @@
+@@ -3208,7 +3226,12 @@
check_io(md_result_file);
}
diff -ruN a/sql/mysqld.h b/sql/mysqld.h
--- a/sql/mysqld.h 2010-07-28 16:47:58.565318871 +0400
+++ b/sql/mysqld.h 2010-07-28 16:48:03.004544367 +0400
-@@ -190,6 +190,8 @@
+@@ -192,6 +192,8 @@
extern ulong back_log;
extern char language[FN_REFLEN];
extern ulong server_id, concurrency;
#include <thr_alarm.h>
#include <ft_global.h>
-@@ -481,6 +486,11 @@
- ulong specialflag=0;
+@@ -484,6 +489,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;
+
+/* flashcache */
/**
Limit of the total number of prepared statements in the server.
Is necessary to protect the server against out-of-memory attacks.
-@@ -4172,6 +4182,97 @@
+@@ -4167,6 +4177,97 @@
#define decrement_handler_count()
#endif /* defined(_WIN32) || defined(HAVE_SMEM) */
#ifndef EMBEDDED_LIBRARY
#ifndef DBUG_OFF
-@@ -4426,6 +4527,10 @@
+@@ -4421,6 +4522,10 @@
test_lc_time_sz();
#endif
/*
We have enough space for fiddling with the argv, continue
*/
-@@ -4629,6 +4734,10 @@
+@@ -4624,6 +4729,10 @@
}
#endif
clean_up(1);
mysqld_exit(0);
}
-@@ -6448,6 +6557,7 @@
+@@ -6445,6 +6554,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},
@@ -384,6 +384,7 @@
lex->describe= 0;
lex->subqueries= FALSE;
- lex->view_prepare_mode= FALSE;
+ lex->context_analysis_only= 0;
+ lex->disable_flashcache= FALSE;
lex->derived_tables= 0;
lex->safe_to_cache_query= 1;
diff -ruN a/sql/sql_lex.h b/sql/sql_lex.h
--- a/sql/sql_lex.h 2010-07-28 16:47:58.575318748 +0400
+++ b/sql/sql_lex.h 2010-07-28 16:48:08.405691834 +0400
-@@ -2300,6 +2300,7 @@
- */
- bool view_prepare_mode;
+@@ -2293,6 +2293,7 @@
+
+ enum enum_yes_no_unknown tx_chain, tx_release;
bool safe_to_cache_query;
+ bool disable_flashcache;
bool subqueries, ignore;
diff -ruN a/sql/handler.cc b/sql/handler.cc
--- a/sql/handler.cc 2010-12-03 20:58:26.000000000 +0300
+++ b/sql/handler.cc 2010-12-30 00:59:23.000000000 +0300
-@@ -1239,6 +1239,8 @@
- if (cookie)
- tc_log->unlog(cookie, xid);
+@@ -1243,6 +1243,8 @@
+ goto end;
+ }
DBUG_EXECUTE_IF("crash_commit_after", DBUG_SUICIDE(););
+ if (is_real_trans)
+ thd->diff_commit_trans++;
RUN_HOOK(transaction, after_commit, (thd, FALSE));
end:
if (rw_trans && mdl_request.ticket)
-@@ -1393,6 +1395,8 @@
+@@ -1397,6 +1399,8 @@
/* Always cleanup. Even if nht==0. There may be savepoints. */
if (is_real_trans)
thd->transaction.cleanup();
if (all)
thd->transaction_rollback_request= FALSE;
-@@ -1796,6 +1800,7 @@
+@@ -1800,6 +1804,7 @@
ha_info->reset(); /* keep it conveniently zero-filled */
}
trans->ha_list= sv->ha_list;
DBUG_RETURN(error);
}
-@@ -2165,6 +2170,8 @@
+@@ -2169,6 +2174,8 @@
dup_ref=ref+ALIGN_SIZE(ref_length);
cached_table_flags= table_flags();
}
DBUG_RETURN(error);
}
-@@ -3596,6 +3603,127 @@
+@@ -3614,6 +3621,127 @@
return;
}
diff -ruN a/sql/log.cc b/sql/log.cc
--- a/sql/log.cc 2010-12-03 20:58:26.000000000 +0300
+++ b/sql/log.cc 2010-12-30 01:55:35.000000000 +0300
-@@ -922,6 +922,13 @@
+@@ -1007,6 +1007,13 @@
mysql_slow_log.reopen_file();
}
/*
Log error with all enabled log event handlers
-@@ -4843,6 +4850,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)
{
-@@ -4854,12 +4863,16 @@
+@@ -5052,12 +5061,16 @@
minimum());
if (e.write(file))
goto err;
}
if (thd->user_var_events.elements)
{
-@@ -4882,6 +4895,8 @@
+@@ -5080,6 +5093,8 @@
flags);
if (e.write(file))
goto err;
}
}
}
-@@ -4893,6 +4908,8 @@
+@@ -5091,6 +5106,8 @@
if (event_info->write(file) ||
DBUG_EVALUATE_IF("injecting_fault_writing", 1, 0))
goto err;
+ thd->binlog_bytes_written+= event_info->data_written;
error= 0;
-
-@@ -5056,7 +5073,8 @@
+ err:
+@@ -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);
-@@ -5103,6 +5121,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
-@@ -5171,6 +5190,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)));
-@@ -5281,20 +5301,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;
- int write_cache(IO_CACHE *cache, bool lock_log, bool flush_and_sync);
+ int write_cache(THD *thd, IO_CACHE *cache,
+ bool lock_log, bool flush_and_sync);
- void set_write_error(THD *thd);
+ void set_write_error(THD *thd, bool is_transactional);
bool check_write_error(THD *thd);
@@ -566,6 +567,7 @@
my_bool opt_optimizer_fix= 0;
/*
True if there is at least one per-hour limit for some user, so we should
-@@ -486,6 +487,7 @@
- ulong specialflag=0;
+@@ -489,6 +490,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;
+ulonglong denied_connections= 0;
/* flashcache */
int cachedev_fd;
-@@ -630,7 +632,9 @@
+@@ -633,7 +635,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
-@@ -1490,6 +1494,11 @@
+@@ -1493,6 +1497,11 @@
#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION
query_response_time_free();
#endif // HAVE_RESPONSE_TIME_DISTRIBUTION
#ifdef HAVE_REPLICATION
end_slave_list();
#endif
-@@ -1593,6 +1602,10 @@
+@@ -1596,6 +1605,10 @@
mysql_cond_destroy(&COND_thread_cache);
mysql_cond_destroy(&COND_flush_thread_cache);
mysql_cond_destroy(&COND_manager);
}
#endif /*EMBEDDED_LIBRARY*/
-@@ -3024,6 +3037,7 @@
+@@ -3019,6 +3032,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},
-@@ -3044,6 +3058,7 @@
+@@ -3039,6 +3053,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},
-@@ -3063,10 +3078,13 @@
+@@ -3058,10 +3073,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},
-@@ -3587,6 +3605,13 @@
+@@ -3582,6 +3600,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();
-@@ -3956,6 +3981,9 @@
+@@ -3951,6 +3976,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");
-@@ -4092,6 +4120,9 @@
+@@ -4087,6 +4115,9 @@
init_max_user_conn();
init_update_queries();
DBUG_RETURN(0);
}
-@@ -5123,6 +5154,7 @@
+@@ -5118,6 +5149,7 @@
{
sql_print_warning("%s", ER_DEFAULT(ER_CON_COUNT_ERROR));
}
delete thd;
DBUG_VOID_RETURN;
}
-@@ -7820,6 +7852,8 @@
+@@ -7817,6 +7849,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,
-@@ -7857,6 +7891,13 @@
+@@ -7854,6 +7888,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 my_bool opt_optimizer_fix;
extern my_bool opt_enable_named_pipe, opt_sync_frm, opt_allow_suspicious_udfs;
extern my_bool opt_secure_auth;
-@@ -180,6 +182,7 @@
+@@ -181,6 +183,7 @@
extern ulong slave_trans_retries;
extern uint slave_net_timeout;
extern uint max_user_connections;
+extern ulonglong denied_connections;
extern ulong what_to_log,flush_time;
extern ulong max_prepared_stmt_count, prepared_stmt_count;
- extern ulong binlog_cache_size, open_files_limit;
-@@ -205,6 +208,11 @@
+ extern ulong open_files_limit;
+@@ -207,6 +210,11 @@
extern struct system_variables max_system_variables;
extern struct system_status_var global_status_var;
extern struct rand_struct sql_rand;
extern const char *opt_date_time_formats[];
extern handlerton *partition_hton;
extern handlerton *myisam_hton;
-@@ -242,6 +250,8 @@
+@@ -244,6 +252,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_logger, key_LOCK_manager,
key_LOCK_prepared_stmt_count,
-@@ -338,7 +348,9 @@
+@@ -340,7 +350,9 @@
LOCK_delayed_status, LOCK_delayed_create, LOCK_crypt, LOCK_timezone,
LOCK_slave_list, LOCK_active_mi, LOCK_manager,
LOCK_global_system_variables, LOCK_user_conn,
extern MYSQL_PLUGIN_IMPORT mysql_mutex_t LOCK_thread_count;
#ifdef HAVE_OPENSSL
extern mysql_mutex_t LOCK_des_key_file;
-@@ -450,6 +462,16 @@
+@@ -452,6 +464,16 @@
return id;
}
/*
Init THD for query processing.
-@@ -1688,6 +1784,32 @@
+@@ -1722,6 +1818,32 @@
}
#endif
struct Item_change_record: public ilink
{
-@@ -1864,6 +1986,7 @@
+@@ -1898,6 +2020,7 @@
}
thd->sent_row_count++;
if (thd->vio_ok())
DBUG_RETURN(protocol->write());
-@@ -1956,6 +2079,7 @@
+@@ -1990,6 +2113,7 @@
select_export::~select_export()
{
thd->sent_row_count=row_count;
}
-@@ -2979,6 +3103,7 @@
+@@ -3013,6 +3137,7 @@
if (likely(thd != 0))
{ /* current_thd==0 when close_connection() calls net_send_error() */
thd->status_var.bytes_sent+= length;
}
}
-@@ -2986,6 +3111,7 @@
+@@ -3020,6 +3145,7 @@
void thd_increment_bytes_received(ulong length)
{
current_thd->status_var.bytes_received+= length;
void change_user(void);
void cleanup(void);
void cleanup_after_query();
-@@ -2726,6 +2778,15 @@
+@@ -2727,6 +2779,15 @@
}
thd_scheduler scheduler;
public:
inline Internal_error_handler *get_internal_handler()
{ return m_internal_handler; }
-@@ -2913,6 +2974,10 @@
+@@ -2914,6 +2975,10 @@
LEX_STRING invoker_host;
};
}
if (net->error && net->vio != 0)
-@@ -728,10 +1335,14 @@
- for (;;)
+@@ -729,12 +1336,16 @@
{
NET *net= &thd->net;
+ bool rc;
+ bool create_user= TRUE;
lex_start(thd);
- if (login_connection(thd))
+ rc= login_connection(thd);
+ MYSQL_AUDIT_NOTIFY_CONNECTION_CONNECT(thd);
+ if (rc)
+ {
+ create_user= FALSE;
goto end_thread;
+ }
- MYSQL_CONNECTION_START(thd->thread_id, thd->security_ctx->priv_user,
+ MYSQL_CONNECTION_START(thd->thread_id, &thd->security_ctx->priv_user[0],
(char *) thd->security_ctx->host_or_ip);
-@@ -758,6 +1369,8 @@
+@@ -761,6 +1372,8 @@
end_thread:
- close_connection(thd, 0, 1);
+ close_connection(thd);
+ thd->update_stats(false);
+ update_global_user_stats(thd, create_user, time(NULL));
if (MYSQL_CALLBACK_ELSE(thread_scheduler, end_thread, (thd, 1), 0))
diff -ruN a/sql/sql_insert.cc b/sql/sql_insert.cc
--- a/sql/sql_insert.cc 2010-12-03 20:58:26.000000000 +0300
+++ b/sql/sql_insert.cc 2010-12-31 04:12:35.000000000 +0300
-@@ -1073,13 +1073,14 @@
+@@ -1069,13 +1069,14 @@
if (error)
goto abort;
}
else
{
-@@ -1095,8 +1096,10 @@
+@@ -1091,8 +1092,10 @@
sprintf(buff, ER(ER_INSERT_INFO), (ulong) info.records,
(ulong) (info.deleted + updated),
(ulong) thd->warning_info->statement_warn_count());
thd->abort_on_warning= 0;
DBUG_RETURN(FALSE);
-@@ -3585,6 +3588,7 @@
+@@ -3539,6 +3542,7 @@
thd->first_successful_insert_id_in_prev_stmt :
(info.copied ? autoinc_value_of_last_inserted_row : 0));
::my_ok(thd, row_count, id, buff);
/*
Commands which always take a long time are logged into
the slow log only if opt_log_slow_admin_statements is set.
-@@ -1619,6 +1632,13 @@
+@@ -1626,6 +1639,13 @@
thd->profiling.discard_current_query();
#endif
break;
case SCH_OPEN_TABLES:
case SCH_VARIABLES:
case SCH_STATUS:
-@@ -1776,6 +1796,7 @@
+@@ -1783,6 +1803,7 @@
thd->security_ctx->priv_host)) &&
check_global_access(thd, SUPER_ACL))
{
my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), "SUPER");
DBUG_RETURN(TRUE);
}
-@@ -4705,6 +4726,7 @@
+@@ -4725,6 +4746,7 @@
case ACL_INTERNAL_ACCESS_DENIED:
if (! no_errors)
{
my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
sctx->priv_user, sctx->priv_host, db);
}
-@@ -4755,6 +4777,7 @@
+@@ -4775,6 +4797,7 @@
DBUG_PRINT("error",("No possible access"));
if (!no_errors)
{
if (thd->password == 2)
my_error(ER_ACCESS_DENIED_NO_PASSWORD_ERROR, MYF(0),
sctx->priv_user,
-@@ -4871,6 +4894,7 @@
+@@ -4891,6 +4914,7 @@
if (!thd->col_access && check_grant_db(thd, dst_db_name))
{
my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
thd->security_ctx->priv_user,
thd->security_ctx->priv_host,
-@@ -5141,6 +5165,7 @@
+@@ -5161,6 +5185,7 @@
if ((thd->security_ctx->master_access & want_access))
return 0;
get_privilege_desc(command, sizeof(command), want_access);
my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), command);
return 1;
#else
-@@ -5529,6 +5554,32 @@
+@@ -5542,6 +5567,32 @@
lex_start(thd);
mysql_reset_thd_for_next_command(thd);
if (query_cache_send_result_to_client(thd, rawbuf, length) <= 0)
{
LEX *lex= thd->lex;
-@@ -5597,6 +5648,52 @@
+@@ -5610,6 +5661,52 @@
DBUG_ASSERT(thd->change_list.is_empty());
}
DBUG_VOID_RETURN;
}
-@@ -2553,12 +2629,38 @@
+@@ -2540,12 +2616,38 @@
/* First of all clear possible warnings from the previous command */
mysql_reset_thd_for_next_command(thd);
}
#if defined(ENABLED_PROFILING)
-@@ -2576,6 +2678,53 @@
+@@ -2563,6 +2665,53 @@
/* Close connection socket; for use with client testing (Bug#43560). */
DBUG_EXECUTE_IF("close_conn_after_stmt_execute", vio_close(thd->net.vio););
DBUG_VOID_RETURN;
}
-@@ -2648,20 +2797,47 @@
+@@ -2635,20 +2784,47 @@
/* First of all clear possible warnings from the previous command */
mysql_reset_thd_for_next_command(thd);
}
thd->stmt_arena= stmt;
-@@ -2678,6 +2854,52 @@
+@@ -2665,6 +2841,52 @@
thd->restore_backup_statement(stmt, &stmt_backup);
thd->stmt_arena= thd;
DBUG_VOID_RETURN;
}
-@@ -2708,13 +2930,39 @@
+@@ -2695,13 +2917,39 @@
/* First of all clear possible warnings from the previous command */
mysql_reset_thd_for_next_command(thd);
}
stmt->close_cursor();
-@@ -2731,6 +2979,53 @@
+@@ -2718,6 +2966,53 @@
my_ok(thd);
diff -ruN a/sql/sql_reload.cc b/sql/sql_reload.cc
--- a/sql/sql_reload.cc 2010-12-03 20:58:26.000000000 +0300
+++ b/sql/sql_reload.cc 2010-12-31 05:00:59.000000000 +0300
-@@ -272,14 +272,48 @@
+@@ -280,14 +280,48 @@
mysql_mutex_unlock(&LOCK_active_mi);
}
#endif
+ }
+ mysql_mutex_unlock(&LOCK_global_user_client_stats);
+ }
- *write_to_binlog= tmp_write_to_binlog;
+ if (*write_to_binlog != -1)
+ *write_to_binlog= tmp_write_to_binlog;
/*
- If the query was killed then this function must fail.
diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc
--- a/sql/sql_show.cc 2010-12-03 20:58:26.000000000 +0300
+++ b/sql/sql_show.cc 2010-12-31 04:39:23.000000000 +0300
/* collect status for all running threads */
-@@ -7465,6 +7781,104 @@
+@@ -7512,6 +7828,104 @@
};
ST_FIELD_INFO processlist_fields_info[]=
{
{"ID", 4, MYSQL_TYPE_LONGLONG, 0, 0, "Id", SKIP_OPEN_TABLE},
-@@ -7654,6 +8068,8 @@
+@@ -7701,6 +8115,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,
-@@ -7663,6 +8079,8 @@
+@@ -7710,6 +8126,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
-@@ -7735,14 +8153,20 @@
+@@ -7782,14 +8200,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},
diff -ruN a/sql/sql_update.cc b/sql/sql_update.cc
--- a/sql/sql_update.cc 2010-12-03 20:58:26.000000000 +0300
+++ b/sql/sql_update.cc 2010-12-31 04:08:17.000000000 +0300
-@@ -894,8 +894,10 @@
+@@ -900,8 +900,10 @@
my_snprintf(buff, sizeof(buff), ER(ER_UPDATE_INFO), (ulong) found,
(ulong) updated,
(ulong) thd->warning_info->statement_warn_count());
DBUG_PRINT("info",("%ld records updated", (long) updated));
}
thd->count_cuted_fields= CHECK_FIELD_IGNORE; /* calc cuted fields */
-@@ -2136,7 +2138,9 @@
+@@ -2146,7 +2148,9 @@
thd->first_successful_insert_id_in_prev_stmt : 0;
my_snprintf(buff, sizeof(buff), ER(ER_UPDATE_INFO),
(ulong) found, (ulong) updated, (ulong) thd->cuted_fields);
diff -ruN a/sql/sys_vars.cc b/sql/sys_vars.cc
--- a/sql/sys_vars.cc 2010-12-03 20:58:26.000000000 +0300
+++ b/sql/sys_vars.cc 2010-12-30 02:22:25.000000000 +0300
-@@ -1547,6 +1547,17 @@
+@@ -1563,6 +1563,17 @@
NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(check_read_only), ON_UPDATE(fix_read_only));
diff -ruN a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
--- a/storage/myisam/ha_myisam.cc 2010-12-03 20:58:26.000000000 +0300
+++ b/storage/myisam/ha_myisam.cc 2010-12-31 05:58:01.000000000 +0300
-@@ -769,6 +769,7 @@
+@@ -768,6 +768,7 @@
int ha_myisam::write_row(uchar *buf)
{
ha_statistic_increment(&SSV::ha_write_count);
/* If we have a timestamp column, update it to the current time */
-@@ -781,11 +782,13 @@
+@@ -780,11 +781,13 @@
*/
if (table->next_number_field && buf == table->record[0])
{
}
int ha_myisam::check(THD* thd, HA_CHECK_OPT* check_opt)
-@@ -1536,16 +1539,24 @@
+@@ -1535,16 +1538,24 @@
int ha_myisam::update_row(const uchar *old_data, uchar *new_data)
{
}
int ha_myisam::index_read_map(uchar *buf, const uchar *key,
-@@ -1557,6 +1568,14 @@
+@@ -1556,6 +1567,14 @@
ha_statistic_increment(&SSV::ha_read_key_count);
int error=mi_rkey(file, buf, active_index, key, keypart_map, find_flag);
table->status=error ? STATUS_NOT_FOUND: 0;
MYSQL_INDEX_READ_ROW_DONE(error);
return error;
}
-@@ -1569,6 +1588,14 @@
+@@ -1568,6 +1587,14 @@
ha_statistic_increment(&SSV::ha_read_key_count);
int error=mi_rkey(file, buf, index, key, keypart_map, find_flag);
table->status=error ? STATUS_NOT_FOUND: 0;
MYSQL_INDEX_READ_ROW_DONE(error);
return error;
}
-@@ -1583,6 +1610,14 @@
+@@ -1582,6 +1609,14 @@
int error=mi_rkey(file, buf, active_index, key, keypart_map,
HA_READ_PREFIX_LAST);
table->status=error ? STATUS_NOT_FOUND: 0;
MYSQL_INDEX_READ_ROW_DONE(error);
DBUG_RETURN(error);
}
-@@ -1594,6 +1629,13 @@
+@@ -1593,6 +1628,13 @@
ha_statistic_increment(&SSV::ha_read_next_count);
int error=mi_rnext(file,buf,active_index);
table->status=error ? STATUS_NOT_FOUND: 0;
MYSQL_INDEX_READ_ROW_DONE(error);
return error;
}
-@@ -1605,6 +1647,13 @@
+@@ -1604,6 +1646,13 @@
ha_statistic_increment(&SSV::ha_read_prev_count);
int error=mi_rprev(file,buf, active_index);
table->status=error ? STATUS_NOT_FOUND: 0;
MYSQL_INDEX_READ_ROW_DONE(error);
return error;
}
-@@ -1616,6 +1665,14 @@
+@@ -1615,6 +1664,14 @@
ha_statistic_increment(&SSV::ha_read_first_count);
int error=mi_rfirst(file, buf, active_index);
table->status=error ? STATUS_NOT_FOUND: 0;
MYSQL_INDEX_READ_ROW_DONE(error);
return error;
}
-@@ -1627,6 +1684,14 @@
+@@ -1626,6 +1683,14 @@
ha_statistic_increment(&SSV::ha_read_last_count);
int error=mi_rlast(file, buf, active_index);
table->status=error ? STATUS_NOT_FOUND: 0;
MYSQL_INDEX_READ_ROW_DONE(error);
return error;
}
-@@ -1644,6 +1709,14 @@
+@@ -1643,6 +1708,14 @@
error= mi_rnext_same(file,buf);
} while (error == HA_ERR_RECORD_DELETED);
table->status=error ? STATUS_NOT_FOUND: 0;
MYSQL_INDEX_READ_ROW_DONE(error);
return error;
}
-@@ -1663,6 +1736,8 @@
+@@ -1662,6 +1735,8 @@
ha_statistic_increment(&SSV::ha_read_rnd_next_count);
int error=mi_scan(file, buf);
table->status=error ? STATUS_NOT_FOUND: 0;
MYSQL_READ_ROW_DONE(error);
return error;
}
-@@ -1679,6 +1754,8 @@
+@@ -1678,6 +1753,8 @@
ha_statistic_increment(&SSV::ha_read_rnd_count);
int error=mi_rrnd(file, buf, my_get_ptr(pos,ref_length));
table->status=error ? STATUS_NOT_FOUND: 0;