From 11822e221c03afb360db1585ec7b558f68f39495 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Arkadiusz=20Mi=C5=9Bkiewicz?= Date: Thu, 28 Apr 2011 08:02:37 +0000 Subject: [PATCH] - up to 5.5.11 Changed files: bug580324.patch -> 1.3 control_online_alter_index.patch -> 1.4 error_pad.patch -> 1.3 innodb_adaptive_hash_index_partitions.patch -> 1.5 innodb_admin_command_base.patch -> 1.4 innodb_buffer_pool_pages_i_s.patch -> 1.5 innodb_buffer_pool_shm.patch -> 1.5 innodb_bug60788.patch -> 1.1 innodb_deadlock_count.patch -> 1.5 innodb_dict_size_limit.patch -> 1.4 innodb_expand_fast_index_creation.patch -> 1.1 innodb_expand_import.patch -> 1.5 innodb_extend_slow.patch -> 1.4 innodb_extra_rseg.patch -> 1.4 innodb_fast_checksum.patch -> 1.5 innodb_files_extend.patch -> 1.5 innodb_fix_misc.patch -> 1.5 innodb_io_patches.patch -> 1.4 innodb_lru_dump_restore.patch -> 1.5 innodb_overwrite_relay_log_info.patch -> 1.5 innodb_pass_corrupt_table.patch -> 1.5 innodb_recovery_patches.patch -> 1.5 innodb_separate_doublewrite.patch -> 1.5 innodb_show_lock_name.patch -> 1.4 innodb_show_status.patch -> 1.4 innodb_show_status_extend.patch -> 1.5 innodb_show_sys_tables.patch -> 1.4 innodb_split_buf_pool_mutex.patch -> 1.4 innodb_stats.patch -> 1.5 innodb_thread_concurrency_timer_based.patch -> 1.4 log_connection_error.patch -> 1.4 log_warnings_suppress.patch -> 1.3 mysql.spec -> 1.548 mysql_remove_eol_carret.patch -> 1.3 mysql_syslog.patch -> 1.4 optimizer_fix.patch -> 1.4 query_cache_enhance.patch -> 1.5 response_time_distribution.patch -> 1.4 show_slave_status_nolock.patch -> 1.4 show_temp.patch -> 1.4 slow_extended.patch -> 1.5 sql_no_fcache.patch -> 1.4 start-stop-messages.patch -> 1.1 userstat.patch -> 1.5 --- bug580324.patch | 18 +- control_online_alter_index.patch | 4 +- error_pad.patch | 12 +- innodb_adaptive_hash_index_partitions.patch | 34 +- innodb_admin_command_base.patch | 4 +- innodb_buffer_pool_pages_i_s.patch | 6 +- innodb_buffer_pool_shm.patch | 58 +- innodb_bug60788.patch | 124 ++++ innodb_deadlock_count.patch | 6 +- innodb_dict_size_limit.patch | 30 +- innodb_expand_fast_index_creation.patch | 730 ++++++++++++++++++++ innodb_expand_import.patch | 16 +- innodb_extend_slow.patch | 42 +- innodb_extra_rseg.patch | 68 +- innodb_fast_checksum.patch | 6 +- innodb_files_extend.patch | 16 +- innodb_fix_misc.patch | 102 +-- innodb_io_patches.patch | 89 ++- innodb_lru_dump_restore.patch | 18 +- innodb_overwrite_relay_log_info.patch | 89 +-- innodb_pass_corrupt_table.patch | 60 +- innodb_recovery_patches.patch | 4 +- innodb_separate_doublewrite.patch | 32 +- innodb_show_lock_name.patch | 18 +- innodb_show_status.patch | 26 +- innodb_show_status_extend.patch | 14 +- innodb_show_sys_tables.patch | 2 +- innodb_split_buf_pool_mutex.patch | 226 +++--- innodb_stats.patch | 403 ++++++++++- innodb_thread_concurrency_timer_based.patch | 14 +- log_connection_error.patch | 16 +- log_warnings_suppress.patch | 32 +- mysql.spec | 12 +- mysql_remove_eol_carret.patch | 20 +- mysql_syslog.patch | 10 +- optimizer_fix.patch | 6 +- query_cache_enhance.patch | 36 +- response_time_distribution.patch | 150 ++-- show_slave_status_nolock.patch | 36 +- show_temp.patch | 55 +- slow_extended.patch | 148 ++-- sql_no_fcache.patch | 70 +- start-stop-messages.patch | 192 +++++ userstat.patch | 230 +++--- 44 files changed, 2320 insertions(+), 964 deletions(-) create mode 100644 innodb_bug60788.patch create mode 100644 innodb_expand_fast_index_creation.patch create mode 100644 start-stop-messages.patch diff --git a/bug580324.patch b/bug580324.patch index 0e77e20..8d9db27 100644 --- a/bug580324.patch +++ b/bug580324.patch @@ -6,8 +6,8 @@ # Any small change to this file in the main branch # should be done or reviewed by the maintainer! diff -ruN a/sql/sql_base.cc b/sql/sql_base.cc ---- a/sql/sql_base.cc 2011-01-11 21:35:26.000000000 +0300 -+++ b/sql/sql_base.cc 2011-01-11 21:42:02.000000000 +0300 +--- a/sql/sql_base.cc 2011-04-09 18:49:00.000000000 +0400 ++++ b/sql/sql_base.cc 2011-04-09 18:49:02.000000000 +0400 @@ -251,8 +251,12 @@ const TABLE_LIST *table_list, bool tmp_table) @@ -24,9 +24,9 @@ diff -ruN a/sql/sql_base.cc b/sql/sql_base.cc { int4store(key + key_length, thd->server_id); 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 -@@ -1113,11 +1113,18 @@ +--- a/sql/sql_parse.cc 2011-04-09 18:49:00.000000000 +0400 ++++ b/sql/sql_parse.cc 2011-04-09 18:49:02.000000000 +0400 +@@ -1112,11 +1112,18 @@ break; #else { @@ -46,7 +46,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc /* SHOW statements should not add the used tables to the list of tables used in a transaction. -@@ -1130,24 +1137,23 @@ +@@ -1129,24 +1136,23 @@ /* We have name + wildcard in packet, separated by endzero */ @@ -83,7 +83,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc mysql_reset_thd_for_next_command(thd); lex_start(thd); /* Must be before we init the table list. */ -@@ -1172,9 +1178,6 @@ +@@ -1171,9 +1177,6 @@ table_list.schema_table= schema_table; } @@ -94,8 +94,8 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc general_log_print(thd, command, "%s %s", table_list.table_name, fields); diff -ruN a/strings/ctype-utf8.c b/strings/ctype-utf8.c ---- a/strings/ctype-utf8.c 2010-12-03 20:58:26.000000000 +0300 -+++ b/strings/ctype-utf8.c 2011-01-11 21:42:02.000000000 +0300 +--- a/strings/ctype-utf8.c 2011-04-09 18:48:03.000000000 +0400 ++++ b/strings/ctype-utf8.c 2011-04-09 18:49:02.000000000 +0400 @@ -4212,6 +4212,10 @@ { int code; diff --git a/control_online_alter_index.patch b/control_online_alter_index.patch index 794bc41..5c72e03 100644 --- a/control_online_alter_index.patch +++ b/control_online_alter_index.patch @@ -8,7 +8,7 @@ diff -ruN a/sql/handler.h b/sql/handler.h --- a/sql/handler.h 2010-11-03 07:01:14.000000000 +0900 +++ b/sql/handler.h 2010-12-03 13:51:04.727293058 +0900 -@@ -197,6 +197,8 @@ +@@ -203,6 +203,8 @@ #define HA_INPLACE_DROP_UNIQUE_INDEX_NO_WRITE (1L << 9) #define HA_INPLACE_ADD_PK_INDEX_NO_WRITE (1L << 10) #define HA_INPLACE_DROP_PK_INDEX_NO_WRITE (1L << 11) @@ -63,7 +63,7 @@ diff -ruN a/sql/sql_table.cc b/sql/sql_table.cc diff -ruN a/sql/sys_vars.cc b/sql/sys_vars.cc --- a/sql/sys_vars.cc 2010-12-02 21:23:05.569356468 +0900 +++ b/sql/sys_vars.cc 2010-12-03 14:05:28.857356603 +0900 -@@ -2140,6 +2140,13 @@ +@@ -2150,6 +2150,13 @@ GLOBAL_VAR(opt_optimizer_fix), NO_CMD_LINE, DEFAULT(TRUE)); diff --git a/error_pad.patch b/error_pad.patch index 240de9d..f6abf72 100644 --- a/error_pad.patch +++ b/error_pad.patch @@ -6,8 +6,8 @@ # Any small change to this file in the main branch # should be done or reviewed by the maintainer! diff -ruN a/extra/comp_err.c b/extra/comp_err.c ---- a/extra/comp_err.c 2010-08-03 17:24:24.000000000 +0000 -+++ b/extra/comp_err.c 2010-09-14 16:49:28.000000000 +0000 +--- a/extra/comp_err.c 2011-04-09 18:48:04.000000000 +0400 ++++ b/extra/comp_err.c 2011-04-09 18:48:56.000000000 +0400 @@ -30,11 +30,12 @@ #include #include @@ -38,7 +38,7 @@ diff -ruN a/extra/comp_err.c b/extra/comp_err.c static struct errors *parse_error_string(char *ptr, int er_count); static struct message *parse_message_string(struct message *new_message, char *str); -@@ -252,6 +255,11 @@ +@@ -251,6 +254,11 @@ for (tmp_error= error_head; tmp_error; tmp_error= tmp_error->next_error) { @@ -50,7 +50,7 @@ diff -ruN a/extra/comp_err.c b/extra/comp_err.c /* generating mysqld_error.h fprintf() will automatically add \r on windows -@@ -344,12 +352,29 @@ +@@ -343,12 +351,29 @@ "language\n", tmp_error->er_name, tmp_lang->lang_short_name); goto err; } @@ -84,7 +84,7 @@ diff -ruN a/extra/comp_err.c b/extra/comp_err.c } /* continue with header of the errmsg.sys file */ -@@ -500,14 +525,26 @@ +@@ -499,14 +524,26 @@ DBUG_RETURN(0); continue; } @@ -116,7 +116,7 @@ diff -ruN a/extra/comp_err.c b/extra/comp_err.c /* add error to the list */ *tail_error= current_error; -@@ -848,78 +885,122 @@ +@@ -847,78 +884,122 @@ DBUG_RETURN(new_message); } diff --git a/innodb_adaptive_hash_index_partitions.patch b/innodb_adaptive_hash_index_partitions.patch index dcbed93..e76cc93 100644 --- a/innodb_adaptive_hash_index_partitions.patch +++ b/innodb_adaptive_hash_index_partitions.patch @@ -8,7 +8,7 @@ diff -ruN a/storage/innobase/btr/btr0btr.c b/storage/innobase/btr/btr0btr.c --- a/storage/innobase/btr/btr0btr.c 2010-12-04 15:52:23.355483176 +0900 +++ b/storage/innobase/btr/btr0btr.c 2010-12-04 16:12:48.639514256 +0900 -@@ -954,7 +954,7 @@ +@@ -1518,7 +1518,7 @@ } ut_a(block); @@ -17,7 +17,7 @@ diff -ruN a/storage/innobase/btr/btr0btr.c b/storage/innobase/btr/btr0btr.c header = buf_block_get_frame(block) + PAGE_HEADER + PAGE_BTR_SEG_TOP; #ifdef UNIV_BTR_DEBUG -@@ -1023,7 +1023,7 @@ +@@ -1587,7 +1587,7 @@ #ifndef UNIV_HOTBACKUP if (UNIV_LIKELY(!recovery)) { @@ -26,16 +26,16 @@ diff -ruN a/storage/innobase/btr/btr0btr.c b/storage/innobase/btr/btr0btr.c } block->check_index_page_at_flush = TRUE; -@@ -1188,7 +1188,7 @@ +@@ -1755,7 +1755,7 @@ ut_a(!page_zip || page_zip_validate(page_zip, page)); #endif /* UNIV_ZIP_DEBUG */ - btr_search_drop_page_hash_index(block); + btr_search_drop_page_hash_index(block, index); + btr_blob_dbg_remove(page, index, "btr_page_empty"); /* Recreate the page: note that global data on page (possible - segment headers, next page-field, etc.) is preserved intact */ -@@ -2497,7 +2497,7 @@ +@@ -3065,7 +3065,7 @@ mem_heap_free(heap); } @@ -44,7 +44,7 @@ diff -ruN a/storage/innobase/btr/btr0btr.c b/storage/innobase/btr/btr0btr.c /* Make the father empty */ btr_page_empty(father_block, father_page_zip, index, page_level, mtr); -@@ -2720,7 +2720,7 @@ +@@ -3289,7 +3289,7 @@ goto err_exit; } @@ -53,7 +53,7 @@ diff -ruN a/storage/innobase/btr/btr0btr.c b/storage/innobase/btr/btr0btr.c /* Remove the page from the level list */ btr_level_list_remove(space, zip_size, page, mtr); -@@ -2761,7 +2761,7 @@ +@@ -3330,7 +3330,7 @@ goto err_exit; } @@ -62,7 +62,7 @@ diff -ruN a/storage/innobase/btr/btr0btr.c b/storage/innobase/btr/btr0btr.c #ifdef UNIV_BTR_DEBUG if (UNIV_LIKELY_NULL(merge_page_zip)) { -@@ -2875,7 +2875,7 @@ +@@ -3445,7 +3445,7 @@ ut_a(btr_page_get_next(page, mtr) == FIL_NULL); ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX)); @@ -71,7 +71,7 @@ diff -ruN a/storage/innobase/btr/btr0btr.c b/storage/innobase/btr/btr0btr.c btr_page_get_father(index, block, mtr, &cursor); father = btr_cur_get_block(&cursor); -@@ -2980,7 +2980,7 @@ +@@ -3550,7 +3550,7 @@ page = buf_block_get_frame(block); ut_a(page_is_comp(merge_page) == page_is_comp(page)); @@ -137,7 +137,7 @@ diff -ruN a/storage/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c } page_zip = buf_block_get_page_zip(block); -@@ -2778,7 +2778,7 @@ +@@ -2779,7 +2779,7 @@ } if (block->is_hashed) { @@ -146,7 +146,7 @@ diff -ruN a/storage/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c } btr_cur_del_mark_set_clust_rec_log(flags, rec, index, val, trx, -@@ -2905,13 +2905,13 @@ +@@ -2906,13 +2906,13 @@ == dict_table_is_comp(cursor->index->table)); if (block->is_hashed) { @@ -1054,7 +1054,7 @@ diff -ruN a/storage/innobase/ha/ha0ha.c b/storage/innobase/ha/ha0ha.c diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc --- a/storage/innobase/handler/ha_innodb.cc 2010-12-04 16:12:20.185850734 +0900 +++ b/storage/innobase/handler/ha_innodb.cc 2010-12-04 16:12:48.674552412 +0900 -@@ -11671,6 +11671,11 @@ +@@ -11682,6 +11682,11 @@ "Disable with --skip-innodb-adaptive-hash-index.", NULL, innodb_adaptive_hash_index_update, TRUE); @@ -1066,7 +1066,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ static MYSQL_SYSVAR_ULONG(replication_delay, srv_replication_delay, PLUGIN_VAR_RQCMDARG, "Replication thread delay (ms) on the slave server if " -@@ -12041,6 +12046,7 @@ +@@ -12047,6 +12052,7 @@ MYSQL_SYSVAR(use_sys_stats_table), MYSQL_SYSVAR(stats_sample_pages), MYSQL_SYSVAR(adaptive_hash_index), @@ -1469,7 +1469,7 @@ diff -ruN a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c --- a/storage/innobase/srv/srv0srv.c 2010-12-04 16:12:20.231484679 +0900 +++ b/storage/innobase/srv/srv0srv.c 2010-12-04 16:12:48.726551018 +0900 -@@ -2048,7 +2048,9 @@ +@@ -2050,7 +2050,9 @@ "-------------------------------------\n", file); ibuf_print(file); @@ -1480,7 +1480,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c fprintf(file, "%.2f hash searches/s, %.2f non-hash searches/s\n", -@@ -2073,14 +2075,15 @@ +@@ -2075,14 +2077,15 @@ ut_total_allocated_memory, mem_pool_get_reserved(mem_comm_pool)); /* Calcurate reserved memories */ @@ -1500,7 +1500,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c lock_sys_subtotal = 0; if (trx_sys) { -@@ -2107,10 +2110,10 @@ +@@ -2109,10 +2112,10 @@ " Threads %lu \t(%lu + %lu)\n", (ulong) (btr_search_sys @@ -1535,7 +1535,7 @@ diff -ruN a/storage/innobase/sync/sync0sync.c b/storage/innobase/sync/sync0sync. diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c --- a/storage/innobase/trx/trx0trx.c 2010-12-03 17:49:11.623953784 +0900 +++ b/storage/innobase/trx/trx0trx.c 2010-12-04 16:12:48.731513275 +0900 -@@ -266,8 +266,14 @@ +@@ -267,8 +267,14 @@ /*=================================*/ trx_t* trx) /*!< in: transaction */ { diff --git a/innodb_admin_command_base.patch b/innodb_admin_command_base.patch index 3bc4034..07acfd5 100644 --- a/innodb_admin_command_base.patch +++ b/innodb_admin_command_base.patch @@ -8,7 +8,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc --- a/storage/innobase/handler/ha_innodb.cc 2010-12-03 17:32:15.624039043 +0900 +++ b/storage/innobase/handler/ha_innodb.cc 2010-12-03 17:32:35.424957827 +0900 -@@ -11833,7 +11833,8 @@ +@@ -11839,7 +11839,8 @@ i_s_innodb_sys_foreign_cols, i_s_innodb_sys_stats, i_s_innodb_table_stats, @@ -21,7 +21,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ diff -ruN a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc --- a/storage/innobase/handler/i_s.cc 2010-12-03 17:30:16.299955549 +0900 +++ b/storage/innobase/handler/i_s.cc 2010-12-03 17:32:35.425989972 +0900 -@@ -4161,3 +4161,139 @@ +@@ -4179,3 +4179,139 @@ STRUCT_FLD(system_vars, NULL), STRUCT_FLD(__reserved1, NULL) }; diff --git a/innodb_buffer_pool_pages_i_s.patch b/innodb_buffer_pool_pages_i_s.patch index 2059e51..660ebd3 100644 --- a/innodb_buffer_pool_pages_i_s.patch +++ b/innodb_buffer_pool_pages_i_s.patch @@ -8,7 +8,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c --- a/storage/innobase/buf/buf0buf.c 2010-12-04 20:20:44.595483291 +0900 +++ b/storage/innobase/buf/buf0buf.c 2010-12-06 19:28:04.055227506 +0900 -@@ -4516,6 +4516,36 @@ +@@ -4519,6 +4519,36 @@ mutex_exit(block_mutex); } @@ -48,7 +48,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc --- a/storage/innobase/handler/ha_innodb.cc 2010-12-04 20:20:44.614551139 +0900 +++ b/storage/innobase/handler/ha_innodb.cc 2010-12-06 19:23:47.622195800 +0900 -@@ -12121,6 +12121,9 @@ +@@ -12127,6 +12127,9 @@ i_s_innodb_sys_stats, i_s_innodb_table_stats, i_s_innodb_index_stats, @@ -69,7 +69,7 @@ diff -ruN a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc } static const char plugin_author[] = "Innobase Oy"; -@@ -4328,3 +4329,701 @@ +@@ -4346,3 +4347,701 @@ STRUCT_FLD(system_vars, NULL), STRUCT_FLD(__reserved1, NULL) }; diff --git a/innodb_buffer_pool_shm.patch b/innodb_buffer_pool_shm.patch index 088672f..48c4535 100644 --- a/innodb_buffer_pool_shm.patch +++ b/innodb_buffer_pool_shm.patch @@ -6,8 +6,8 @@ # Any small change to this file in the main branch # should be done or reviewed by the maintainer! diff -ruN a/storage/innobase/buf/buf0buddy.c b/storage/innobase/buf/buf0buddy.c ---- a/storage/innobase/buf/buf0buddy.c 2010-12-04 19:46:39.372513543 +0900 -+++ b/storage/innobase/buf/buf0buddy.c 2010-12-07 17:56:28.302087851 +0900 +--- a/storage/innobase/buf/buf0buddy.c 2011-04-09 18:48:28.000000000 +0400 ++++ b/storage/innobase/buf/buf0buddy.c 2011-04-09 18:48:48.000000000 +0400 @@ -183,7 +183,7 @@ void* buf, /*!< in: buffer frame to deallocate */ ibool have_page_hash_mutex) @@ -27,8 +27,8 @@ diff -ruN a/storage/innobase/buf/buf0buddy.c b/storage/innobase/buf/buf0buddy.c ut_ad(!mutex_own(&buf_pool->zip_mutex)); ut_ad(buf_block_get_state(block) == BUF_BLOCK_READY_FOR_USE); diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c ---- a/storage/innobase/buf/buf0buf.c 2010-12-06 20:16:21.726195340 +0900 -+++ b/storage/innobase/buf/buf0buf.c 2010-12-07 20:40:30.824749814 +0900 +--- a/storage/innobase/buf/buf0buf.c 2011-04-09 18:48:47.000000000 +0400 ++++ b/storage/innobase/buf/buf0buf.c 2011-04-09 18:48:48.000000000 +0400 @@ -53,6 +53,10 @@ #include "page0zip.h" #include "trx0trx.h" @@ -658,8 +658,8 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c if (srv_buf_pool_old_size == srv_buf_pool_size) { diff -ruN a/storage/innobase/ha/hash0hash.c b/storage/innobase/ha/hash0hash.c ---- a/storage/innobase/ha/hash0hash.c 2010-11-03 07:01:13.000000000 +0900 -+++ b/storage/innobase/ha/hash0hash.c 2010-12-07 16:10:14.937749140 +0900 +--- a/storage/innobase/ha/hash0hash.c 2011-04-09 18:48:05.000000000 +0400 ++++ b/storage/innobase/ha/hash0hash.c 2011-04-09 18:48:48.000000000 +0400 @@ -133,6 +133,70 @@ } @@ -732,8 +732,8 @@ diff -ruN a/storage/innobase/ha/hash0hash.c b/storage/innobase/ha/hash0hash.c UNIV_INTERN void diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc ---- a/storage/innobase/handler/ha_innodb.cc 2010-12-06 20:16:21.733263627 +0900 -+++ b/storage/innobase/handler/ha_innodb.cc 2010-12-07 17:56:28.316139830 +0900 +--- a/storage/innobase/handler/ha_innodb.cc 2011-04-09 18:48:47.000000000 +0400 ++++ b/storage/innobase/handler/ha_innodb.cc 2011-04-09 18:48:48.000000000 +0400 @@ -194,6 +194,7 @@ static my_bool innobase_create_status_file = FALSE; static my_bool innobase_stats_on_metadata = TRUE; @@ -765,7 +765,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ #ifdef HAVE_LARGE_PAGES if ((os_use_large_pages = (ibool) my_use_large_pages)) -@@ -11702,6 +11712,16 @@ +@@ -11713,6 +11723,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); @@ -782,7 +782,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ static MYSQL_SYSVAR_ULONG(commit_concurrency, innobase_commit_concurrency, PLUGIN_VAR_RQCMDARG, "Helps in performance tuning in heavily concurrent environments.", -@@ -12000,6 +12020,8 @@ +@@ -12006,6 +12026,8 @@ MYSQL_SYSVAR(autoextend_increment), MYSQL_SYSVAR(buffer_pool_size), MYSQL_SYSVAR(buffer_pool_instances), @@ -792,8 +792,8 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ MYSQL_SYSVAR(fast_checksum), MYSQL_SYSVAR(commit_concurrency), diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h ---- a/storage/innobase/include/buf0buf.h 2010-12-06 20:16:21.778264552 +0900 -+++ b/storage/innobase/include/buf0buf.h 2010-12-07 17:56:28.322749380 +0900 +--- a/storage/innobase/include/buf0buf.h 2011-04-09 18:48:47.000000000 +0400 ++++ b/storage/innobase/include/buf0buf.h 2011-04-09 18:48:48.000000000 +0400 @@ -36,6 +36,7 @@ #ifndef UNIV_HOTBACKUP #include "ut0rbt.h" @@ -819,8 +819,8 @@ diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0bu /** 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 +--- a/storage/innobase/include/hash0hash.h 2011-04-09 18:48:05.000000000 +0400 ++++ b/storage/innobase/include/hash0hash.h 2011-04-09 18:48:48.000000000 +0400 @@ -49,6 +49,28 @@ hash_create( /*========*/ @@ -903,8 +903,8 @@ diff -ruN a/storage/innobase/include/hash0hash.h b/storage/innobase/include/hash /************************************************************//** Gets the mutex index for a fold value in a hash table. diff -ruN a/storage/innobase/include/os0proc.h b/storage/innobase/include/os0proc.h ---- a/storage/innobase/include/os0proc.h 2010-11-03 07:01:13.000000000 +0900 -+++ b/storage/innobase/include/os0proc.h 2010-12-07 16:10:14.955718750 +0900 +--- a/storage/innobase/include/os0proc.h 2011-04-09 18:48:05.000000000 +0400 ++++ b/storage/innobase/include/os0proc.h 2011-04-09 18:48:48.000000000 +0400 @@ -32,6 +32,11 @@ #ifdef UNIV_LINUX #include @@ -948,8 +948,8 @@ diff -ruN a/storage/innobase/include/os0proc.h b/storage/innobase/include/os0pro #include "os0proc.ic" #endif diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h ---- a/storage/innobase/include/srv0srv.h 2010-12-04 20:20:28.016566697 +0900 -+++ b/storage/innobase/include/srv0srv.h 2010-12-07 16:10:14.956717659 +0900 +--- a/storage/innobase/include/srv0srv.h 2011-04-09 18:48:45.000000000 +0400 ++++ b/storage/innobase/include/srv0srv.h 2011-04-09 18:48:48.000000000 +0400 @@ -171,6 +171,10 @@ extern ulint srv_mem_pool_size; extern ulint srv_lock_table_size; @@ -962,8 +962,8 @@ diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0sr extern ulint srv_n_file_io_threads; diff -ruN a/storage/innobase/include/ut0lst.h b/storage/innobase/include/ut0lst.h ---- a/storage/innobase/include/ut0lst.h 2010-11-03 07:01:13.000000000 +0900 -+++ b/storage/innobase/include/ut0lst.h 2010-12-07 16:10:14.957785525 +0900 +--- a/storage/innobase/include/ut0lst.h 2011-04-09 18:48:05.000000000 +0400 ++++ b/storage/innobase/include/ut0lst.h 2011-04-09 18:48:48.000000000 +0400 @@ -257,5 +257,48 @@ ut_a(ut_list_node_313 == NULL); \ } while (0) @@ -1014,8 +1014,8 @@ diff -ruN a/storage/innobase/include/ut0lst.h b/storage/innobase/include/ut0lst. #endif diff -ruN a/storage/innobase/log/log0recv.c b/storage/innobase/log/log0recv.c ---- a/storage/innobase/log/log0recv.c 2010-12-04 19:46:40.212513377 +0900 -+++ b/storage/innobase/log/log0recv.c 2010-12-07 16:10:14.959785817 +0900 +--- a/storage/innobase/log/log0recv.c 2011-04-09 18:48:42.000000000 +0400 ++++ b/storage/innobase/log/log0recv.c 2011-04-09 18:48:48.000000000 +0400 @@ -2912,6 +2912,7 @@ /*==========================*/ { @@ -1025,8 +1025,8 @@ diff -ruN a/storage/innobase/log/log0recv.c b/storage/innobase/log/log0recv.c recv_needed_recovery = TRUE; diff -ruN a/storage/innobase/os/os0proc.c b/storage/innobase/os/os0proc.c ---- a/storage/innobase/os/os0proc.c 2010-11-03 07:01:13.000000000 +0900 -+++ b/storage/innobase/os/os0proc.c 2010-12-07 16:10:14.960800123 +0900 +--- a/storage/innobase/os/os0proc.c 2011-04-09 18:48:05.000000000 +0400 ++++ b/storage/innobase/os/os0proc.c 2011-04-09 18:48:48.000000000 +0400 @@ -229,3 +229,173 @@ } #endif @@ -1202,8 +1202,8 @@ diff -ruN a/storage/innobase/os/os0proc.c b/storage/innobase/os/os0proc.c +#endif /* HAVE_SYS_IPC_H && HAVE_SYS_SHM_H */ +} diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c ---- a/storage/innobase/srv/srv0srv.c 2010-12-04 20:20:44.687550693 +0900 -+++ b/storage/innobase/srv/srv0srv.c 2010-12-07 16:10:14.962785720 +0900 +--- a/storage/innobase/srv/srv0srv.c 2011-04-09 18:48:46.000000000 +0400 ++++ b/storage/innobase/srv/srv0srv.c 2011-04-09 18:48:48.000000000 +0400 @@ -235,6 +235,11 @@ UNIV_INTERN ulint srv_mem_pool_size = ULINT_MAX; UNIV_INTERN ulint srv_lock_table_size = ULINT_MAX; @@ -1217,9 +1217,9 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c instead. */ UNIV_INTERN ulint srv_n_file_io_threads = ULINT_MAX; diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c ---- a/storage/innobase/srv/srv0start.c 2010-12-04 20:19:29.806482628 +0900 -+++ b/storage/innobase/srv/srv0start.c 2010-12-07 16:10:14.964785346 +0900 -@@ -1838,6 +1838,8 @@ +--- a/storage/innobase/srv/srv0start.c 2011-04-09 18:48:43.000000000 +0400 ++++ b/storage/innobase/srv/srv0start.c 2011-04-09 18:48:48.000000000 +0400 +@@ -1844,6 +1844,8 @@ Note that this is not as heavy weight as it seems. At this point there will be only ONE page in the buf_LRU and there must be no page in the buf_flush list. */ diff --git a/innodb_bug60788.patch b/innodb_bug60788.patch new file mode 100644 index 0000000..d1e2cc4 --- /dev/null +++ b/innodb_bug60788.patch @@ -0,0 +1,124 @@ +# name : innodb_bug60788.patch +# maintainer : Alexey +# +# Fix for MySQL bug #60788: InnoDB crashes with an assertion failure when +# receiving a signal on pwrite() +# +# Changes InnoDB IO code so that fsync(), pread() and pwrite() are restarted +# when interrupted by a signal. +# +diff -ruN a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c +--- a/storage/innobase/os/os0file.c 2011-04-20 12:09:57.000000000 +0400 ++++ b/storage/innobase/os/os0file.c 2011-04-20 12:10:04.000000000 +0400 +@@ -2083,6 +2083,9 @@ + failures++; + + retry = TRUE; ++ } else if (ret == -1 && errno == EINTR) { ++ /* Handle signal interruptions correctly */ ++ retry = TRUE; + } else { + + retry = FALSE; +@@ -2212,6 +2215,7 @@ + off_t offs; + #if defined(HAVE_PREAD) && !defined(HAVE_BROKEN_PREAD) + ssize_t n_bytes; ++ ssize_t n_read; + #endif /* HAVE_PREAD && !HAVE_BROKEN_PREAD */ + ulint sec; + ulint ms; +@@ -2252,7 +2256,18 @@ + os_n_pending_reads++; + os_mutex_exit(os_file_count_mutex); + +- n_bytes = pread(file, buf, (ssize_t)n, offs); ++ /* Handle signal interruptions correctly */ ++ for (n_bytes = 0; n_bytes < (ssize_t) n; ) { ++ n_read = pread(file, buf, (ssize_t)n, offs); ++ if (n_read > 0) { ++ n_bytes += n_read; ++ offs += n_read; ++ } else if (n_read == -1 && errno == EINTR) { ++ continue; ++ } else { ++ break; ++ } ++ } + + os_mutex_enter(os_file_count_mutex); + os_file_n_pending_preads--; +@@ -2271,6 +2286,7 @@ + { + off_t ret_offset; + ssize_t ret; ++ ssize_t n_read; + #ifndef UNIV_HOTBACKUP + ulint i; + #endif /* !UNIV_HOTBACKUP */ +@@ -2291,7 +2307,17 @@ + if (ret_offset < 0) { + ret = -1; + } else { +- ret = read(file, buf, (ssize_t)n); ++ /* Handle signal interruptions correctly */ ++ for (ret = 0; ret < (ssize_t) n; ) { ++ n_read = read(file, buf, (ssize_t)n); ++ if (n_read > 0) { ++ ret += n_read; ++ } else if (n_read == -1 && errno == EINTR) { ++ continue; ++ } else { ++ break; ++ } ++ } + } + + #ifndef UNIV_HOTBACKUP +@@ -2330,6 +2356,7 @@ + offset */ + { + ssize_t ret; ++ ssize_t n_written; + off_t offs; + + ut_a((offset & 0xFFFFFFFFUL) == offset); +@@ -2357,7 +2384,18 @@ + os_n_pending_writes++; + os_mutex_exit(os_file_count_mutex); + +- ret = pwrite(file, buf, (ssize_t)n, offs); ++ /* Handle signal interruptions correctly */ ++ for (ret = 0; ret < (ssize_t) n; ) { ++ n_written = pwrite(file, buf, (ssize_t)n, offs); ++ if (n_written > 0) { ++ ret += n_written; ++ offs += n_written; ++ } else if (n_written == -1 && errno == EINTR) { ++ continue; ++ } else { ++ break; ++ } ++ } + + os_mutex_enter(os_file_count_mutex); + os_file_n_pending_pwrites--; +@@ -2404,7 +2442,17 @@ + goto func_exit; + } + +- ret = write(file, buf, (ssize_t)n); ++ /* Handle signal interruptions correctly */ ++ for (ret = 0; ret < (ssize_t) n; ) { ++ n_written = write(file, buf, (ssize_t)n); ++ if (n_written > 0) { ++ ret += n_written; ++ } else if (n_written == -1 && errno == EINTR) { ++ continue; ++ } else { ++ break; ++ } ++ } + + # ifdef UNIV_DO_FLUSH + if (srv_unix_file_flush_method != SRV_UNIX_LITTLESYNC diff --git a/innodb_deadlock_count.patch b/innodb_deadlock_count.patch index cc1a6c0..2e5b3e8 100644 --- a/innodb_deadlock_count.patch +++ b/innodb_deadlock_count.patch @@ -31,7 +31,7 @@ diff -ruN a/storage/innobase/include/lock0lock.h b/storage/innobase/include/lock diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h --- a/storage/innobase/include/srv0srv.h 2010-12-04 15:55:21.378480843 +0900 +++ b/storage/innobase/include/srv0srv.h 2010-12-04 16:10:24.606550983 +0900 -@@ -774,6 +774,7 @@ +@@ -776,6 +776,7 @@ ulint innodb_buffer_pool_read_ahead_evicted;/*!< srv_read_ahead evicted*/ ulint innodb_dblwr_pages_written; /*!< srv_dblwr_pages_written */ ulint innodb_dblwr_writes; /*!< srv_dblwr_writes */ @@ -53,7 +53,7 @@ diff -ruN a/storage/innobase/lock/lock0lock.c b/storage/innobase/lock/lock0lock. diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c --- a/storage/innobase/srv/srv0srv.c 2010-12-04 15:57:13.069513371 +0900 +++ b/storage/innobase/srv/srv0srv.c 2010-12-04 16:10:24.610593039 +0900 -@@ -473,6 +473,7 @@ +@@ -475,6 +475,7 @@ static ulint srv_n_rows_deleted_old = 0; static ulint srv_n_rows_read_old = 0; @@ -61,7 +61,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c UNIV_INTERN ulint srv_n_lock_wait_count = 0; UNIV_INTERN ulint srv_n_lock_wait_current_count = 0; UNIV_INTERN ib_int64_t srv_n_lock_wait_time = 0; -@@ -2291,6 +2292,7 @@ +@@ -2293,6 +2294,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 --git a/innodb_dict_size_limit.patch b/innodb_dict_size_limit.patch index 99c2609..e66e67d 100644 --- a/innodb_dict_size_limit.patch +++ b/innodb_dict_size_limit.patch @@ -384,9 +384,9 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ {"have_atomic_builtins", (char*) &export_vars.innodb_have_atomic_builtins, SHOW_BOOL}, {"log_waits", -@@ -11616,6 +11618,11 @@ - "Number of extra user rollback segments which are used in a round-robin fashion.", - NULL, NULL, 127, 0, 127, 0); +@@ -11618,6 +11620,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(dict_size_limit, srv_dict_size_limit, + PLUGIN_VAR_RQCMDARG, @@ -396,10 +396,10 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(additional_mem_pool_size), MYSQL_SYSVAR(autoextend_increment), -@@ -11684,6 +11691,7 @@ +@@ -11685,6 +11692,7 @@ + MYSQL_SYSVAR(flush_neighbor_pages), MYSQL_SYSVAR(read_ahead), MYSQL_SYSVAR(adaptive_flushing_method), - MYSQL_SYSVAR(extra_rsegments), + MYSQL_SYSVAR(dict_size_limit), MYSQL_SYSVAR(use_sys_malloc), MYSQL_SYSVAR(use_native_aio), @@ -454,7 +454,7 @@ diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0bu 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 -@@ -1158,6 +1158,12 @@ +@@ -1170,6 +1170,12 @@ /*====================================*/ dict_table_t* table, /*!< in: table */ const char* name); /*!< in: name of the index to find */ @@ -484,7 +484,7 @@ diff -ruN a/storage/innobase/include/dict0dict.ic b/storage/innobase/include/dic return(table); } -@@ -877,6 +884,12 @@ +@@ -905,6 +912,12 @@ table = dict_load_table_on_id(table_id); } @@ -500,16 +500,15 @@ diff -ruN a/storage/innobase/include/dict0dict.ic b/storage/innobase/include/dic diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h --- a/storage/innobase/include/srv0srv.h 2010-12-03 15:43:57.297067100 +0900 +++ b/storage/innobase/include/srv0srv.h 2010-12-03 15:45:47.562024404 +0900 -@@ -233,7 +233,7 @@ +@@ -232,6 +232,7 @@ + extern ulint srv_read_ahead; extern ulint srv_adaptive_flushing_method; - extern ulint srv_extra_rsegments; -- +extern ulint srv_dict_size_limit; /*-------------------------------------------*/ extern ulint srv_n_rows_inserted; -@@ -726,6 +726,7 @@ +@@ -727,6 +728,7 @@ ulint innodb_data_writes; /*!< I/O write requests */ ulint innodb_data_written; /*!< Data bytes written */ ulint innodb_data_reads; /*!< I/O read requests */ @@ -520,15 +519,16 @@ diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0sr diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c --- a/storage/innobase/srv/srv0srv.c 2010-12-03 15:43:57.301024390 +0900 +++ b/storage/innobase/srv/srv0srv.c 2010-12-03 15:45:47.565023830 +0900 -@@ -421,6 +421,7 @@ +@@ -422,6 +422,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 */ - - UNIV_INTERN ulint srv_extra_rsegments = 127; /* extra rseg for users */ ++ +UNIV_INTERN ulint srv_dict_size_limit = 0; /*-------------------------------------------*/ UNIV_INTERN ulong srv_n_spin_wait_rounds = 30; UNIV_INTERN ulong srv_n_free_tickets_to_enter = 500; -@@ -2231,6 +2232,7 @@ +@@ -2232,6 +2234,7 @@ export_vars.innodb_data_reads = os_n_file_reads; export_vars.innodb_data_writes = os_n_file_writes; export_vars.innodb_data_written = srv_data_written; diff --git a/innodb_expand_fast_index_creation.patch b/innodb_expand_fast_index_creation.patch new file mode 100644 index 0000000..c103a5a --- /dev/null +++ b/innodb_expand_fast_index_creation.patch @@ -0,0 +1,730 @@ +# name : innodb_expand_fast_index_creation.patch +# maintainer : Alexey +# +# Expands the applicability of InnoDB fast index creation to mysqldump, +# ALTER TABLE and OPTIMIZE TABLE. +# +diff -ruN a/client/client_priv.h b/client/client_priv.h +--- a/client/client_priv.h 2011-04-11 08:57:20.000000000 +0400 ++++ b/client/client_priv.h 2011-04-11 08:57:21.000000000 +0400 +@@ -89,6 +89,7 @@ + OPT_NO_REMOVE_EOL_CARRET, + OPT_DEFAULT_AUTH, + OPT_DEFAULT_PLUGIN, ++ OPT_INNODB_OPTIMIZE_KEYS, + OPT_MAX_CLIENT_OPTION + }; + +diff -ruN a/client/mysqldump.c b/client/mysqldump.c +--- a/client/mysqldump.c 2011-04-11 08:57:17.000000000 +0400 ++++ b/client/mysqldump.c 2011-04-11 08:57:21.000000000 +0400 +@@ -45,6 +45,7 @@ + #include + #include + #include ++#include + + #include "client_priv.h" + #include "mysql.h" +@@ -141,6 +142,8 @@ + + static my_bool server_supports_sql_no_fcache= FALSE; + ++static my_bool opt_innodb_optimize_keys= FALSE; ++ + /* + Dynamic_string wrapper functions. In this file use these + wrappers, they will terminate the process if there is +@@ -186,6 +189,8 @@ + + HASH ignore_table; + ++LIST *skipped_keys_list; ++ + static struct my_option my_long_options[] = + { + {"all-databases", 'A', +@@ -349,6 +354,11 @@ + "in dump produced with --dump-slave.", &opt_include_master_host_port, + &opt_include_master_host_port, 0, GET_BOOL, NO_ARG, + 0, 0, 0, 0, 0, 0}, ++ {"innodb-optimize-keys", OPT_INNODB_OPTIMIZE_KEYS, ++ "Use InnoDB fast index creation by creating secondary indexes after " ++ "dumping the data.", ++ &opt_innodb_optimize_keys, &opt_innodb_optimize_keys, 0, GET_BOOL, NO_ARG, ++ 0, 0, 0, 0, 0, 0}, + {"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}, +@@ -2236,6 +2246,77 @@ + } + + /* ++ Remove secondary/foreign key definitions from a given SHOW CREATE TABLE string ++ and store them into a temporary list to be used later. ++ ++ SYNOPSIS ++ skip_secondary_keys() ++ create_str SHOW CREATE TABLE output ++ ++ ++ DESCRIPTION ++ ++ Stores all lines starting with "KEY" or "UNIQUE KEY" or "CONSTRAINT" ++ into skipped_keys_list and removes them from the input string. ++ Ignoring FOREIGN KEYS constraints when creating the table is ok, because ++ mysqldump sets foreign_key_checks to 0 anyway. ++*/ ++ ++static void skip_secondary_keys(char *create_str) ++{ ++ char *ptr, *strend; ++ char *last_comma = NULL; ++ ++ strend= create_str + strlen(create_str); ++ ++ ptr= create_str; ++ while (*ptr) ++ { ++ char *tmp, *orig_ptr; ++ ++ orig_ptr= ptr; ++ /* Skip leading whitespace */ ++ while (*ptr && my_isspace(charset_info, *ptr)) ++ ptr++; ++ ++ /* Read the next line */ ++ for (tmp= ptr; *tmp != '\n' && *tmp != '\0'; tmp++); ++ ++ /* Is it a secondary index definition? */ ++ if (*tmp == '\n' && ++ (!strncmp(ptr, "UNIQUE KEY ", sizeof("UNIQUE KEY ") - 1) || ++ !strncmp(ptr, "KEY ", sizeof("KEY ") - 1) || ++ !strncmp(ptr, "CONSTRAINT ", sizeof("CONSTRAINT ") - 1))) ++ { ++ char *data, *end= tmp - 1; ++ ++ /* Remove the trailing comma */ ++ if (*end == ',') ++ end--; ++ data= my_strndup(ptr, end - ptr + 1, MYF(MY_FAE)); ++ skipped_keys_list= list_cons(data, skipped_keys_list); ++ ++ memmove(orig_ptr, tmp + 1, strend - tmp); ++ ptr= orig_ptr; ++ strend-= tmp + 1 - ptr; ++ ++ /* Remove the comma on the previos line */ ++ if (last_comma != NULL) ++ { ++ *last_comma= ' '; ++ last_comma = NULL; ++ } ++ } ++ else ++ { ++ if (tmp[-1] == ',') ++ last_comma= tmp - 1; ++ ptr= (*tmp == '\0') ? tmp : tmp + 1; ++ } ++ } ++} ++ ++/* + get_table_structure -- retrievs database structure, prints out corresponding + CREATE statement and fills out insert_pat if the table is the type we will + be dumping. +@@ -2476,6 +2557,9 @@ + + row= mysql_fetch_row(result); + ++ if (opt_innodb_optimize_keys && !strcmp(table_type, "InnoDB")) ++ skip_secondary_keys(row[1]); ++ + fprintf(sql_file, (opt_compatible_mode & 3) ? "%s;\n" : + "/*!40101 SET @saved_cs_client = @@character_set_client */;\n" + "/*!40101 SET character_set_client = utf8 */;\n" +@@ -3570,6 +3654,27 @@ + goto err; + } + ++ /* Perform delayed secondary index creation for --innodb-optimize-keys */ ++ if (skipped_keys_list) ++ { ++ uint keys; ++ skipped_keys_list= list_reverse(skipped_keys_list); ++ fprintf(md_result_file, "ALTER TABLE %s ", opt_quoted_table); ++ for (keys= list_length(skipped_keys_list); keys > 0; keys--) ++ { ++ LIST *node= skipped_keys_list; ++ char *def= node->data; ++ ++ fprintf(md_result_file, "ADD %s%s", def, (keys > 1) ? ", " : ";\n"); ++ ++ skipped_keys_list= list_delete(skipped_keys_list, node); ++ my_free(def); ++ my_free(node); ++ } ++ ++ DBUG_ASSERT(skipped_keys_list == NULL); ++ } ++ + /* Moved enable keys to before unlock per bug 15977 */ + if (opt_disable_keys) + { +diff -ruN /dev/null b/mysql-test/r/percona_mysqldump_innodb_optimize_keys.result +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ b/mysql-test/r/percona_mysqldump_innodb_optimize_keys.result 2011-04-11 08:57:21.000000000 +0400 +@@ -0,0 +1,109 @@ ++# ++# Test the --innodb-optimize-keys option. ++# ++CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b INT, KEY(b)) ENGINE=MyISAM; ++###################################### ++ ++/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; ++/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; ++/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; ++/*!40101 SET NAMES utf8 */; ++/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; ++/*!40103 SET TIME_ZONE='+00:00' */; ++/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; ++/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; ++/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; ++/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; ++DROP TABLE IF EXISTS `t1`; ++/*!40101 SET @saved_cs_client = @@character_set_client */; ++/*!40101 SET character_set_client = utf8 */; ++CREATE TABLE `t1` ( ++ `a` int(11) NOT NULL, ++ `b` int(11) DEFAULT NULL, ++ PRIMARY KEY (`a`), ++ KEY `b` (`b`) ++) ENGINE=MyISAM DEFAULT CHARSET=latin1; ++/*!40101 SET character_set_client = @saved_cs_client */; ++ ++LOCK TABLES `t1` WRITE; ++/*!40000 ALTER TABLE `t1` DISABLE KEYS */; ++/*!40000 ALTER TABLE `t1` ENABLE KEYS */; ++UNLOCK TABLES; ++/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; ++ ++/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; ++/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; ++/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; ++/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; ++/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; ++/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; ++/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; ++ ++###################################### ++DROP TABLE t1; ++CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB; ++INSERT INTO t2 VALUES (0), (1), (2); ++CREATE TABLE t1 ( ++id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, ++a INT, b VARCHAR(255), c DECIMAL(10,3), ++KEY (b), ++UNIQUE KEY uniq(c,a), ++FOREIGN KEY (a) REFERENCES t2(a) ON DELETE CASCADE ++) ENGINE=InnoDB; ++INSERT INTO t1(a,b,c) VALUES (0, "0", 0.0), (1, "1", 1.1), (2, "2", 2.2); ++###################################### ++ ++/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; ++/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; ++/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; ++/*!40101 SET NAMES utf8 */; ++/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; ++/*!40103 SET TIME_ZONE='+00:00' */; ++/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; ++/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; ++/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; ++/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; ++DROP TABLE IF EXISTS `t1`; ++/*!40101 SET @saved_cs_client = @@character_set_client */; ++/*!40101 SET character_set_client = utf8 */; ++CREATE TABLE `t1` ( ++ `id` int(11) NOT NULL AUTO_INCREMENT, ++ `a` int(11) DEFAULT NULL, ++ `b` varchar(255) DEFAULT NULL, ++ `c` decimal(10,3) DEFAULT NULL, ++ PRIMARY KEY (`id`) ++) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; ++/*!40101 SET character_set_client = @saved_cs_client */; ++ ++LOCK TABLES `t1` WRITE; ++/*!40000 ALTER TABLE `t1` DISABLE KEYS */; ++INSERT INTO `t1` VALUES (1,0,'0',0.000),(2,1,'1',1.100),(3,2,'2',2.200); ++ALTER TABLE `t1` ADD UNIQUE KEY `uniq` (`c`,`a`), ADD KEY `b` (`b`), ADD KEY `a` (`a`), ADD CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t2` (`a`) ON DELETE CASCADE; ++/*!40000 ALTER TABLE `t1` ENABLE KEYS */; ++UNLOCK TABLES; ++DROP TABLE IF EXISTS `t2`; ++/*!40101 SET @saved_cs_client = @@character_set_client */; ++/*!40101 SET character_set_client = utf8 */; ++CREATE TABLE `t2` ( ++ `a` int(11) NOT NULL, ++ PRIMARY KEY (`a`) ++) ENGINE=InnoDB DEFAULT CHARSET=latin1; ++/*!40101 SET character_set_client = @saved_cs_client */; ++ ++LOCK TABLES `t2` WRITE; ++/*!40000 ALTER TABLE `t2` DISABLE KEYS */; ++INSERT INTO `t2` VALUES (0),(1),(2); ++/*!40000 ALTER TABLE `t2` ENABLE KEYS */; ++UNLOCK TABLES; ++/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; ++ ++/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; ++/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; ++/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; ++/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; ++/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; ++/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; ++/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; ++ ++###################################### ++DROP TABLE t1, t2; +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 2011-03-31 17:36:17.000000000 +0400 ++++ b/mysql-test/suite/innodb/r/innodb.result 2011-04-11 23:26:45.000000000 +0400 +@@ -1673,7 +1673,7 @@ + 71 + SELECT variable_value - @innodb_rows_inserted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_inserted'; + variable_value - @innodb_rows_inserted_orig +-1066 ++1108 + SELECT variable_value - @innodb_rows_updated_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_updated'; + variable_value - @innodb_rows_updated_orig + 866 +diff -ruN a/mysql-test/suite/innodb/t/innodb-index.test b/mysql-test/suite/innodb/t/innodb-index.test +--- a/mysql-test/suite/innodb/t/innodb-index.test 2011-03-31 17:36:17.000000000 +0400 ++++ b/mysql-test/suite/innodb/t/innodb-index.test 2011-04-11 08:57:21.000000000 +0400 +@@ -28,6 +28,11 @@ + show create table t1; + --error ER_MULTIPLE_PRI_KEY + alter table t1 add primary key (c); ++# Suppress the error log messages occuring on duplicate key error ++# during ALTER TABLE when using fast index creation ++--disable_query_log ++call mtr.add_suppression("Cannot find index PRIMARY in InnoDB index translation table."); ++--enable_query_log + --error ER_DUP_ENTRY + alter table t1 drop primary key, add primary key (b); + create unique index c on t1 (c); +diff -ruN a/mysql-test/suite/innodb/t/innodb.test b/mysql-test/suite/innodb/t/innodb.test +--- a/mysql-test/suite/innodb/t/innodb.test 2011-03-31 17:36:17.000000000 +0400 ++++ b/mysql-test/suite/innodb/t/innodb.test 2011-04-11 08:57:21.000000000 +0400 +@@ -21,6 +21,12 @@ + + -- source include/have_innodb.inc + ++# Suppress the error log message occuring on duplicate key error ++# during ALTER TABLE when using fast index creation ++--disable_query_log ++call mtr.add_suppression("Cannot find index v_2 in InnoDB index translation table."); ++--enable_query_log ++ + let $MYSQLD_DATADIR= `select @@datadir`; + + # Save the original values of some variables in order to be able to +diff -ruN /dev/null b/mysql-test/t/percona_mysqldump_innodb_optimize_keys.test +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ b/mysql-test/t/percona_mysqldump_innodb_optimize_keys.test 2011-04-11 08:57:21.000000000 +0400 +@@ -0,0 +1,62 @@ ++# Embedded server doesn't support external clients ++--source include/not_embedded.inc ++ ++# Fast index creation is only available in InnoDB plugin ++--source include/have_innodb.inc ++ ++# Save the initial number of concurrent sessions ++--source include/count_sessions.inc ++ ++--echo # ++--echo # Test the --innodb-optimize-keys option. ++--echo # ++ ++--let $file=$MYSQLTEST_VARDIR/tmp/t1.sql ++ ++# First test that the option has no effect on non-InnoDB tables ++ ++CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b INT, KEY(b)) ENGINE=MyISAM; ++ ++--exec $MYSQL_DUMP --skip-comments --innodb-optimize-keys test t1 >$file ++ ++--echo ###################################### ++--cat_file $file ++--echo ###################################### ++ ++--remove_file $file ++ ++DROP TABLE t1; ++ ++ ++# Check that for InnoDB tables secondary and foreign keys are created ++# after the data is dumped ++ ++CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB; ++INSERT INTO t2 VALUES (0), (1), (2); ++ ++CREATE TABLE t1 ( ++ id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, ++ a INT, b VARCHAR(255), c DECIMAL(10,3), ++ KEY (b), ++ UNIQUE KEY uniq(c,a), ++ FOREIGN KEY (a) REFERENCES t2(a) ON DELETE CASCADE ++) ENGINE=InnoDB; ++ ++INSERT INTO t1(a,b,c) VALUES (0, "0", 0.0), (1, "1", 1.1), (2, "2", 2.2); ++ ++--exec $MYSQL_DUMP --skip-comments --innodb-optimize-keys test t1 t2 >$file ++ ++--echo ###################################### ++--cat_file $file ++--echo ###################################### ++ ++# Check that the resulting dump can be imported back ++ ++--exec $MYSQL test < $file ++ ++--remove_file $file ++ ++DROP TABLE t1, t2; ++ ++# Wait till we reached the initial number of concurrent sessions ++--source include/wait_until_count_sessions.inc +diff -ruN a/sql/sql_lex.cc b/sql/sql_lex.cc +--- a/sql/sql_lex.cc 2011-04-11 08:57:17.000000000 +0400 ++++ b/sql/sql_lex.cc 2011-04-11 08:57:21.000000000 +0400 +@@ -1630,6 +1630,9 @@ + alter_list(rhs.alter_list, mem_root), + key_list(rhs.key_list, mem_root), + create_list(rhs.create_list, mem_root), ++ delayed_key_list(rhs.delayed_key_list, mem_root), ++ delayed_key_info(rhs.delayed_key_info), ++ delayed_key_count(rhs.delayed_key_count), + flags(rhs.flags), + keys_onoff(rhs.keys_onoff), + tablespace_op(rhs.tablespace_op), +@@ -1652,6 +1655,7 @@ + list_copy_and_replace_each_value(alter_list, mem_root); + list_copy_and_replace_each_value(key_list, mem_root); + list_copy_and_replace_each_value(create_list, mem_root); ++ list_copy_and_replace_each_value(delayed_key_list, mem_root); + /* partition_names are not deeply copied currently */ + } + +diff -ruN a/sql/sql_lex.h b/sql/sql_lex.h +--- a/sql/sql_lex.h 2011-04-11 08:57:19.000000000 +0400 ++++ b/sql/sql_lex.h 2011-04-11 08:57:21.000000000 +0400 +@@ -1003,6 +1003,9 @@ + List alter_list; + List key_list; + List create_list; ++ List delayed_key_list; ++ KEY *delayed_key_info; ++ uint delayed_key_count; + uint flags; + enum enum_enable_or_disable keys_onoff; + enum tablespace_op_type tablespace_op; +@@ -1014,6 +1017,8 @@ + + + Alter_info() : ++ delayed_key_info(NULL), ++ delayed_key_count(0), + flags(0), + keys_onoff(LEAVE_AS_IS), + tablespace_op(NO_TABLESPACE_OP), +@@ -1029,6 +1034,9 @@ + alter_list.empty(); + key_list.empty(); + create_list.empty(); ++ delayed_key_list.empty(); ++ delayed_key_info= NULL; ++ delayed_key_count= 0; + flags= 0; + keys_onoff= LEAVE_AS_IS; + tablespace_op= NO_TABLESPACE_OP; +diff -ruN a/sql/sql_table.cc b/sql/sql_table.cc +--- a/sql/sql_table.cc 2011-04-11 08:56:57.000000000 +0400 ++++ b/sql/sql_table.cc 2011-04-11 23:30:02.000000000 +0400 +@@ -2773,7 +2773,7 @@ + file The handler for the new table. + key_info_buffer OUT An array of KEY structs for the indexes. + key_count OUT The number of elements in the array. +- select_field_count The number of fields coming from a select table. ++ select_field_count The number of fields coming from a select table. + + DESCRIPTION + Prepares the table and key structures for table creation. +@@ -3119,7 +3119,6 @@ + } + + /* Create keys */ +- + List_iterator key_iterator(alter_info->key_list); + List_iterator key_iterator2(alter_info->key_list); + uint key_parts=0, fk_key_count=0; +@@ -3217,6 +3216,14 @@ + if (!*key_info_buffer || ! key_part_info) + DBUG_RETURN(TRUE); // Out of memory + ++ List_iterator delayed_key_iterator(alter_info->delayed_key_list); ++ alter_info->delayed_key_count= 0; ++ if (alter_info->delayed_key_list.elements > 0) ++ { ++ alter_info->delayed_key_info= (KEY *) sql_calloc(sizeof(KEY) * ++ (*key_count)); ++ } ++ + key_iterator.rewind(); + key_number=0; + for (; (key=key_iterator++) ; key_number++) +@@ -3635,6 +3642,22 @@ + key_info->comment.str= key->key_create_info.comment.str; + } + ++ if (alter_info->delayed_key_list.elements > 0) ++ { ++ Key *delayed_key; ++ ++ delayed_key_iterator.rewind(); ++ while ((delayed_key= delayed_key_iterator++)) ++ { ++ if (delayed_key == key) ++ { ++ alter_info->delayed_key_info[alter_info->delayed_key_count++]= ++ *key_info; ++ break; ++ } ++ } ++ } ++ + key_info++; + } + if (!unique_key && !primary_key && +@@ -5247,6 +5270,10 @@ + List new_create_list; + /* New key definitions are added here */ + List new_key_list; ++ /* List with secondary keys which should be created after copying the data */ ++ List delayed_key_list; ++ /* Foreign key list returned by handler::get_foreign_key_list() */ ++ List f_key_list; + List_iterator drop_it(alter_info->drop_list); + List_iterator def_it(alter_info->create_list); + List_iterator alter_it(alter_info->alter_list); +@@ -5259,6 +5286,7 @@ + uint used_fields= create_info->used_fields; + KEY *key_info=table->key_info; + bool rc= TRUE; ++ bool skip_secondary; + + DBUG_ENTER("mysql_prepare_alter_table"); + +@@ -5286,6 +5314,7 @@ + char *tablespace= static_cast(thd->alloc(FN_LEN + 1)); + /* + Regular alter table of disk stored table (no tablespace/storage change) ++ + Copy tablespace name + */ + if (tablespace && +@@ -5436,7 +5465,23 @@ + /* + Collect all keys which isn't in drop list. Add only those + for which some fields exists. +- */ ++ ++ We also store secondary keys in delayed_key_list to make use of ++ the InnoDB fast index creation. The following conditions must be ++ met: ++ ++ - we are going to create an InnoDB table (this is checked later when the ++ target engine is known); ++ - the key most be a non-UNIQUE one; ++ - there are no foreign keys. This can be optimized later to exclude only ++ those keys which are a part of foreign key constraints. Currently we ++ simply disable this optimization for all keys if there are any foreign ++ key constraints in the table. ++ */ ++ ++ skip_secondary= ++ !table->file->get_foreign_key_list(thd, &f_key_list) && ++ f_key_list.elements == 0; + + for (uint i=0 ; i < table->s->keys ; i++,key_info++) + { +@@ -5553,6 +5598,8 @@ + test(key_info->flags & HA_GENERATED_KEY), + key_parts); + new_key_list.push_back(key); ++ if (skip_secondary && key_type == Key::MULTIPLE) ++ delayed_key_list.push_back(key); + } + } + { +@@ -5560,7 +5607,21 @@ + while ((key=key_it++)) // Add new keys + { + if (key->type != Key::FOREIGN_KEY) ++ { + new_key_list.push_back(key); ++ if (skip_secondary && key->type == Key::MULTIPLE) ++ delayed_key_list.push_back(key); ++ } ++ else if (skip_secondary) ++ { ++ /* ++ We are adding a foreign key so disable the secondary keys ++ optimization. ++ */ ++ skip_secondary= FALSE; ++ delayed_key_list.empty(); ++ } ++ + if (key->name.str && + !my_strcasecmp(system_charset_info, key->name.str, primary_key_name)) + { +@@ -5609,12 +5670,100 @@ + rc= FALSE; + alter_info->create_list.swap(new_create_list); + alter_info->key_list.swap(new_key_list); ++ alter_info->delayed_key_list.swap(delayed_key_list); + err: + DBUG_RETURN(rc); + } + + + /* ++ Temporarily remove secondary keys previously stored in ++ alter_info->delayed_key_info. ++*/ ++static int ++remove_secondary_keys(THD *thd, TABLE *table, Alter_info *alter_info) ++{ ++ uint *key_numbers; ++ uint key_counter= 0; ++ uint i; ++ int error; ++ DBUG_ENTER("remove_secondary_keys"); ++ DBUG_ASSERT(alter_info->delayed_key_count > 0); ++ ++ key_numbers= (uint *) thd->alloc(sizeof(uint) * ++ alter_info->delayed_key_count); ++ for (i= 0; i < alter_info->delayed_key_count; i++) ++ { ++ KEY *key= alter_info->delayed_key_info + i; ++ uint j; ++ ++ for (j= 0; j < table->s->keys; j++) ++ { ++ if (!strcmp(table->key_info[j].name, key->name)) ++ { ++ key_numbers[key_counter++]= j; ++ break; ++ } ++ } ++ } ++ ++ DBUG_ASSERT(key_counter == alter_info->delayed_key_count); ++ ++ if ((error= table->file->prepare_drop_index(table, key_numbers, ++ key_counter)) || ++ (error= table->file->final_drop_index(table))) ++ { ++ table->file->print_error(error, MYF(0)); ++ } ++ ++ DBUG_RETURN(error); ++} ++ ++/* ++ Restore secondary keys previously removed in remove_secondary_keys. ++*/ ++ ++static int ++restore_secondary_keys(THD *thd, TABLE *table, Alter_info *alter_info) ++{ ++ uint i; ++ int error; ++ DBUG_ENTER("restore_secondary_keys"); ++ DBUG_ASSERT(alter_info->delayed_key_count > 0); ++ ++ thd_proc_info(thd, "restoring secondary keys"); ++ ++ /* Fix the key parts */ ++ for (i= 0; i < alter_info->delayed_key_count; i++) ++ { ++ KEY *key = alter_info->delayed_key_info + i; ++ KEY_PART_INFO *key_part; ++ KEY_PART_INFO *part_end; ++ ++ part_end= key->key_part + key->key_parts; ++ for (key_part= key->key_part; key_part < part_end; key_part++) ++ key_part->field= table->field[key_part->fieldnr]; ++ } ++ ++ if ((error= table->file->add_index(table, alter_info->delayed_key_info, ++ alter_info->delayed_key_count))) ++ { ++ /* ++ Exchange the key_info for the error message. If we exchange ++ key number by key name in the message later, we need correct info. ++ */ ++ KEY *save_key_info= table->key_info; ++ table->key_info= alter_info->delayed_key_info; ++ table->file->print_error(error, MYF(0)); ++ table->key_info= save_key_info; ++ ++ DBUG_RETURN(error); ++ } ++ ++ DBUG_RETURN(0); ++} ++ ++/* + Alter table + + SYNOPSIS +@@ -6405,19 +6554,38 @@ + */ + if (new_table && !(new_table->file->ha_table_flags() & HA_NO_COPY_ON_ALTER)) + { ++ /* ++ Check if we can temporarily remove secondary indexes from the table ++ before copying the data and recreate them later to utilize InnoDB fast ++ index creation. ++ TODO: is there a better way to check for InnoDB? ++ */ ++ bool optimize_keys= (alter_info->delayed_key_count > 0) && ++ !my_strcasecmp(system_charset_info, ++ new_table->file->table_type(), "InnoDB"); + /* We don't want update TIMESTAMP fields during ALTER TABLE. */ + new_table->timestamp_field_type= TIMESTAMP_NO_AUTO_SET; + new_table->next_number_field=new_table->found_next_number_field; ++ + thd_proc_info(thd, "copy to tmp table"); + DBUG_EXECUTE_IF("abort_copy_table", { + my_error(ER_LOCK_WAIT_TIMEOUT, MYF(0)); + goto err_new_table_cleanup; + }); ++ ++ if (optimize_keys) ++ { ++ /* ignore the error */ ++ error= remove_secondary_keys(thd, new_table, alter_info); ++ } ++ + error= copy_data_between_tables(table, new_table, + alter_info->create_list, ignore, + order_num, order, &copied, &deleted, + alter_info->keys_onoff, + alter_info->error_if_not_empty); ++ if (!error && optimize_keys) ++ error= restore_secondary_keys(thd, new_table, alter_info); + } + else + { diff --git a/innodb_expand_import.patch b/innodb_expand_import.patch index 69f4208..c758f2c 100644 --- a/innodb_expand_import.patch +++ b/innodb_expand_import.patch @@ -515,7 +515,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ } err = convert_error_code_to_mysql(err, dict_table->flags, NULL); -@@ -11618,6 +11626,11 @@ +@@ -11625,6 +11633,11 @@ "Choose method of innodb_adaptive_flushing. (native, [estimate], keep_average)", NULL, innodb_adaptive_flushing_method_update, 1, &adaptive_flushing_method_typelib); @@ -524,17 +524,17 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ + "Enable/Disable converting automatically *.ibd files when import tablespace.", + NULL, NULL, 0, 0, 1, 0); + - static MYSQL_SYSVAR_ULONG(extra_rsegments, srv_extra_rsegments, + static MYSQL_SYSVAR_ULONG(dict_size_limit, srv_dict_size_limit, PLUGIN_VAR_RQCMDARG, - "Number of extra user rollback segments which are used in a round-robin fashion.", -@@ -11695,6 +11708,7 @@ + "Limit the allocated memory for dictionary cache. (0: unlimited)", +@@ -11697,6 +11710,7 @@ MYSQL_SYSVAR(flush_neighbor_pages), MYSQL_SYSVAR(read_ahead), MYSQL_SYSVAR(adaptive_flushing_method), + MYSQL_SYSVAR(import_table_from_xtrabackup), - MYSQL_SYSVAR(extra_rsegments), MYSQL_SYSVAR(dict_size_limit), MYSQL_SYSVAR(use_sys_malloc), + MYSQL_SYSVAR(use_native_aio), diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h --- a/storage/innobase/include/srv0srv.h 2010-12-03 15:48:03.077954270 +0900 +++ b/storage/innobase/include/srv0srv.h 2010-12-03 15:52:23.561986996 +0900 @@ -544,18 +544,18 @@ diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0sr +extern ulint srv_expand_import; + - extern ulint srv_extra_rsegments; extern ulint srv_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 -@@ -420,6 +420,8 @@ +@@ -423,6 +423,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 */ +UNIV_INTERN ulint srv_expand_import = 0; /* 0:disable 1:enable */ + - UNIV_INTERN ulint srv_extra_rsegments = 127; /* extra rseg for users */ UNIV_INTERN ulint srv_dict_size_limit = 0; /*-------------------------------------------*/ + UNIV_INTERN ulong srv_n_spin_wait_rounds = 30; diff --git a/innodb_extend_slow.patch b/innodb_extend_slow.patch index be09a5b..1441bb3 100644 --- a/innodb_extend_slow.patch +++ b/innodb_extend_slow.patch @@ -136,7 +136,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c retries = 0; } else if (retries < BUF_PAGE_READ_MAX_RETRIES) { ++retries; -@@ -3217,6 +3280,13 @@ +@@ -3220,6 +3283,13 @@ /* Let us wait until the read operation completes */ @@ -150,7 +150,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c for (;;) { enum buf_io_fix io_fix; -@@ -3231,6 +3301,12 @@ +@@ -3234,6 +3304,12 @@ break; } } @@ -163,7 +163,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c } fix_type = MTR_MEMO_BUF_FIX; -@@ -3256,13 +3332,17 @@ +@@ -3259,13 +3335,17 @@ /* In the case of a first access, try to apply linear read-ahead */ @@ -182,7 +182,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c return(block); } -@@ -3286,6 +3366,7 @@ +@@ -3289,6 +3369,7 @@ unsigned access_time; ibool success; ulint fix_type; @@ -190,7 +190,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c ut_ad(block); ut_ad(mtr); -@@ -3363,13 +3444,17 @@ +@@ -3366,13 +3447,17 @@ #if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG ut_a(block->page.file_page_was_freed == FALSE); #endif @@ -209,7 +209,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c } #ifdef UNIV_IBUF_COUNT_DEBUG -@@ -3379,6 +3464,9 @@ +@@ -3382,6 +3467,9 @@ buf_pool = buf_pool_from_block(block); buf_pool->stat.n_page_gets++; @@ -219,7 +219,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c return(TRUE); } -@@ -3401,6 +3489,7 @@ +@@ -3404,6 +3492,7 @@ buf_pool_t* buf_pool; ibool success; ulint fix_type; @@ -227,7 +227,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c ut_ad(mtr); ut_ad(mtr->state == MTR_ACTIVE); -@@ -3487,6 +3576,11 @@ +@@ -3490,6 +3579,11 @@ #endif buf_pool->stat.n_page_gets++; @@ -429,7 +429,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ /*********************************************************************//** Note that a transaction has been registered with MySQL. @return true if transaction is registered with MySQL 2PC coordinator */ -@@ -9280,6 +9316,25 @@ +@@ -9284,6 +9320,25 @@ statement has ended */ if (trx->n_mysql_tables_in_use == 0) { @@ -872,7 +872,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c /* 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 -@@ -1257,6 +1260,10 @@ +@@ -1259,6 +1262,10 @@ ibool has_slept = FALSE; srv_conc_slot_t* slot = NULL; ulint i; @@ -883,7 +883,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c if (trx->mysql_thd != NULL && thd_is_replication_slave_thread(trx->mysql_thd)) { -@@ -1333,6 +1340,7 @@ +@@ -1335,6 +1342,7 @@ switches. */ if (SRV_THREAD_SLEEP_DELAY > 0) { os_thread_sleep(SRV_THREAD_SLEEP_DELAY); @@ -891,7 +891,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c } trx->op_info = ""; -@@ -1388,6 +1396,13 @@ +@@ -1390,6 +1398,13 @@ /* Go to wait for the event; when a thread leaves InnoDB it will release this thread */ @@ -905,7 +905,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c trx->op_info = "waiting in InnoDB queue"; thd_wait_begin(trx->mysql_thd, THD_WAIT_ROW_TABLE_LOCK); -@@ -1396,6 +1411,12 @@ +@@ -1398,6 +1413,12 @@ trx->op_info = ""; @@ -921,7 +921,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c --- a/storage/innobase/trx/trx0trx.c 2010-12-03 15:41:52.053955669 +0900 +++ b/storage/innobase/trx/trx0trx.c 2010-12-03 17:42:42.127023410 +0900 -@@ -185,6 +185,15 @@ +@@ -186,6 +186,15 @@ trx->global_read_view = NULL; trx->read_view = NULL; @@ -937,7 +937,7 @@ diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c /* Set X/Open XA transaction identification to NULL */ memset(&trx->xid, 0, sizeof(trx->xid)); trx->xid.formatID = -1; -@@ -222,6 +231,11 @@ +@@ -223,6 +232,11 @@ trx->mysql_process_no = os_proc_get_number(); @@ -949,7 +949,7 @@ diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c return(trx); } -@@ -353,6 +367,12 @@ +@@ -354,6 +368,12 @@ /*===============*/ trx_t* trx) /*!< in, own: trx object */ { @@ -962,7 +962,7 @@ diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c mutex_enter(&kernel_mutex); UT_LIST_REMOVE(mysql_trx_list, trx_sys->mysql_trx_list, trx); -@@ -374,6 +394,12 @@ +@@ -375,6 +395,12 @@ /*====================*/ trx_t* trx) /*!< in, own: trx object */ { @@ -975,7 +975,7 @@ diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c mutex_enter(&kernel_mutex); trx_free(trx); -@@ -1091,6 +1117,9 @@ +@@ -1153,6 +1179,9 @@ trx_t* trx) /*!< in: transaction */ { que_thr_t* thr; @@ -985,7 +985,7 @@ diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c ut_ad(mutex_own(&kernel_mutex)); ut_ad(trx->que_state == TRX_QUE_LOCK_WAIT); -@@ -1105,6 +1134,11 @@ +@@ -1167,6 +1196,11 @@ thr = UT_LIST_GET_FIRST(trx->wait_thrs); } @@ -997,7 +997,7 @@ diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c trx->que_state = TRX_QUE_RUNNING; } -@@ -1118,6 +1152,9 @@ +@@ -1180,6 +1214,9 @@ trx_t* trx) /*!< in: transaction in the TRX_QUE_LOCK_WAIT state */ { que_thr_t* thr; @@ -1007,7 +1007,7 @@ diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c ut_ad(mutex_own(&kernel_mutex)); ut_ad(trx->que_state == TRX_QUE_LOCK_WAIT); -@@ -1132,6 +1169,11 @@ +@@ -1194,6 +1231,11 @@ thr = UT_LIST_GET_FIRST(trx->wait_thrs); } diff --git a/innodb_extra_rseg.patch b/innodb_extra_rseg.patch index 966baff..e34bdf3 100644 --- a/innodb_extra_rseg.patch +++ b/innodb_extra_rseg.patch @@ -8,27 +8,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc --- a/storage/innobase/handler/ha_innodb.cc 2010-12-03 15:18:48.879955903 +0900 +++ b/storage/innobase/handler/ha_innodb.cc 2010-12-03 15:22:53.779955671 +0900 -@@ -11403,6 +11403,11 @@ - "Choose method of innodb_adaptive_flushing. (native, [estimate], keep_average)", - NULL, innodb_adaptive_flushing_method_update, 1, &adaptive_flushing_method_typelib); - -+static 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.", -+ 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), -@@ -11468,6 +11473,7 @@ - MYSQL_SYSVAR(flush_neighbor_pages), - MYSQL_SYSVAR(read_ahead), - MYSQL_SYSVAR(adaptive_flushing_method), -+ MYSQL_SYSVAR(extra_rsegments), - MYSQL_SYSVAR(use_sys_malloc), - MYSQL_SYSVAR(use_native_aio), - MYSQL_SYSVAR(change_buffering), -@@ -11496,6 +11502,7 @@ +@@ -11504,6 +11504,7 @@ innobase_system_variables, /* system variables */ NULL /* reserved */ }, @@ -225,49 +205,3 @@ diff -ruN a/storage/innobase/handler/i_s.h b/storage/innobase/handler/i_s.h +extern struct st_mysql_plugin i_s_innodb_rseg; #endif /* i_s_h */ -diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h ---- a/storage/innobase/include/srv0srv.h 2010-12-03 15:18:48.894029379 +0900 -+++ b/storage/innobase/include/srv0srv.h 2010-12-03 15:22:53.786986025 +0900 -@@ -230,6 +230,8 @@ - extern ulint srv_read_ahead; - extern ulint srv_adaptive_flushing_method; - -+extern ulint srv_extra_rsegments; -+ - /*-------------------------------------------*/ - - extern ulint srv_n_rows_inserted; -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 -@@ -418,6 +418,8 @@ - UNIV_INTERN ulint srv_enable_unsafe_group_commit = 0; /* 0:disable 1:enable */ - UNIV_INTERN ulint srv_read_ahead = 3; /* 1: random 2: linear 3: Both */ - UNIV_INTERN ulint srv_adaptive_flushing_method = 0; /* 0: native 1: estimate 2: keep_average */ -+ -+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; -diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c ---- a/storage/innobase/trx/trx0trx.c 2010-12-03 15:18:48.918982105 +0900 -+++ b/storage/innobase/trx/trx0trx.c 2010-12-03 15:22:53.792983193 +0900 -@@ -619,7 +619,7 @@ - - rseg = UT_LIST_GET_NEXT(rseg_list, rseg); - -- if (rseg == NULL) { -+ if (rseg == NULL || rseg->id > srv_extra_rsegments) { - rseg = UT_LIST_GET_FIRST(trx_sys->rseg_list); - } - -@@ -627,7 +627,8 @@ - it */ - - if ((rseg->id == TRX_SYS_SYSTEM_RSEG_ID) -- && (UT_LIST_GET_LEN(trx_sys->rseg_list) > 1)) { -+ && (UT_LIST_GET_LEN(trx_sys->rseg_list) > 1) -+ && srv_extra_rsegments > 0) { - goto loop; - } - diff --git a/innodb_fast_checksum.patch b/innodb_fast_checksum.patch index 432267e..b0e1da0 100644 --- a/innodb_fast_checksum.patch +++ b/innodb_fast_checksum.patch @@ -178,7 +178,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ #ifdef HAVE_LARGE_PAGES if ((os_use_large_pages = (ibool) my_use_large_pages)) -@@ -11397,6 +11399,15 @@ +@@ -11401,6 +11403,15 @@ "Disable with --skip-innodb-checksums.", NULL, NULL, TRUE); @@ -194,7 +194,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ static MYSQL_SYSVAR_STR(data_home_dir, innobase_data_home_dir, PLUGIN_VAR_READONLY, "The common part for InnoDB table spaces.", -@@ -11903,6 +11914,7 @@ +@@ -11909,6 +11920,7 @@ MYSQL_SYSVAR(buffer_pool_size), MYSQL_SYSVAR(buffer_pool_instances), MYSQL_SYSVAR(checksums), @@ -291,7 +291,7 @@ diff -ruN a/storage/innobase/include/ut0rnd.ic b/storage/innobase/include/ut0rnd diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c --- a/storage/innobase/srv/srv0srv.c 2010-12-04 15:52:23.498513634 +0900 +++ b/storage/innobase/srv/srv0srv.c 2010-12-04 15:53:45.053550283 +0900 -@@ -418,6 +418,7 @@ +@@ -421,6 +421,7 @@ UNIV_INTERN ibool srv_use_doublewrite_buf = TRUE; UNIV_INTERN ibool srv_use_checksums = TRUE; diff --git a/innodb_files_extend.patch b/innodb_files_extend.patch index 56e31b7..9a2130e 100644 --- a/innodb_files_extend.patch +++ b/innodb_files_extend.patch @@ -200,7 +200,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ } } -@@ -11408,6 +11470,16 @@ +@@ -11412,6 +11474,16 @@ "#### Attention: The checksum is not compatible for normal or disabled version! ####", NULL, NULL, FALSE); @@ -217,7 +217,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ static MYSQL_SYSVAR_STR(data_home_dir, innobase_data_home_dir, PLUGIN_VAR_READONLY, "The common part for InnoDB table spaces.", -@@ -11909,6 +11981,8 @@ +@@ -11915,6 +11987,8 @@ NULL, NULL, 0, &corrupt_table_action_typelib); static struct st_mysql_sys_var* innobase_system_variables[]= { @@ -363,7 +363,7 @@ diff -ruN a/storage/innobase/include/page0types.h b/storage/innobase/include/pag diff -ruN a/storage/innobase/include/trx0sys.h b/storage/innobase/include/trx0sys.h --- a/storage/innobase/include/trx0sys.h 2010-12-04 15:37:50.593480594 +0900 +++ b/storage/innobase/include/trx0sys.h 2010-12-04 15:55:58.262549554 +0900 -@@ -521,9 +521,9 @@ +@@ -515,9 +515,9 @@ /** Contents of TRX_SYS_MYSQL_LOG_MAGIC_N_FLD */ #define TRX_SYS_MYSQL_LOG_MAGIC_N 873422344 @@ -379,7 +379,7 @@ diff -ruN a/storage/innobase/include/trx0sys.h b/storage/innobase/include/trx0sy diff -ruN a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i --- a/storage/innobase/include/univ.i 2010-11-03 07:01:13.000000000 +0900 +++ b/storage/innobase/include/univ.i 2010-12-04 15:55:58.263549721 +0900 -@@ -296,9 +296,13 @@ +@@ -298,9 +298,13 @@ */ /* The 2-logarithm of UNIV_PAGE_SIZE: */ @@ -395,7 +395,7 @@ diff -ruN a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i /* Maximum number of parallel threads in a parallelized operation */ #define UNIV_MAX_PARALLELISM 32 -@@ -417,7 +421,7 @@ +@@ -419,7 +423,7 @@ stored part of the field in the tablespace. The length field then contains the sum of the following flag and the locally stored len. */ @@ -404,7 +404,7 @@ diff -ruN a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i /* Some macros to improve branch prediction and reduce cache misses */ #if defined(__GNUC__) && (__GNUC__ > 2) && ! defined(__INTEL_COMPILER) -@@ -520,4 +524,6 @@ +@@ -522,4 +526,6 @@ UNIV_MEM_ALLOC(addr, size); \ } while (0) @@ -564,7 +564,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c --- a/storage/innobase/srv/srv0start.c 2010-12-04 15:52:23.502513556 +0900 +++ b/storage/innobase/srv/srv0start.c 2010-12-04 15:55:58.285550583 +0900 -@@ -1556,11 +1556,13 @@ +@@ -1562,11 +1562,13 @@ } #endif /* UNIV_LOG_ARCHIVE */ @@ -580,7 +580,7 @@ diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c return(DB_ERROR); } -@@ -1569,7 +1571,7 @@ +@@ -1575,7 +1577,7 @@ for (i = 0; i < srv_n_data_files; i++) { #ifndef __WIN__ diff --git a/innodb_fix_misc.patch b/innodb_fix_misc.patch index 18245c3..f6110f2 100644 --- a/innodb_fix_misc.patch +++ b/innodb_fix_misc.patch @@ -10,13 +10,10 @@ #!!! notice !!! # Any small change to this file in the main branch # should be done or reviewed by the maintainer! -# -# comment: http://lists.mysql.com/commits/112400 is applied also for innodb_plugin -# to pass innodb_bug53756.test by innodb_plugin diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c --- a/storage/innobase/buf/buf0buf.c 2011-02-23 19:00:48.178696354 +0900 +++ b/storage/innobase/buf/buf0buf.c 2011-02-23 19:01:19.138826278 +0900 -@@ -4043,6 +4043,7 @@ +@@ -4046,6 +4046,7 @@ bpage->state = BUF_BLOCK_ZIP_PAGE; bpage->space = space; bpage->offset = offset; @@ -102,66 +99,6 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c #ifdef UNIV_IBUF_COUNT_DEBUG ut_a(ibuf_count_get(bpage->space, bpage->offset) == 0); #endif /* UNIV_IBUF_COUNT_DEBUG */ -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 -@@ -1868,6 +1868,8 @@ - - ut_ad(mutex_own(&(dict_sys->mutex))); - -+ table = NULL; -+ - /* NOTE that the operation of this function is protected by - the dictionary mutex, and therefore no deadlocks can occur - with other dictionary operations. */ -@@ -1894,15 +1896,17 @@ - BTR_SEARCH_LEAF, &pcur, &mtr); - rec = btr_pcur_get_rec(&pcur); - -- if (!btr_pcur_is_on_user_rec(&pcur) -- || rec_get_deleted_flag(rec, 0)) { -+ if (!btr_pcur_is_on_user_rec(&pcur)) { - /* Not found */ -+ goto func_exit; -+ } - -- btr_pcur_close(&pcur); -- mtr_commit(&mtr); -- mem_heap_free(heap); -- -- return(NULL); -+ /* Find the first record that is not delete marked */ -+ while (rec_get_deleted_flag(rec, 0)) { -+ if (!btr_pcur_move_to_next_user_rec(&pcur, &mtr)) { -+ goto func_exit; -+ } -+ rec = btr_pcur_get_rec(&pcur); - } - - /*---------------------------------------------------*/ -@@ -1915,12 +1919,7 @@ - - /* Check if the table id in record is the one searched for */ - if (table_id != mach_read_from_8(field)) { -- -- btr_pcur_close(&pcur); -- mtr_commit(&mtr); -- mem_heap_free(heap); -- -- return(NULL); -+ goto func_exit; - } - - /* Now we get the table name from the record */ -@@ -1928,7 +1927,7 @@ - /* Load the table definition to memory */ - table = dict_load_table(mem_heap_strdupl(heap, (char*) field, len), - TRUE); -- -+func_exit: - btr_pcur_close(&pcur); - mtr_commit(&mtr); - mem_heap_free(heap); diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c --- a/storage/innobase/fil/fil0fil.c 2011-02-23 19:00:48.223696428 +0900 +++ b/storage/innobase/fil/fil0fil.c 2011-02-23 19:01:19.147655510 +0900 @@ -178,16 +115,25 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c ut_ad(mutex_own(&(system->mutex))); ut_a(node->open); - ut_a(node->n_pending == 0); -+ ut_a(node->n_pending == 0 || srv_lazy_drop_table); ++ ut_a(node->n_pending == 0 || node->space->is_being_deleted); ut_a(node->n_pending_flushes == 0); ut_a(node->modification_counter == node->flush_counter); +@@ -874,7 +875,7 @@ + ut_a(system->n_open > 0); + system->n_open--; + +- if (node->space->purpose == FIL_TABLESPACE && !trx_sys_sys_space(node->space->id)) { ++ if (node->n_pending == 0 && node->space->purpose == FIL_TABLESPACE && !trx_sys_sys_space(node->space->id)) { + ut_a(UT_LIST_GET_LEN(system->LRU) > 0); + + /* The node is in the LRU list, remove it */ @@ -1073,7 +1074,7 @@ ut_ad(node && system && space); ut_ad(mutex_own(&(system->mutex))); ut_a(node->magic_n == FIL_NODE_MAGIC_N); - ut_a(node->n_pending == 0); -+ ut_a(node->n_pending == 0 || srv_lazy_drop_table); ++ ut_a(node->n_pending == 0 || space->is_being_deleted); if (node->open) { /* We fool the assertion in fil_node_close_file() to think @@ -357,7 +303,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc --- a/storage/innobase/handler/ha_innodb.cc 2010-12-04 15:57:13.035513990 +0900 +++ b/storage/innobase/handler/ha_innodb.cc 2010-12-04 15:57:53.084513775 +0900 -@@ -11980,6 +11980,12 @@ +@@ -11986,6 +11986,12 @@ "except for the deletion.", NULL, NULL, 0, &corrupt_table_action_typelib); @@ -370,15 +316,15 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(page_size), MYSQL_SYSVAR(log_block_size), -@@ -12070,6 +12076,7 @@ - MYSQL_SYSVAR(purge_threads), +@@ -12076,6 +12082,7 @@ MYSQL_SYSVAR(purge_batch_size), + MYSQL_SYSVAR(rollback_segments), MYSQL_SYSVAR(corrupt_table_action), + MYSQL_SYSVAR(lazy_drop_table), NULL }; -@@ -12079,7 +12086,7 @@ +@@ -12085,7 +12092,7 @@ &innobase_storage_engine, innobase_hton_name, "Innobase Oy", @@ -401,7 +347,7 @@ diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0bu diff -ruN a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0buf.ic --- a/storage/innobase/include/buf0buf.ic 2011-02-23 19:00:48.130659154 +0900 +++ b/storage/innobase/include/buf0buf.ic 2011-02-23 19:01:19.185655906 +0900 -@@ -406,6 +406,7 @@ +@@ -408,6 +408,7 @@ buf_block_set_state(block, BUF_BLOCK_FILE_PAGE); block->page.space = space; block->page.offset = page_no; @@ -522,9 +468,9 @@ diff -ruN a/storage/innobase/include/os0file.ic b/storage/innobase/include/os0fi diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h --- a/storage/innobase/include/srv0srv.h 2011-02-23 19:00:48.212625715 +0900 +++ b/storage/innobase/include/srv0srv.h 2011-02-23 19:01:19.193655990 +0900 -@@ -248,6 +248,8 @@ +@@ -247,6 +247,8 @@ + extern ulint srv_pass_corrupt_table; - extern ulint srv_extra_rsegments; extern ulint srv_dict_size_limit; + +extern ulint srv_lazy_drop_table; @@ -547,7 +493,7 @@ diff -ruN a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i 2010-12-04 15:57:53.091592933 +0900 @@ -53,6 +53,11 @@ #define INNODB_VERSION_MINOR 1 - #define INNODB_VERSION_BUGFIX 5 + #define INNODB_VERSION_BUGFIX 6 +#ifndef PERCONA_INNODB_VERSION +#define PERCONA_INNODB_VERSION 12.1 @@ -743,9 +689,9 @@ diff -ruN a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c --- a/storage/innobase/srv/srv0srv.c 2011-02-23 19:00:48.283695497 +0900 +++ b/storage/innobase/srv/srv0srv.c 2011-02-23 19:01:19.204696643 +0900 -@@ -446,6 +446,8 @@ +@@ -448,6 +448,8 @@ + UNIV_INTERN ulint srv_pass_corrupt_table = 0; /* 0:disable 1:enable */ - UNIV_INTERN ulint srv_extra_rsegments = 127; /* extra rseg for users */ UNIV_INTERN ulint srv_dict_size_limit = 0; + +UNIV_INTERN ulint srv_lazy_drop_table = 0; @@ -755,7 +701,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c --- a/storage/innobase/srv/srv0start.c 2010-12-04 15:57:13.073495392 +0900 +++ b/storage/innobase/srv/srv0start.c 2010-12-04 16:02:50.704884053 +0900 -@@ -2156,7 +2156,7 @@ +@@ -2162,7 +2162,7 @@ if (srv_print_verbose_log) { ut_print_timestamp(stderr); fprintf(stderr, @@ -778,7 +724,7 @@ diff -ruN a/storage/innobase/sync/sync0sync.c b/storage/innobase/sync/sync0sync. diff -ruN a/storage/innobase/trx/trx0purge.c b/storage/innobase/trx/trx0purge.c --- a/storage/innobase/trx/trx0purge.c 2010-11-03 07:01:13.000000000 +0900 +++ b/storage/innobase/trx/trx0purge.c 2010-12-04 15:57:53.106551154 +0900 -@@ -1131,8 +1131,7 @@ +@@ -1149,8 +1149,7 @@ /* If we cannot advance the 'purge view' because of an old 'consistent read view', then the DML statements cannot be delayed. Also, srv_max_purge_lag <= 0 means 'infinity'. */ diff --git a/innodb_io_patches.patch b/innodb_io_patches.patch index 0fc4079..0315e34 100644 --- a/innodb_io_patches.patch +++ b/innodb_io_patches.patch @@ -94,19 +94,16 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ srv_force_recovery = (ulint) innobase_force_recovery; srv_use_doublewrite_buf = (ibool) innobase_use_doublewrite; -@@ -10992,9 +11012,9 @@ - - static MYSQL_SYSVAR_ULONG(purge_threads, srv_n_purge_threads, +@@ -11001,7 +11021,7 @@ PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY, -- "Purge threads can be either 0 or 1. Default is 0.", -+ "Purge threads can be either 0 or 1. Default is 1.", + "Purge threads can be either 0 or 1.", NULL, NULL, - 0, /* Default setting */ + 1, /* Default setting */ 0, /* Minimum value */ 1, 0); /* Maximum value */ -@@ -11036,12 +11056,18 @@ +@@ -11043,12 +11063,18 @@ innodb_file_format_max_validate, innodb_file_format_max_update, "Antelope"); @@ -131,7 +128,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ static MYSQL_SYSVAR_STR(flush_method, innobase_file_flush_method, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, -@@ -11136,7 +11162,7 @@ +@@ -11143,7 +11169,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.", @@ -140,7 +137,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ static MYSQL_SYSVAR_LONG(buffer_pool_instances, innobase_buffer_pool_instances, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, -@@ -11288,6 +11314,95 @@ +@@ -11295,6 +11321,95 @@ "trigger a readahead.", NULL, NULL, 56, 0, 64, 0); @@ -236,7 +233,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(additional_mem_pool_size), MYSQL_SYSVAR(autoextend_increment), -@@ -11308,6 +11423,7 @@ +@@ -11315,6 +11430,7 @@ MYSQL_SYSVAR(file_format_check), MYSQL_SYSVAR(file_format_max), MYSQL_SYSVAR(flush_log_at_trx_commit), @@ -244,7 +241,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ MYSQL_SYSVAR(flush_method), MYSQL_SYSVAR(force_recovery), MYSQL_SYSVAR(locks_unsafe_for_binlog), -@@ -11345,6 +11461,13 @@ +@@ -11352,6 +11468,13 @@ MYSQL_SYSVAR(show_verbose_locks), MYSQL_SYSVAR(show_locks_held), MYSQL_SYSVAR(version), @@ -345,7 +342,7 @@ diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0sr /*-------------------------------------------*/ extern ulint srv_n_rows_inserted; -@@ -394,8 +405,9 @@ +@@ -397,8 +408,9 @@ when writing data files, but do flush after writing to log files */ SRV_UNIX_NOSYNC, /*!< do not flush after writing */ @@ -553,7 +550,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c /* Try to flush dirty pages so as to avoid IO bursts at the checkpoints. */ -@@ -406,6 +407,17 @@ +@@ -409,6 +410,17 @@ UNIV_INTERN ulong srv_replication_delay = 0; @@ -571,7 +568,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c /*-------------------------------------------*/ UNIV_INTERN ulong srv_n_spin_wait_rounds = 30; UNIV_INTERN ulong srv_n_free_tickets_to_enter = 500; -@@ -2742,6 +2754,7 @@ +@@ -2745,6 +2757,7 @@ ulint n_pages_purged = 0; ulint n_bytes_merged; ulint n_pages_flushed; @@ -579,7 +576,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c ulint n_bytes_archived; ulint n_tables_to_drop; ulint n_ios; -@@ -2749,7 +2762,20 @@ +@@ -2752,7 +2765,20 @@ ulint n_ios_very_old; ulint n_pend_ios; ulint next_itr_time; @@ -600,7 +597,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c #ifdef UNIV_DEBUG_THREAD_CREATION fprintf(stderr, "Master thread starts, id %lu\n", -@@ -2771,6 +2797,9 @@ +@@ -2774,6 +2800,9 @@ mutex_exit(&kernel_mutex); @@ -610,7 +607,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c loop: /*****************************************************************/ /* ---- When there is database activity by users, we cycle in this -@@ -2801,9 +2830,13 @@ +@@ -2804,9 +2833,13 @@ /* Sleep for 1 second on entrying the for loop below the first time. */ next_itr_time = ut_time_ms() + 1000; @@ -624,7 +621,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c /* ALTER TABLE in MySQL requires on Unix that the table handler can drop tables lazily after there no longer are SELECT queries to them. */ -@@ -2827,6 +2860,7 @@ +@@ -2830,6 +2863,7 @@ srv_main_thread_op_info = "sleeping"; srv_main_1_second_loops++; @@ -632,7 +629,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c if (next_itr_time > cur_time && srv_shutdown_state == SRV_SHUTDOWN_NONE) { -@@ -2837,10 +2871,26 @@ +@@ -2840,10 +2874,26 @@ (next_itr_time - cur_time) * 1000)); srv_main_sleeps++; @@ -659,7 +656,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c /* Flush logs if needed */ srv_sync_log_buffer_in_background(); -@@ -2860,7 +2910,7 @@ +@@ -2863,7 +2913,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"; @@ -668,7 +665,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c /* Flush logs if needed */ srv_sync_log_buffer_in_background(); -@@ -2877,7 +2927,11 @@ +@@ -2880,7 +2930,11 @@ n_pages_flushed = buf_flush_list( PCT_IO(100), IB_ULONGLONG_MAX); @@ -681,7 +678,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c /* Try to keep the rate of flushing of dirty pages such that redo log generation does not -@@ -2893,6 +2947,224 @@ +@@ -2896,6 +2950,224 @@ n_flush, IB_ULONGLONG_MAX); } @@ -906,7 +903,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c } if (srv_activity_count == old_activity_count) { -@@ -2941,7 +3213,7 @@ +@@ -2944,7 +3216,7 @@ even if the server were active */ srv_main_thread_op_info = "doing insert buffer merge"; @@ -915,7 +912,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c /* Flush logs if needed */ srv_sync_log_buffer_in_background(); -@@ -3049,7 +3321,7 @@ +@@ -3052,7 +3324,7 @@ buf_flush_list below. Otherwise, the system favors clean pages over cleanup throughput. */ n_bytes_merged = ibuf_contract_for_n_pages(FALSE, @@ -924,15 +921,15 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c } srv_main_thread_op_info = "reserving kernel mutex"; -@@ -3195,6 +3467,7 @@ - srv_slot_t* slot; +@@ -3199,6 +3471,7 @@ + ulint retries = 0; ulint slot_no = ULINT_UNDEFINED; ulint n_total_purged = ULINT_UNDEFINED; + ulint next_itr_time; ut_a(srv_n_purge_threads == 1); -@@ -3217,9 +3490,12 @@ +@@ -3221,9 +3494,12 @@ mutex_exit(&kernel_mutex); @@ -940,12 +937,12 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c + while (srv_shutdown_state != SRV_SHUTDOWN_EXIT_THREADS) { - ulint n_pages_purged; + ulint n_pages_purged = 0; + ulint cur_time; /* If there are very few records to purge or the last purge didn't purge any records then wait for activity. -@@ -3260,6 +3536,16 @@ +@@ -3272,6 +3548,16 @@ } while (n_pages_purged > 0 && !srv_fast_shutdown); srv_sync_log_buffer_in_background(); @@ -965,7 +962,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c --- a/storage/innobase/srv/srv0start.c 2010-11-03 07:01:13.000000000 +0900 +++ b/storage/innobase/srv/srv0start.c 2010-12-03 15:10:09.103023543 +0900 -@@ -1212,6 +1212,9 @@ +@@ -1218,6 +1218,9 @@ } else if (0 == ut_strcmp(srv_file_flush_method_str, "O_DIRECT")) { srv_unix_file_flush_method = SRV_UNIX_O_DIRECT; @@ -975,10 +972,26 @@ diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c } else if (0 == ut_strcmp(srv_file_flush_method_str, "littlesync")) { srv_unix_file_flush_method = SRV_UNIX_LITTLESYNC; +diff -ruN a/storage/innobase/trx/trx0purge.c b/storage/innobase/trx/trx0purge.c +--- a/storage/innobase/trx/trx0purge.c 2011-04-12 14:14:14.000000000 +0900 ++++ b/storage/innobase/trx/trx0purge.c 2011-04-12 14:15:44.000000000 +0900 +@@ -392,10 +392,10 @@ + trx_sys->rseg_history_len++; + mutex_exit(&kernel_mutex); + +- if (!(trx_sys->rseg_history_len % srv_purge_batch_size)) { ++// if (!(trx_sys->rseg_history_len % srv_purge_batch_size)) { /*should wake up always*/ + /* Inform the purge thread that there is work to do. */ + srv_wake_purge_thread_if_not_active(); +- } ++// } + } + + /**********************************************************************//** diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c --- a/storage/innobase/trx/trx0trx.c 2010-11-03 07:01:13.000000000 +0900 +++ b/storage/innobase/trx/trx0trx.c 2010-12-03 15:10:09.106023937 +0900 -@@ -865,6 +865,7 @@ +@@ -925,6 +925,7 @@ trx->read_view = NULL; if (lsn) { @@ -986,7 +999,7 @@ diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c mutex_exit(&kernel_mutex); -@@ -873,6 +874,12 @@ +@@ -933,6 +934,12 @@ trx_undo_insert_cleanup(trx); } @@ -999,7 +1012,7 @@ diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c /* NOTE that we could possibly make a group commit more efficient here: call os_thread_yield here to allow also other trxs to come to commit! */ -@@ -904,9 +911,9 @@ +@@ -964,9 +971,9 @@ if (trx->flush_log_later) { /* Do nothing yet */ trx->must_flush_log_later = TRUE; @@ -1011,7 +1024,7 @@ diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c if (srv_unix_file_flush_method == SRV_UNIX_NOSYNC) { /* Write the log but do not flush it to disk */ -@@ -918,7 +925,7 @@ +@@ -978,7 +985,7 @@ log_write_up_to(lsn, LOG_WAIT_ONE_GROUP, TRUE); } @@ -1020,7 +1033,7 @@ diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c /* Write the log but do not flush it to disk */ -@@ -1582,16 +1589,23 @@ +@@ -1642,16 +1649,23 @@ trx_t* trx) /*!< in: trx handle */ { ib_uint64_t lsn = trx->commit_lsn; @@ -1046,7 +1059,7 @@ diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c if (srv_unix_file_flush_method == SRV_UNIX_NOSYNC) { /* Write the log but do not flush it to disk */ -@@ -1602,7 +1616,7 @@ +@@ -1662,7 +1676,7 @@ log_write_up_to(lsn, LOG_WAIT_ONE_GROUP, TRUE); } @@ -1055,7 +1068,7 @@ diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c /* Write the log but do not flush it to disk */ -@@ -1855,6 +1869,8 @@ +@@ -1915,6 +1929,8 @@ /*--------------------------------------*/ if (lsn) { @@ -1064,7 +1077,7 @@ diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c /* Depending on the my.cnf options, we may now write the log buffer to the log files, making the prepared state of the transaction durable if the OS does not crash. We may also -@@ -1874,9 +1890,15 @@ +@@ -1934,9 +1950,15 @@ mutex_exit(&kernel_mutex); @@ -1082,7 +1095,7 @@ diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c if (srv_unix_file_flush_method == SRV_UNIX_NOSYNC) { /* Write the log but do not flush it to disk */ -@@ -1888,7 +1910,7 @@ +@@ -1948,7 +1970,7 @@ log_write_up_to(lsn, LOG_WAIT_ONE_GROUP, TRUE); } diff --git a/innodb_lru_dump_restore.patch b/innodb_lru_dump_restore.patch index 1947c7d..fff4ee8 100644 --- a/innodb_lru_dump_restore.patch +++ b/innodb_lru_dump_restore.patch @@ -382,7 +382,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc --- a/storage/innobase/handler/ha_innodb.cc 2010-12-03 17:49:11.589956135 +0900 +++ b/storage/innobase/handler/ha_innodb.cc 2010-12-04 15:33:37.645555490 +0900 -@@ -11767,6 +11767,12 @@ +@@ -11773,6 +11773,12 @@ "Limit the allocated memory for dictionary cache. (0: unlimited)", NULL, NULL, 0, 0, LONG_MAX, 0); @@ -395,14 +395,14 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(additional_mem_pool_size), MYSQL_SYSVAR(autoextend_increment), -@@ -11849,6 +11855,7 @@ +@@ -11854,6 +11860,7 @@ #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ MYSQL_SYSVAR(read_ahead_threshold), MYSQL_SYSVAR(io_capacity), + MYSQL_SYSVAR(buffer_pool_restore_at_startup), MYSQL_SYSVAR(purge_threads), MYSQL_SYSVAR(purge_batch_size), - NULL + MYSQL_SYSVAR(rollback_segments), 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:34:35.286211349 +0900 +++ b/storage/innobase/handler/i_s.cc 2010-12-04 15:33:37.677480733 +0900 @@ -414,7 +414,7 @@ diff -ruN a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc } static const char plugin_author[] = "Innobase Oy"; -@@ -4254,6 +4255,36 @@ +@@ -4272,6 +4273,36 @@ "Hello!"); goto end_func; } @@ -535,7 +535,7 @@ diff -ruN a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fi diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h --- a/storage/innobase/include/srv0srv.h 2010-12-03 17:49:11.603969747 +0900 +++ b/storage/innobase/include/srv0srv.h 2010-12-04 15:33:37.685550816 +0900 -@@ -357,6 +357,9 @@ +@@ -359,6 +359,9 @@ reading of a disk page */ extern ulint srv_buf_pool_reads; @@ -545,7 +545,7 @@ diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0sr /** Status variables to be passed to MySQL */ typedef struct export_var_struct export_struc; -@@ -677,6 +680,16 @@ +@@ -679,6 +682,16 @@ /*=====================*/ void* arg); /*!< in: a dummy parameter required by os_thread_create */ @@ -565,7 +565,7 @@ diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0sr diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c --- a/storage/innobase/srv/srv0srv.c 2010-12-03 17:49:11.620986661 +0900 +++ b/storage/innobase/srv/srv0srv.c 2010-12-04 15:33:37.708550811 +0900 -@@ -334,6 +334,9 @@ +@@ -337,6 +337,9 @@ reading of a disk page */ UNIV_INTERN ulint srv_buf_pool_reads = 0; @@ -575,7 +575,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c /* structure to pass status variables to MySQL */ UNIV_INTERN export_struc export_vars; -@@ -2701,6 +2704,56 @@ +@@ -2703,6 +2706,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. */ @@ -647,7 +647,7 @@ diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c /** We use this mutex to test the return value of pthread_mutex_trylock on successful locking. HP-UX does NOT return 0, though Linux et al do. */ -@@ -1816,6 +1816,10 @@ +@@ -1822,6 +1822,10 @@ os_thread_create(&srv_monitor_thread, NULL, thread_ids + 4 + SRV_MAX_N_IO_THREADS); diff --git a/innodb_overwrite_relay_log_info.patch b/innodb_overwrite_relay_log_info.patch index 8946e80..1bda99d 100644 --- a/innodb_overwrite_relay_log_info.patch +++ b/innodb_overwrite_relay_log_info.patch @@ -262,7 +262,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ static MYSQL_SYSVAR_BOOL(doublewrite, innobase_use_doublewrite, PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY, "Enable InnoDB doublewrite buffer (enabled by default). " -@@ -11448,6 +11646,7 @@ +@@ -11450,6 +11648,7 @@ MYSQL_SYSVAR(old_blocks_pct), MYSQL_SYSVAR(old_blocks_time), MYSQL_SYSVAR(open_files), @@ -273,7 +273,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ diff -ruN a/storage/innobase/include/trx0sys.h b/storage/innobase/include/trx0sys.h --- a/storage/innobase/include/trx0sys.h 2010-11-03 07:01:13.000000000 +0900 +++ b/storage/innobase/include/trx0sys.h 2010-12-03 15:38:20.321953297 +0900 -@@ -52,6 +52,9 @@ +@@ -53,6 +53,9 @@ extern ib_int64_t trx_sys_mysql_master_log_pos; /* @} */ @@ -283,7 +283,7 @@ diff -ruN a/storage/innobase/include/trx0sys.h b/storage/innobase/include/trx0sy /** If this MySQL server uses binary logging, after InnoDB has been inited and if it has done a crash recovery, we store the binlog file name and position here. */ -@@ -293,7 +296,8 @@ +@@ -287,7 +290,8 @@ void trx_sys_update_mysql_binlog_offset( /*===============================*/ @@ -293,7 +293,7 @@ diff -ruN a/storage/innobase/include/trx0sys.h b/storage/innobase/include/trx0sy ib_int64_t offset, /*!< in: position in that log file */ ulint field, /*!< in: offset of the MySQL log info field in the trx sys header */ -@@ -488,6 +492,7 @@ +@@ -482,6 +486,7 @@ @see trx_sys_mysql_master_log_name @see trx_sys_mysql_bin_log_name */ #define TRX_SYS_MYSQL_LOG_NAME_LEN 512 @@ -301,7 +301,7 @@ diff -ruN a/storage/innobase/include/trx0sys.h b/storage/innobase/include/trx0sy /** Contents of TRX_SYS_MYSQL_LOG_MAGIC_N_FLD */ #define TRX_SYS_MYSQL_LOG_MAGIC_N 873422344 -@@ -497,6 +502,7 @@ +@@ -491,6 +496,7 @@ /** The offset of the MySQL replication info in the trx system header; this contains the same fields as TRX_SYS_MYSQL_LOG_INFO below */ #define TRX_SYS_MYSQL_MASTER_LOG_INFO (UNIV_PAGE_SIZE - 2000) @@ -438,7 +438,7 @@ diff -ruN a/storage/innobase/trx/trx0sys.c b/storage/innobase/trx/trx0sys.c diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c --- a/storage/innobase/trx/trx0trx.c 2010-12-03 15:37:45.549028990 +0900 +++ b/storage/innobase/trx/trx0trx.c 2010-12-03 15:38:20.328957217 +0900 -@@ -135,6 +135,10 @@ +@@ -136,6 +136,10 @@ trx->mysql_log_file_name = NULL; trx->mysql_log_offset = 0; @@ -449,47 +449,52 @@ diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c mutex_create(trx_undo_mutex_key, &trx->undo_mutex, SYNC_TRX_UNDO); -@@ -732,6 +736,7 @@ - trx_rseg_t* rseg; - trx_undo_t* undo; +@@ -766,6 +770,7 @@ + { mtr_t mtr; + trx_rseg_t* rseg; + trx_sysf_t* sys_header = NULL; - ut_ad(mutex_own(&kernel_mutex)); + ut_ad(!mutex_own(&kernel_mutex)); -@@ -787,13 +792,35 @@ +@@ -819,8 +824,12 @@ - if (trx->mysql_log_file_name - && trx->mysql_log_file_name[0] != '\0') { -+ if (!sys_header) { -+ sys_header = trx_sysf_get(&mtr); -+ } - trx_sys_update_mysql_binlog_offset( -+ sys_header, - trx->mysql_log_file_name, - trx->mysql_log_offset, - TRX_SYS_MYSQL_LOG_INFO, &mtr); - trx->mysql_log_file_name = NULL; - } + if (trx->mysql_log_file_name + && trx->mysql_log_file_name[0] != '\0') { ++ if (!sys_header) { ++ sys_header = trx_sysf_get(&mtr); ++ } -+ if (trx->mysql_master_log_file_name[0] != '\0') { -+ /* This database server is a MySQL replication slave */ -+ if (!sys_header) { -+ sys_header = trx_sysf_get(&mtr); -+ } -+ trx_sys_update_mysql_binlog_offset( -+ sys_header, -+ trx->mysql_relay_log_file_name, -+ trx->mysql_relay_log_pos, -+ TRX_SYS_MYSQL_RELAY_LOG_INFO, &mtr); -+ trx_sys_update_mysql_binlog_offset( -+ sys_header, -+ trx->mysql_master_log_file_name, -+ trx->mysql_master_log_pos, -+ TRX_SYS_MYSQL_MASTER_LOG_INFO, &mtr); -+ trx->mysql_master_log_file_name = ""; + trx_sys_update_mysql_binlog_offset( ++ sys_header, + trx->mysql_log_file_name, + trx->mysql_log_offset, + TRX_SYS_MYSQL_LOG_INFO, &mtr); +@@ -828,6 +837,27 @@ + trx->mysql_log_file_name = NULL; + } + ++ if (trx->mysql_master_log_file_name[0] != '\0') { ++ /* This database server is a MySQL replication slave */ ++ if (!sys_header) { ++ sys_header = trx_sysf_get(&mtr); + } + - /* The following call commits the mini-transaction, making the - whole transaction committed in the file-based world, at this - log sequence number. The transaction becomes 'durable' when ++ trx_sys_update_mysql_binlog_offset( ++ sys_header, ++ trx->mysql_relay_log_file_name, ++ trx->mysql_relay_log_pos, ++ TRX_SYS_MYSQL_RELAY_LOG_INFO, &mtr); ++ ++ trx_sys_update_mysql_binlog_offset( ++ sys_header, ++ trx->mysql_master_log_file_name, ++ trx->mysql_master_log_pos, ++ TRX_SYS_MYSQL_MASTER_LOG_INFO, &mtr); ++ ++ trx->mysql_master_log_file_name = ""; ++ } ++ + /* The following call commits the mini-transaction, making the + whole transaction committed in the file-based world, at this + log sequence number. The transaction becomes 'durable' when diff --git a/innodb_pass_corrupt_table.patch b/innodb_pass_corrupt_table.patch index 76fe92b..910e9fe 100644 --- a/innodb_pass_corrupt_table.patch +++ b/innodb_pass_corrupt_table.patch @@ -8,7 +8,7 @@ diff -ruN a/storage/innobase/btr/btr0btr.c b/storage/innobase/btr/btr0btr.c --- a/storage/innobase/btr/btr0btr.c 2010-11-03 07:01:13.000000000 +0900 +++ b/storage/innobase/btr/btr0btr.c 2010-12-04 15:38:18.110513593 +0900 -@@ -137,6 +137,12 @@ +@@ -691,6 +691,12 @@ root_page_no = dict_index_get_page(index); block = btr_block_get(space, zip_size, root_page_no, RW_X_LATCH, mtr); @@ -21,7 +21,7 @@ diff -ruN a/storage/innobase/btr/btr0btr.c b/storage/innobase/btr/btr0btr.c ut_a((ibool)!!page_is_comp(buf_block_get_frame(block)) == dict_table_is_comp(index->table)); #ifdef UNIV_BTR_DEBUG -@@ -422,6 +428,12 @@ +@@ -977,6 +983,12 @@ root = btr_root_get(index, &mtr); @@ -34,7 +34,7 @@ diff -ruN a/storage/innobase/btr/btr0btr.c b/storage/innobase/btr/btr0btr.c if (flag == BTR_N_LEAF_PAGES) { seg_header = root + PAGE_HEADER + PAGE_BTR_SEG_LEAF; -@@ -869,6 +881,13 @@ +@@ -1433,6 +1445,13 @@ mtr_start(&mtr); root = btr_page_get(space, zip_size, root_page_no, RW_X_LATCH, &mtr); @@ -48,7 +48,7 @@ diff -ruN a/storage/innobase/btr/btr0btr.c b/storage/innobase/btr/btr0btr.c #ifdef UNIV_BTR_DEBUG ut_a(btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF + root, space)); -@@ -891,6 +910,12 @@ +@@ -1455,6 +1474,12 @@ mtr_start(&mtr); root = btr_page_get(space, zip_size, root_page_no, RW_X_LATCH, &mtr); @@ -61,7 +61,7 @@ diff -ruN a/storage/innobase/btr/btr0btr.c b/storage/innobase/btr/btr0btr.c #ifdef UNIV_BTR_DEBUG ut_a(btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_TOP + root, space)); -@@ -924,6 +949,11 @@ +@@ -1488,6 +1513,11 @@ block = btr_block_get(space, zip_size, root_page_no, RW_X_LATCH, mtr); @@ -231,7 +231,7 @@ diff -ruN a/storage/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c page = buf_block_get_frame(block); index = cursor->index; zip_size = buf_block_get_zip_size(block); -@@ -2924,6 +3002,11 @@ +@@ -2925,6 +3003,11 @@ block = btr_cur_get_block(cursor); @@ -243,7 +243,7 @@ diff -ruN a/storage/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c ut_ad(page_is_leaf(buf_block_get_frame(block))); rec = btr_cur_get_rec(cursor); -@@ -3627,6 +3710,11 @@ +@@ -3628,6 +3711,11 @@ page = btr_cur_get_page(&cursor); @@ -373,7 +373,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c switch (buf_block_get_state(block)) { buf_page_t* bpage; ibool success; -@@ -3690,6 +3712,7 @@ +@@ -3693,6 +3715,7 @@ bpage->newest_modification = 0; bpage->oldest_modification = 0; HASH_INVALIDATE(bpage, hash); @@ -381,7 +381,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c #if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG bpage->file_page_was_freed = FALSE; #endif /* UNIV_DEBUG_FILE_ACCESSES || UNIV_DEBUG */ -@@ -4200,7 +4223,8 @@ +@@ -4203,7 +4226,8 @@ void buf_page_io_complete( /*=================*/ @@ -391,7 +391,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c { enum buf_io_fix io_type; buf_pool_t* buf_pool = buf_pool_from_bpage(bpage); -@@ -4279,6 +4303,7 @@ +@@ -4282,6 +4306,7 @@ (ulong) bpage->offset); } @@ -399,7 +399,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c /* From version 3.23.38 up we store the page checksum to the 4 first bytes of the page end lsn field */ -@@ -4320,6 +4345,19 @@ +@@ -4323,6 +4348,19 @@ REFMAN "forcing-innodb-recovery.html\n" "InnoDB: about forcing recovery.\n", stderr); @@ -419,7 +419,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c if (srv_force_recovery < SRV_FORCE_IGNORE_CORRUPT) { fputs("InnoDB: Ending processing because of" " a corrupt database page.\n", -@@ -4327,6 +4365,7 @@ +@@ -4330,6 +4368,7 @@ exit(1); } } @@ -427,7 +427,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c if (recv_recovery_is_on()) { /* Pages must be uncompressed for crash recovery. */ -@@ -4336,8 +4375,11 @@ +@@ -4339,8 +4378,11 @@ if (uncompressed && !recv_no_ibuf_operations) { ibuf_merge_or_delete_for_page( @@ -505,7 +505,7 @@ diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict. size = btr_get_size(index, BTR_TOTAL_SIZE); index->stat_index_size = size; -@@ -4452,6 +4459,12 @@ +@@ -4480,6 +4487,12 @@ heap = mem_heap_create(1000); while (index) { @@ -518,7 +518,7 @@ diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict. /*===========================================*/ { dict_table_t* sys_stats; -@@ -4617,6 +4630,12 @@ +@@ -4666,6 +4679,12 @@ || (srv_force_recovery < SRV_FORCE_NO_LOG_REDO && dict_index_is_clust(index)))) { ulint size; @@ -531,7 +531,7 @@ diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict. size = btr_get_size(index, BTR_TOTAL_SIZE); index->stat_index_size = size; -@@ -5341,4 +5360,42 @@ +@@ -5462,4 +5481,42 @@ rw_lock_free(&dict_table_stats_latches[i]); } } @@ -577,7 +577,7 @@ diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict. diff -ruN a/storage/innobase/dict/dict0mem.c b/storage/innobase/dict/dict0mem.c --- a/storage/innobase/dict/dict0mem.c 2010-11-03 07:01:13.000000000 +0900 +++ b/storage/innobase/dict/dict0mem.c 2010-12-04 15:38:18.126549463 +0900 -@@ -94,6 +94,8 @@ +@@ -97,6 +97,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; @@ -1007,7 +1007,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ /* In sql_show we call with this flag: update then statistics so that they are up-to-date */ -@@ -8429,10 +8510,18 @@ +@@ -8433,10 +8514,18 @@ THD* thd, /*!< in: connection thread handle */ HA_CHECK_OPT* check_opt) /*!< in: currently ignored */ { @@ -1026,7 +1026,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ return(0); } -@@ -8614,6 +8703,10 @@ +@@ -8618,6 +8707,10 @@ my_error(ER_QUERY_INTERRUPTED, MYF(0)); } @@ -1037,7 +1037,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ DBUG_RETURN(is_ok ? HA_ADMIN_OK : HA_ADMIN_CORRUPT); } -@@ -9384,6 +9477,10 @@ +@@ -9388,6 +9481,10 @@ update_thd(thd); @@ -1048,7 +1048,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ if (prebuilt->table->ibd_file_missing && !thd_tablespace_op(thd)) { ut_print_timestamp(stderr); fprintf(stderr, -@@ -11781,6 +11878,25 @@ +@@ -11787,6 +11884,25 @@ "0 (the default) disables automatic dumps.", NULL, NULL, 0, 0, UINT_MAX32, 0); @@ -1074,10 +1074,10 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(additional_mem_pool_size), MYSQL_SYSVAR(autoextend_increment), -@@ -11867,6 +11983,7 @@ - MYSQL_SYSVAR(buffer_pool_restore_at_startup), +@@ -11873,6 +11989,7 @@ MYSQL_SYSVAR(purge_threads), MYSQL_SYSVAR(purge_batch_size), + MYSQL_SYSVAR(rollback_segments), + MYSQL_SYSVAR(corrupt_table_action), NULL }; @@ -1166,7 +1166,7 @@ diff -ruN a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0b /*********************************************************************//** Gets the current size of buffer buf_pool in bytes. @return size in bytes */ -@@ -617,6 +617,12 @@ +@@ -619,6 +619,12 @@ /*================*/ const buf_block_t* block) /*!< in: pointer to the control block */ { @@ -1182,7 +1182,7 @@ diff -ruN a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0b diff -ruN a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h --- a/storage/innobase/include/dict0dict.h 2010-12-03 17:30:16.306955940 +0900 +++ b/storage/innobase/include/dict0dict.h 2010-12-04 15:38:18.169513750 +0900 -@@ -1226,6 +1226,15 @@ +@@ -1245,6 +1245,15 @@ dict_close(void); /*============*/ @@ -1201,7 +1201,7 @@ diff -ruN a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict diff -ruN a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h --- a/storage/innobase/include/dict0mem.h 2010-11-03 07:01:13.000000000 +0900 +++ b/storage/innobase/include/dict0mem.h 2010-12-04 15:38:18.171513956 +0900 -@@ -625,6 +625,7 @@ +@@ -636,6 +636,7 @@ the AUTOINC lock on this table. */ /* @} */ /*----------------------*/ @@ -1302,8 +1302,8 @@ diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0sr extern ulint srv_expand_import; +extern ulint srv_pass_corrupt_table; - extern ulint srv_extra_rsegments; extern ulint srv_dict_size_limit; + /*-------------------------------------------*/ diff -ruN a/storage/innobase/page/page0zip.c b/storage/innobase/page/page0zip.c --- a/storage/innobase/page/page0zip.c 2010-11-03 07:01:13.000000000 +0900 +++ b/storage/innobase/page/page0zip.c 2010-12-04 15:38:18.195515935 +0900 @@ -1371,18 +1371,18 @@ diff -ruN a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c --- a/storage/innobase/srv/srv0srv.c 2010-12-04 15:37:50.602481253 +0900 +++ b/storage/innobase/srv/srv0srv.c 2010-12-04 15:38:18.209513823 +0900 -@@ -434,6 +434,7 @@ +@@ -437,6 +437,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 */ +UNIV_INTERN ulint srv_pass_corrupt_table = 0; /* 0:disable 1:enable */ - UNIV_INTERN ulint srv_extra_rsegments = 127; /* extra rseg for users */ UNIV_INTERN ulint srv_dict_size_limit = 0; + /*-------------------------------------------*/ diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c --- a/storage/innobase/srv/srv0start.c 2010-12-04 15:37:50.605491300 +0900 +++ b/storage/innobase/srv/srv0start.c 2010-12-04 15:38:18.212513722 +0900 -@@ -2144,6 +2144,13 @@ +@@ -2150,6 +2150,13 @@ os_fast_mutex_free(&srv_os_test_mutex); diff --git a/innodb_recovery_patches.patch b/innodb_recovery_patches.patch index f7c849e..c1de1a7 100644 --- a/innodb_recovery_patches.patch +++ b/innodb_recovery_patches.patch @@ -126,7 +126,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ srv_use_doublewrite_buf = (ibool) innobase_use_doublewrite; srv_use_checksums = (ibool) innobase_use_checksums; -@@ -11246,6 +11249,11 @@ +@@ -11250,6 +11253,11 @@ "The common part for InnoDB table spaces.", NULL, NULL, NULL); @@ -138,7 +138,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ static MYSQL_SYSVAR_BOOL(recovery_update_relay_log, innobase_overwrite_relay_log_info, PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY, "During InnoDB crash recovery on slave overwrite relay-log.info " -@@ -11717,6 +11725,7 @@ +@@ -11723,6 +11731,7 @@ MYSQL_SYSVAR(data_file_path), MYSQL_SYSVAR(data_home_dir), MYSQL_SYSVAR(doublewrite), diff --git a/innodb_separate_doublewrite.patch b/innodb_separate_doublewrite.patch index 3b63f09..434c649 100644 --- a/innodb_separate_doublewrite.patch +++ b/innodb_separate_doublewrite.patch @@ -8,7 +8,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c --- a/storage/innobase/buf/buf0buf.c 2010-12-03 17:49:11.574962867 +0900 +++ b/storage/innobase/buf/buf0buf.c 2010-12-04 15:35:58.624514033 +0900 -@@ -4248,7 +4248,8 @@ +@@ -4251,7 +4251,8 @@ read_space_id = mach_read_from_4( frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID); @@ -75,7 +75,7 @@ diff -ruN a/storage/innobase/dict/dict0load.c b/storage/innobase/dict/dict0load. /** Following are six InnoDB system tables */ -@@ -797,7 +798,7 @@ +@@ -811,7 +812,7 @@ mtr_commit(&mtr); @@ -84,7 +84,7 @@ diff -ruN a/storage/innobase/dict/dict0load.c b/storage/innobase/dict/dict0load. /* The system tablespace always exists. */ } else if (in_crash_recovery) { /* Check that the tablespace (the .ibd file) really -@@ -1594,7 +1595,7 @@ +@@ -1623,7 +1624,7 @@ space = mach_read_from_4(field); /* Check if the tablespace exists and has the right name */ @@ -93,7 +93,7 @@ diff -ruN a/storage/innobase/dict/dict0load.c b/storage/innobase/dict/dict0load. flags = dict_sys_tables_get_flags(rec); if (UNIV_UNLIKELY(flags == ULINT_UNDEFINED)) { -@@ -1744,7 +1745,7 @@ +@@ -1776,7 +1777,7 @@ goto err_exit; } @@ -357,7 +357,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ srv_use_sys_stats_table = (ibool) innobase_use_sys_stats_table; /* -------------- Log files ---------------------------*/ -@@ -11610,6 +11613,11 @@ +@@ -11621,6 +11624,11 @@ "Path to individual files and their sizes.", NULL, NULL, NULL); @@ -369,7 +369,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ static MYSQL_SYSVAR_LONG(autoinc_lock_mode, innobase_autoinc_lock_mode, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, "The AUTOINC lock modes supported by InnoDB: " -@@ -11782,6 +11790,7 @@ +@@ -11788,6 +11796,7 @@ MYSQL_SYSVAR(commit_concurrency), MYSQL_SYSVAR(concurrency_tickets), MYSQL_SYSVAR(data_file_path), @@ -426,7 +426,7 @@ diff -ruN a/storage/innobase/include/srv0start.h b/storage/innobase/include/srv0 diff -ruN a/storage/innobase/include/trx0sys.h b/storage/innobase/include/trx0sys.h --- a/storage/innobase/include/trx0sys.h 2010-12-03 15:41:52.047049291 +0900 +++ b/storage/innobase/include/trx0sys.h 2010-12-04 15:35:58.647551222 +0900 -@@ -124,6 +124,22 @@ +@@ -125,6 +125,22 @@ /*=============*/ ulint space, /*!< in: space */ ulint page_no);/*!< in: page number */ @@ -449,7 +449,7 @@ diff -ruN a/storage/innobase/include/trx0sys.h b/storage/innobase/include/trx0sy /*****************************************************************//** Creates and initializes the central memory structures for the transaction system. This is called when the database is started. */ -@@ -137,6 +153,13 @@ +@@ -138,6 +154,13 @@ void trx_sys_create(void); /*================*/ @@ -463,7 +463,7 @@ diff -ruN a/storage/innobase/include/trx0sys.h b/storage/innobase/include/trx0sy /****************************************************************//** Looks for a free slot for a rollback segment in the trx system file copy. @return slot index or ULINT_UNDEFINED if not found */ -@@ -448,6 +471,8 @@ +@@ -442,6 +465,8 @@ /* Space id and page no where the trx system file copy resides */ #define TRX_SYS_SPACE 0 /* the SYSTEM tablespace */ @@ -519,7 +519,7 @@ diff -ruN a/storage/innobase/include/trx0sys.ic b/storage/innobase/include/trx0s diff -ruN a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c --- a/storage/innobase/row/row0mysql.c 2010-12-03 17:30:16.334989510 +0900 +++ b/storage/innobase/row/row0mysql.c 2010-12-04 15:35:58.652496484 +0900 -@@ -3423,7 +3423,7 @@ +@@ -3449,7 +3449,7 @@ /* Do not drop possible .ibd tablespace if something went wrong: we do not want to delete valuable data of the user */ @@ -710,7 +710,7 @@ diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c ibool log_file_created; ibool log_created = FALSE; ibool log_opened = FALSE; -@@ -1456,6 +1595,7 @@ +@@ -1462,6 +1601,7 @@ } err = open_or_create_data_files(&create_new_db, @@ -718,7 +718,7 @@ diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c #ifdef UNIV_LOG_ARCHIVE &min_arch_log_no, &max_arch_log_no, #endif /* UNIV_LOG_ARCHIVE */ -@@ -1623,6 +1763,14 @@ +@@ -1629,6 +1769,14 @@ after the double write buffer has been created. */ trx_sys_create(); @@ -733,7 +733,7 @@ diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c dict_create(); srv_startup_is_before_trx_rollback_phase = FALSE; -@@ -1656,6 +1804,13 @@ +@@ -1662,6 +1810,13 @@ recv_recovery_from_archive_finish(); #endif /* UNIV_LOG_ARCHIVE */ } else { @@ -747,7 +747,7 @@ diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c /* Check if we support the max format that is stamped on the system tablespace. -@@ -1742,6 +1897,17 @@ +@@ -1748,6 +1903,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(); @@ -973,7 +973,7 @@ diff -ruN a/storage/innobase/trx/trx0sys.c b/storage/innobase/trx/trx0sys.c && ((page_no >= block1 && page_no < block1 + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) -@@ -990,6 +1146,83 @@ +@@ -1015,6 +1171,83 @@ } /*****************************************************************//** @@ -1057,7 +1057,7 @@ diff -ruN a/storage/innobase/trx/trx0sys.c b/storage/innobase/trx/trx0sys.c Creates and initializes the central memory structures for the transaction system. This is called when the database is started. */ UNIV_INTERN -@@ -1351,6 +1584,26 @@ +@@ -1386,6 +1619,26 @@ /* Does nothing at the moment */ } diff --git a/innodb_show_lock_name.patch b/innodb_show_lock_name.patch index c9a8a47..87e33bd 100644 --- a/innodb_show_lock_name.patch +++ b/innodb_show_lock_name.patch @@ -8,7 +8,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc --- a/storage/innobase/handler/ha_innodb.cc 2010-12-03 17:34:35.285040381 +0900 +++ b/storage/innobase/handler/ha_innodb.cc 2010-12-03 17:35:12.974975252 +0900 -@@ -9571,8 +9571,8 @@ +@@ -9575,8 +9575,8 @@ rw_lock_wait_time += mutex->lspent_time; } #else /* UNIV_DEBUG */ @@ -19,7 +19,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ buf2len= (uint) my_snprintf(buf2, sizeof(buf2), "os_waits=%lu", (ulong) mutex->count_os_wait); -@@ -9587,9 +9587,8 @@ +@@ -9591,9 +9591,8 @@ if (block_mutex) { buf1len = (uint) my_snprintf(buf1, sizeof buf1, @@ -31,7 +31,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ buf2len = (uint) my_snprintf(buf2, sizeof buf2, "os_waits=%lu", (ulong) block_mutex_oswait_count); -@@ -9618,8 +9617,8 @@ +@@ -9622,8 +9621,8 @@ continue; } @@ -42,7 +42,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ buf2len = my_snprintf(buf2, sizeof buf2, "os_waits=%lu", (ulong) lock->count_os_wait); -@@ -9633,9 +9632,8 @@ +@@ -9637,9 +9636,8 @@ if (block_lock) { buf1len = (uint) my_snprintf(buf1, sizeof buf1, @@ -370,7 +370,7 @@ diff -ruN a/storage/innobase/sync/sync0rw.c b/storage/innobase/sync/sync0rw.c # endif #endif /* INNODB_RW_LOCKS_USE_ATOMICS */ -@@ -280,8 +281,7 @@ +@@ -283,8 +284,7 @@ ut_d(lock->magic_n = RW_LOCK_MAGIC_N); @@ -380,7 +380,7 @@ diff -ruN a/storage/innobase/sync/sync0rw.c b/storage/innobase/sync/sync0rw.c lock->count_os_wait = 0; lock->last_s_file_name = "not yet reserved"; -@@ -401,10 +401,10 @@ +@@ -404,10 +404,10 @@ if (srv_print_latch_waits) { fprintf(stderr, "Thread %lu spin wait rw-s-lock at %p" @@ -393,7 +393,7 @@ diff -ruN a/storage/innobase/sync/sync0rw.c b/storage/innobase/sync/sync0rw.c } /* We try once again to obtain the lock */ -@@ -437,10 +437,9 @@ +@@ -440,10 +440,9 @@ if (srv_print_latch_waits) { fprintf(stderr, "Thread %lu OS wait rw-s-lock at %p" @@ -406,7 +406,7 @@ diff -ruN a/storage/innobase/sync/sync0rw.c b/storage/innobase/sync/sync0rw.c } /* these stats may not be accurate */ -@@ -659,9 +658,9 @@ +@@ -662,9 +661,9 @@ if (srv_print_latch_waits) { fprintf(stderr, "Thread %lu spin wait rw-x-lock at %p" @@ -418,7 +418,7 @@ diff -ruN a/storage/innobase/sync/sync0rw.c b/storage/innobase/sync/sync0rw.c } sync_array_reserve_cell(sync_primary_wait_array, -@@ -682,9 +681,9 @@ +@@ -685,9 +684,9 @@ if (srv_print_latch_waits) { fprintf(stderr, "Thread %lu OS wait for rw-x-lock at %p" diff --git a/innodb_show_status.patch b/innodb_show_status.patch index 64463e6..1aae941 100644 --- a/innodb_show_status.patch +++ b/innodb_show_status.patch @@ -105,7 +105,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ {"buffer_pool_pages_free", (char*) &export_vars.innodb_buffer_pool_pages_free, SHOW_LONG}, #ifdef UNIV_DEBUG -@@ -11050,6 +11052,16 @@ +@@ -11057,6 +11059,16 @@ "Force InnoDB to not use next-key locking, to use only row-level locking.", NULL, NULL, FALSE); @@ -122,7 +122,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ #ifdef UNIV_LOG_ARCHIVE static MYSQL_SYSVAR_STR(log_arch_dir, innobase_log_arch_dir, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, -@@ -11237,7 +11249,7 @@ +@@ -11244,7 +11256,7 @@ static MYSQL_SYSVAR_STR(version, innodb_version_str, PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_READONLY, @@ -131,7 +131,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ static MYSQL_SYSVAR_BOOL(use_sys_malloc, srv_use_sys_malloc, PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY, -@@ -11330,6 +11342,8 @@ +@@ -11337,6 +11349,8 @@ MYSQL_SYSVAR(thread_concurrency), MYSQL_SYSVAR(thread_sleep_delay), MYSQL_SYSVAR(autoinc_lock_mode), @@ -196,7 +196,7 @@ diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0sr /* The sort order table of the MySQL latin1_swedish_ci character set collation */ extern const byte* srv_latin1_ordering; -@@ -323,6 +326,8 @@ +@@ -326,6 +329,8 @@ buffer pool to disk */ extern ulint srv_buf_pool_flushed; @@ -205,7 +205,7 @@ diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0sr /** Number of buffer pool reads that led to the reading of a disk page */ extern ulint srv_buf_pool_reads; -@@ -717,6 +722,7 @@ +@@ -720,6 +725,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 */ @@ -340,7 +340,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c /** Maximum number of times allowed to conditionally acquire mutex before switching to blocking wait on the mutex */ #define MAX_MUTEX_NOWAIT 20 -@@ -318,6 +322,7 @@ +@@ -321,6 +325,7 @@ /* variable to count the number of pages that were written from buffer pool to the disk */ UNIV_INTERN ulint srv_buf_pool_flushed = 0; @@ -348,7 +348,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c /** Number of buffer pool reads that led to the reading of a disk page */ -@@ -1826,6 +1831,13 @@ +@@ -1829,6 +1834,13 @@ ulint n_reserved; ibool ret; @@ -362,7 +362,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c mutex_enter(&srv_innodb_monitor_mutex); current_time = time(NULL); -@@ -1874,31 +1886,6 @@ +@@ -1877,31 +1889,6 @@ mutex_exit(&dict_foreign_err_mutex); @@ -394,7 +394,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c fputs("--------\n" "FILE I/O\n" "--------\n", file); -@@ -1929,10 +1916,84 @@ +@@ -1932,10 +1919,84 @@ "BUFFER POOL AND MEMORY\n" "----------------------\n", file); fprintf(file, @@ -483,7 +483,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c fprintf(file, "Dictionary memory allocated " ULINTPF "\n", dict_sys->size); -@@ -1948,6 +2009,16 @@ +@@ -1951,6 +2012,16 @@ fprintf(file, "%lu read views open inside InnoDB\n", UT_LIST_GET_LEN(trx_sys->view_list)); @@ -500,7 +500,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c n_reserved = fil_space_get_n_reserved_extents(0); if (n_reserved > 0) { fprintf(file, -@@ -1991,6 +2062,31 @@ +@@ -1994,6 +2065,31 @@ srv_n_rows_deleted_old = srv_n_rows_deleted; srv_n_rows_read_old = srv_n_rows_read; @@ -532,7 +532,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c fputs("----------------------------\n" "END OF INNODB MONITOR OUTPUT\n" "============================\n", file); -@@ -2034,6 +2130,7 @@ +@@ -2037,6 +2133,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; @@ -612,7 +612,7 @@ diff -ruN a/storage/innobase/thr/thr0loc.c b/storage/innobase/thr/thr0loc.c diff -ruN a/storage/innobase/trx/trx0purge.c b/storage/innobase/trx/trx0purge.c --- a/storage/innobase/trx/trx0purge.c 2010-12-04 02:58:26.000000000 +0900 +++ b/storage/innobase/trx/trx0purge.c 2011-01-21 19:40:42.086683671 +0900 -@@ -1201,7 +1201,7 @@ +@@ -1212,7 +1212,7 @@ /*=====================*/ { fprintf(stderr, "InnoDB: Purge system view:\n"); diff --git a/innodb_show_status_extend.patch b/innodb_show_status_extend.patch index 286905a..3993c18 100644 --- a/innodb_show_status_extend.patch +++ b/innodb_show_status_extend.patch @@ -245,7 +245,7 @@ diff -ruN a/storage/innobase/include/lock0lock.h b/storage/innobase/include/lock diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h --- a/storage/innobase/include/srv0srv.h 2011-01-21 19:53:42.380638228 +0900 +++ b/storage/innobase/include/srv0srv.h 2011-01-21 19:54:44.662600032 +0900 -@@ -751,6 +751,11 @@ +@@ -753,6 +753,11 @@ /** Status variables to be passed to MySQL */ struct export_var_struct{ @@ -257,7 +257,7 @@ diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0sr ulint innodb_data_pending_reads; /*!< Pending reads */ ulint innodb_data_pending_writes; /*!< Pending writes */ ulint innodb_data_pending_fsyncs; /*!< Pending fsyncs */ -@@ -768,6 +773,9 @@ +@@ -770,6 +775,9 @@ #ifdef UNIV_DEBUG ulint innodb_buffer_pool_pages_latched; /*!< Latched pages */ #endif /* UNIV_DEBUG */ @@ -267,7 +267,7 @@ diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0sr ulint innodb_buffer_pool_read_requests; /*!< buf_pool->stat.n_page_gets */ ulint innodb_buffer_pool_reads; /*!< srv_buf_pool_reads */ ulint innodb_buffer_pool_wait_free; /*!< srv_buf_pool_wait_free */ -@@ -776,13 +784,43 @@ +@@ -778,13 +786,43 @@ ulint innodb_buffer_pool_write_requests;/*!< srv_buf_pool_write_requests */ ulint innodb_buffer_pool_read_ahead; /*!< srv_read_ahead */ ulint innodb_buffer_pool_read_ahead_evicted;/*!< srv_read_ahead evicted*/ @@ -311,7 +311,7 @@ diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0sr ulint innodb_os_log_written; /*!< srv_os_log_written */ ulint innodb_os_log_fsyncs; /*!< fil_n_log_flushes */ ulint innodb_os_log_pending_writes; /*!< srv_os_log_pending_writes */ -@@ -791,6 +829,8 @@ +@@ -793,6 +831,8 @@ ulint innodb_pages_created; /*!< buf_pool->stat.n_pages_created */ ulint innodb_pages_read; /*!< buf_pool->stat.n_pages_read */ ulint innodb_pages_written; /*!< buf_pool->stat.n_pages_written */ @@ -320,7 +320,7 @@ diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0sr ulint innodb_row_lock_waits; /*!< srv_n_lock_wait_count */ ulint innodb_row_lock_current_waits; /*!< srv_n_lock_wait_current_count */ ib_int64_t innodb_row_lock_time; /*!< srv_n_lock_wait_time -@@ -800,11 +840,18 @@ +@@ -802,11 +842,18 @@ / srv_n_lock_wait_count */ ulint innodb_row_lock_time_max; /*!< srv_n_lock_max_wait_time / 1000 */ @@ -391,7 +391,7 @@ diff -ruN a/storage/innobase/lock/lock0lock.c b/storage/innobase/lock/lock0lock. diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c --- a/storage/innobase/srv/srv0srv.c 2011-01-21 19:53:42.390637840 +0900 +++ b/storage/innobase/srv/srv0srv.c 2011-01-21 19:54:44.673637084 +0900 -@@ -2267,12 +2267,49 @@ +@@ -2269,12 +2269,49 @@ ulint LRU_len; ulint free_len; ulint flush_list_len; @@ -441,7 +441,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c export_vars.innodb_data_pending_reads = os_n_pending_reads; export_vars.innodb_data_pending_writes -@@ -2309,6 +2346,92 @@ +@@ -2311,6 +2348,92 @@ export_vars.innodb_buffer_pool_pages_misc = buf_pool_get_n_pages() - LRU_len - free_len; diff --git a/innodb_show_sys_tables.patch b/innodb_show_sys_tables.patch index d066de9..2ecc321 100644 --- a/innodb_show_sys_tables.patch +++ b/innodb_show_sys_tables.patch @@ -41,7 +41,7 @@ diff -ruN a/storage/innobase/dict/dict0load.c b/storage/innobase/dict/dict0load. diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc --- a/storage/innobase/handler/ha_innodb.cc 2010-12-03 15:53:54.615040167 +0900 +++ b/storage/innobase/handler/ha_innodb.cc 2010-12-03 16:07:26.851357007 +0900 -@@ -11746,7 +11746,14 @@ +@@ -11748,7 +11748,14 @@ i_s_innodb_cmp, i_s_innodb_cmp_reset, i_s_innodb_cmpmem, diff --git a/innodb_split_buf_pool_mutex.patch b/innodb_split_buf_pool_mutex.patch index 2cc9399..f9a9c06 100644 --- a/innodb_split_buf_pool_mutex.patch +++ b/innodb_split_buf_pool_mutex.patch @@ -8,7 +8,7 @@ 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 -@@ -4066,7 +4066,8 @@ +@@ -4069,7 +4069,8 @@ mtr_commit(mtr); @@ -18,7 +18,7 @@ diff -ruN a/storage/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c mutex_enter(&block->mutex); /* Only free the block if it is still allocated to -@@ -4077,16 +4078,21 @@ +@@ -4080,16 +4081,21 @@ && buf_block_get_space(block) == space && buf_block_get_page_no(block) == page_no) { @@ -1393,16 +1393,37 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c #if UNIV_WORD_SIZE == 4 /* On 32-bit systems, there is no padding in buf_page_t. On other systems, Valgrind could complain about uninitialized pad -@@ -3016,7 +3154,7 @@ +@@ -3016,8 +3154,8 @@ /* Try to evict the block from the buffer pool, to use the insert buffer (change buffer) as much as possible. */ - if (buf_LRU_free_block(&block->page, TRUE) == BUF_LRU_FREED) { +- mutex_exit(&block->mutex); + if (buf_LRU_free_block(&block->page, TRUE, FALSE) == BUF_LRU_FREED) { - mutex_exit(&block->mutex); ++ mutex_exit(block_mutex); if (mode == BUF_GET_IF_IN_POOL_OR_WATCH) { /* Set the watch, as it would have -@@ -3052,13 +3190,14 @@ + been set if the page were not in the +@@ -3026,6 +3164,9 @@ + space, offset, fold); + + if (UNIV_LIKELY_NULL(block)) { ++ block_mutex = buf_page_get_mutex((buf_page_t*)block); ++ ut_a(block_mutex); ++ ut_ad(mutex_own(block_mutex)); + + /* The page entered the buffer + pool for some reason. Try to +@@ -3033,7 +3174,7 @@ + goto got_block; + } + } +- buf_pool_mutex_exit(buf_pool); ++ //buf_pool_mutex_exit(buf_pool); + fprintf(stderr, + "innodb_change_buffering_debug evict %u %u\n", + (unsigned) space, (unsigned) offset); +@@ -3052,13 +3193,14 @@ buf_block_buf_fix_inc(block, file, line); @@ -1419,7 +1440,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c buf_page_set_accessed_make_young(&block->page, access_time); -@@ -3291,9 +3430,11 @@ +@@ -3291,9 +3433,11 @@ buf_pool = buf_pool_from_block(block); if (mode == BUF_MAKE_YOUNG && buf_page_peek_if_too_old(&block->page)) { @@ -1433,7 +1454,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c } else if (!buf_page_is_accessed(&block->page)) { /* Above, we do a dirty read on purpose, to avoid mutex contention. The field buf_page_t::access_time -@@ -3301,9 +3442,11 @@ +@@ -3301,9 +3445,11 @@ field must be protected by mutex, however. */ ulint time_ms = ut_time_ms(); @@ -1447,7 +1468,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c } ut_ad(!ibuf_inside() || (mode == BUF_KEEP_OLD)); -@@ -3370,18 +3513,21 @@ +@@ -3370,18 +3516,21 @@ ut_ad(mtr); ut_ad(mtr->state == MTR_ACTIVE); @@ -1472,7 +1493,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG ut_a(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE); -@@ -3470,7 +3616,10 @@ +@@ -3470,7 +3619,10 @@ buf_page_t* hash_page; buf_pool_t* buf_pool = buf_pool_get(space, offset); @@ -1484,7 +1505,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c ut_ad(mutex_own(&(block->mutex))); ut_a(buf_block_get_state(block) != BUF_BLOCK_FILE_PAGE); -@@ -3499,11 +3648,14 @@ +@@ -3499,11 +3651,14 @@ if (UNIV_LIKELY(!hash_page)) { } else if (buf_pool_watch_is_sentinel(buf_pool, hash_page)) { /* Preserve the reference count. */ @@ -1500,7 +1521,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c } else { fprintf(stderr, "InnoDB: Error: page %lu %lu already found" -@@ -3513,7 +3665,8 @@ +@@ -3513,7 +3668,8 @@ (const void*) hash_page, (const void*) block); #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG mutex_exit(&block->mutex); @@ -1510,7 +1531,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c buf_print(); buf_LRU_print(); buf_validate(); -@@ -3597,7 +3750,9 @@ +@@ -3597,7 +3753,9 @@ fold = buf_page_address_fold(space, offset); @@ -1521,7 +1542,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c watch_page = buf_page_hash_get_low(buf_pool, space, offset, fold); if (watch_page && !buf_pool_watch_is_sentinel(buf_pool, watch_page)) { -@@ -3606,9 +3761,15 @@ +@@ -3606,9 +3764,15 @@ err_exit: if (block) { mutex_enter(&block->mutex); @@ -1538,7 +1559,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c bpage = NULL; goto func_exit; -@@ -3631,6 +3792,8 @@ +@@ -3631,6 +3795,8 @@ buf_page_init(space, offset, fold, block); @@ -1547,7 +1568,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c /* The block must be put to the LRU list, to the old blocks */ buf_LRU_add_block(bpage, TRUE/* to old blocks */); -@@ -3658,7 +3821,7 @@ +@@ -3658,7 +3824,7 @@ been added to buf_pool->LRU and buf_pool->page_hash. */ mutex_exit(&block->mutex); @@ -1556,7 +1577,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c mutex_enter(&block->mutex); block->page.zip.data = data; -@@ -3671,6 +3834,7 @@ +@@ -3671,6 +3837,7 @@ buf_unzip_LRU_add_block(block, TRUE); } @@ -1564,7 +1585,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c mutex_exit(&block->mutex); } else { /* Defer buf_buddy_alloc() until after the block has -@@ -3682,8 +3846,8 @@ +@@ -3682,8 +3849,8 @@ control block (bpage), in order to avoid the invocation of buf_buddy_relocate_block() on uninitialized data. */ @@ -1575,7 +1596,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c /* Initialize the buf_pool pointer. */ bpage->buf_pool_index = buf_pool_index(buf_pool); -@@ -3702,8 +3866,11 @@ +@@ -3702,8 +3869,11 @@ /* The block was added by some other thread. */ watch_page = NULL; @@ -1589,7 +1610,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c bpage = NULL; goto func_exit; -@@ -3747,18 +3914,24 @@ +@@ -3747,18 +3917,24 @@ HASH_INSERT(buf_page_t, hash, buf_pool->page_hash, fold, bpage); @@ -1615,7 +1636,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c if (mode == BUF_READ_IBUF_PAGES_ONLY) { -@@ -3800,7 +3973,9 @@ +@@ -3800,7 +3976,9 @@ fold = buf_page_address_fold(space, offset); @@ -1626,7 +1647,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c block = (buf_block_t*) buf_page_hash_get_low( buf_pool, space, offset, fold); -@@ -3816,7 +3991,9 @@ +@@ -3816,7 +3994,9 @@ #endif /* UNIV_DEBUG_FILE_ACCESSES || UNIV_DEBUG */ /* Page can be found in buf_pool */ @@ -1637,7 +1658,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c buf_block_free(free_block); -@@ -3838,6 +4015,7 @@ +@@ -3838,6 +4018,7 @@ mutex_enter(&block->mutex); buf_page_init(space, offset, fold, block); @@ -1645,7 +1666,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c /* The block must be put to the LRU list */ buf_LRU_add_block(&block->page, FALSE); -@@ -3864,7 +4042,7 @@ +@@ -3864,7 +4045,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. */ @@ -1654,7 +1675,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c mutex_enter(&block->mutex); block->page.zip.data = data; -@@ -3882,7 +4060,8 @@ +@@ -3882,7 +4063,8 @@ buf_page_set_accessed(&block->page, time_ms); @@ -1664,7 +1685,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c mtr_memo_push(mtr, block, MTR_MEMO_BUF_FIX); -@@ -3933,6 +4112,8 @@ +@@ -3933,6 +4115,8 @@ buf_pool_t* buf_pool = buf_pool_from_bpage(bpage); const ibool uncompressed = (buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE); @@ -1673,7 +1694,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c ut_a(buf_page_in_file(bpage)); -@@ -4066,8 +4247,26 @@ +@@ -4066,8 +4250,26 @@ } } @@ -1701,7 +1722,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c #ifdef UNIV_IBUF_COUNT_DEBUG if (io_type == BUF_IO_WRITE || uncompressed) { -@@ -4090,6 +4289,7 @@ +@@ -4090,6 +4292,7 @@ the x-latch to this OS thread: do not let this confuse you in debugging! */ @@ -1709,7 +1730,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c ut_ad(buf_pool->n_pend_reads > 0); buf_pool->n_pend_reads--; buf_pool->stat.n_pages_read++; -@@ -4107,6 +4307,9 @@ +@@ -4107,6 +4310,9 @@ buf_flush_write_complete(bpage); @@ -1719,7 +1740,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c if (uncompressed) { rw_lock_s_unlock_gen(&((buf_block_t*) bpage)->lock, BUF_IO_WRITE); -@@ -4129,8 +4332,8 @@ +@@ -4129,8 +4335,8 @@ } #endif /* UNIV_DEBUG */ @@ -1729,7 +1750,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c } /*********************************************************************//** -@@ -4147,7 +4350,9 @@ +@@ -4147,7 +4353,9 @@ ut_ad(buf_pool); @@ -1740,7 +1761,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c chunk = buf_pool->chunks; -@@ -4164,7 +4369,9 @@ +@@ -4164,7 +4372,9 @@ } } @@ -1751,7 +1772,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c return(TRUE); } -@@ -4212,7 +4419,8 @@ +@@ -4212,7 +4422,8 @@ freed = buf_LRU_search_and_free_block(buf_pool, 100); } @@ -1761,7 +1782,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c ut_ad(UT_LIST_GET_LEN(buf_pool->LRU) == 0); ut_ad(UT_LIST_GET_LEN(buf_pool->unzip_LRU) == 0); -@@ -4225,7 +4433,8 @@ +@@ -4225,7 +4436,8 @@ memset(&buf_pool->stat, 0x00, sizeof(buf_pool->stat)); buf_refresh_io_stats(buf_pool); @@ -1771,7 +1792,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c } /*********************************************************************//** -@@ -4267,7 +4476,10 @@ +@@ -4267,7 +4479,10 @@ ut_ad(buf_pool); @@ -1783,7 +1804,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c chunk = buf_pool->chunks; -@@ -4362,7 +4574,7 @@ +@@ -4362,7 +4577,7 @@ /* Check clean compressed-only blocks. */ for (b = UT_LIST_GET_FIRST(buf_pool->zip_clean); b; @@ -1792,7 +1813,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c ut_a(buf_page_get_state(b) == BUF_BLOCK_ZIP_PAGE); switch (buf_page_get_io_fix(b)) { case BUF_IO_NONE: -@@ -4393,7 +4605,7 @@ +@@ -4393,7 +4608,7 @@ buf_flush_list_mutex_enter(buf_pool); for (b = UT_LIST_GET_FIRST(buf_pool->flush_list); b; @@ -1801,7 +1822,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c ut_ad(b->in_flush_list); ut_a(b->oldest_modification); n_flush++; -@@ -4452,6 +4664,8 @@ +@@ -4452,6 +4667,8 @@ } ut_a(UT_LIST_GET_LEN(buf_pool->LRU) == n_lru); @@ -1810,7 +1831,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c if (UT_LIST_GET_LEN(buf_pool->free) != n_free) { fprintf(stderr, "Free list len %lu, free blocks %lu\n", (ulong) UT_LIST_GET_LEN(buf_pool->free), -@@ -4462,8 +4676,11 @@ +@@ -4462,8 +4679,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); @@ -1823,7 +1844,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c ut_a(buf_LRU_validate()); ut_a(buf_flush_validate(buf_pool)); -@@ -4519,7 +4736,9 @@ +@@ -4519,7 +4739,9 @@ index_ids = mem_alloc(size * sizeof *index_ids); counts = mem_alloc(sizeof(ulint) * size); @@ -1834,7 +1855,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c buf_flush_list_mutex_enter(buf_pool); fprintf(stderr, -@@ -4588,7 +4807,9 @@ +@@ -4588,7 +4810,9 @@ } } @@ -1845,7 +1866,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c for (i = 0; i < n_found; i++) { index = dict_index_get_if_in_cache(index_ids[i]); -@@ -4645,7 +4866,7 @@ +@@ -4645,7 +4869,7 @@ buf_chunk_t* chunk; ulint fixed_pages_number = 0; @@ -1854,7 +1875,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c chunk = buf_pool->chunks; -@@ -4679,7 +4900,7 @@ +@@ -4679,7 +4903,7 @@ /* Traverse the lists of clean and dirty compressed-only blocks. */ for (b = UT_LIST_GET_FIRST(buf_pool->zip_clean); b; @@ -1863,7 +1884,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c ut_a(buf_page_get_state(b) == BUF_BLOCK_ZIP_PAGE); ut_a(buf_page_get_io_fix(b) != BUF_IO_WRITE); -@@ -4691,7 +4912,7 @@ +@@ -4691,7 +4915,7 @@ buf_flush_list_mutex_enter(buf_pool); for (b = UT_LIST_GET_FIRST(buf_pool->flush_list); b; @@ -1872,7 +1893,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c ut_ad(b->in_flush_list); switch (buf_page_get_state(b)) { -@@ -4717,7 +4938,7 @@ +@@ -4717,7 +4941,7 @@ buf_flush_list_mutex_exit(buf_pool); mutex_exit(&buf_pool->zip_mutex); @@ -1881,7 +1902,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c return(fixed_pages_number); } -@@ -4873,6 +5094,8 @@ +@@ -4873,6 +5097,8 @@ /* Find appropriate pool_info to store stats for this buffer pool */ pool_info = &all_pool_info[pool_id]; @@ -1890,7 +1911,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c buf_pool_mutex_enter(buf_pool); buf_flush_list_mutex_enter(buf_pool); -@@ -4983,6 +5206,8 @@ +@@ -4983,6 +5209,8 @@ pool_info->unzip_cur = buf_LRU_stat_cur.unzip; buf_refresh_io_stats(buf_pool); @@ -1899,7 +1920,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c buf_pool_mutex_exit(buf_pool); } -@@ -5224,11 +5449,13 @@ +@@ -5224,11 +5452,13 @@ { ulint len; @@ -2047,7 +2068,28 @@ diff -ruN a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c 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); -@@ -1260,12 +1261,18 @@ +@@ -1177,7 +1178,7 @@ + buf_pool_t* buf_pool, /*!< in/out: buffer pool instance */ + buf_block_t* block) /*!< in/out: buffer control block */ + { +- ut_ad(buf_pool_mutex_own(buf_pool)); ++ //ut_ad(buf_pool_mutex_own(buf_pool)); + ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE); + ut_ad(mutex_own(&block->mutex)); + +@@ -1185,8 +1186,11 @@ + return(FALSE); + } + ++ buf_pool_mutex_enter(buf_pool); ++ + if (buf_pool->n_flush[BUF_FLUSH_LRU] > 0 + || buf_pool->init_flush[BUF_FLUSH_LRU]) { ++ buf_pool_mutex_exit(buf_pool); + /* There is already a flush batch of the same type running */ + return(FALSE); + } +@@ -1260,12 +1264,18 @@ ibool is_uncompressed; ut_ad(flush_type == BUF_FLUSH_LRU || flush_type == BUF_FLUSH_LIST); @@ -2067,7 +2109,7 @@ diff -ruN a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c ut_ad(buf_flush_ready_for_flush(bpage, flush_type)); buf_page_set_io_fix(bpage, BUF_IO_WRITE); -@@ -1427,14 +1434,16 @@ +@@ -1427,14 +1437,16 @@ buf_pool = buf_pool_get(space, i); @@ -2086,21 +2128,21 @@ diff -ruN a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c continue; } -@@ -1446,11 +1455,9 @@ +@@ -1446,11 +1458,9 @@ if (flush_type != BUF_FLUSH_LRU || i == offset || buf_page_is_old(bpage)) { - mutex_t* block_mutex = buf_page_get_mutex(bpage); -- -- mutex_enter(block_mutex); + mutex_t* block_mutex = buf_page_get_mutex_enter(bpage); +- mutex_enter(block_mutex); +- - if (buf_flush_ready_for_flush(bpage, flush_type) + if (block_mutex && buf_flush_ready_for_flush(bpage, flush_type) && (i == offset || !bpage->buf_fix_count)) { /* We only try to flush those neighbors != offset where the buf fix -@@ -1466,11 +1473,12 @@ +@@ -1466,11 +1476,12 @@ ut_ad(!buf_pool_mutex_own(buf_pool)); count++; continue; @@ -2115,7 +2157,7 @@ diff -ruN a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c } return(count); -@@ -1503,21 +1511,25 @@ +@@ -1503,21 +1514,25 @@ buf_pool_t* buf_pool = buf_pool_from_bpage(bpage); #endif /* UNIV_DEBUG */ @@ -2147,7 +2189,7 @@ diff -ruN a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c /* These fields are protected by both the buffer pool mutex and block mutex. */ -@@ -1533,13 +1545,18 @@ +@@ -1533,13 +1548,18 @@ *count, n_to_flush); @@ -2169,7 +2211,7 @@ diff -ruN a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c return(flushed); } -@@ -1560,7 +1577,8 @@ +@@ -1560,7 +1580,8 @@ buf_page_t* bpage; ulint count = 0; @@ -2179,7 +2221,7 @@ diff -ruN a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c do { /* Start from the end of the list looking for a -@@ -1582,7 +1600,8 @@ +@@ -1582,7 +1603,8 @@ should be flushed, we factor in this value. */ buf_lru_flush_page_count += count; @@ -2189,7 +2231,7 @@ diff -ruN a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c return(count); } -@@ -1610,9 +1629,10 @@ +@@ -1610,9 +1632,10 @@ { ulint len; buf_page_t* bpage; @@ -2201,7 +2243,7 @@ diff -ruN a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c /* If we have flushed enough, leave the loop */ do { -@@ -1631,6 +1651,7 @@ +@@ -1631,6 +1654,7 @@ if (bpage) { ut_a(bpage->oldest_modification > 0); @@ -2209,7 +2251,7 @@ diff -ruN a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c } if (!bpage || bpage->oldest_modification >= lsn_limit) { -@@ -1672,9 +1693,17 @@ +@@ -1672,9 +1696,17 @@ break; } @@ -2229,7 +2271,7 @@ diff -ruN a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c buf_flush_list_mutex_exit(buf_pool); -@@ -1683,7 +1712,7 @@ +@@ -1683,7 +1715,7 @@ } while (count < min_n && bpage != NULL && len > 0); @@ -2238,7 +2280,7 @@ diff -ruN a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c return(count); } -@@ -1722,13 +1751,15 @@ +@@ -1722,13 +1754,15 @@ || sync_thread_levels_empty_gen(TRUE)); #endif /* UNIV_SYNC_DEBUG */ @@ -2255,7 +2297,7 @@ diff -ruN a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c break; case BUF_FLUSH_LIST: count = buf_flush_flush_list_batch(buf_pool, min_n, lsn_limit); -@@ -1737,7 +1768,7 @@ +@@ -1737,7 +1771,7 @@ ut_error; } @@ -2264,7 +2306,7 @@ diff -ruN a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c buf_flush_buffered_writes(); -@@ -1993,7 +2024,7 @@ +@@ -1993,7 +2027,7 @@ retry: //buf_pool_mutex_enter(buf_pool); if (have_LRU_mutex) @@ -2273,7 +2315,7 @@ diff -ruN a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c n_replaceable = UT_LIST_GET_LEN(buf_pool->free); -@@ -2010,15 +2041,15 @@ +@@ -2010,15 +2044,15 @@ bpage = UT_LIST_GET_LAST(buf_pool->LRU); continue; } @@ -2294,7 +2336,7 @@ diff -ruN a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c distance++; -@@ -2027,7 +2058,7 @@ +@@ -2027,7 +2061,7 @@ //buf_pool_mutex_exit(buf_pool); if (have_LRU_mutex) @@ -2303,7 +2345,7 @@ diff -ruN a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c if (n_replaceable >= BUF_FLUSH_FREE_BLOCK_MARGIN(buf_pool)) { -@@ -2226,7 +2257,7 @@ +@@ -2226,7 +2260,7 @@ ut_ad(buf_flush_list_mutex_own(buf_pool)); @@ -2312,7 +2354,7 @@ diff -ruN a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c ut_ad(ut_list_node_313->in_flush_list)); bpage = UT_LIST_GET_FIRST(buf_pool->flush_list); -@@ -2266,7 +2297,7 @@ +@@ -2266,7 +2300,7 @@ rnode = rbt_next(buf_pool->flush_rbt, rnode); } @@ -2503,7 +2545,7 @@ diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c - ut_ad(buf_pool_mutex_own(buf_pool)); + //ut_ad(buf_pool_mutex_own(buf_pool)); + ut_ad(mutex_own(&buf_pool->LRU_list_mutex)); -+ ut_ad(mutex_own(&buf_pool->flush_list_mutex)); ++ ut_ad(mutex_own(&buf_pool->zip_mutex)); ut_ad(buf_page_get_state(bpage) == BUF_BLOCK_ZIP_PAGE); /* Find the first successor of bpage in the LRU list @@ -3502,6 +3544,16 @@ diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0bu ulint instance_no; /*!< Array index of this buffer pool instance */ ulint old_pool_size; /*!< Old pool size in bytes */ +@@ -1763,8 +1795,8 @@ + /** Test if a buffer pool mutex is owned. */ + #define buf_pool_mutex_own(b) mutex_own(&b->mutex) + /** Acquire a buffer pool mutex. */ ++/* the buf_pool_mutex is changed the latch order */ + #define buf_pool_mutex_enter(b) do { \ +- ut_ad(!mutex_own(&b->zip_mutex)); \ + mutex_enter(&b->mutex); \ + } while (0) + diff -ruN a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0buf.ic --- a/storage/innobase/include/buf0buf.ic 2010-11-03 07:01:13.000000000 +0900 +++ b/storage/innobase/include/buf0buf.ic 2010-12-03 15:48:29.345024524 +0900 @@ -3514,11 +3566,13 @@ diff -ruN a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0b break; case BUF_BLOCK_ZIP_PAGE: case BUF_BLOCK_ZIP_DIRTY: -@@ -317,9 +317,14 @@ +@@ -317,9 +317,16 @@ { buf_pool_t* buf_pool = buf_pool_from_bpage(bpage); -+ if (buf_pool_watch_is_sentinel(buf_pool, bpage)) { ++ if (/*equivalent to buf_pool_watch_is_sentinel(buf_pool, bpage)*/ ++ bpage >= &buf_pool->watch[0] ++ && bpage < &buf_pool->watch[BUF_POOL_WATCH_SIZE]) { + /* TODO: this code is the interim. should be confirmed later. */ + return(&buf_pool->zip_mutex); + } @@ -3530,7 +3584,7 @@ diff -ruN a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0b return(NULL); case BUF_BLOCK_ZIP_PAGE: case BUF_BLOCK_ZIP_DIRTY: -@@ -329,6 +334,28 @@ +@@ -329,6 +336,28 @@ } } @@ -3559,7 +3613,7 @@ diff -ruN a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0b /*********************************************************************//** Get the flush type of a page. @return flush type */ -@@ -425,8 +452,8 @@ +@@ -425,8 +454,8 @@ enum buf_io_fix io_fix) /*!< in: io_fix state */ { #ifdef UNIV_DEBUG @@ -3570,7 +3624,7 @@ diff -ruN a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0b #endif ut_ad(mutex_own(buf_page_get_mutex(bpage))); -@@ -456,14 +483,14 @@ +@@ -456,14 +485,14 @@ const buf_page_t* bpage) /*!< control block being relocated */ { #ifdef UNIV_DEBUG @@ -3589,7 +3643,7 @@ diff -ruN a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0b && bpage->buf_fix_count == 0); } -@@ -477,8 +504,8 @@ +@@ -477,8 +506,8 @@ const buf_page_t* bpage) /*!< in: control block */ { #ifdef UNIV_DEBUG @@ -3600,7 +3654,7 @@ diff -ruN a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0b #endif ut_ad(buf_page_in_file(bpage)); -@@ -498,7 +525,8 @@ +@@ -498,7 +527,8 @@ buf_pool_t* buf_pool = buf_pool_from_bpage(bpage); #endif /* UNIV_DEBUG */ ut_a(buf_page_in_file(bpage)); @@ -3610,7 +3664,7 @@ diff -ruN a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0b ut_ad(bpage->in_LRU_list); #ifdef UNIV_LRU_DEBUG -@@ -545,9 +573,10 @@ +@@ -545,9 +575,10 @@ ulint time_ms) /*!< in: ut_time_ms() */ { #ifdef UNIV_DEBUG @@ -3623,7 +3677,7 @@ diff -ruN a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0b ut_a(buf_page_in_file(bpage)); if (!bpage->access_time) { -@@ -761,19 +790,19 @@ +@@ -761,19 +792,19 @@ /*===========*/ buf_block_t* block) /*!< in, own: block to be freed */ { @@ -3647,7 +3701,7 @@ diff -ruN a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0b } #endif /* !UNIV_HOTBACKUP */ -@@ -821,17 +850,17 @@ +@@ -821,17 +852,17 @@ page frame */ { ib_uint64_t lsn; @@ -3670,7 +3724,7 @@ diff -ruN a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0b return(lsn); } -@@ -849,7 +878,7 @@ +@@ -849,7 +880,7 @@ #ifdef UNIV_SYNC_DEBUG buf_pool_t* buf_pool = buf_pool_from_bpage((buf_page_t*)block); @@ -3679,7 +3733,7 @@ diff -ruN a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0b && (block->page.buf_fix_count == 0)) || rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE)); #endif /* UNIV_SYNC_DEBUG */ -@@ -979,7 +1008,11 @@ +@@ -979,7 +1010,11 @@ buf_page_t* bpage; ut_ad(buf_pool); @@ -3692,7 +3746,7 @@ diff -ruN a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0b ut_ad(fold == buf_page_address_fold(space, offset)); /* Look for the page in the hash table */ -@@ -1064,11 +1097,13 @@ +@@ -1064,11 +1099,13 @@ const buf_page_t* bpage; buf_pool_t* buf_pool = buf_pool_get(space, offset); @@ -3708,7 +3762,7 @@ diff -ruN a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0b return(bpage != NULL); } -@@ -1196,4 +1231,38 @@ +@@ -1196,4 +1233,38 @@ buf_pool_mutex_exit(buf_pool); } } @@ -3797,8 +3851,8 @@ diff -ruN a/storage/innobase/include/sync0sync.h b/storage/innobase/include/sync extern mysql_pfs_key_t dict_foreign_err_mutex_key; extern mysql_pfs_key_t dict_sys_mutex_key; @@ -660,7 +664,7 @@ - #define SYNC_TRX_LOCK_HEAP 298 #define SYNC_TRX_SYS_HEADER 290 + #define SYNC_PURGE_QUEUE 200 #define SYNC_LOG 170 -#define SYNC_LOG_FLUSH_ORDER 147 +#define SYNC_LOG_FLUSH_ORDER 156 @@ -3832,7 +3886,7 @@ diff -ruN a/storage/innobase/include/sync0sync.h b/storage/innobase/include/sync diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c --- a/storage/innobase/srv/srv0srv.c 2010-12-03 15:48:03.080956216 +0900 +++ b/storage/innobase/srv/srv0srv.c 2010-12-03 15:48:29.355023766 +0900 -@@ -3099,7 +3099,7 @@ +@@ -3101,7 +3101,7 @@ level += log_sys->max_checkpoint_age - (lsn - oldest_modification); } @@ -3841,7 +3895,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c n_blocks++; } -@@ -3185,7 +3185,7 @@ +@@ -3187,7 +3187,7 @@ found = TRUE; break; } diff --git a/innodb_stats.patch b/innodb_stats.patch index 5192d11..095c25a 100644 --- a/innodb_stats.patch +++ b/innodb_stats.patch @@ -47,22 +47,26 @@ diff -ruN a/storage/innobase/dict/dict0boot.c b/storage/innobase/dict/dict0boot. index = dict_mem_index_create("SYS_FIELDS", "CLUST_IND", DICT_HDR_SPACE, -@@ -442,6 +465,41 @@ +@@ -442,6 +465,45 @@ FALSE); ut_a(error == DB_SUCCESS); + /*-------------------------*/ -+ table = dict_mem_table_create("SYS_STATS", DICT_HDR_SPACE, 3, 0); ++ table = dict_mem_table_create("SYS_STATS", DICT_HDR_SPACE, 4, 0); + table->n_mysql_handles_opened = 1; /* for pin */ + + dict_mem_table_add_col(table, heap, "INDEX_ID", DATA_BINARY, 0, 0); + dict_mem_table_add_col(table, heap, "KEY_COLS", DATA_INT, 0, 4); + dict_mem_table_add_col(table, heap, "DIFF_VALS", DATA_BINARY, 0, 0); ++ dict_mem_table_add_col(table, heap, "NON_NULL_VALS", DATA_BINARY, 0, 0); + + /* The '+ 2' below comes from the fields DB_TRX_ID, DB_ROLL_PTR */ +#if DICT_SYS_STATS_DIFF_VALS_FIELD != 2 + 2 +#error "DICT_SYS_STATS_DIFF_VALS_FIELD != 2 + 2" +#endif ++#if DICT_SYS_STATS_NON_NULL_VALS_FIELD != 3 + 2 ++#error "DICT_SYS_STATS_NON_NULL_VALS_FIELD != 3 + 2" ++#endif + + table->id = DICT_STATS_ID; + dict_table_add_to_cache(table, heap); @@ -89,7 +93,7 @@ diff -ruN a/storage/innobase/dict/dict0boot.c b/storage/innobase/dict/dict0boot. mtr_commit(&mtr); /*-------------------------*/ -@@ -455,6 +513,7 @@ +@@ -455,6 +517,7 @@ dict_load_sys_table(dict_sys->sys_columns); dict_load_sys_table(dict_sys->sys_indexes); dict_load_sys_table(dict_sys->sys_fields); @@ -100,7 +104,7 @@ diff -ruN a/storage/innobase/dict/dict0boot.c b/storage/innobase/dict/dict0boot. diff -ruN a/storage/innobase/dict/dict0crea.c b/storage/innobase/dict/dict0crea.c --- a/storage/innobase/dict/dict0crea.c 2010-12-03 15:48:03.036081059 +0900 +++ b/storage/innobase/dict/dict0crea.c 2010-12-03 17:19:24.836964976 +0900 -@@ -508,6 +508,51 @@ +@@ -508,6 +508,56 @@ } /*****************************************************************//** @@ -125,7 +129,7 @@ diff -ruN a/storage/innobase/dict/dict0crea.c b/storage/innobase/dict/dict0crea. + + sys_stats = dict_sys->sys_stats; + -+ entry = dtuple_create(heap, 3 + DATA_N_SYS_COLS); ++ entry = dtuple_create(heap, 4 + DATA_N_SYS_COLS); + + dict_table_copy_types(entry, sys_stats); + @@ -144,6 +148,11 @@ diff -ruN a/storage/innobase/dict/dict0crea.c b/storage/innobase/dict/dict0crea. + ptr = mem_heap_alloc(heap, 8); + mach_write_to_8(ptr, 0); /* initial value is 0 */ + dfield_set_data(dfield, ptr, 8); ++ /* 5: NON_NULL_VALS ------------------*/ ++ dfield = dtuple_get_nth_field(entry, 3/*NON_NULL_VALS*/); ++ ptr = mem_heap_alloc(heap, 8); ++ mach_write_to_8(ptr, 0); /* initial value is 0 */ ++ dfield_set_data(dfield, ptr, 8); + + return(entry); +} @@ -152,7 +161,7 @@ diff -ruN a/storage/innobase/dict/dict0crea.c b/storage/innobase/dict/dict0crea. Creates the tuple with which the index entry is searched for writing the index tree root page number, if such a tree is created. @return the tuple for search */ -@@ -617,6 +662,27 @@ +@@ -617,6 +667,27 @@ } /***************************************************************//** @@ -180,7 +189,7 @@ diff -ruN a/storage/innobase/dict/dict0crea.c b/storage/innobase/dict/dict0crea. Creates an index tree for the index if it is not a member of a cluster. @return DB_SUCCESS or DB_OUT_OF_FILE_SPACE */ static -@@ -937,6 +1003,49 @@ +@@ -937,6 +1008,49 @@ dict_sys->sys_fields, heap); node->field_def->common.parent = node; @@ -230,7 +239,7 @@ diff -ruN a/storage/innobase/dict/dict0crea.c b/storage/innobase/dict/dict0crea. node->commit_node = commit_node_create(heap); node->commit_node->common.parent = node; -@@ -1087,6 +1196,7 @@ +@@ -1087,6 +1201,7 @@ node->state = INDEX_BUILD_FIELD_DEF; node->field_no = 0; @@ -238,7 +247,7 @@ diff -ruN a/storage/innobase/dict/dict0crea.c b/storage/innobase/dict/dict0crea. thr->run_node = node->ind_def; -@@ -1132,7 +1242,31 @@ +@@ -1132,7 +1247,31 @@ goto function_exit; } @@ -271,7 +280,7 @@ diff -ruN a/storage/innobase/dict/dict0crea.c b/storage/innobase/dict/dict0crea. } if (node->state == INDEX_CREATE_INDEX_TREE) { -@@ -1178,6 +1312,66 @@ +@@ -1178,6 +1317,66 @@ return(NULL); } @@ -350,7 +359,7 @@ diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict. } return(table); -@@ -4310,6 +4310,240 @@ +@@ -4310,6 +4310,289 @@ } /*********************************************************************//** @@ -402,15 +411,18 @@ diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict. + ulint key_cols; + ulint n_cols; + const rec_t* rec; ++ ulint n_fields; + const byte* field; + ulint len; + ib_int64_t* stat_n_diff_key_vals_tmp; ++ ib_int64_t* stat_n_non_null_key_vals_tmp; + byte* buf; + ulint i; + mtr_t mtr; + + n_cols = dict_index_get_n_unique(index); + stat_n_diff_key_vals_tmp = mem_heap_zalloc(heap, (n_cols + 1) * sizeof(ib_int64_t)); ++ stat_n_non_null_key_vals_tmp = mem_heap_zalloc(heap, (n_cols + 1) * sizeof(ib_int64_t)); + + sys_stats = dict_sys->sys_stats; + sys_index = UT_LIST_GET_FIRST(sys_stats->indexes); @@ -446,9 +458,13 @@ diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict. + } + + if (rec_get_deleted_flag(rec, 0)) { ++ /* don't count */ ++ i--; + goto next_rec; + } + ++ n_fields = rec_get_n_fields_old(rec); ++ + field = rec_get_nth_field_old(rec, 1, &len); + ut_a(len == 4); + @@ -460,6 +476,21 @@ diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict. + ut_a(len == 8); + + stat_n_diff_key_vals_tmp[i] = mach_read_from_8(field); ++ ++ if (n_fields > DICT_SYS_STATS_NON_NULL_VALS_FIELD) { ++ field = rec_get_nth_field_old(rec, DICT_SYS_STATS_NON_NULL_VALS_FIELD, &len); ++ ut_a(len == 8); ++ ++ stat_n_non_null_key_vals_tmp[i] = mach_read_from_8(field); ++ } else { ++ /* not enough fields: should be older */ ++ fprintf(stderr, "InnoDB: Notice: stats for %s/%s (%lu/%lu)" ++ " in SYS_STATS seems older format. " ++ "Please execute ANALYZE TABLE for it.\n", ++ index->table_name, index->name, i, n_cols); ++ ++ stat_n_non_null_key_vals_tmp[i] = ((ib_int64_t)(-1)); ++ } +next_rec: + btr_pcur_move_to_next_user_rec(&pcur, &mtr); + } @@ -469,6 +500,12 @@ diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict. + + for (i = 0; i <= n_cols; i++) { + index->stat_n_diff_key_vals[i] = stat_n_diff_key_vals_tmp[i]; ++ if (stat_n_non_null_key_vals_tmp[i] == ((ib_int64_t)(-1))) { ++ /* approximate value */ ++ index->stat_n_non_null_key_vals[i] = stat_n_diff_key_vals_tmp[n_cols]; ++ } else { ++ index->stat_n_non_null_key_vals[i] = stat_n_non_null_key_vals_tmp[i]; ++ } + } +} +/*===========================================*/ @@ -507,18 +544,22 @@ diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict. + ulint n_cols; + ulint rests; + const rec_t* rec; ++ ulint n_fields; + const byte* field; + ulint len; + ib_int64_t* stat_n_diff_key_vals_tmp; ++ ib_int64_t* stat_n_non_null_key_vals_tmp; + byte* buf; + ulint i; + mtr_t mtr; + + n_cols = dict_index_get_n_unique(index); + stat_n_diff_key_vals_tmp = mem_heap_zalloc(heap, (n_cols + 1) * sizeof(ib_int64_t)); ++ stat_n_non_null_key_vals_tmp = mem_heap_zalloc(heap, (n_cols + 1) * sizeof(ib_int64_t)); + + for (i = 0; i <= n_cols; i++) { + stat_n_diff_key_vals_tmp[i] = index->stat_n_diff_key_vals[i]; ++ stat_n_non_null_key_vals_tmp[i] = index->stat_n_non_null_key_vals[i]; + } + + sys_stats = dict_sys->sys_stats; @@ -552,6 +593,18 @@ diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict. + } + + if (rec_get_deleted_flag(rec, 0)) { ++ /* don't count */ ++ i--; ++ goto next_rec; ++ } ++ ++ n_fields = rec_get_n_fields_old(rec); ++ ++ if (n_fields <= DICT_SYS_STATS_NON_NULL_VALS_FIELD) { ++ /* not update for the older smaller format */ ++ fprintf(stderr, "InnoDB: Notice: stats for %s/%s (%lu/%lu)" ++ " in SYS_STATS seems older format. Please ANALYZE TABLE it.\n", ++ index->table_name, index->name, i, n_cols); + goto next_rec; + } + @@ -565,6 +618,11 @@ diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict. + + mlog_write_ull((byte*)field, stat_n_diff_key_vals_tmp[key_cols], &mtr); + ++ field = rec_get_nth_field_old(rec, DICT_SYS_STATS_NON_NULL_VALS_FIELD, &len); ++ ut_a(len == 8); ++ ++ mlog_write_ull((byte*)field, stat_n_non_null_key_vals_tmp[key_cols], &mtr); ++ + rests--; + +next_rec: @@ -591,7 +649,7 @@ diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict. Calculates new estimates for table and index statistics. The statistics are used in query optimization. */ UNIV_INTERN -@@ -4317,10 +4551,11 @@ +@@ -4317,10 +4600,11 @@ dict_update_statistics( /*===================*/ dict_table_t* table, /*!< in/out: table */ @@ -604,7 +662,7 @@ diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict. { dict_index_t* index; ulint sum_of_index_sizes = 0; -@@ -4337,6 +4572,27 @@ +@@ -4337,6 +4621,27 @@ return; } @@ -632,7 +690,7 @@ diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict. /* Find out the sizes of the indexes and how many different values for the key they approximately have */ -@@ -4401,6 +4657,11 @@ +@@ -4401,6 +4706,11 @@ index = dict_table_get_next_index(index); } while (index); @@ -644,7 +702,86 @@ diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict. index = dict_table_get_first_index(table); table->stat_n_rows = index->stat_n_diff_key_vals[ -@@ -4495,7 +4756,8 @@ +@@ -4418,6 +4728,78 @@ + dict_table_stats_unlock(table, RW_X_LATCH); + } + ++/*********************************************************************//** ++*/ ++UNIV_INTERN ++ibool ++dict_is_older_statistics( ++/*=====================*/ ++ dict_index_t* index) ++{ ++ mem_heap_t* heap; ++ dict_table_t* sys_stats; ++ dict_index_t* sys_index; ++ btr_pcur_t pcur; ++ dtuple_t* tuple; ++ dfield_t* dfield; ++ const rec_t* rec; ++ ulint n_fields; ++ ulint len; ++ byte* buf; ++ mtr_t mtr; ++ ++ heap = mem_heap_create(100); ++ ++ sys_stats = dict_sys->sys_stats; ++ sys_index = UT_LIST_GET_FIRST(sys_stats->indexes); ++ ut_a(!dict_table_is_comp(sys_stats)); ++ ++ tuple = dtuple_create(heap, 1); ++ dfield = dtuple_get_nth_field(tuple, 0); ++ ++ buf = mem_heap_alloc(heap, 8); ++ mach_write_to_8(buf, index->id); ++ ++ dfield_set_data(dfield, buf, 8); ++ dict_index_copy_types(tuple, sys_index, 1); ++ ++ mtr_start(&mtr); ++ ++ btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE, ++ BTR_SEARCH_LEAF, &pcur, &mtr); ++ ++next_rec: ++ rec = btr_pcur_get_rec(&pcur); ++ ++ if (!btr_pcur_is_on_user_rec(&pcur) ++ || mach_read_from_8(rec_get_nth_field_old(rec, 0, &len)) ++ != index->id) { ++ /* not found */ ++ btr_pcur_close(&pcur); ++ mtr_commit(&mtr); ++ mem_heap_free(heap); ++ /* no statistics == not older statistics */ ++ return(FALSE); ++ } ++ ++ if (rec_get_deleted_flag(rec, 0)) { ++ btr_pcur_move_to_next_user_rec(&pcur, &mtr); ++ goto next_rec; ++ } ++ ++ n_fields = rec_get_n_fields_old(rec); ++ ++ btr_pcur_close(&pcur); ++ mtr_commit(&mtr); ++ mem_heap_free(heap); ++ ++ if (n_fields > DICT_SYS_STATS_NON_NULL_VALS_FIELD) { ++ return(FALSE); ++ } else { ++ return(TRUE); ++ } ++} ++ + /**********************************************************************//** + Prints info of a foreign key constraint. */ + static +@@ -4495,7 +4877,8 @@ ut_ad(mutex_own(&(dict_sys->mutex))); @@ -682,7 +819,7 @@ diff -ruN a/storage/innobase/dict/dict0load.c b/storage/innobase/dict/dict0load. } return(NULL); -@@ -582,6 +584,61 @@ +@@ -582,6 +584,75 @@ //#endif /* FOREIGN_NOT_USED */ /********************************************************************//** @@ -697,16 +834,20 @@ diff -ruN a/storage/innobase/dict/dict0load.c b/storage/innobase/dict/dict0load. + const rec_t* rec, /*!< in: current SYS_STATS rec */ + index_id_t* index_id, /*!< out: INDEX_ID */ + ulint* key_cols, /*!< out: KEY_COLS */ -+ ib_uint64_t* diff_vals) /*!< out: DIFF_VALS */ ++ ib_uint64_t* diff_vals, /*!< out: DIFF_VALS */ ++ ib_uint64_t* non_null_vals) /*!< out: NON_NULL_VALS */ +{ + ulint len; + const byte* field; ++ ulint n_fields; + + if (UNIV_UNLIKELY(rec_get_deleted_flag(rec, 0))) { + return("delete-marked record in SYS_STATS"); + } + -+ if (UNIV_UNLIKELY(rec_get_n_fields_old(rec) != 5)) { ++ n_fields = rec_get_n_fields_old(rec); ++ ++ if (UNIV_UNLIKELY(n_fields < 5)) { + return("wrong number of columns in SYS_STATS record"); + } + @@ -738,6 +879,16 @@ diff -ruN a/storage/innobase/dict/dict0load.c b/storage/innobase/dict/dict0load. + } + *diff_vals = mach_read_from_8(field); + ++ if (n_fields < 6) { ++ *non_null_vals = ((ib_uint64_t)(-1)); ++ } else { ++ field = rec_get_nth_field_old(rec, 5/*NON_NULL_VALS*/, &len); ++ if (UNIV_UNLIKELY(len != 8)) { ++ goto err_len; ++ } ++ *non_null_vals = mach_read_from_8(field); ++ } ++ + return(NULL); +} +/********************************************************************//** @@ -821,7 +972,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ break; case DB_RECORD_NOT_FOUND: error = HA_ERR_END_OF_FILE; -@@ -8077,11 +8102,31 @@ +@@ -8077,11 +8102,35 @@ /* In sql_show we call with this flag: update then statistics so that they are up-to-date */ @@ -838,6 +989,10 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ + for (index = dict_table_get_first_index(ib_table); + index != NULL; + index = dict_table_get_next_index(index)) { ++ if (dict_is_older_statistics(index)) { ++ row_delete_stats_for_mysql(index, prebuilt->trx); ++ innobase_commit_low(prebuilt->trx); ++ } + row_insert_stats_for_mysql(index, prebuilt->trx); + innobase_commit_low(prebuilt->trx); + } @@ -854,7 +1009,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ prebuilt->trx->op_info = "returning various info to MySQL"; } -@@ -8159,7 +8204,7 @@ +@@ -8159,7 +8208,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. */ @@ -863,7 +1018,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ || !(flag & HA_STATUS_VARIABLE_EXTRA)) { /* We do not update delete_length if no locking is requested so the "old" value can -@@ -11354,6 +11399,26 @@ +@@ -11361,6 +11410,26 @@ "The number of index pages to sample when calculating statistics (default 8)", NULL, NULL, 8, 1, ~0ULL, 0); @@ -890,7 +1045,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ static MYSQL_SYSVAR_BOOL(adaptive_hash_index, btr_search_enabled, PLUGIN_VAR_OPCMDARG, "Enable InnoDB adaptive hash index (enabled by default). " -@@ -11684,6 +11749,9 @@ +@@ -11686,6 +11755,9 @@ MYSQL_SYSVAR(recovery_update_relay_log), MYSQL_SYSVAR(rollback_on_timeout), MYSQL_SYSVAR(stats_on_metadata), @@ -900,7 +1055,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ MYSQL_SYSVAR(stats_sample_pages), MYSQL_SYSVAR(adaptive_hash_index), MYSQL_SYSVAR(stats_method), -@@ -11753,7 +11821,10 @@ +@@ -11755,7 +11827,10 @@ i_s_innodb_sys_columns, i_s_innodb_sys_fields, i_s_innodb_sys_foreign, @@ -923,7 +1078,7 @@ diff -ruN a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc } static const char plugin_author[] = "Innobase Oy"; -@@ -3457,6 +3458,203 @@ +@@ -3457,6 +3458,221 @@ STRUCT_FLD(__reserved1, NULL) }; @@ -957,6 +1112,15 @@ diff -ruN a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + ++#define SYS_STATS_NON_NULL_VALS 3 ++ {STRUCT_FLD(field_name, "NON_NULL_VALS"), ++ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), ++ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), ++ STRUCT_FLD(value, 0), ++ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL), ++ STRUCT_FLD(old_name, ""), ++ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, ++ + END_OF_ST_FIELD_INFO +}; +/**********************************************************************//** @@ -970,6 +1134,7 @@ diff -ruN a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc + index_id_t index_id, /*!< in: INDEX_ID */ + ulint key_cols, /*!< in: KEY_COLS */ + ib_uint64_t diff_vals, /*!< in: DIFF_VALS */ ++ ib_uint64_t non_null_vals, /*!< in: NON_NULL_VALS */ + TABLE* table_to_fill) /*!< in/out: fill this table */ +{ + Field** fields; @@ -984,6 +1149,13 @@ diff -ruN a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc + + OK(fields[SYS_STATS_DIFF_VALS]->store(longlong(diff_vals), TRUE)); + ++ if (non_null_vals == ((ib_uint64_t)(-1))) { ++ fields[SYS_STATS_NON_NULL_VALS]->set_null(); ++ } else { ++ OK(fields[SYS_STATS_NON_NULL_VALS]->store(longlong(non_null_vals), TRUE)); ++ fields[SYS_STATS_NON_NULL_VALS]->set_notnull(); ++ } ++ + OK(schema_table_store_record(thd, table_to_fill)); + + DBUG_RETURN(0); @@ -1022,17 +1194,18 @@ diff -ruN a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc + index_id_t index_id; + ulint key_cols; + ib_uint64_t diff_vals; ++ ib_uint64_t non_null_vals; + + /* Extract necessary information from a SYS_FOREIGN_COLS row */ + err_msg = dict_process_sys_stats_rec( -+ heap, rec, &index_id, &key_cols, &diff_vals); ++ heap, rec, &index_id, &key_cols, &diff_vals, &non_null_vals); + + mtr_commit(&mtr); + mutex_exit(&dict_sys->mutex); + + if (!err_msg) { + i_s_dict_fill_sys_stats( -+ thd, index_id, key_cols, diff_vals, ++ thd, index_id, key_cols, diff_vals, non_null_vals, + tables->table); + } else { + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, @@ -1127,7 +1300,7 @@ diff -ruN a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc /*********************************************************************** */ static ST_FIELD_INFO i_s_innodb_rseg_fields_info[] = -@@ -3619,3 +3817,347 @@ +@@ -3619,3 +3835,347 @@ /* void* */ STRUCT_FLD(__reserved1, NULL) }; @@ -1512,11 +1685,12 @@ diff -ruN a/storage/innobase/include/dict0boot.h b/storage/innobase/include/dict /*-------------------------------------------------------------*/ /* The field number of the page number field in the sys_indexes table -@@ -144,11 +148,15 @@ +@@ -144,11 +148,16 @@ #define DICT_SYS_INDEXES_TYPE_FIELD 6 #define DICT_SYS_INDEXES_NAME_FIELD 4 +#define DICT_SYS_STATS_DIFF_VALS_FIELD 4 ++#define DICT_SYS_STATS_NON_NULL_VALS_FIELD 5 + /* When a row id which is zero modulo this number (which must be a power of two) is assigned, the field DICT_HDR_ROW_ID on the dictionary header page is @@ -1587,7 +1761,7 @@ diff -ruN a/storage/innobase/include/dict0crea.h b/storage/innobase/include/dict diff -ruN a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h --- a/storage/innobase/include/dict0dict.h 2010-12-03 15:48:03.073024387 +0900 +++ b/storage/innobase/include/dict0dict.h 2010-12-03 17:19:24.888965622 +0900 -@@ -1084,10 +1084,11 @@ +@@ -1096,10 +1096,18 @@ dict_update_statistics( /*===================*/ dict_table_t* table, /*!< in/out: table */ @@ -1597,10 +1771,17 @@ diff -ruN a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict not been initialized yet, otherwise do nothing */ + ibool sync); ++/*********************************************************************//** ++*/ ++UNIV_INTERN ++ibool ++dict_is_older_statistics( ++/*=====================*/ ++ dict_index_t* index); /********************************************************************//** Reserves the dictionary system mutex for MySQL. */ UNIV_INTERN -@@ -1202,6 +1203,7 @@ +@@ -1214,6 +1222,7 @@ dict_table_t* sys_columns; /*!< SYS_COLUMNS table */ dict_table_t* sys_indexes; /*!< SYS_INDEXES table */ dict_table_t* sys_fields; /*!< SYS_FIELDS table */ @@ -1619,7 +1800,7 @@ diff -ruN a/storage/innobase/include/dict0load.h b/storage/innobase/include/dict /* This must be last item. Defines the number of system tables. */ SYS_NUM_SYSTEM_TABLES -@@ -319,6 +320,19 @@ +@@ -322,6 +323,20 @@ const char** ref_col_name, /*!< out: referenced column name in referenced table */ ulint* pos); /*!< out: column position */ @@ -1635,7 +1816,8 @@ diff -ruN a/storage/innobase/include/dict0load.h b/storage/innobase/include/dict + const rec_t* rec, /*!< in: current SYS_STATS rec */ + index_id_t* index_id, /*!< out: INDEX_ID */ + ulint* key_cols, /*!< out: KEY_COLS */ -+ ib_uint64_t* diff_vals); /*!< out: DIFF_VALS */ ++ ib_uint64_t* diff_vals, /*!< out: DIFF_VALS */ ++ ib_uint64_t* non_null_vals); /*!< out: NON_NULL_VALS */ #ifndef UNIV_NONINL #include "dict0load.ic" #endif @@ -1654,7 +1836,7 @@ diff -ruN a/storage/innobase/include/que0que.h b/storage/innobase/include/que0qu diff -ruN a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h --- a/storage/innobase/include/row0mysql.h 2010-11-03 07:01:13.000000000 +0900 +++ b/storage/innobase/include/row0mysql.h 2010-12-03 17:19:24.904973020 +0900 -@@ -387,6 +387,14 @@ +@@ -387,6 +387,22 @@ then checked for not being too large. */ /*********************************************************************//** @@ -1665,6 +1847,14 @@ diff -ruN a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0 +/*=======================*/ + dict_index_t* index, + trx_t* trx); ++/*********************************************************************//** ++*/ ++UNIV_INTERN ++int ++row_delete_stats_for_mysql( ++/*=======================*/ ++ dict_index_t* index, ++ trx_t* trx); +/*********************************************************************//** Scans a table create SQL string and adds to the data dictionary the foreign key constraints declared in the string. This function @@ -1725,6 +1915,18 @@ diff -ruN a/storage/innobase/que/que0que.c b/storage/innobase/que/que0que.c } else if (type == QUE_NODE_ROW_PRINTF) { thr = row_printf_step(thr); } else { +diff -ruN a/storage/innobase/row/row0ins.c b/storage/innobase/row/row0ins.c +--- a/storage/innobase/row/row0ins.c 2011-03-10 00:11:38.000000000 +0900 ++++ b/storage/innobase/row/row0ins.c 2011-03-30 11:44:58.000000000 +0900 +@@ -2012,6 +2012,8 @@ + } + + #ifdef UNIV_DEBUG ++ if (!srv_use_sys_stats_table ++ || index != UT_LIST_GET_FIRST(dict_sys->sys_stats->indexes)) + { + page_t* page = btr_cur_get_page(&cursor); + rec_t* first_rec = page_rec_get_next( diff -ruN a/storage/innobase/row/row0merge.c b/storage/innobase/row/row0merge.c --- a/storage/innobase/row/row0merge.c 2010-11-03 07:01:13.000000000 +0900 +++ b/storage/innobase/row/row0merge.c 2010-12-03 17:19:24.914955391 +0900 @@ -1759,7 +1961,7 @@ diff -ruN a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c } } -@@ -2105,6 +2108,45 @@ +@@ -2105,6 +2108,71 @@ } /*********************************************************************//** @@ -1801,11 +2003,37 @@ diff -ruN a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c + return((int) err); +} + ++/*********************************************************************//** ++*/ ++UNIV_INTERN ++int ++row_delete_stats_for_mysql( ++/*=============================*/ ++ dict_index_t* index, ++ trx_t* trx) ++{ ++ pars_info_t* info = pars_info_create(); ++ ++ trx->op_info = "delete rows from SYS_STATS"; ++ ++ trx_start_if_not_started(trx); ++ trx->error_state = DB_SUCCESS; ++ ++ pars_info_add_ull_literal(info, "indexid", index->id); ++ ++ return((int) que_eval_sql(info, ++ "PROCEDURE DELETE_STATISTICS_PROC () IS\n" ++ "BEGIN\n" ++ "DELETE FROM SYS_STATS WHERE INDEX_ID = :indexid;\n" ++ "END;\n" ++ , TRUE, trx)); ++} ++ +/*********************************************************************//** 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 @@ +@@ -3024,7 +3092,7 @@ dict_table_autoinc_initialize(table, 1); dict_table_autoinc_unlock(table); dict_update_statistics(table, FALSE /* update even if stats are @@ -1814,7 +2042,7 @@ diff -ruN a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c trx_commit_for_mysql(trx); -@@ -3326,6 +3368,8 @@ +@@ -3326,6 +3394,8 @@ " IF (SQL % NOTFOUND) THEN\n" " found := 0;\n" " ELSE\n" @@ -1823,10 +2051,78 @@ diff -ruN a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c " DELETE FROM SYS_FIELDS\n" " WHERE INDEX_ID = index_id;\n" " DELETE FROM SYS_INDEXES\n" +diff -ruN a/storage/innobase/row/row0row.c b/storage/innobase/row/row0row.c +--- a/storage/innobase/row/row0row.c 2011-03-10 00:11:38.000000000 +0900 ++++ b/storage/innobase/row/row0row.c 2011-03-30 11:44:58.000000000 +0900 +@@ -347,6 +347,14 @@ + + rec_len = rec_offs_n_fields(offsets); + ++ if (srv_use_sys_stats_table ++ && index == UT_LIST_GET_FIRST(dict_sys->sys_stats->indexes)) { ++ if (rec_len < dict_index_get_n_fields(index)) { ++ /* the new record should be extended */ ++ rec_len = dict_index_get_n_fields(index); ++ } ++ } ++ + entry = dtuple_create(heap, rec_len); + + dtuple_set_n_fields_cmp(entry, +@@ -358,6 +366,14 @@ + for (i = 0; i < rec_len; i++) { + + dfield = dtuple_get_nth_field(entry, i); ++ ++ if (srv_use_sys_stats_table ++ && index == UT_LIST_GET_FIRST(dict_sys->sys_stats->indexes) ++ && i >= rec_offs_n_fields(offsets)) { ++ dfield_set_null(dfield); ++ continue; ++ } ++ + field = rec_get_nth_field(rec, offsets, i, &len); + + dfield_set_data(dfield, field, len); +diff -ruN a/storage/innobase/row/row0upd.c b/storage/innobase/row/row0upd.c +--- a/storage/innobase/row/row0upd.c 2011-03-10 00:11:38.000000000 +0900 ++++ b/storage/innobase/row/row0upd.c 2011-03-30 11:44:58.000000000 +0900 +@@ -439,6 +439,12 @@ + 0); + } + ++ if (srv_use_sys_stats_table ++ && index == UT_LIST_GET_FIRST(dict_sys->sys_stats->indexes) ++ && upd_field->field_no >= rec_offs_n_fields(offsets)) { ++ return(TRUE); ++ } ++ + old_len = rec_offs_nth_size(offsets, upd_field->field_no); + + if (rec_offs_comp(offsets) +@@ -879,6 +885,18 @@ + + for (i = 0; i < dtuple_get_n_fields(entry); i++) { + ++ if (srv_use_sys_stats_table ++ && index == UT_LIST_GET_FIRST(dict_sys->sys_stats->indexes) ++ && i >= rec_offs_n_fields(offsets)) { ++ dfield = dtuple_get_nth_field(entry, i); ++ ++ upd_field = upd_get_nth_field(update, n_diff); ++ dfield_copy(&(upd_field->new_val), dfield); ++ upd_field_set_field_no(upd_field, i, index, trx); ++ n_diff++; ++ goto skip_compare; ++ } ++ + data = rec_get_nth_field(rec, offsets, i, &len); + + dfield = dtuple_get_nth_field(entry, i); 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 -@@ -402,6 +402,9 @@ +@@ -405,6 +405,9 @@ /* When estimating number of different key values in an index, sample this many index pages */ UNIV_INTERN unsigned long long srv_stats_sample_pages = 8; @@ -1836,3 +2132,36 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c UNIV_INTERN ibool srv_use_doublewrite_buf = TRUE; UNIV_INTERN ibool srv_use_checksums = TRUE; +diff -ruN a/storage/innobase/trx/trx0rec.c b/storage/innobase/trx/trx0rec.c +--- a/storage/innobase/trx/trx0rec.c 2011-03-10 00:11:38.000000000 +0900 ++++ b/storage/innobase/trx/trx0rec.c 2011-03-30 11:44:58.000000000 +0900 +@@ -665,14 +665,27 @@ + /* Save to the undo log the old values of the columns to be updated. */ + + if (update) { ++ ulint extended = 0; ++ + if (trx_undo_left(undo_page, ptr) < 5) { + + return(0); + } + +- ptr += mach_write_compressed(ptr, upd_get_n_fields(update)); ++ if (srv_use_sys_stats_table ++ && index == UT_LIST_GET_FIRST(dict_sys->sys_stats->indexes)) { ++ for (i = 0; i < upd_get_n_fields(update); i++) { ++ ulint pos = upd_get_nth_field(update, i)->field_no; ++ ++ if (pos >= rec_offs_n_fields(offsets)) { ++ extended++; ++ } ++ } ++ } ++ ++ ptr += mach_write_compressed(ptr, upd_get_n_fields(update) - extended); + +- for (i = 0; i < upd_get_n_fields(update); i++) { ++ for (i = 0; i < upd_get_n_fields(update) - extended; i++) { + + ulint pos = upd_get_nth_field(update, i)->field_no; + diff --git a/innodb_thread_concurrency_timer_based.patch b/innodb_thread_concurrency_timer_based.patch index 9f06e58..2585ff8 100644 --- a/innodb_thread_concurrency_timer_based.patch +++ b/innodb_thread_concurrency_timer_based.patch @@ -26,7 +26,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ #ifdef UNIV_LOG_ARCHIVE srv_log_archive_on = (ulint) innobase_log_archive; #endif /* UNIV_LOG_ARCHIVE */ -@@ -11444,6 +11448,12 @@ +@@ -11451,6 +11455,12 @@ "Maximum delay between polling for a spin lock (6 by default)", NULL, NULL, 6L, 0L, ~0L, 0); @@ -39,7 +39,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ static MYSQL_SYSVAR_ULONG(thread_concurrency, srv_thread_concurrency, PLUGIN_VAR_RQCMDARG, "Helps in performance tuning in heavily concurrent environments. Sets the maximum number of threads allowed inside InnoDB. Value 0 will disable the thread throttling.", -@@ -11660,6 +11670,7 @@ +@@ -11662,6 +11672,7 @@ MYSQL_SYSVAR(spin_wait_delay), MYSQL_SYSVAR(table_locks), MYSQL_SYSVAR(thread_concurrency), @@ -62,7 +62,7 @@ diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0sr diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c --- a/storage/innobase/srv/srv0srv.c 2010-12-03 15:37:45.546023493 +0900 +++ b/storage/innobase/srv/srv0srv.c 2010-12-03 15:42:11.574955879 +0900 -@@ -351,6 +351,7 @@ +@@ -354,6 +354,7 @@ computer. Bigger computers need bigger values. Value 0 will disable the concurrency check. */ @@ -70,7 +70,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c UNIV_INTERN ulong srv_thread_concurrency = 0; /* this mutex protects srv_conc data structures */ -@@ -1169,6 +1170,75 @@ +@@ -1170,6 +1171,75 @@ /*********************************************************************//** Puts an OS thread to wait if there are too many concurrent threads (>= srv_thread_concurrency) inside InnoDB. The threads wait in a FIFO queue. */ @@ -146,7 +146,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c UNIV_INTERN void srv_conc_enter_innodb( -@@ -1199,6 +1269,13 @@ +@@ -1200,6 +1270,13 @@ return; } @@ -160,7 +160,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c os_fast_mutex_lock(&srv_conc_mutex); retry: if (trx->declared_to_be_inside_innodb) { -@@ -1344,6 +1421,14 @@ +@@ -1345,6 +1422,14 @@ } ut_ad(srv_conc_n_threads >= 0); @@ -175,7 +175,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c os_fast_mutex_lock(&srv_conc_mutex); -@@ -1377,6 +1462,13 @@ +@@ -1378,6 +1463,13 @@ return; } diff --git a/log_connection_error.patch b/log_connection_error.patch index 228ff7d..49815e0 100644 --- a/log_connection_error.patch +++ b/log_connection_error.patch @@ -5,9 +5,9 @@ #!!! notice !!! # Any small change to this file in the main branch # should be done or reviewed by the maintainer! -diff -ruN a/patch_info/log_connection_error.patch b/patch_info/log_connection_error.patch ---- a/patch_info/log_connection_error.patch 1970-01-01 03:00:00.000000000 +0300 -+++ b/patch_info/log_connection_error.patch 2010-07-28 16:47:47.634070367 +0400 +diff -ruN /dev/null b/patch_info/log_connection_error.patch +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ b/patch_info/log_connection_error.patch 2011-04-09 18:48:54.000000000 +0400 @@ -0,0 +1,6 @@ +File=log_connection_error.patch +Name=logging abandoned connections @@ -16,9 +16,9 @@ diff -ruN a/patch_info/log_connection_error.patch b/patch_info/log_connection_er +License=GPL +Comment= 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 -@@ -5011,6 +5011,10 @@ +--- a/sql/mysqld.cc 2011-04-09 18:48:53.000000000 +0400 ++++ b/sql/mysqld.cc 2011-04-09 18:48:54.000000000 +0400 +@@ -5044,6 +5044,10 @@ DBUG_PRINT("error",("Too many connections")); close_connection(thd, ER_CON_COUNT_ERROR); @@ -29,7 +29,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc delete thd; DBUG_VOID_RETURN; } -@@ -5391,6 +5395,10 @@ +@@ -5424,6 +5428,10 @@ if (!(thd->net.vio= vio_new_win32pipe(hConnectedPipe)) || my_net_init(&thd->net, thd->net.vio)) { @@ -40,7 +40,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc close_connection(thd, ER_OUT_OF_RESOURCES); delete thd; continue; -@@ -5586,6 +5594,10 @@ +@@ -5619,6 +5627,10 @@ event_conn_closed)) || my_net_init(&thd->net, thd->net.vio)) { diff --git a/log_warnings_suppress.patch b/log_warnings_suppress.patch index 6c8693b..92fa4ad 100644 --- a/log_warnings_suppress.patch +++ b/log_warnings_suppress.patch @@ -5,9 +5,9 @@ #!!! notice !!! # Any small change to this file in the main branch # should be done or reviewed by the maintainer! -diff -ruN a/patch_info/log_warnings_suppress.patch b/patch_info/log_warnings_suppress.patch ---- a/patch_info/log_warnings_suppress.patch 1970-01-01 03:00:00.000000000 +0300 -+++ b/patch_info/log_warnings_suppress.patch 2011-01-05 20:35:46.000000000 +0300 +diff -ruN /dev/null b/patch_info/log_warnings_suppress.patch +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ b/patch_info/log_warnings_suppress.patch 2011-04-09 18:48:59.000000000 +0400 @@ -0,0 +1,9 @@ +File=log_warnings_suppress.patch +Name=Disable log warnings for enumerated warnings (old name:suppress_log_warning_1592.patch) @@ -19,9 +19,9 @@ diff -ruN a/patch_info/log_warnings_suppress.patch b/patch_info/log_warnings_sup +2011-01-05 rename patch suppress_log_warning_1592.patch to log_warnings_silence.patch. Also remove boolean system variable "suppress_log_warning_1592" and add set varbile "log_warnings_silence" (possible values: 1592) +2011-02-21 rename patch log_warning_silence.patch to log_warnings_suppress.patch. Also rename variable "log_warning_silence" to "log_warning_suppress". 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 -@@ -621,6 +621,8 @@ +--- a/sql/mysqld.cc 2011-04-09 18:48:59.000000000 +0400 ++++ b/sql/mysqld.cc 2011-04-09 18:48:59.000000000 +0400 +@@ -627,6 +627,8 @@ SHOW_COMP_OPTION have_crypt, have_compress; SHOW_COMP_OPTION have_profiling; @@ -31,9 +31,9 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc pthread_key(MEM_ROOT**,THR_MALLOC); 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 -@@ -226,6 +226,8 @@ +--- a/sql/mysqld.h 2011-04-09 18:48:58.000000000 +0400 ++++ b/sql/mysqld.h 2011-04-09 18:48:59.000000000 +0400 +@@ -227,6 +227,8 @@ extern TYPELIB thread_handling_typelib; extern my_decimal decimal_zero; @@ -43,8 +43,8 @@ diff -ruN a/sql/mysqld.h b/sql/mysqld.h #ifdef HAVE_PSI_INTERFACE 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 +--- a/sql/sql_class.cc 2011-04-09 18:48:50.000000000 +0400 ++++ b/sql/sql_class.cc 2011-04-09 18:48:59.000000000 +0400 @@ -4579,7 +4579,7 @@ ER_BINLOG_UNSAFE_STATEMENT, ER(ER_BINLOG_UNSAFE_STATEMENT), @@ -55,8 +55,8 @@ diff -ruN a/sql/sql_class.cc b/sql/sql_class.cc char buf[MYSQL_ERRMSG_SIZE * 2]; sprintf(buf, ER(ER_BINLOG_UNSAFE_STATEMENT), diff -ruN a/sql/sql_class.h b/sql/sql_class.h ---- a/sql/sql_class.h 2011-01-05 20:31:33.000000000 +0300 -+++ b/sql/sql_class.h 2011-01-05 20:32:37.000000000 +0300 +--- a/sql/sql_class.h 2011-04-09 18:48:53.000000000 +0400 ++++ b/sql/sql_class.h 2011-04-09 18:48:59.000000000 +0400 @@ -90,6 +90,7 @@ SLOG_F_TMP_TABLE, SLOG_F_TMP_DISK, SLOG_F_FILESORT, SLOG_F_FILESORT_DISK @@ -66,9 +66,9 @@ diff -ruN a/sql/sql_class.h b/sql/sql_class.h SLAVE_EXEC_MODE_IDEMPOTENT, SLAVE_EXEC_MODE_LAST_BIT}; 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 -@@ -1424,6 +1424,15 @@ +--- a/sql/sys_vars.cc 2011-04-09 18:48:55.000000000 +0400 ++++ b/sql/sys_vars.cc 2011-04-09 18:48:59.000000000 +0400 +@@ -1434,6 +1434,15 @@ READ_ONLY GLOBAL_VAR(mysqld_port), CMD_LINE(REQUIRED_ARG, 'P'), VALID_RANGE(0, UINT_MAX32), DEFAULT(0), BLOCK_SIZE(1)); diff --git a/mysql.spec b/mysql.spec index 7443146..0eb9b32 100644 --- a/mysql.spec +++ b/mysql.spec @@ -34,13 +34,13 @@ Summary(ru.UTF-8): MySQL - быстрый SQL-сервер Summary(uk.UTF-8): MySQL - швидкий SQL-сервер Summary(zh_CN.UTF-8): MySQL数据库服务器 Name: mysql -Version: 5.5.10 -Release: 2 +Version: 5.5.11 +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: ee604aff531ff85abeb10cf332c1355a +# Source0-md5: befa4e0d0aa95be6c8f6f143ae3b0641 Source100: http://www.sphinxsearch.com/downloads/sphinx-0.9.9.tar.gz # Source100-md5: 7b9b618cb9b378f949bb1b91ddcc4f54 Source1: %{name}.init @@ -122,6 +122,8 @@ Patch142: userstat.patch Patch143: bug580324.patch Patch144: mysql_remove_eol_carret.patch Patch145: processlist_row_stats.patch +Patch146: innodb_expand_fast_index_creation.patch +Patch147: innodb_bug60788.patch # URL: http://www.mysql.com/products/community/ BuildRequires: bison @@ -564,7 +566,7 @@ mv sphinx-*/mysqlse storage/sphinx # %patch100 -p1 %patch101 -p1 -#%patch102 -p1 +%patch102 -p1 %patch103 -p1 %patch104 -p1 %patch105 -p1 @@ -608,6 +610,8 @@ mv sphinx-*/mysqlse storage/sphinx %patch143 -p1 %patch144 -p1 %patch145 -p1 +%patch146 -p1 +%patch147 -p1 # # to get these files rebuild diff --git a/mysql_remove_eol_carret.patch b/mysql_remove_eol_carret.patch index 3704414..8efb37b 100644 --- a/mysql_remove_eol_carret.patch +++ b/mysql_remove_eol_carret.patch @@ -6,9 +6,9 @@ # Any small change to this file in the main branch # should be done or reviewed by the maintainer! diff -ruN a/client/client_priv.h b/client/client_priv.h ---- a/client/client_priv.h 2010-07-06 15:06:50.000000000 -0700 -+++ b/client/client_priv.h 2010-07-06 15:07:18.000000000 -0700 -@@ -89,6 +89,7 @@ +--- a/client/client_priv.h 2011-04-09 18:48:54.000000000 +0400 ++++ b/client/client_priv.h 2011-04-09 18:49:03.000000000 +0400 +@@ -86,6 +86,7 @@ OPT_SYSLOG, #endif OPT_PLUGIN_DIR, @@ -17,8 +17,8 @@ diff -ruN a/client/client_priv.h b/client/client_priv.h OPT_DEFAULT_PLUGIN, OPT_MAX_CLIENT_OPTION diff -ruN a/client/mysql.cc b/client/mysql.cc ---- a/client/mysql.cc 2010-06-03 08:50:02.000000000 -0700 -+++ b/client/mysql.cc 2010-07-06 15:07:18.000000000 -0700 +--- a/client/mysql.cc 2011-04-09 18:48:54.000000000 +0400 ++++ b/client/mysql.cc 2011-04-09 18:49:03.000000000 +0400 @@ -133,6 +133,8 @@ enum enum_info_type { INFO_INFO,INFO_ERROR,INFO_RESULT}; typedef enum enum_info_type INFO_TYPE; @@ -40,8 +40,8 @@ diff -ruN a/client/mysql.cc b/client/mysql.cc &unbuffered, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"column-names", OPT_COLUMN_NAMES, "Write column names in results.", diff -ruN a/client/readline.cc b/client/readline.cc ---- a/client/readline.cc 2010-06-03 08:50:23.000000000 -0700 -+++ b/client/readline.cc 2010-07-06 15:07:18.000000000 -0700 +--- a/client/readline.cc 2011-04-09 18:48:03.000000000 +0400 ++++ b/client/readline.cc 2011-04-09 18:49:03.000000000 +0400 @@ -21,6 +21,8 @@ #include #include "my_readline.h" @@ -60,9 +60,9 @@ diff -ruN a/client/readline.cc b/client/readline.cc out_length--; /* Remove '\r' */ line_buff->read_length=out_length; pos[out_length]=0; -diff -ruN a/patch_info/mysql_remove_eol_carret.patch b/patch_info/mysql_remove_eol_carret.patch ---- a/patch_info/mysql_remove_eol_carret.patch 1969-12-31 16:00:00.000000000 -0800 -+++ b/patch_info/mysql_remove_eol_carret.patch 2010-07-06 15:10:10.000000000 -0700 +diff -ruN /dev/null b/patch_info/mysql_remove_eol_carret.patch +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ b/patch_info/mysql_remove_eol_carret.patch 2011-04-09 18:49:03.000000000 +0400 @@ -0,0 +1,7 @@ +File=mysql_remove_eol_carret.patch +Name= diff --git a/mysql_syslog.patch b/mysql_syslog.patch index 063d170..ac219cf 100644 --- a/mysql_syslog.patch +++ b/mysql_syslog.patch @@ -6,9 +6,9 @@ # Any small change to this file in the main branch # should be done or reviewed by the maintainer! diff -ruN a/client/client_priv.h b/client/client_priv.h ---- a/client/client_priv.h 2011-01-13 18:35:59.000000000 +0300 -+++ b/client/client_priv.h 2011-01-13 18:38:21.000000000 +0300 -@@ -85,6 +85,9 @@ +--- a/client/client_priv.h 2011-04-09 18:48:18.000000000 +0400 ++++ b/client/client_priv.h 2011-04-09 18:48:54.000000000 +0400 +@@ -82,6 +82,9 @@ OPT_DEBUG_INFO, OPT_DEBUG_CHECK, OPT_COLUMN_TYPES, OPT_ERROR_LOG_FILE, OPT_WRITE_BINLOG, OPT_DUMP_DATE, OPT_INIT_COMMAND, @@ -19,8 +19,8 @@ diff -ruN a/client/client_priv.h b/client/client_priv.h OPT_DEFAULT_AUTH, OPT_DEFAULT_PLUGIN, diff -ruN a/client/mysql.cc b/client/mysql.cc ---- a/client/mysql.cc 2010-12-03 20:58:26.000000000 +0300 -+++ b/client/mysql.cc 2011-01-13 18:38:21.000000000 +0300 +--- a/client/mysql.cc 2011-04-09 18:48:04.000000000 +0400 ++++ b/client/mysql.cc 2011-04-09 18:48:54.000000000 +0400 @@ -38,6 +38,11 @@ #include "my_readline.h" #include diff --git a/optimizer_fix.patch b/optimizer_fix.patch index 9516542..5bdbaa3 100644 --- a/optimizer_fix.patch +++ b/optimizer_fix.patch @@ -20,7 +20,7 @@ diff -ruN /dev/null b/patch_info/optimizer_fix.info diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc --- a/sql/mysqld.cc 2010-12-02 19:22:40.027024953 +0900 +++ b/sql/mysqld.cc 2010-12-02 20:51:50.811356434 +0900 -@@ -428,6 +428,7 @@ +@@ -429,6 +429,7 @@ uint opt_debug_sync_timeout= 0; #endif /* defined(ENABLED_DEBUG_SYNC) */ my_bool opt_old_style_user_limits= 0, trust_function_creators= 0; @@ -129,7 +129,7 @@ diff -ruN a/sql/opt_range.cc b/sql/opt_range.cc diff -ruN a/sql/sql_select.cc b/sql/sql_select.cc --- a/sql/sql_select.cc 2010-11-03 07:01:14.000000000 +0900 +++ b/sql/sql_select.cc 2010-12-02 20:47:55.813953789 +0900 -@@ -2611,6 +2611,11 @@ +@@ -2615,6 +2615,11 @@ table->reginfo.impossible_range=1; DBUG_RETURN(0); } @@ -144,7 +144,7 @@ diff -ruN a/sql/sql_select.cc b/sql/sql_select.cc diff -ruN a/sql/sys_vars.cc b/sql/sys_vars.cc --- a/sql/sys_vars.cc 2010-12-02 20:31:56.208023606 +0900 +++ b/sql/sys_vars.cc 2010-12-02 21:17:44.618120277 +0900 -@@ -2134,6 +2134,12 @@ +@@ -2144,6 +2144,12 @@ VALID_RANGE(1, IF_WIN(INT_MAX32/1000, LONG_TIMEOUT)), DEFAULT(NET_WAIT_TIMEOUT), BLOCK_SIZE(1)); diff --git a/query_cache_enhance.patch b/query_cache_enhance.patch index 1448923..8b3132c 100644 --- a/query_cache_enhance.patch +++ b/query_cache_enhance.patch @@ -5,9 +5,9 @@ #!!! notice !!! # Any small change to this file in the main branch # should be done or reviewed by the maintainer! -diff -ruN a/patch_info/query_cache_enhance.patch b/patch_info/query_cache_enhance.patch ---- a/patch_info/query_cache_enhance.patch 1970-01-01 05:00:00.000000000 +0500 -+++ b/patch_info/query_cache_enhance.patch 2010-11-12 17:24:47.000000000 +0500 +diff -ruN /dev/null b/patch_info/query_cache_enhance.patch +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ b/patch_info/query_cache_enhance.patch 2011-04-09 18:48:53.000000000 +0400 @@ -0,0 +1,15 @@ +File=query_cache_enhance.patch +Name= query cache Percona's cumulative patch @@ -25,9 +25,9 @@ diff -ruN a/patch_info/query_cache_enhance.patch b/patch_info/query_cache_enhanc +2010-09 - Merge patches to one +2010-11 - Ported to 5.5 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 -@@ -897,6 +897,7 @@ +--- a/sql/mysqld.cc 2011-04-09 18:48:50.000000000 +0400 ++++ b/sql/mysqld.cc 2011-04-09 18:48:53.000000000 +0400 +@@ -903,6 +903,7 @@ #endif #ifdef HAVE_QUERY_CACHE ulong query_cache_min_res_unit= QUERY_CACHE_MIN_RESULT_DATA_SIZE; @@ -36,8 +36,8 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc #endif #ifdef HAVE_SMEM diff -ruN a/sql/mysqld.h b/sql/mysqld.h ---- a/sql/mysqld.h 2010-11-03 03:01:14.000000000 +0500 -+++ b/sql/mysqld.h 2010-11-13 15:34:36.000000000 +0500 +--- a/sql/mysqld.h 2011-04-09 18:48:50.000000000 +0400 ++++ b/sql/mysqld.h 2011-04-09 18:48:53.000000000 +0400 @@ -91,6 +91,7 @@ extern my_bool opt_log, opt_slow_log; extern my_bool opt_backup_history_log; @@ -46,9 +46,9 @@ diff -ruN a/sql/mysqld.h b/sql/mysqld.h extern ulonglong log_output_options; extern ulong log_backup_output_options; extern my_bool opt_log_queries_not_using_indexes; -diff -ruN a/sql/query_strip_comments.h b/sql/query_strip_comments.h ---- a/sql/query_strip_comments.h 1970-01-01 05:00:00.000000000 +0500 -+++ b/sql/query_strip_comments.h 2010-11-12 17:24:47.000000000 +0500 +diff -ruN /dev/null b/sql/query_strip_comments.h +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ b/sql/query_strip_comments.h 2011-04-09 18:48:53.000000000 +0400 @@ -0,0 +1,37 @@ +#ifndef _SQL_QUERY_STRIPC_COMMENTS_H_ +#define _SQL_QUERY_STRIPC_COMMENTS_H_ @@ -88,8 +88,8 @@ diff -ruN a/sql/query_strip_comments.h b/sql/query_strip_comments.h +#endif // HAVE_QUERY_CACHE +#endif // _SQL_QUERY_STRIPC_COMMENTS_H_ diff -ruN a/sql/sql_cache.cc b/sql/sql_cache.cc ---- a/sql/sql_cache.cc 2010-11-03 03:01:14.000000000 +0500 -+++ b/sql/sql_cache.cc 2010-11-12 17:24:47.000000000 +0500 +--- a/sql/sql_cache.cc 2011-04-09 18:48:50.000000000 +0400 ++++ b/sql/sql_cache.cc 2011-04-09 18:48:53.000000000 +0400 @@ -344,6 +344,181 @@ #include "probes_mysql.h" #include "transaction.h" @@ -452,8 +452,8 @@ diff -ruN a/sql/sql_cache.cc b/sql/sql_cache.cc if (query_block == 0 || query_block->query()->result() == 0 || diff -ruN a/sql/sql_class.h b/sql/sql_class.h ---- a/sql/sql_class.h 2010-11-03 03:01:14.000000000 +0500 -+++ b/sql/sql_class.h 2010-11-13 15:34:25.000000000 +0500 +--- a/sql/sql_class.h 2011-04-09 18:48:50.000000000 +0400 ++++ b/sql/sql_class.h 2011-04-09 18:48:53.000000000 +0400 @@ -40,6 +40,9 @@ #include "thr_lock.h" /* thr_lock_type, THR_LOCK_DATA, THR_LOCK_INFO */ @@ -475,9 +475,9 @@ diff -ruN a/sql/sql_class.h b/sql/sql_class.h /* MARK_COLUMNS_NONE: Means mark_used_colums is not set and no indicator to 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 -@@ -1740,6 +1740,11 @@ +--- a/sql/sys_vars.cc 2011-04-09 18:48:50.000000000 +0400 ++++ b/sql/sys_vars.cc 2011-04-09 18:48:53.000000000 +0400 +@@ -1750,6 +1750,11 @@ NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(fix_query_cache_size)); diff --git a/response_time_distribution.patch b/response_time_distribution.patch index d2c2a5c..b826249 100644 --- a/response_time_distribution.patch +++ b/response_time_distribution.patch @@ -6,8 +6,8 @@ # Any small change to this file in the main branch # should be done or reviewed by the maintainer! 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 +--- a/CMakeLists.txt 2011-03-31 17:36:18.000000000 +0400 ++++ b/CMakeLists.txt 2011-04-09 19:12:12.000000000 +0400 @@ -165,7 +165,12 @@ OPTION (WITH_UNIT_TESTS "Compile MySQL with unit tests" ON) MARK_AS_ADVANCED(CYBOZU BACKUP_TEST WITHOUT_SERVER DISABLE_SHARED) @@ -23,8 +23,8 @@ diff -ruN a/CMakeLists.txt b/CMakeLists.txt IF(ENABLE_DEBUG_SYNC) SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC") diff -ruN a/include/mysql_com.h b/include/mysql_com.h ---- a/include/mysql_com.h 2010-12-03 20:58:24.000000000 +0300 -+++ b/include/mysql_com.h 2011-01-16 18:53:58.000000000 +0300 +--- a/include/mysql_com.h 2011-03-31 17:36:18.000000000 +0400 ++++ b/include/mysql_com.h 2011-04-10 11:28:51.000000000 +0400 @@ -137,10 +137,11 @@ #define REFRESH_FAST 32768 /* Intern flag */ @@ -41,9 +41,9 @@ diff -ruN a/include/mysql_com.h b/include/mysql_com.h #define CLIENT_LONG_PASSWORD 1 /* new more secure passwords */ #define CLIENT_FOUND_ROWS 2 /* Found instead of affected rows */ -diff -ruN a/patch_info/response-time-distribution.info b/patch_info/response-time-distribution.info ---- a/patch_info/response-time-distribution.info 1970-01-01 03:00:00.000000000 +0300 -+++ b/patch_info/response-time-distribution.info 2011-01-16 18:53:59.000000000 +0300 +diff -ruN /dev/null b/patch_info/response-time-distribution.info +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ b/patch_info/response-time-distribution.info 2011-04-09 19:12:12.000000000 +0400 @@ -0,0 +1,9 @@ +File=response-time-distribution.patch +Name=Response time distribution @@ -55,8 +55,8 @@ diff -ruN a/patch_info/response-time-distribution.info b/patch_info/response-tim +2010-07-02 first version avaliable +2010-09-15 add column 'total' diff -ruN a/sql/CMakeLists.txt b/sql/CMakeLists.txt ---- a/sql/CMakeLists.txt 2010-12-03 20:58:26.000000000 +0300 -+++ b/sql/CMakeLists.txt 2011-01-16 18:53:59.000000000 +0300 +--- a/sql/CMakeLists.txt 2011-03-31 17:36:18.000000000 +0400 ++++ b/sql/CMakeLists.txt 2011-04-09 19:12:12.000000000 +0400 @@ -51,7 +51,7 @@ message.h mf_iocache.cc my_decimal.cc ../sql-common/my_time.c mysqld.cc net_serv.cc keycaches.cc @@ -76,9 +76,9 @@ diff -ruN a/sql/CMakeLists.txt b/sql/CMakeLists.txt debug_sync.cc debug_sync.h sql_repl.cc sql_select.cc sql_show.cc sql_state.c sql_string.cc diff -ruN a/sql/handler.h b/sql/handler.h ---- a/sql/handler.h 2011-01-16 18:53:33.000000000 +0300 -+++ b/sql/handler.h 2011-01-16 18:54:00.000000000 +0300 -@@ -572,6 +572,7 @@ +--- a/sql/handler.h 2011-04-09 19:11:54.000000000 +0400 ++++ b/sql/handler.h 2011-04-10 11:28:51.000000000 +0400 +@@ -578,6 +578,7 @@ SCH_PROFILES, SCH_REFERENTIAL_CONSTRAINTS, SCH_PROCEDURES, @@ -87,8 +87,8 @@ diff -ruN a/sql/handler.h b/sql/handler.h SCH_SCHEMA_PRIVILEGES, SCH_SESSION_STATUS, diff -ruN a/sql/lex.h b/sql/lex.h ---- a/sql/lex.h 2010-12-03 20:58:26.000000000 +0300 -+++ b/sql/lex.h 2011-01-16 18:54:01.000000000 +0300 +--- a/sql/lex.h 2011-03-31 17:36:18.000000000 +0400 ++++ b/sql/lex.h 2011-04-10 11:28:52.000000000 +0400 @@ -426,6 +426,7 @@ { "PURGE", SYM(PURGE)}, { "QUARTER", SYM(QUARTER_SYM)}, @@ -98,8 +98,8 @@ diff -ruN a/sql/lex.h b/sql/lex.h { "RANGE", SYM(RANGE_SYM)}, { "READ", SYM(READ_SYM)}, diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc ---- a/sql/mysqld.cc 2011-01-16 18:53:35.000000000 +0300 -+++ b/sql/mysqld.cc 2011-01-17 02:22:27.000000000 +0300 +--- a/sql/mysqld.cc 2011-04-09 19:12:11.000000000 +0400 ++++ b/sql/mysqld.cc 2011-04-10 11:28:52.000000000 +0400 @@ -69,6 +69,8 @@ #include "debug_sync.h" #include "sql_callback.h" @@ -109,7 +109,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc #ifdef WITH_PERFSCHEMA_STORAGE_ENGINE #include "../storage/perfschema/pfs_server.h" #endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */ -@@ -604,7 +606,7 @@ +@@ -610,7 +612,7 @@ MY_LOCALE *my_default_lc_messages; MY_LOCALE *my_default_lc_time_names; @@ -118,7 +118,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc SHOW_COMP_OPTION have_geometry, have_rtree_keys; SHOW_COMP_OPTION have_crypt, have_compress; SHOW_COMP_OPTION have_profiling; -@@ -905,6 +907,10 @@ +@@ -911,6 +913,10 @@ my_bool opt_enable_shared_memory; HANDLE smem_event_connect_request= 0; #endif @@ -129,7 +129,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc my_bool opt_use_ssl = 0; char *opt_ssl_ca= NULL, *opt_ssl_capath= NULL, *opt_ssl_cert= NULL, -@@ -1473,6 +1479,9 @@ +@@ -1482,6 +1488,9 @@ my_free(opt_bin_logname); bitmap_free(&temp_pool); free_max_user_conn(); @@ -139,7 +139,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc #ifdef HAVE_REPLICATION end_slave_list(); #endif -@@ -3944,6 +3953,9 @@ +@@ -3964,6 +3973,9 @@ if (!DEFAULT_ERRMSGS[0][0]) unireg_abort(1); @@ -149,7 +149,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc /* We have to initialize the storage engines before CSV logging */ if (ha_init()) { -@@ -6819,6 +6831,11 @@ +@@ -6852,6 +6864,11 @@ #else have_query_cache=SHOW_OPTION_NO; #endif @@ -162,8 +162,8 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc have_geometry=SHOW_OPTION_YES; #else diff -ruN a/sql/mysqld.h b/sql/mysqld.h ---- a/sql/mysqld.h 2011-01-16 18:53:35.000000000 +0300 -+++ b/sql/mysqld.h 2011-01-17 02:08:20.000000000 +0300 +--- a/sql/mysqld.h 2011-04-09 19:12:11.000000000 +0400 ++++ b/sql/mysqld.h 2011-04-10 11:28:52.000000000 +0400 @@ -98,6 +98,10 @@ extern bool opt_disable_networking, opt_skip_show_db; extern bool opt_skip_name_resolve; @@ -175,10 +175,10 @@ diff -ruN a/sql/mysqld.h b/sql/mysqld.h extern my_bool opt_character_set_client_handshake; extern bool volatile abort_loop; extern bool in_bootstrap; -diff -ruN a/sql/query_response_time.cc b/sql/query_response_time.cc ---- a/sql/query_response_time.cc 1970-01-01 03:00:00.000000000 +0300 -+++ b/sql/query_response_time.cc 2011-01-17 02:13:08.000000000 +0300 -@@ -0,0 +1,372 @@ +diff -ruN /dev/null b/sql/query_response_time.cc +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ b/sql/query_response_time.cc 2011-04-10 00:27:11.000000000 +0400 +@@ -0,0 +1,367 @@ +#include "mysql_version.h" +#ifdef __FreeBSD__ +#include @@ -432,18 +432,13 @@ diff -ruN a/sql/query_response_time.cc b/sql/query_response_time.cc + } + void collect(uint64 time) + { -+ bool no_collect= false; -+ DBUG_EXECUTE_IF("response_time_distribution_log_only_more_300_milliseconds", { \ -+ no_collect= time < 300 * 1000; \ -+ }); -+ if(no_collect) return; + int i= 0; + for(int count= m_utility->bound_count(); count > i; ++i) + { + if(m_utility->bound(i) > time) + { + __sync_fetch_and_add(&(m_count[i]),(uint32)1); -+ add_time_atomic(&(m_total[i]),time); ++ add_time_atomic(&(m_total[i]),time); + break; + } + } @@ -551,9 +546,9 @@ diff -ruN a/sql/query_response_time.cc b/sql/query_response_time.cc + return query_response_time::g_collector.fill(thd,tables,cond); +} +#endif // HAVE_RESPONSE_TIME_DISTRIBUTION -diff -ruN a/sql/query_response_time.h b/sql/query_response_time.h ---- a/sql/query_response_time.h 1970-01-01 03:00:00.000000000 +0300 -+++ b/sql/query_response_time.h 2011-01-17 02:13:34.000000000 +0300 +diff -ruN /dev/null b/sql/query_response_time.h +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ b/sql/query_response_time.h 2011-04-09 19:12:12.000000000 +0400 @@ -0,0 +1,71 @@ +#ifndef QUERY_RESPONSE_TIME_H +#define QUERY_RESPONSE_TIME_H @@ -627,8 +622,8 @@ diff -ruN a/sql/query_response_time.h b/sql/query_response_time.h + +#endif // QUERY_RESPONSE_TIME_H diff -ruN a/sql/set_var.h b/sql/set_var.h ---- a/sql/set_var.h 2010-12-03 20:58:26.000000000 +0300 -+++ b/sql/set_var.h 2011-01-17 02:20:59.000000000 +0300 +--- a/sql/set_var.h 2011-03-31 17:36:18.000000000 +0400 ++++ b/sql/set_var.h 2011-04-09 19:12:12.000000000 +0400 @@ -293,6 +293,7 @@ extern SHOW_COMP_OPTION have_ssl, have_symlink, have_dlopen; @@ -638,8 +633,8 @@ diff -ruN a/sql/set_var.h b/sql/set_var.h extern SHOW_COMP_OPTION have_crypt; extern SHOW_COMP_OPTION have_compress; diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc ---- a/sql/sql_parse.cc 2011-01-16 18:53:35.000000000 +0300 -+++ b/sql/sql_parse.cc 2011-01-17 02:15:09.000000000 +0300 +--- a/sql/sql_parse.cc 2011-04-09 19:12:10.000000000 +0400 ++++ b/sql/sql_parse.cc 2011-04-10 11:28:51.000000000 +0400 @@ -88,6 +88,7 @@ #include "sp_cache.h" #include "events.h" @@ -648,7 +643,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc #include "transaction.h" #include "sql_audit.h" #include "sql_prepare.h" -@@ -1483,22 +1484,36 @@ +@@ -1482,22 +1483,74 @@ Do not log administrative statements unless the appropriate option is set. */ @@ -660,16 +655,53 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc { - ulonglong end_utime_of_query= thd->current_utime(); - thd_proc_info(thd, "logging slow query"); -- ++ 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 ++ ++#define DBUG_TEST_QRT(t,v) \ ++ DBUG_EXECUTE_IF(t, \ ++ { \ ++ query_execution_time= v; \ ++ DBUG_SET("-d,"t); \ ++ }) ++ ++ DBUG_EXECUTE_IF("query_exec_time_debug", query_execution_time= 0; ); ++ ++ DBUG_TEST_QRT("query_exec_time_0.31", 310000UL); ++ DBUG_TEST_QRT("query_exec_time_0.32", 320000UL); ++ DBUG_TEST_QRT("query_exec_time_0.33", 330000UL); ++ DBUG_TEST_QRT("query_exec_time_0.34", 340000UL); ++ DBUG_TEST_QRT("query_exec_time_0.35", 350000UL); ++ DBUG_TEST_QRT("query_exec_time_0.36", 360000UL); ++ DBUG_TEST_QRT("query_exec_time_0.37", 370000UL); ++ DBUG_TEST_QRT("query_exec_time_0.38", 380000UL); ++ DBUG_TEST_QRT("query_exec_time_0.39", 390000UL); ++ DBUG_TEST_QRT("query_exec_time_0.4", 400000UL); ++ DBUG_TEST_QRT("query_exec_time_0.5", 500000UL); ++ DBUG_TEST_QRT("query_exec_time_1.1", 1100000UL); ++ DBUG_TEST_QRT("query_exec_time_1.2", 1200000UL); ++ DBUG_TEST_QRT("query_exec_time_1.3", 1300000UL); ++ DBUG_TEST_QRT("query_exec_time_1.4", 1400000UL); ++ DBUG_TEST_QRT("query_exec_time_1.5", 1500000UL); ++ DBUG_TEST_QRT("query_exec_time_2.1", 2100000UL); ++ DBUG_TEST_QRT("query_exec_time_2.3", 2300000UL); ++ DBUG_TEST_QRT("query_exec_time_2.5", 2500000UL); ++ ++ DBUG_EXECUTE_IF("query_exec_time_debug", ++ if (query_execution_time == 0) ++ opt_query_response_time_stats= 0; ++ else ++ opt_query_response_time_stats= 1;); + - if (((thd->server_status & SERVER_QUERY_WAS_SLOW) || - ((thd->server_status & - (SERVER_QUERY_NO_INDEX_USED | SERVER_QUERY_NO_GOOD_INDEX_USED)) && - opt_log_queries_not_using_indexes && - !(sql_command_flags[thd->lex->sql_command] & CF_STATUS_COMMAND))) && - thd->examined_row_count >= thd->variables.min_examined_row_limit) -+ 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 ++#undef DBUG_TEST_QRT ++ + if(opt_query_response_time_stats) + { + query_response_time_collect(query_execution_time); @@ -697,7 +729,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc } } DBUG_VOID_RETURN; -@@ -1617,6 +1632,7 @@ +@@ -1616,6 +1669,7 @@ case SCH_CHARSETS: case SCH_ENGINES: case SCH_COLLATIONS: @@ -706,8 +738,8 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc case SCH_USER_PRIVILEGES: case SCH_SCHEMA_PRIVILEGES: 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 2011-01-17 02:16:19.000000000 +0300 +--- a/sql/sql_reload.cc 2011-03-31 17:36:18.000000000 +0400 ++++ b/sql/sql_reload.cc 2011-04-10 11:28:51.000000000 +0400 @@ -25,7 +25,7 @@ #include "hostname.h" // hostname_cache_refresh #include "sql_repl.h" // reset_master, reset_slave @@ -717,7 +749,7 @@ diff -ruN a/sql/sql_reload.cc b/sql/sql_reload.cc /** Reload/resets privileges and the different caches. -@@ -282,6 +282,12 @@ +@@ -296,6 +296,12 @@ #endif if (options & REFRESH_USER_RESOURCES) reset_mqh((LEX_USER *) NULL, 0); /* purecov: inspected */ @@ -731,8 +763,8 @@ diff -ruN a/sql/sql_reload.cc b/sql/sql_reload.cc *write_to_binlog= tmp_write_to_binlog; /* 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 +--- a/sql/sql_show.cc 2011-04-09 19:12:10.000000000 +0400 ++++ b/sql/sql_show.cc 2011-04-10 11:28:51.000000000 +0400 @@ -50,6 +50,7 @@ #include "event_data_objects.h" #endif @@ -771,8 +803,8 @@ diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc fill_schema_schemata, make_schemata_old_format, 0, 1, -1, 0, 0}, {"SCHEMA_PRIVILEGES", schema_privileges_fields_info, create_schema_table, diff -ruN a/sql/sql_yacc.yy b/sql/sql_yacc.yy ---- a/sql/sql_yacc.yy 2011-01-16 18:53:34.000000000 +0300 -+++ b/sql/sql_yacc.yy 2011-01-17 02:19:03.000000000 +0300 +--- a/sql/sql_yacc.yy 2011-04-09 19:11:54.000000000 +0400 ++++ b/sql/sql_yacc.yy 2011-04-10 11:28:52.000000000 +0400 @@ -1193,6 +1193,7 @@ %token PURGE %token QUARTER_SYM @@ -781,7 +813,7 @@ diff -ruN a/sql/sql_yacc.yy b/sql/sql_yacc.yy %token QUICK %token RANGE_SYM /* SQL-2003-R */ %token READS_SYM /* SQL-2003-R */ -@@ -11089,6 +11090,15 @@ +@@ -11076,6 +11077,15 @@ { Lex->sql_command = SQLCOM_SHOW_SLAVE_STAT; } @@ -797,7 +829,7 @@ diff -ruN a/sql/sql_yacc.yy b/sql/sql_yacc.yy | CREATE PROCEDURE_SYM sp_name { LEX *lex= Lex; -@@ -11325,6 +11335,12 @@ +@@ -11312,6 +11322,12 @@ { Lex->type|= REFRESH_STATUS; } | SLAVE { Lex->type|= REFRESH_SLAVE; } @@ -810,7 +842,7 @@ diff -ruN a/sql/sql_yacc.yy b/sql/sql_yacc.yy | MASTER_SYM { Lex->type|= REFRESH_MASTER; } | DES_KEY_FILE -@@ -12610,6 +12626,7 @@ +@@ -12597,6 +12613,7 @@ | PROXY_SYM {} | QUARTER_SYM {} | QUERY_SYM {} @@ -819,8 +851,8 @@ diff -ruN a/sql/sql_yacc.yy b/sql/sql_yacc.yy | READ_ONLY_SYM {} | REBUILD_SYM {} diff -ruN a/sql/sys_vars.cc b/sql/sys_vars.cc ---- a/sql/sys_vars.cc 2011-01-16 18:53:35.000000000 +0300 -+++ b/sql/sys_vars.cc 2011-01-17 02:19:53.000000000 +0300 +--- a/sql/sys_vars.cc 2011-04-09 19:12:11.000000000 +0400 ++++ b/sql/sys_vars.cc 2011-04-10 11:28:51.000000000 +0400 @@ -49,6 +49,7 @@ #include "../storage/perfschema/pfs_server.h" #endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */ @@ -829,7 +861,7 @@ diff -ruN a/sql/sys_vars.cc b/sql/sys_vars.cc /* This forward declaration is needed because including sql_base.h causes further includes. [TODO] Eliminate this forward declaration -@@ -1791,6 +1792,26 @@ +@@ -1801,6 +1802,26 @@ DEFAULT(FALSE)); #endif /* HAVE_QUERY_CACHE */ diff --git a/show_slave_status_nolock.patch b/show_slave_status_nolock.patch index 9c76d11..34c2fbd 100644 --- a/show_slave_status_nolock.patch +++ b/show_slave_status_nolock.patch @@ -5,9 +5,9 @@ #!!! notice !!! # Any small change to this file in the main branch # should be done or reviewed by the maintainer! -diff -ruN a/patch_info/show_slave_status_nolock.patch b/patch_info/show_slave_status_nolock.patch ---- a/patch_info/show_slave_status_nolock.patch 1970-01-01 03:00:00.000000000 +0300 -+++ b/patch_info/show_slave_status_nolock.patch 2010-12-29 20:38:13.000000000 +0300 +diff -ruN /dev/null b/patch_info/show_slave_status_nolock.patch +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ b/patch_info/show_slave_status_nolock.patch 2011-04-10 11:29:06.000000000 +0400 @@ -0,0 +1,6 @@ +File=show_slave_status_nolock.patch +Name= SHOW SLAVE STATUS NOLOCK @@ -16,8 +16,8 @@ diff -ruN a/patch_info/show_slave_status_nolock.patch b/patch_info/show_slave_st +License=GPL +Comment= Implement SHOW SLAVE STATUS without lock (STOP SLAVE lock the same mutex what lock SHOW SLAVE STATUS) diff -ruN a/sql/lex.h b/sql/lex.h ---- a/sql/lex.h 2010-12-29 20:27:19.000000000 +0300 -+++ b/sql/lex.h 2010-12-29 20:28:57.000000000 +0300 +--- a/sql/lex.h 2011-04-10 11:29:05.000000000 +0400 ++++ b/sql/lex.h 2011-04-10 11:29:06.000000000 +0400 @@ -378,6 +378,7 @@ { "NONE", SYM(NONE_SYM)}, { "NOT", SYM(NOT_SYM)}, @@ -27,9 +27,9 @@ diff -ruN a/sql/lex.h b/sql/lex.h { "NUMERIC", SYM(NUMERIC_SYM)}, { "NVARCHAR", SYM(NVARCHAR_SYM)}, 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 -@@ -3067,6 +3067,7 @@ +--- a/sql/mysqld.cc 2011-04-10 11:29:05.000000000 +0400 ++++ b/sql/mysqld.cc 2011-04-10 11:29:06.000000000 +0400 +@@ -3075,6 +3075,7 @@ {"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}, @@ -38,8 +38,8 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc {"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}, diff -ruN a/sql/sql_lex.h b/sql/sql_lex.h ---- a/sql/sql_lex.h 2010-12-29 20:27:19.000000000 +0300 -+++ b/sql/sql_lex.h 2010-12-29 20:32:26.000000000 +0300 +--- a/sql/sql_lex.h 2011-04-10 11:29:05.000000000 +0400 ++++ b/sql/sql_lex.h 2011-04-10 11:29:06.000000000 +0400 @@ -190,6 +190,8 @@ SQLCOM_SHOW_PROFILE, SQLCOM_SHOW_PROFILES, SQLCOM_SIGNAL, SQLCOM_RESIGNAL, @@ -50,9 +50,9 @@ diff -ruN a/sql/sql_lex.h b/sql/sql_lex.h When a command is added here, be sure it's also added in mysqld.cc in "struct show_var_st status_vars[]= {" ... diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc ---- a/sql/sql_parse.cc 2010-12-29 20:27:19.000000000 +0300 -+++ b/sql/sql_parse.cc 2010-12-29 20:34:50.000000000 +0300 -@@ -336,6 +336,7 @@ +--- a/sql/sql_parse.cc 2011-04-10 11:28:51.000000000 +0400 ++++ b/sql/sql_parse.cc 2011-04-10 11:29:06.000000000 +0400 +@@ -335,6 +335,7 @@ sql_command_flags[SQLCOM_SHOW_CREATE]= CF_STATUS_COMMAND; sql_command_flags[SQLCOM_SHOW_MASTER_STAT]= CF_STATUS_COMMAND; sql_command_flags[SQLCOM_SHOW_SLAVE_STAT]= CF_STATUS_COMMAND; @@ -60,7 +60,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc 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; -@@ -2269,12 +2270,16 @@ +@@ -2293,12 +2294,16 @@ mysql_mutex_unlock(&LOCK_active_mi); break; } @@ -78,7 +78,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc if (active_mi != NULL) { res = show_master_info(thd, active_mi); -@@ -2285,7 +2290,10 @@ +@@ -2309,7 +2314,10 @@ WARN_NO_MASTER_INFO, ER(WARN_NO_MASTER_INFO)); my_ok(thd); } @@ -91,8 +91,8 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc } case SQLCOM_SHOW_MASTER_STAT: diff -ruN a/sql/sql_yacc.yy b/sql/sql_yacc.yy ---- a/sql/sql_yacc.yy 2010-12-29 20:27:19.000000000 +0300 -+++ b/sql/sql_yacc.yy 2010-12-29 20:36:40.000000000 +0300 +--- a/sql/sql_yacc.yy 2011-04-10 11:29:05.000000000 +0400 ++++ b/sql/sql_yacc.yy 2011-04-10 11:29:06.000000000 +0400 @@ -1292,6 +1292,7 @@ %token STARTS_SYM %token START_SYM /* SQL-2003-R */ @@ -101,7 +101,7 @@ diff -ruN a/sql/sql_yacc.yy b/sql/sql_yacc.yy %token STDDEV_SAMP_SYM /* SQL-2003-N */ %token STD_SYM %token STOP_SYM -@@ -11095,6 +11096,10 @@ +@@ -11082,6 +11083,10 @@ { Lex->sql_command = SQLCOM_SHOW_SLAVE_STAT; } diff --git a/show_temp.patch b/show_temp.patch index ee8a9b0..6862baf 100644 --- a/show_temp.patch +++ b/show_temp.patch @@ -6,9 +6,9 @@ # Any small change to this file in the main branch # should be done or reviewed by the maintainer! diff -ruN a/sql/handler.h b/sql/handler.h ---- a/sql/handler.h 2010-12-03 14:09:14.406955791 +0900 -+++ b/sql/handler.h 2010-12-03 14:29:16.533356953 +0900 -@@ -561,6 +561,7 @@ +--- a/sql/handler.h 2011-04-09 19:11:53.000000000 +0400 ++++ b/sql/handler.h 2011-04-10 12:16:43.000000000 +0400 +@@ -567,6 +567,7 @@ SCH_EVENTS, SCH_FILES, SCH_GLOBAL_STATUS, @@ -16,7 +16,7 @@ diff -ruN a/sql/handler.h b/sql/handler.h SCH_GLOBAL_VARIABLES, SCH_KEY_COLUMN_USAGE, SCH_OPEN_TABLES, -@@ -582,6 +583,7 @@ +@@ -588,6 +589,7 @@ SCH_TABLE_CONSTRAINTS, SCH_TABLE_NAMES, SCH_TABLE_PRIVILEGES, @@ -25,9 +25,9 @@ diff -ruN a/sql/handler.h b/sql/handler.h SCH_USER_PRIVILEGES, SCH_VARIABLES, 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 -@@ -3047,6 +3047,7 @@ +--- a/sql/mysqld.cc 2011-04-09 19:11:52.000000000 +0400 ++++ b/sql/mysqld.cc 2011-04-10 12:16:44.000000000 +0400 +@@ -3055,6 +3055,7 @@ {"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}, @@ -36,21 +36,20 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc {"show_variables", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_VARIABLES]), SHOW_LONG_STATUS}, {"show_warnings", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_WARNS]), SHOW_LONG_STATUS}, diff -ruN a/sql/sql_lex.h b/sql/sql_lex.h ---- a/sql/sql_lex.h 2010-12-02 19:22:40.040023288 +0900 -+++ b/sql/sql_lex.h 2010-12-03 14:09:53.465292483 +0900 -@@ -186,7 +186,7 @@ - SQLCOM_CREATE_EVENT, SQLCOM_ALTER_EVENT, SQLCOM_DROP_EVENT, - SQLCOM_SHOW_CREATE_EVENT, SQLCOM_SHOW_EVENTS, - SQLCOM_SHOW_CREATE_TRIGGER, -- SQLCOM_ALTER_DB_UPGRADE, -+ SQLCOM_ALTER_DB_UPGRADE, SQLCOM_SHOW_TEMPORARY_TABLES, - SQLCOM_SHOW_PROFILE, SQLCOM_SHOW_PROFILES, - SQLCOM_SIGNAL, SQLCOM_RESIGNAL, - SQLCOM_SHOW_RELAYLOG_EVENTS, +--- a/sql/sql_lex.h 2011-03-31 17:36:18.000000000 +0400 ++++ b/sql/sql_lex.h 2011-04-10 12:22:19.000000000 +0400 +@@ -194,6 +194,7 @@ + When a command is added here, be sure it's also added in mysqld.cc + in "struct show_var_st status_vars[]= {" ... + */ ++ SQLCOM_SHOW_TEMPORARY_TABLES, + /* This should be the last !!! */ + SQLCOM_END + }; diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc ---- a/sql/sql_parse.cc 2010-12-02 19:22:40.046023936 +0900 -+++ b/sql/sql_parse.cc 2010-12-03 14:09:53.471950455 +0900 -@@ -349,6 +349,9 @@ +--- a/sql/sql_parse.cc 2011-03-31 17:36:18.000000000 +0400 ++++ b/sql/sql_parse.cc 2011-04-10 12:16:44.000000000 +0400 +@@ -348,6 +348,9 @@ sql_command_flags[SQLCOM_SHOW_TABLES]= (CF_STATUS_COMMAND | CF_SHOW_TABLE_COMMAND | CF_REEXECUTION_FRAGILE); @@ -60,7 +59,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc sql_command_flags[SQLCOM_SHOW_TABLE_STATUS]= (CF_STATUS_COMMAND | CF_SHOW_TABLE_COMMAND | CF_REEXECUTION_FRAGILE); -@@ -1511,6 +1514,8 @@ +@@ -1510,6 +1513,8 @@ case SCH_TABLE_NAMES: case SCH_TABLES: @@ -69,7 +68,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc case SCH_VIEWS: case SCH_TRIGGERS: case SCH_EVENTS: -@@ -2018,6 +2023,7 @@ +@@ -2017,6 +2022,7 @@ } case SQLCOM_SHOW_DATABASES: case SQLCOM_SHOW_TABLES: @@ -77,7 +76,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc case SQLCOM_SHOW_TRIGGERS: case SQLCOM_SHOW_TABLE_STATUS: case SQLCOM_SHOW_OPEN_TABLES: -@@ -4807,6 +4813,8 @@ +@@ -4797,6 +4803,8 @@ case SCH_TABLE_NAMES: case SCH_TABLES: @@ -87,8 +86,8 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc case SCH_TRIGGERS: case SCH_EVENTS: diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc ---- a/sql/sql_show.cc 2010-12-03 13:38:47.493070606 +0900 -+++ b/sql/sql_show.cc 2010-12-03 14:27:04.590939717 +0900 +--- a/sql/sql_show.cc 2011-04-09 19:11:52.000000000 +0400 ++++ b/sql/sql_show.cc 2011-04-10 12:16:44.000000000 +0400 @@ -2686,6 +2686,7 @@ break; case SQLCOM_SHOW_TABLES: @@ -373,8 +372,8 @@ diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc get_all_tables, make_old_format, get_schema_triggers_record, 5, 6, 0, OPEN_TRIGGER_ONLY|OPTIMIZE_I_S_TABLE}, diff -ruN a/sql/sql_yacc.yy b/sql/sql_yacc.yy ---- a/sql/sql_yacc.yy 2010-12-02 19:22:40.077024170 +0900 -+++ b/sql/sql_yacc.yy 2010-12-03 14:09:53.496023791 +0900 +--- a/sql/sql_yacc.yy 2011-03-31 17:36:18.000000000 +0400 ++++ b/sql/sql_yacc.yy 2011-04-10 12:16:43.000000000 +0400 @@ -10869,6 +10869,15 @@ if (prepare_schema_table(YYTHD, lex, 0, SCH_TABLE_NAMES)) MYSQL_YYABORT; diff --git a/slow_extended.patch b/slow_extended.patch index 0341950..adb6970 100644 --- a/slow_extended.patch +++ b/slow_extended.patch @@ -6,8 +6,8 @@ # Any small change to this file in the main branch # should be done or reviewed by the maintainer! diff -ruN a/include/mysql/plugin_audit.h.pp b/include/mysql/plugin_audit.h.pp ---- a/include/mysql/plugin_audit.h.pp 2011-01-20 00:37:08.000000000 +0200 -+++ b/include/mysql/plugin_audit.h.pp 2011-02-21 22:57:48.816765777 +0200 +--- a/include/mysql/plugin_audit.h.pp 2011-04-09 18:48:05.000000000 +0400 ++++ b/include/mysql/plugin_audit.h.pp 2011-04-09 18:48:50.000000000 +0400 @@ -178,6 +178,16 @@ char *thd_security_context(void* thd, char *buffer, unsigned int length, unsigned int max_query_len); @@ -26,8 +26,8 @@ diff -ruN a/include/mysql/plugin_audit.h.pp b/include/mysql/plugin_audit.h.pp int thd_killed(const void* thd); unsigned long thd_get_thread_id(const void* thd); diff -ruN a/include/mysql/plugin_auth.h.pp b/include/mysql/plugin_auth.h.pp ---- a/include/mysql/plugin_auth.h.pp 2011-01-20 00:37:08.000000000 +0200 -+++ b/include/mysql/plugin_auth.h.pp 2011-02-21 22:57:48.816765777 +0200 +--- a/include/mysql/plugin_auth.h.pp 2011-04-09 18:48:05.000000000 +0400 ++++ b/include/mysql/plugin_auth.h.pp 2011-04-09 18:48:50.000000000 +0400 @@ -178,6 +178,16 @@ char *thd_security_context(void* thd, char *buffer, unsigned int length, unsigned int max_query_len); @@ -46,8 +46,8 @@ diff -ruN a/include/mysql/plugin_auth.h.pp b/include/mysql/plugin_auth.h.pp int thd_killed(const void* thd); unsigned long thd_get_thread_id(const void* thd); diff -ruN a/include/mysql/plugin_ftparser.h.pp b/include/mysql/plugin_ftparser.h.pp ---- a/include/mysql/plugin_ftparser.h.pp 2011-01-20 00:37:08.000000000 +0200 -+++ b/include/mysql/plugin_ftparser.h.pp 2011-02-21 22:57:48.816765777 +0200 +--- a/include/mysql/plugin_ftparser.h.pp 2011-04-09 18:48:05.000000000 +0400 ++++ b/include/mysql/plugin_ftparser.h.pp 2011-04-09 18:48:50.000000000 +0400 @@ -131,6 +131,16 @@ char *thd_security_context(void* thd, char *buffer, unsigned int length, unsigned int max_query_len); @@ -66,8 +66,8 @@ diff -ruN a/include/mysql/plugin_ftparser.h.pp b/include/mysql/plugin_ftparser.h int thd_killed(const void* thd); unsigned long thd_get_thread_id(const void* thd); diff -ruN a/include/mysql/plugin.h b/include/mysql/plugin.h ---- a/include/mysql/plugin.h 2011-01-20 00:37:08.000000000 +0200 -+++ b/include/mysql/plugin.h 2011-02-21 22:57:48.817765600 +0200 +--- a/include/mysql/plugin.h 2011-04-09 18:48:05.000000000 +0400 ++++ b/include/mysql/plugin.h 2011-04-09 18:48:50.000000000 +0400 @@ -536,6 +536,17 @@ /* Increments the row counter, see THD::row_count */ void thd_inc_row_count(MYSQL_THD thd); @@ -86,9 +86,9 @@ diff -ruN a/include/mysql/plugin.h b/include/mysql/plugin.h /** Create a temporary file. -diff -ruN a/patch_info/slow_extended.info b/patch_info/slow_extended.info ---- a/patch_info/slow_extended.info 1970-01-01 03:00:00.000000000 +0300 -+++ b/patch_info/slow_extended.info 2011-02-21 22:57:48.818765423 +0200 +diff -ruN /dev/null b/patch_info/slow_extended.info +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ b/patch_info/slow_extended.info 2011-04-09 18:48:50.000000000 +0400 @@ -0,0 +1,25 @@ +File=slow_extended.patch +Name=Extended statistics in slow.log (not InnoDB part) @@ -115,15 +115,9 @@ diff -ruN a/patch_info/slow_extended.info b/patch_info/slow_extended.info +6) Change variable types (system/command-line) +2011-01 +Patch profiling_slow.patch was merged -+2011-02 -+Rename variables: -+LOG_SLOW_TIMESTAMP_EVERY => SLOW_QUERY_LOG_TIMESTAMP_ALWAYS -+LOG_WARNINGS_SILENCE => LOG_WARNINGS_SUPPRESS -+SLOW_QUERY_LOG_MICROSECONDS_TIMESTAMP => SLOW_QUERY_LOG_TIMESTAMP_PRECISION=(SECOND,MICROSECOND) -+USE_GLOBAL_LOG_SLOW_CONTROL => SLOW_QUERY_LOG_USE_GLOBAL_CONTROL diff -ruN a/scripts/mysqldumpslow.sh b/scripts/mysqldumpslow.sh ---- a/scripts/mysqldumpslow.sh 2011-01-20 00:37:09.000000000 +0200 -+++ b/scripts/mysqldumpslow.sh 2011-02-21 22:57:48.818765423 +0200 +--- a/scripts/mysqldumpslow.sh 2011-04-09 18:48:05.000000000 +0400 ++++ b/scripts/mysqldumpslow.sh 2011-04-09 18:48:50.000000000 +0400 @@ -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) : ('',''); @@ -136,8 +130,8 @@ diff -ruN a/scripts/mysqldumpslow.sh b/scripts/mysqldumpslow.sh # remove fluff that mysqld writes to log when it (re)starts: diff -ruN a/sql/event_scheduler.cc b/sql/event_scheduler.cc ---- a/sql/event_scheduler.cc 2011-01-20 00:37:09.000000000 +0200 -+++ b/sql/event_scheduler.cc 2011-02-21 22:57:48.819765246 +0200 +--- a/sql/event_scheduler.cc 2011-04-09 18:48:05.000000000 +0400 ++++ b/sql/event_scheduler.cc 2011-04-09 18:48:50.000000000 +0400 @@ -195,6 +195,7 @@ thd->client_capabilities|= CLIENT_MULTI_RESULTS; mysql_mutex_lock(&LOCK_thread_count); @@ -147,9 +141,9 @@ diff -ruN a/sql/event_scheduler.cc b/sql/event_scheduler.cc /* diff -ruN a/sql/filesort.cc b/sql/filesort.cc ---- a/sql/filesort.cc 2011-01-20 00:37:09.000000000 +0200 -+++ b/sql/filesort.cc 2011-02-21 22:57:48.821764892 +0200 -@@ -193,6 +193,7 @@ +--- a/sql/filesort.cc 2011-04-09 18:48:05.000000000 +0400 ++++ b/sql/filesort.cc 2011-04-09 18:48:50.000000000 +0400 +@@ -195,6 +195,7 @@ { status_var_increment(thd->status_var.filesort_scan_count); } @@ -157,7 +151,7 @@ diff -ruN a/sql/filesort.cc b/sql/filesort.cc #ifdef CAN_TRUST_RANGE if (select && select->quick && select->quick->records > 0L) { -@@ -258,6 +259,7 @@ +@@ -260,6 +261,7 @@ } else { @@ -165,7 +159,7 @@ diff -ruN a/sql/filesort.cc b/sql/filesort.cc if (table_sort.buffpek && table_sort.buffpek_len < maxbuffer) { my_free(table_sort.buffpek); -@@ -1216,6 +1218,7 @@ +@@ -1219,6 +1221,7 @@ DBUG_ENTER("merge_buffers"); status_var_increment(current_thd->status_var.filesort_merge_passes); @@ -174,8 +168,8 @@ diff -ruN a/sql/filesort.cc b/sql/filesort.cc { killed= ¬_killable; diff -ruN a/sql/log.cc b/sql/log.cc ---- a/sql/log.cc 2011-01-20 00:37:09.000000000 +0200 -+++ b/sql/log.cc 2011-02-21 23:14:33.973714581 +0200 +--- a/sql/log.cc 2011-04-09 18:48:05.000000000 +0400 ++++ b/sql/log.cc 2011-04-09 18:48:50.000000000 +0400 @@ -715,11 +715,13 @@ */ @@ -389,8 +383,8 @@ diff -ruN a/sql/log.cc b/sql/log.cc { // Database changed if (my_b_printf(&log_file,"use %s;\n",thd->db) == (uint) -1) diff -ruN a/sql/log.h b/sql/log.h ---- a/sql/log.h 2011-01-20 00:37:09.000000000 +0200 -+++ b/sql/log.h 2011-02-21 22:57:48.826764006 +0200 +--- a/sql/log.h 2011-04-09 18:48:05.000000000 +0400 ++++ b/sql/log.h 2011-04-09 18:48:50.000000000 +0400 @@ -242,7 +242,7 @@ uint user_host_len, int thread_id, const char *command_type, uint command_type_len, @@ -400,7 +394,7 @@ diff -ruN a/sql/log.h b/sql/log.h const char *user_host, uint user_host_len, ulonglong query_utime, ulonglong lock_utime, bool is_command, const char *sql_text, uint sql_text_len); -@@ -492,7 +492,7 @@ +@@ -515,7 +515,7 @@ virtual bool init()= 0; virtual void cleanup()= 0; @@ -409,7 +403,7 @@ diff -ruN a/sql/log.h b/sql/log.h time_t query_start_arg, const char *user_host, uint user_host_len, ulonglong query_utime, ulonglong lock_utime, bool is_command, -@@ -521,7 +521,7 @@ +@@ -544,7 +544,7 @@ virtual bool init(); virtual void cleanup(); @@ -418,7 +412,7 @@ diff -ruN a/sql/log.h b/sql/log.h time_t query_start_arg, const char *user_host, uint user_host_len, ulonglong query_utime, ulonglong lock_utime, bool is_command, -@@ -553,7 +553,7 @@ +@@ -576,7 +576,7 @@ virtual bool init(); virtual void cleanup(); @@ -428,9 +422,9 @@ diff -ruN a/sql/log.h b/sql/log.h uint user_host_len, ulonglong query_utime, ulonglong lock_utime, bool is_command, diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc ---- a/sql/mysqld.cc 2011-02-21 22:57:24.442081625 +0200 -+++ b/sql/mysqld.cc 2011-02-21 22:59:30.845699981 +0200 -@@ -419,6 +419,10 @@ +--- a/sql/mysqld.cc 2011-04-09 18:48:20.000000000 +0400 ++++ b/sql/mysqld.cc 2011-04-09 18:48:50.000000000 +0400 +@@ -420,6 +420,10 @@ char* opt_secure_file_priv; my_bool opt_log_slow_admin_statements= 0; my_bool opt_log_slow_slave_statements= 0; @@ -441,7 +435,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc my_bool lower_case_file_system= 0; my_bool opt_large_pages= 0; my_bool opt_super_large_pages= 0; -@@ -5806,10 +5810,10 @@ +@@ -5839,10 +5843,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}, @@ -454,7 +448,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc {"log-slow-queries", OPT_SLOW_QUERY_LOG, "Log slow queries to a table or log file. Defaults logging to table " "mysql.slow_log or hostname-slow.log if --log-output=file is used. " -@@ -7194,6 +7198,10 @@ +@@ -7231,6 +7235,10 @@ C_MODE_END @@ -465,7 +459,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc /** Get server options from the command line, and perform related server initializations. -@@ -7335,6 +7343,8 @@ +@@ -7372,6 +7380,8 @@ global_system_variables.long_query_time= (ulonglong) (global_system_variables.long_query_time_double * 1e6); @@ -475,8 +469,8 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc opt_specialflag|= SPECIAL_SHORT_LOG_FORMAT; diff -ruN a/sql/mysqld.h b/sql/mysqld.h ---- a/sql/mysqld.h 2011-02-21 22:57:24.398089415 +0200 -+++ b/sql/mysqld.h 2011-02-21 23:01:50.079045873 +0200 +--- a/sql/mysqld.h 2011-04-09 18:48:17.000000000 +0400 ++++ b/sql/mysqld.h 2011-04-09 18:48:50.000000000 +0400 @@ -116,6 +116,10 @@ extern char* opt_secure_backup_file_priv; extern size_t opt_secure_backup_file_priv_len; @@ -489,8 +483,8 @@ diff -ruN a/sql/mysqld.h b/sql/mysqld.h extern my_bool opt_old_style_user_limits, trust_function_creators; extern uint opt_crash_binlog_innodb; diff -ruN a/sql/slave.cc b/sql/slave.cc ---- a/sql/slave.cc 2011-01-20 00:37:09.000000000 +0200 -+++ b/sql/slave.cc 2011-02-21 22:57:48.834762590 +0200 +--- a/sql/slave.cc 2011-04-09 18:48:05.000000000 +0400 ++++ b/sql/slave.cc 2011-04-09 18:48:50.000000000 +0400 @@ -2038,6 +2038,7 @@ + MAX_LOG_EVENT_HEADER; /* note, incr over the global not session var */ thd->slave_thread = 1; @@ -500,9 +494,9 @@ diff -ruN a/sql/slave.cc b/sql/slave.cc thd->client_capabilities = CLIENT_LOCAL_FILES; mysql_mutex_lock(&LOCK_thread_count); diff -ruN a/sql/sp_head.cc b/sql/sp_head.cc ---- a/sql/sp_head.cc 2011-01-20 00:37:09.000000000 +0200 -+++ b/sql/sp_head.cc 2011-02-21 22:57:48.837762059 +0200 -@@ -2151,7 +2151,7 @@ +--- a/sql/sp_head.cc 2011-04-09 18:48:05.000000000 +0400 ++++ b/sql/sp_head.cc 2011-04-09 18:48:50.000000000 +0400 +@@ -2150,7 +2150,7 @@ DBUG_PRINT("info",(" %.*s: eval args done", (int) m_name.length, m_name.str)); } @@ -512,8 +506,8 @@ diff -ruN a/sql/sp_head.cc b/sql/sp_head.cc DBUG_PRINT("info", ("Disabling slow log for the execution")); save_enable_slow_log= true; diff -ruN a/sql/sql_cache.cc b/sql/sql_cache.cc ---- a/sql/sql_cache.cc 2011-01-20 00:37:09.000000000 +0200 -+++ b/sql/sql_cache.cc 2011-02-21 22:57:48.840761528 +0200 +--- a/sql/sql_cache.cc 2011-04-09 18:48:05.000000000 +0400 ++++ b/sql/sql_cache.cc 2011-04-09 18:48:50.000000000 +0400 @@ -1756,6 +1756,7 @@ response, we can't handle it anyway. */ @@ -531,8 +525,8 @@ diff -ruN a/sql/sql_cache.cc b/sql/sql_cache.cc DBUG_RETURN(0); // Query was not cached } diff -ruN a/sql/sql_class.cc b/sql/sql_class.cc ---- a/sql/sql_class.cc 2011-01-20 00:37:09.000000000 +0200 -+++ b/sql/sql_class.cc 2011-02-21 22:57:48.843760997 +0200 +--- a/sql/sql_class.cc 2011-04-09 18:48:05.000000000 +0400 ++++ b/sql/sql_class.cc 2011-04-09 18:48:50.000000000 +0400 @@ -368,6 +368,37 @@ thd->warning_info->inc_current_row_for_warning(); } @@ -621,8 +615,8 @@ diff -ruN a/sql/sql_class.cc b/sql/sql_class.cc } diff -ruN a/sql/sql_class.h b/sql/sql_class.h ---- a/sql/sql_class.h 2011-02-21 22:57:24.423084989 +0200 -+++ b/sql/sql_class.h 2011-02-21 23:06:24.869371276 +0200 +--- a/sql/sql_class.h 2011-04-09 18:48:19.000000000 +0400 ++++ b/sql/sql_class.h 2011-04-09 18:48:50.000000000 +0400 @@ -60,6 +60,33 @@ enum enum_duplicates { DUP_ERROR, DUP_REPLACE, DUP_UPDATE }; enum enum_delay_key_write { DELAY_KEY_WRITE_NONE, DELAY_KEY_WRITE_ON, @@ -718,9 +712,9 @@ diff -ruN a/sql/sql_class.h b/sql/sql_class.h uint in_sub_stmt; diff -ruN a/sql/sql_connect.cc b/sql/sql_connect.cc ---- a/sql/sql_connect.cc 2011-01-20 00:37:09.000000000 +0200 -+++ b/sql/sql_connect.cc 2011-02-21 22:57:48.848760112 +0200 -@@ -741,6 +741,15 @@ +--- a/sql/sql_connect.cc 2011-04-09 18:48:05.000000000 +0400 ++++ b/sql/sql_connect.cc 2011-04-09 18:48:50.000000000 +0400 +@@ -764,6 +764,15 @@ prepare_new_connection_state(thd); @@ -737,9 +731,9 @@ diff -ruN a/sql/sql_connect.cc b/sql/sql_connect.cc !(thd->killed == THD::KILL_CONNECTION)) { diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc ---- a/sql/sql_parse.cc 2011-02-21 22:57:24.451080031 +0200 -+++ b/sql/sql_parse.cc 2011-02-21 22:57:48.852759404 +0200 -@@ -1431,7 +1431,6 @@ +--- a/sql/sql_parse.cc 2011-04-09 18:48:20.000000000 +0400 ++++ b/sql/sql_parse.cc 2011-04-09 18:48:50.000000000 +0400 +@@ -1430,7 +1430,6 @@ DBUG_RETURN(error); } @@ -747,7 +741,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc void log_slow_statement(THD *thd) { DBUG_ENTER("log_slow_statement"); -@@ -1444,6 +1443,42 @@ +@@ -1443,6 +1442,42 @@ if (unlikely(thd->in_sub_stmt)) DBUG_VOID_RETURN; // Don't set time for sub stmt @@ -790,7 +784,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc /* Do not log administrative statements unless the appropriate option is set. -@@ -1819,6 +1854,9 @@ +@@ -1818,6 +1853,9 @@ context.resolve_in_table_list_only(select_lex-> table_list.first); @@ -800,7 +794,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc /* Reset warning count for each query that uses tables A better approach would be to reset this for any commands -@@ -5258,6 +5296,21 @@ +@@ -5248,6 +5286,21 @@ thd->rand_used= 0; thd->sent_row_count= thd->examined_row_count= 0; @@ -823,9 +817,9 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc thd->binlog_unsafe_warning_flags= 0; diff -ruN a/sql/sql_select.cc b/sql/sql_select.cc ---- a/sql/sql_select.cc 2011-02-21 22:57:24.411087114 +0200 -+++ b/sql/sql_select.cc 2011-02-21 22:57:48.867756749 +0200 -@@ -6894,7 +6894,10 @@ +--- a/sql/sql_select.cc 2011-04-09 18:48:17.000000000 +0400 ++++ b/sql/sql_select.cc 2011-04-09 18:48:50.000000000 +0400 +@@ -6898,7 +6898,10 @@ { join->thd->server_status|=SERVER_QUERY_NO_INDEX_USED; if (statistics) @@ -836,7 +830,7 @@ diff -ruN a/sql/sql_select.cc b/sql/sql_select.cc } } else -@@ -6908,7 +6911,10 @@ +@@ -6912,7 +6915,10 @@ { join->thd->server_status|=SERVER_QUERY_NO_INDEX_USED; if (statistics) @@ -847,7 +841,7 @@ diff -ruN a/sql/sql_select.cc b/sql/sql_select.cc } } if (!table->no_keyread) -@@ -10239,6 +10245,7 @@ +@@ -10243,6 +10249,7 @@ (ulong) rows_limit,test(group))); status_var_increment(thd->status_var.created_tmp_tables); @@ -855,7 +849,7 @@ diff -ruN a/sql/sql_select.cc b/sql/sql_select.cc if (use_temp_pool && !(test_flags & TEST_KEEP_TMP_TABLES)) temp_pool_slot = bitmap_lock_set_next(&temp_pool); -@@ -11137,6 +11144,7 @@ +@@ -11141,6 +11148,7 @@ goto err; } status_var_increment(table->in_use->status_var.created_tmp_disk_tables); @@ -863,7 +857,7 @@ diff -ruN a/sql/sql_select.cc b/sql/sql_select.cc share->db_record_offset= 1; DBUG_RETURN(0); err: -@@ -11155,6 +11163,14 @@ +@@ -11159,6 +11167,14 @@ save_proc_info=thd->proc_info; thd_proc_info(thd, "removing tmp table"); @@ -879,8 +873,8 @@ diff -ruN a/sql/sql_select.cc b/sql/sql_select.cc ha_release_temporary_latches(thd); diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc ---- a/sql/sql_show.cc 2011-02-21 22:57:24.456079146 +0200 -+++ b/sql/sql_show.cc 2011-02-21 22:57:48.873755686 +0200 +--- a/sql/sql_show.cc 2011-04-09 18:48:20.000000000 +0400 ++++ b/sql/sql_show.cc 2011-04-09 18:48:50.000000000 +0400 @@ -1943,8 +1943,17 @@ table->field[4]->store(command_name[tmp->command].str, command_name[tmp->command].length, cs); @@ -902,9 +896,9 @@ diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc if ((val= thread_state_info(tmp))) { diff -ruN a/sql/sys_vars.cc b/sql/sys_vars.cc ---- a/sql/sys_vars.cc 2011-02-21 22:57:24.435082865 +0200 -+++ b/sql/sys_vars.cc 2011-02-21 23:10:51.177188840 +0200 -@@ -2852,6 +2852,117 @@ +--- a/sql/sys_vars.cc 2011-04-09 18:48:19.000000000 +0400 ++++ b/sql/sys_vars.cc 2011-04-09 18:48:50.000000000 +0400 +@@ -2862,6 +2862,117 @@ DEFAULT(FALSE), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(fix_log_state)); @@ -1023,8 +1017,8 @@ diff -ruN a/sql/sys_vars.cc b/sql/sys_vars.cc static Sys_var_mybool Sys_log_slow( "log_slow_queries", diff -ruN a/sql/sql_profile.cc b/sql/sql_profile.cc ---- a/sql/sql_profile.cc 2011-01-20 00:37:09.000000000 +0200 -+++ b/sql/sql_profile.cc 2011-02-21 22:57:48.877754978 +0200 +--- a/sql/sql_profile.cc 2011-04-09 18:48:05.000000000 +0400 ++++ b/sql/sql_profile.cc 2011-04-09 18:48:50.000000000 +0400 @@ -243,7 +243,8 @@ { time_usecs= (double) my_getsystime() / 10.0; /* 1 sec was 1e7, now is 1e6 */ @@ -1195,8 +1189,8 @@ diff -ruN a/sql/sql_profile.cc b/sql/sql_profile.cc Fill the information schema table, "query_profile", as defined in show.cc . There are two ways to get to this function: Selecting from the information diff -ruN a/sql/sql_profile.h b/sql/sql_profile.h ---- a/sql/sql_profile.h 2011-01-20 00:37:09.000000000 +0200 -+++ b/sql/sql_profile.h 2011-02-21 22:57:48.878754801 +0200 +--- a/sql/sql_profile.h 2011-04-09 18:48:05.000000000 +0400 ++++ b/sql/sql_profile.h 2011-04-09 18:48:50.000000000 +0400 @@ -164,11 +164,15 @@ */ class PROF_MEASUREMENT diff --git a/sql_no_fcache.patch b/sql_no_fcache.patch index b05ce61..cc180b3 100644 --- a/sql_no_fcache.patch +++ b/sql_no_fcache.patch @@ -6,8 +6,8 @@ # Any small change to this file in the main branch # should be done or reviewed by the maintainer! 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 +--- a/client/mysqldump.c 2011-04-09 18:48:18.000000000 +0400 ++++ b/client/mysqldump.c 2011-04-09 18:48:58.000000000 +0400 @@ -139,6 +139,8 @@ static uint opt_protocol= 0; static char *opt_plugin_dir= 0, *opt_default_auth= 0; @@ -17,7 +17,7 @@ diff -ruN a/client/mysqldump.c b/client/mysqldump.c /* Dynamic_string wrapper functions. In this file use these wrappers, they will terminate the process if there is -@@ -1486,6 +1488,17 @@ +@@ -1492,6 +1494,17 @@ /* Don't switch charsets for 4.1 and earlier. (bug#34192). */ server_supports_switching_charsets= FALSE; } @@ -35,7 +35,7 @@ diff -ruN a/client/mysqldump.c b/client/mysqldump.c /* As we're going to set SQL_MODE, it would be lost on reconnect, so we cannot reconnect. -@@ -3167,7 +3180,12 @@ +@@ -3173,7 +3186,12 @@ /* now build the query string */ @@ -49,7 +49,7 @@ diff -ruN a/client/mysqldump.c b/client/mysqldump.c dynstr_append_checked(&query_string, filename); dynstr_append_checked(&query_string, "'"); -@@ -3217,7 +3235,12 @@ +@@ -3223,7 +3241,12 @@ check_io(md_result_file); } @@ -63,9 +63,9 @@ diff -ruN a/client/mysqldump.c b/client/mysqldump.c dynstr_append_checked(&query_string, result_table); if (where) -diff -ruN a/include/flashcache_ioctl.h b/include/flashcache_ioctl.h ---- a/include/flashcache_ioctl.h 1970-01-01 03:00:00.000000000 +0300 -+++ b/include/flashcache_ioctl.h 2010-07-28 16:47:59.744079911 +0400 +diff -ruN /dev/null b/include/flashcache_ioctl.h +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ b/include/flashcache_ioctl.h 2011-04-09 18:48:58.000000000 +0400 @@ -0,0 +1,53 @@ +/**************************************************************************** + * flashcache_ioctl.h @@ -120,9 +120,9 @@ diff -ruN a/include/flashcache_ioctl.h b/include/flashcache_ioctl.h +#define FLASHCACHEDELALLWHITELIST _IOW(FLASHCACHE_IOCTL, FLASHCACHEDELWHITELISTALL_CMD, pid_t) + +#endif -diff -ruN a/patch_info/sql_no_fcache.info b/patch_info/sql_no_fcache.info ---- a/patch_info/sql_no_fcache.info 1970-01-01 03:00:00.000000000 +0300 -+++ b/patch_info/sql_no_fcache.info 2010-07-28 16:47:59.915439165 +0400 +diff -ruN /dev/null b/patch_info/sql_no_fcache.info +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ b/patch_info/sql_no_fcache.info 2011-04-09 18:48:58.000000000 +0400 @@ -0,0 +1,6 @@ +File=sql_no_fcache.patch +Name=Support for flashcache including the SQL_NO_FCACHE option that prevents blocks from being cached during a query. @@ -131,8 +131,8 @@ diff -ruN a/patch_info/sql_no_fcache.info b/patch_info/sql_no_fcache.info +License=GPL +Comment= diff -ruN a/sql/lex.h b/sql/lex.h ---- a/sql/lex.h 2010-07-28 16:47:58.575318748 +0400 -+++ b/sql/lex.h 2010-07-28 16:48:00.134078469 +0400 +--- a/sql/lex.h 2011-04-09 18:48:55.000000000 +0400 ++++ b/sql/lex.h 2011-04-09 18:48:58.000000000 +0400 @@ -516,6 +516,7 @@ { "SQL_CACHE", SYM(SQL_CACHE_SYM)}, { "SQL_CALC_FOUND_ROWS", SYM(SQL_CALC_FOUND_ROWS)}, @@ -142,9 +142,9 @@ diff -ruN a/sql/lex.h b/sql/lex.h { "SQL_THREAD", SYM(SQL_THREAD)}, { "SQL_TSI_SECOND", SYM(SECOND_SYM)}, 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 -@@ -192,6 +192,8 @@ +--- a/sql/mysqld.h 2011-04-09 18:48:55.000000000 +0400 ++++ b/sql/mysqld.h 2011-04-09 18:48:58.000000000 +0400 +@@ -193,6 +193,8 @@ extern ulong back_log; extern char language[FN_REFLEN]; extern ulong server_id, concurrency; @@ -154,8 +154,8 @@ diff -ruN a/sql/mysqld.h b/sql/mysqld.h extern char *opt_mysql_tmpdir, mysql_charsets_dir[]; extern int mysql_unpacked_real_data_home_len; diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc ---- a/sql/mysqld.cc 2010-07-28 16:47:58.565318871 +0400 -+++ b/sql/mysqld.cc 2010-07-28 16:48:03.004544367 +0400 +--- a/sql/mysqld.cc 2011-04-09 18:48:55.000000000 +0400 ++++ b/sql/mysqld.cc 2011-04-09 18:48:58.000000000 +0400 @@ -86,6 +86,11 @@ #ifdef HAVE_SYS_PRCTL_H #include @@ -168,7 +168,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc #include #include -@@ -485,6 +490,11 @@ +@@ -486,6 +491,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; @@ -177,10 +177,10 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc +int cachedev_fd; +my_bool cachedev_enabled= FALSE; + - /** - Limit of the total number of prepared statements in the server. - Is necessary to protect the server against out-of-memory attacks. -@@ -4186,6 +4196,97 @@ + /* + Maximum length of parameter value which can be set through + mysql_send_long_data() call. +@@ -4206,6 +4216,97 @@ #define decrement_handler_count() #endif /* defined(_WIN32) || defined(HAVE_SMEM) */ @@ -278,7 +278,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc #ifndef EMBEDDED_LIBRARY #ifndef DBUG_OFF -@@ -4442,6 +4543,10 @@ +@@ -4464,6 +4565,10 @@ test_lc_time_sz(); #endif @@ -289,7 +289,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc /* We have enough space for fiddling with the argv, continue */ -@@ -4645,6 +4750,10 @@ +@@ -4667,6 +4772,10 @@ } #endif clean_up(1); @@ -300,7 +300,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc mysqld_exit(0); } -@@ -6467,6 +6576,7 @@ +@@ -6500,6 +6609,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}, @@ -309,8 +309,8 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc {"Handler_commit", (char*) offsetof(STATUS_VAR, ha_commit_count), SHOW_LONG_STATUS}, {"Handler_delete", (char*) offsetof(STATUS_VAR, ha_delete_count), SHOW_LONG_STATUS}, diff -ruN a/sql/sql_lex.cc b/sql/sql_lex.cc ---- a/sql/sql_lex.cc 2010-07-28 16:47:58.555318714 +0400 -+++ b/sql/sql_lex.cc 2010-07-28 16:48:07.794069239 +0400 +--- a/sql/sql_lex.cc 2011-04-09 18:48:04.000000000 +0400 ++++ b/sql/sql_lex.cc 2011-04-09 18:48:58.000000000 +0400 @@ -384,6 +384,7 @@ lex->describe= 0; lex->subqueries= FALSE; @@ -320,9 +320,9 @@ diff -ruN a/sql/sql_lex.cc b/sql/sql_lex.cc lex->safe_to_cache_query= 1; lex->leaf_tables_insert= 0; 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 -@@ -2293,6 +2293,7 @@ +--- a/sql/sql_lex.h 2011-04-09 18:48:20.000000000 +0400 ++++ b/sql/sql_lex.h 2011-04-09 18:48:58.000000000 +0400 +@@ -2291,6 +2291,7 @@ enum enum_yes_no_unknown tx_chain, tx_release; bool safe_to_cache_query; @@ -331,8 +331,8 @@ diff -ruN a/sql/sql_lex.h b/sql/sql_lex.h st_parsing_options parsing_options; Alter_info alter_info; diff -ruN a/sql/sql_select.cc b/sql/sql_select.cc ---- a/sql/sql_select.cc 2010-07-28 16:47:58.555318714 +0400 -+++ b/sql/sql_select.cc 2010-07-28 16:48:13.414069437 +0400 +--- a/sql/sql_select.cc 2011-04-09 18:48:50.000000000 +0400 ++++ b/sql/sql_select.cc 2011-04-09 18:48:58.000000000 +0400 @@ -55,6 +55,12 @@ #define PREV_BITS(type,A) ((type) (((type) 1 << (A)) -1)) @@ -378,8 +378,8 @@ diff -ruN a/sql/sql_select.cc b/sql/sql_select.cc DBUG_RETURN(res); } diff -ruN a/sql/sql_yacc.yy b/sql/sql_yacc.yy ---- a/sql/sql_yacc.yy 2010-07-28 16:47:58.565318871 +0400 -+++ b/sql/sql_yacc.yy 2010-07-28 16:48:14.205317990 +0400 +--- a/sql/sql_yacc.yy 2011-04-09 18:48:55.000000000 +0400 ++++ b/sql/sql_yacc.yy 2011-04-09 18:48:58.000000000 +0400 @@ -1283,6 +1283,7 @@ %token SQL_CACHE_SYM %token SQL_CALC_FOUND_ROWS diff --git a/start-stop-messages.patch b/start-stop-messages.patch new file mode 100644 index 0000000..c231384 --- /dev/null +++ b/start-stop-messages.patch @@ -0,0 +1,192 @@ +--- a/scripts/mysqld_multi.sh ++++ b/scripts/mysqld_multi.sh +@@ -233,10 +233,10 @@ sub report_mysqlds + { + my (@groups, $com, $i, @options, $pec); + +- print "Reporting MySQL servers\n"; ++ print "Reporting MySQL (Percona Server) servers\n"; + if (!$opt_no_log) + { +- w2log("\nReporting MySQL servers","$opt_log",0,0); ++ w2log("\nReporting MySQL (Percona Server) servers","$opt_log",0,0); + } + @groups = &find_groups($groupids); + for ($i = 0; defined($groups[$i]); $i++) +@@ -247,19 +247,19 @@ sub report_mysqlds + $pec = $? >> 8; + if ($pec) + { +- print "MySQL server from group: $groups[$i] is not running\n"; ++ print "MySQL (Percona Server) from group: $groups[$i] is not running\n"; + if (!$opt_no_log) + { +- w2log("MySQL server from group: $groups[$i] is not running", ++ w2log("MySQL (Percona Server) from group: $groups[$i] is not running", + "$opt_log", 0, 0); + } + } + else + { +- print "MySQL server from group: $groups[$i] is running\n"; ++ print "MySQL (Percona Server) from group: $groups[$i] is running\n"; + if (!$opt_no_log) + { +- w2log("MySQL server from group: $groups[$i] is running", ++ w2log("MySQL (Percona Server) from group: $groups[$i] is running", + "$opt_log", 0, 0); + } + } +@@ -284,11 +284,11 @@ sub start_mysqlds() + + if (!$opt_no_log) + { +- w2log("\nStarting MySQL servers\n","$opt_log",0,0); ++ w2log("\nStarting MySQL (Percona Server)\n","$opt_log",0,0); + } + else + { +- print "\nStarting MySQL servers\n"; ++ print "\nStarting MySQL (Percona Server)\n"; + } + @groups = &find_groups($groupids); + for ($i = 0; defined($groups[$i]); $i++) +@@ -359,7 +359,7 @@ sub start_mysqlds() + } + if (!$i && !$opt_no_log) + { +- w2log("No MySQL servers to be started (check your GNRs)", ++ w2log("No MySQL (Percona Server) servers to be started (check your GNRs)", + "$opt_log", 0, 0); + } + } +@@ -374,11 +374,11 @@ sub stop_mysqlds() + + if (!$opt_no_log) + { +- w2log("\nStopping MySQL servers\n","$opt_log",0,0); ++ w2log("\nStopping MySQL (Percona Server) servers\n","$opt_log",0,0); + } + else + { +- print "\nStopping MySQL servers\n"; ++ print "\nStopping MySQL (Percona Server) servers\n"; + } + @groups = &find_groups($groupids); + for ($i = 0; defined($groups[$i]); $i++) +@@ -391,7 +391,7 @@ sub stop_mysqlds() + } + if (!$i && !$opt_no_log) + { +- w2log("No MySQL servers to be stopped (check your GNRs)", ++ w2log("No MySQL (Percona Server) servers to be stopped (check your GNRs)", + "$opt_log", 0, 0); + } + } +--- a/support-files/mysql.server.sh ++++ b/support-files/mysql.server.sh +@@ -2,7 +2,7 @@ + # Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + # This file is public domain and comes with NO WARRANTY of any kind + +-# MySQL daemon start/stop script. ++# MySQL (Percona Server) daemon start/stop script. + + # Usually this is put in /etc/init.d (at least on machines SYSV R4 based + # systems) and linked to /etc/rc3.d/S99mysql and /etc/rc0.d/K01mysql. +@@ -21,8 +21,8 @@ + # Required-Stop: $local_fs $network $remote_fs + # Default-Start: 2 3 4 5 + # Default-Stop: 0 1 6 +-# Short-Description: start and stop MySQL +-# Description: MySQL is a very fast and reliable SQL database engine. ++# Short-Description: start and stop MySQL (Percona Server) ++# Description: Percona-Server is a SQL database engine with focus on high performance. + ### END INIT INFO + + # If you install MySQL on some other places than @prefix@, then you +@@ -275,7 +275,7 @@ case "$mode" in + # Safeguard (relative paths, core dumps..) + cd $basedir + +- echo $echo_n "Starting MySQL" ++ echo $echo_n "Starting MySQL (Percona Server)" + if test -x $bindir/mysqld_safe + then + # Give extra arguments to mysqld with the my.cnf file. This script +@@ -305,12 +305,12 @@ case "$mode" in + + if (kill -0 $mysqld_pid 2>/dev/null) + then +- echo $echo_n "Shutting down MySQL" ++ echo $echo_n "Shutting down MySQL (Percona Server)" + kill $mysqld_pid + # mysqld should remove the pid file when it exits, so wait for it. + wait_for_pid removed "$mysqld_pid" "$mysqld_pid_file_path"; return_value=$? + else +- log_failure_msg "MySQL server process #$mysqld_pid is not running!" ++ log_failure_msg "MySQL (Percona Server) server process #$mysqld_pid is not running!" + rm "$mysqld_pid_file_path" + fi + +@@ -321,7 +321,7 @@ case "$mode" in + fi + exit $return_value + else +- log_failure_msg "MySQL server PID file could not be found!" ++ log_failure_msg "MySQL (Percona Server) PID file could not be found!" + fi + ;; + +@@ -339,10 +339,10 @@ case "$mode" in + 'reload'|'force-reload') + if test -s "$mysqld_pid_file_path" ; then + read mysqld_pid < "$mysqld_pid_file_path" +- kill -HUP $mysqld_pid && log_success_msg "Reloading service MySQL" ++ kill -HUP $mysqld_pid && log_success_msg "Reloading service MySQL (Percona Server)" + touch "$mysqld_pid_file_path" + else +- log_failure_msg "MySQL PID file could not be found!" ++ log_failure_msg "MySQL (Percona Server) PID file could not be found!" + exit 1 + fi + ;; +@@ -351,10 +351,10 @@ case "$mode" in + if test -s "$mysqld_pid_file_path" ; then + read mysqld_pid < "$mysqld_pid_file_path" + if kill -0 $mysqld_pid 2>/dev/null ; then +- log_success_msg "MySQL running ($mysqld_pid)" ++ log_success_msg "MySQL (Percona Server) running ($mysqld_pid)" + exit 0 + else +- log_failure_msg "MySQL is not running, but PID file exists" ++ log_failure_msg "MySQL (Percona Server) is not running, but PID file exists" + exit 1 + fi + else +@@ -362,13 +362,13 @@ case "$mode" in + mysqld_pid=`pidof $libexecdir/mysqld` + if test -z $mysqld_pid ; then + if test -f "$lock_file_path" ; then +- log_failure_msg "MySQL is not running, but lock file ($lock_file_path) exists" ++ log_failure_msg "MySQL (Percona Server) is not running, but lock file ($lock_file_path) exists" + exit 2 + fi +- log_failure_msg "MySQL is not running" ++ log_failure_msg "MySQL (Percona Server) is not running" + exit 3 + else +- log_failure_msg "MySQL is running but PID file could not be found" ++ log_failure_msg "MySQL (Percona Server) is running but PID file could not be found" + exit 4 + fi + fi +@@ -376,7 +376,7 @@ case "$mode" in + *) + # usage + basename=`basename "$0"` +- echo "Usage: $basename {start|stop|restart|reload|force-reload|status} [ MySQL server options ]" ++ echo "Usage: $basename {start|stop|restart|reload|force-reload|status} [ MySQL (Percona Server) options ]" + exit 1 + ;; + esac diff --git a/userstat.patch b/userstat.patch index a43c926..8bf9b4b 100644 --- a/userstat.patch +++ b/userstat.patch @@ -6,8 +6,8 @@ # Any small change to this file in the main branch # should be done or reviewed by the maintainer! diff -ruN a/include/mysql/plugin.h b/include/mysql/plugin.h ---- a/include/mysql/plugin.h 2010-12-03 20:58:24.000000000 +0300 -+++ b/include/mysql/plugin.h 2010-12-31 06:06:43.000000000 +0300 +--- a/include/mysql/plugin.h 2011-04-10 12:23:47.000000000 +0400 ++++ b/include/mysql/plugin.h 2011-04-10 12:24:34.000000000 +0400 @@ -547,6 +547,9 @@ unsigned long thd_log_slow_verbosity(const MYSQL_THD thd); int thd_opt_slow_log(); @@ -19,8 +19,8 @@ diff -ruN a/include/mysql/plugin.h b/include/mysql/plugin.h Create a temporary file. diff -ruN a/include/mysql_com.h b/include/mysql_com.h ---- a/include/mysql_com.h 2010-12-03 20:58:24.000000000 +0300 -+++ b/include/mysql_com.h 2010-12-31 06:12:05.000000000 +0300 +--- a/include/mysql_com.h 2011-04-10 12:23:52.000000000 +0400 ++++ b/include/mysql_com.h 2011-04-10 12:24:34.000000000 +0400 @@ -31,6 +31,7 @@ #define SERVER_VERSION_LENGTH 60 @@ -41,9 +41,9 @@ diff -ruN a/include/mysql_com.h b/include/mysql_com.h #define CLIENT_LONG_PASSWORD 1 /* new more secure passwords */ #define CLIENT_FOUND_ROWS 2 /* Found instead of affected rows */ -diff -ruN a/patch_info/userstats.patch b/patch_info/userstats.patch ---- a/patch_info/userstats.patch 1970-01-01 03:00:00.000000000 +0300 -+++ b/patch_info/userstats.patch 2010-12-30 00:45:46.000000000 +0300 +diff -ruN /dev/null b/patch_info/userstats.patch +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ b/patch_info/userstats.patch 2011-04-10 12:24:34.000000000 +0400 @@ -0,0 +1,17 @@ +File=userstats.patch +Name=SHOW USER/TABLE/INDEX statistics @@ -63,8 +63,8 @@ diff -ruN a/patch_info/userstats.patch b/patch_info/userstats.patch +2011-02 +Rename variable USERSTAT_RUNNING => USERSTAT 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 +--- a/sql/handler.cc 2011-04-10 12:16:42.000000000 +0400 ++++ b/sql/handler.cc 2011-04-10 12:24:34.000000000 +0400 @@ -1243,6 +1243,8 @@ goto end; } @@ -100,7 +100,7 @@ diff -ruN a/sql/handler.cc b/sql/handler.cc DBUG_RETURN(error); } -@@ -3614,6 +3621,127 @@ +@@ -3619,6 +3626,127 @@ return; } @@ -229,8 +229,8 @@ diff -ruN a/sql/handler.cc b/sql/handler.cc /**************************************************************************** ** Some general functions that isn't in the handler class diff -ruN a/sql/handler.h b/sql/handler.h ---- a/sql/handler.h 2010-12-03 20:58:26.000000000 +0300 -+++ b/sql/handler.h 2010-12-31 05:10:00.000000000 +0300 +--- a/sql/handler.h 2011-04-10 12:23:52.000000000 +0400 ++++ b/sql/handler.h 2011-04-10 12:24:34.000000000 +0400 @@ -33,6 +33,10 @@ #include #include @@ -242,7 +242,7 @@ diff -ruN a/sql/handler.h b/sql/handler.h // the following is for checking tables #define HA_ADMIN_ALREADY_DONE 1 -@@ -553,10 +557,12 @@ +@@ -559,10 +563,12 @@ enum enum_schema_tables { SCH_CHARSETS= 0, @@ -255,7 +255,7 @@ diff -ruN a/sql/handler.h b/sql/handler.h SCH_ENGINES, SCH_EVENTS, SCH_FILES, -@@ -584,9 +590,12 @@ +@@ -590,9 +596,12 @@ SCH_TABLE_CONSTRAINTS, SCH_TABLE_NAMES, SCH_TABLE_PRIVILEGES, @@ -268,7 +268,7 @@ diff -ruN a/sql/handler.h b/sql/handler.h SCH_VARIABLES, SCH_VIEWS }; -@@ -1201,6 +1210,9 @@ +@@ -1207,6 +1216,9 @@ bool locked; bool implicit_emptied; /* Can be !=0 only if HEAP */ const COND *pushed_cond; @@ -278,7 +278,7 @@ diff -ruN a/sql/handler.h b/sql/handler.h /** next_insert_id is the next value which should be inserted into the auto_increment column: in a inserting-multi-row statement (like INSERT -@@ -1252,10 +1264,12 @@ +@@ -1258,10 +1270,12 @@ ref_length(sizeof(my_off_t)), ft_handler(0), inited(NONE), locked(FALSE), implicit_emptied(0), @@ -293,7 +293,7 @@ diff -ruN a/sql/handler.h b/sql/handler.h virtual ~handler(void) { DBUG_ASSERT(locked == FALSE); -@@ -1378,6 +1392,8 @@ +@@ -1384,6 +1398,8 @@ { table= table_arg; table_share= share; @@ -302,7 +302,7 @@ diff -ruN a/sql/handler.h b/sql/handler.h } virtual double scan_time() { return ulonglong2double(stats.data_file_length) / IO_SIZE + 2; } -@@ -1745,6 +1761,8 @@ +@@ -1751,6 +1767,8 @@ virtual bool is_crashed() const { return 0; } virtual bool auto_repair() const { return 0; } @@ -312,8 +312,8 @@ diff -ruN a/sql/handler.h b/sql/handler.h #define CHF_CREATE_FLAG 0 #define CHF_DELETE_FLAG 1 diff -ruN a/sql/lex.h b/sql/lex.h ---- a/sql/lex.h 2010-12-03 20:58:26.000000000 +0300 -+++ b/sql/lex.h 2010-12-30 01:25:40.000000000 +0300 +--- a/sql/lex.h 2011-04-10 12:23:55.000000000 +0400 ++++ b/sql/lex.h 2011-04-10 12:24:34.000000000 +0400 @@ -111,6 +111,7 @@ { "CIPHER", SYM(CIPHER_SYM)}, { "CLASS_ORIGIN", SYM(CLASS_ORIGIN_SYM)}, @@ -354,8 +354,8 @@ diff -ruN a/sql/lex.h b/sql/lex.h { "USING", SYM(USING)}, { "UTC_DATE", SYM(UTC_DATE_SYM)}, 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 +--- a/sql/log.cc 2011-04-10 12:23:47.000000000 +0400 ++++ b/sql/log.cc 2011-04-10 12:24:34.000000000 +0400 @@ -1007,6 +1007,13 @@ mysql_slow_log.reopen_file(); } @@ -370,7 +370,7 @@ diff -ruN a/sql/log.cc b/sql/log.cc /* Log error with all enabled log event handlers -@@ -5041,6 +5048,8 @@ +@@ -5039,6 +5046,8 @@ thd->first_successful_insert_id_in_prev_stmt_for_binlog); if (e.write(file)) goto err; @@ -379,7 +379,7 @@ diff -ruN a/sql/log.cc b/sql/log.cc } if (thd->auto_inc_intervals_in_cur_stmt_for_binlog.nb_elements() > 0) { -@@ -5052,12 +5061,16 @@ +@@ -5050,12 +5059,16 @@ minimum()); if (e.write(file)) goto err; @@ -396,7 +396,7 @@ diff -ruN a/sql/log.cc b/sql/log.cc } if (thd->user_var_events.elements) { -@@ -5080,6 +5093,8 @@ +@@ -5078,6 +5091,8 @@ flags); if (e.write(file)) goto err; @@ -405,7 +405,7 @@ diff -ruN a/sql/log.cc b/sql/log.cc } } } -@@ -5091,6 +5106,8 @@ +@@ -5089,6 +5104,8 @@ if (event_info->write(file) || DBUG_EVALUATE_IF("injecting_fault_writing", 1, 0)) goto err; @@ -414,7 +414,7 @@ diff -ruN a/sql/log.cc b/sql/log.cc error= 0; err: -@@ -5276,7 +5293,8 @@ +@@ -5274,7 +5291,8 @@ be reset as a READ_CACHE to be able to read the contents from it. */ @@ -424,7 +424,7 @@ diff -ruN a/sql/log.cc b/sql/log.cc { Mutex_sentry sentry(lock_log ? &LOCK_log : NULL); -@@ -5323,6 +5341,7 @@ +@@ -5321,6 +5339,7 @@ /* write the first half of the split header */ if (my_b_write(&log_file, header, carry)) return ER_ERROR_ON_WRITE; @@ -432,7 +432,7 @@ diff -ruN a/sql/log.cc b/sql/log.cc /* copy fixed second half of header to cache so the correct -@@ -5391,6 +5410,7 @@ +@@ -5389,6 +5408,7 @@ /* Write data to the binary log file */ if (my_b_write(&log_file, cache->read_pos, length)) return ER_ERROR_ON_WRITE; @@ -440,7 +440,7 @@ diff -ruN a/sql/log.cc b/sql/log.cc cache->read_pos=cache->read_end; // Mark buffer used up } while ((length= my_b_fill(cache))); -@@ -5505,20 +5525,23 @@ +@@ -5503,20 +5523,23 @@ Query_log_event qinfo(thd, STRING_WITH_LEN("BEGIN"), TRUE, FALSE, TRUE, 0); if (qinfo.write(&log_file)) goto err; @@ -467,9 +467,9 @@ diff -ruN a/sql/log.cc b/sql/log.cc if (incident && write_incident(thd, FALSE)) goto err; diff -ruN a/sql/log.h b/sql/log.h ---- a/sql/log.h 2010-12-03 20:58:26.000000000 +0300 -+++ b/sql/log.h 2010-12-30 01:56:04.000000000 +0300 -@@ -414,7 +414,8 @@ +--- a/sql/log.h 2011-04-10 12:23:47.000000000 +0400 ++++ b/sql/log.h 2011-04-10 12:24:34.000000000 +0400 +@@ -437,7 +437,8 @@ bool write(THD *thd, IO_CACHE *cache, Log_event *commit_event, bool incident); bool write_incident(THD *thd, bool lock); @@ -479,7 +479,7 @@ diff -ruN a/sql/log.h b/sql/log.h void set_write_error(THD *thd, bool is_transactional); bool check_write_error(THD *thd); -@@ -566,6 +567,7 @@ +@@ -589,6 +590,7 @@ const char *sql_text, uint sql_text_len, CHARSET_INFO *client_cs); void flush(); @@ -488,9 +488,9 @@ diff -ruN a/sql/log.h b/sql/log.h MYSQL_QUERY_LOG *get_mysql_slow_log() { return &mysql_slow_log; } MYSQL_QUERY_LOG *get_mysql_log() { return &mysql_log; } diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc ---- a/sql/mysqld.cc 2010-12-03 20:58:26.000000000 +0300 -+++ b/sql/mysqld.cc 2010-12-30 02:04:50.000000000 +0300 -@@ -439,6 +439,7 @@ +--- a/sql/mysqld.cc 2011-04-10 12:23:56.000000000 +0400 ++++ b/sql/mysqld.cc 2011-04-10 12:24:34.000000000 +0400 +@@ -440,6 +440,7 @@ uint opt_debug_sync_timeout= 0; #endif /* defined(ENABLED_DEBUG_SYNC) */ my_bool opt_old_style_user_limits= 0, trust_function_creators= 0; @@ -498,7 +498,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc my_bool opt_optimizer_fix= 0; /* True if there is at least one per-hour limit for some user, so we should -@@ -490,6 +491,7 @@ +@@ -491,6 +492,7 @@ ulong binlog_cache_use= 0, binlog_cache_disk_use= 0; ulong binlog_stmt_cache_use= 0, binlog_stmt_cache_disk_use= 0; ulong max_connections, max_connect_errors; @@ -506,7 +506,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc /* flashcache */ int cachedev_fd; -@@ -634,7 +636,9 @@ +@@ -640,7 +642,9 @@ LOCK_crypt, LOCK_global_system_variables, LOCK_user_conn, LOCK_slave_list, LOCK_active_mi, @@ -517,7 +517,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc /** The below lock protects access to two global server variables: max_prepared_stmt_count and prepared_stmt_count. These variables -@@ -1494,6 +1498,11 @@ +@@ -1503,6 +1507,11 @@ #ifdef HAVE_RESPONSE_TIME_DISTRIBUTION query_response_time_free(); #endif // HAVE_RESPONSE_TIME_DISTRIBUTION @@ -529,7 +529,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc #ifdef HAVE_REPLICATION end_slave_list(); #endif -@@ -1597,6 +1606,10 @@ +@@ -1606,6 +1615,10 @@ mysql_cond_destroy(&COND_thread_cache); mysql_cond_destroy(&COND_flush_thread_cache); mysql_cond_destroy(&COND_manager); @@ -540,7 +540,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc } #endif /*EMBEDDED_LIBRARY*/ -@@ -3033,6 +3046,7 @@ +@@ -3042,6 +3055,7 @@ {"show_binlog_events", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_BINLOG_EVENTS]), SHOW_LONG_STATUS}, {"show_binlogs", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_BINLOGS]), SHOW_LONG_STATUS}, {"show_charsets", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_CHARSETS]), SHOW_LONG_STATUS}, @@ -548,15 +548,15 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc {"show_collations", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_COLLATIONS]), SHOW_LONG_STATUS}, {"show_contributors", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_CONTRIBUTORS]), SHOW_LONG_STATUS}, {"show_create_db", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_CREATE_DB]), SHOW_LONG_STATUS}, -@@ -3053,6 +3067,7 @@ +@@ -3062,6 +3076,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_index_statistics",(char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_INDEX_STATS]), 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}, -@@ -3072,10 +3087,13 @@ + {"show_open_tables", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_OPEN_TABLES]), SHOW_LONG_STATUS}, +@@ -3080,10 +3095,13 @@ {"show_slave_status_nolock", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_SLAVE_NOLOCK_STAT]), SHOW_LONG_STATUS}, {"show_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_STATUS]), SHOW_LONG_STATUS}, {"show_storage_engines", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_STORAGE_ENGINES]), SHOW_LONG_STATUS}, @@ -570,7 +570,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc {"show_variables", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_VARIABLES]), SHOW_LONG_STATUS}, {"show_warnings", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_WARNS]), SHOW_LONG_STATUS}, {"slave_start", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SLAVE_START]), SHOW_LONG_STATUS}, -@@ -3601,6 +3619,13 @@ +@@ -3621,6 +3639,13 @@ mysql_mutex_init(key_LOCK_server_started, &LOCK_server_started, MY_MUTEX_INIT_FAST); mysql_cond_init(key_COND_server_started, &COND_server_started, NULL); @@ -584,7 +584,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc sp_cache_init(); #ifdef HAVE_EVENT_SCHEDULER Events::init_mutexes(); -@@ -3970,6 +3995,9 @@ +@@ -3990,6 +4015,9 @@ query_response_time_init(); #endif // HAVE_RESPONSE_TIME_DISTRIBUTION /* We have to initialize the storage engines before CSV logging */ @@ -594,7 +594,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc if (ha_init()) { sql_print_error("Can't init databases"); -@@ -4106,6 +4134,9 @@ +@@ -4126,6 +4154,9 @@ init_max_user_conn(); init_update_queries(); @@ -604,7 +604,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc DBUG_RETURN(0); } -@@ -5139,6 +5170,7 @@ +@@ -5172,6 +5203,7 @@ { sql_print_warning("%s", ER_DEFAULT(ER_CON_COUNT_ERROR)); } @@ -612,7 +612,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc delete thd; DBUG_VOID_RETURN; } -@@ -7834,6 +7866,8 @@ +@@ -7878,6 +7910,8 @@ key_delayed_insert_mutex, key_hash_filo_lock, key_LOCK_active_mi, key_LOCK_connection_count, key_LOCK_crypt, key_LOCK_delayed_create, key_LOCK_delayed_insert, key_LOCK_delayed_status, key_LOCK_error_log, @@ -621,7 +621,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc key_LOCK_gdl, key_LOCK_global_system_variables, key_LOCK_manager, key_LOCK_prepared_stmt_count, -@@ -7871,6 +7905,13 @@ +@@ -7917,6 +7951,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}, @@ -636,8 +636,8 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc { &key_LOCK_global_system_variables, "LOCK_global_system_variables", PSI_FLAG_GLOBAL}, { &key_LOCK_manager, "LOCK_manager", PSI_FLAG_GLOBAL}, diff -ruN a/sql/mysqld.h b/sql/mysqld.h ---- a/sql/mysqld.h 2010-12-03 20:58:26.000000000 +0300 -+++ b/sql/mysqld.h 2010-12-31 06:04:59.000000000 +0300 +--- a/sql/mysqld.h 2011-04-10 12:23:56.000000000 +0400 ++++ b/sql/mysqld.h 2011-04-10 12:24:34.000000000 +0400 @@ -23,6 +23,7 @@ #include "my_atomic.h" /* my_atomic_rwlock_t */ #include "mysql/psi/mysql_file.h" /* MYSQL_FILE */ @@ -654,7 +654,7 @@ diff -ruN a/sql/mysqld.h b/sql/mysqld.h 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; -@@ -181,6 +183,7 @@ +@@ -182,6 +184,7 @@ extern ulong slave_trans_retries; extern uint slave_net_timeout; extern uint max_user_connections; @@ -662,7 +662,7 @@ diff -ruN a/sql/mysqld.h b/sql/mysqld.h extern ulong what_to_log,flush_time; extern ulong max_prepared_stmt_count, prepared_stmt_count; extern ulong open_files_limit; -@@ -207,6 +210,11 @@ +@@ -208,6 +211,11 @@ extern struct system_variables max_system_variables; extern struct system_status_var global_status_var; extern struct rand_struct sql_rand; @@ -674,7 +674,7 @@ diff -ruN a/sql/mysqld.h b/sql/mysqld.h extern const char *opt_date_time_formats[]; extern handlerton *partition_hton; extern handlerton *myisam_hton; -@@ -244,6 +252,8 @@ +@@ -245,6 +253,8 @@ key_delayed_insert_mutex, key_hash_filo_lock, key_LOCK_active_mi, key_LOCK_connection_count, key_LOCK_crypt, key_LOCK_delayed_create, key_LOCK_delayed_insert, key_LOCK_delayed_status, key_LOCK_error_log, @@ -683,7 +683,7 @@ diff -ruN a/sql/mysqld.h b/sql/mysqld.h key_LOCK_gdl, key_LOCK_global_system_variables, key_LOCK_logger, key_LOCK_manager, key_LOCK_prepared_stmt_count, -@@ -340,7 +350,9 @@ +@@ -344,7 +354,9 @@ LOCK_delayed_status, LOCK_delayed_create, LOCK_crypt, LOCK_timezone, LOCK_slave_list, LOCK_active_mi, LOCK_manager, LOCK_global_system_variables, LOCK_user_conn, @@ -694,7 +694,7 @@ diff -ruN a/sql/mysqld.h b/sql/mysqld.h extern MYSQL_PLUGIN_IMPORT mysql_mutex_t LOCK_thread_count; #ifdef HAVE_OPENSSL extern mysql_mutex_t LOCK_des_key_file; -@@ -451,6 +463,16 @@ +@@ -456,6 +468,16 @@ return id; } @@ -712,8 +712,8 @@ diff -ruN a/sql/mysqld.h b/sql/mysqld.h /* TODO: Replace this with an inline function. diff -ruN a/sql/sql_base.cc b/sql/sql_base.cc ---- a/sql/sql_base.cc 2010-12-03 20:58:26.000000000 +0300 -+++ b/sql/sql_base.cc 2010-12-30 02:33:17.000000000 +0300 +--- a/sql/sql_base.cc 2011-04-10 12:16:42.000000000 +0400 ++++ b/sql/sql_base.cc 2011-04-10 12:24:34.000000000 +0400 @@ -1524,6 +1524,11 @@ table->mdl_ticket= NULL; @@ -736,8 +736,8 @@ diff -ruN a/sql/sql_base.cc b/sql/sql_base.cc closefrm(table, 0); if (delete_table) diff -ruN a/sql/sql_class.cc b/sql/sql_class.cc ---- a/sql/sql_class.cc 2010-12-03 20:58:26.000000000 +0300 -+++ b/sql/sql_class.cc 2010-12-30 02:41:40.000000000 +0300 +--- a/sql/sql_class.cc 2011-04-10 12:23:56.000000000 +0400 ++++ b/sql/sql_class.cc 2011-04-10 12:24:34.000000000 +0400 @@ -602,6 +602,13 @@ mysys_var=0; binlog_evt_union.do_union= FALSE; @@ -921,8 +921,8 @@ diff -ruN a/sql/sql_class.cc b/sql/sql_class.cc diff -ruN a/sql/sql_class.h b/sql/sql_class.h ---- a/sql/sql_class.h 2010-12-03 20:58:26.000000000 +0300 -+++ b/sql/sql_class.h 2010-12-31 05:15:57.000000000 +0300 +--- a/sql/sql_class.h 2011-04-10 12:23:56.000000000 +0400 ++++ b/sql/sql_class.h 2011-04-10 12:24:34.000000000 +0400 @@ -1617,6 +1617,8 @@ */ enum enum_server_command command; @@ -1031,8 +1031,8 @@ diff -ruN a/sql/sql_class.h b/sql/sql_class.h /** A short cut for thd->stmt_da->set_ok_status(). */ diff -ruN a/sql/sql_connect.cc b/sql/sql_connect.cc ---- a/sql/sql_connect.cc 2010-12-03 20:58:26.000000000 +0300 -+++ b/sql/sql_connect.cc 2010-12-31 03:53:28.000000000 +0300 +--- a/sql/sql_connect.cc 2011-04-10 12:23:47.000000000 +0400 ++++ b/sql/sql_connect.cc 2011-04-10 12:24:34.000000000 +0400 @@ -55,6 +55,24 @@ #define MIN_HANDSHAKE_SIZE 6 #endif /* HAVE_OPENSSL && !EMBEDDED_LIBRARY */ @@ -1653,7 +1653,7 @@ diff -ruN a/sql/sql_connect.cc b/sql/sql_connect.cc /* The thread may returned back to the pool and assigned to a user that doesn't have a limit. Ensure the user is not using resources -@@ -565,11 +1164,18 @@ +@@ -588,11 +1187,18 @@ my_sleep(1000); /* must wait after eof() */ #endif statistic_increment(aborted_connects,&LOCK_status); @@ -1672,7 +1672,7 @@ diff -ruN a/sql/sql_connect.cc b/sql/sql_connect.cc DBUG_RETURN(0); } -@@ -599,6 +1205,7 @@ +@@ -622,6 +1228,7 @@ if (thd->killed || (net->error && net->vio != 0)) { statistic_increment(aborted_threads,&LOCK_status); @@ -1680,7 +1680,7 @@ diff -ruN a/sql/sql_connect.cc b/sql/sql_connect.cc } if (net->error && net->vio != 0) -@@ -729,12 +1336,16 @@ +@@ -752,12 +1359,16 @@ { NET *net= &thd->net; bool rc; @@ -1697,7 +1697,7 @@ diff -ruN a/sql/sql_connect.cc b/sql/sql_connect.cc MYSQL_CONNECTION_START(thd->thread_id, &thd->security_ctx->priv_user[0], (char *) thd->security_ctx->host_or_ip); -@@ -761,6 +1372,8 @@ +@@ -784,6 +1395,8 @@ end_thread: close_connection(thd); @@ -1707,8 +1707,8 @@ diff -ruN a/sql/sql_connect.cc b/sql/sql_connect.cc return; // Probably no-threads diff -ruN a/sql/sql_delete.cc b/sql/sql_delete.cc ---- a/sql/sql_delete.cc 2010-12-03 20:58:26.000000000 +0300 -+++ b/sql/sql_delete.cc 2010-12-31 03:58:22.000000000 +0300 +--- a/sql/sql_delete.cc 2011-04-10 12:16:42.000000000 +0400 ++++ b/sql/sql_delete.cc 2011-04-10 12:24:34.000000000 +0400 @@ -411,6 +411,7 @@ my_ok(thd, deleted); DBUG_PRINT("info",("%ld records deleted",(long) deleted)); @@ -1726,8 +1726,8 @@ diff -ruN a/sql/sql_delete.cc b/sql/sql_delete.cc } 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 +--- a/sql/sql_insert.cc 2011-04-10 12:16:42.000000000 +0400 ++++ b/sql/sql_insert.cc 2011-04-10 12:24:34.000000000 +0400 @@ -1069,13 +1069,14 @@ if (error) @@ -1767,12 +1767,12 @@ diff -ruN a/sql/sql_insert.cc b/sql/sql_insert.cc } diff -ruN a/sql/sql_lex.h b/sql/sql_lex.h ---- a/sql/sql_lex.h 2010-12-03 20:58:26.000000000 +0300 -+++ b/sql/sql_lex.h 2010-12-31 05:07:18.000000000 +0300 -@@ -196,6 +196,9 @@ - When a command is added here, be sure it's also added in mysqld.cc +--- a/sql/sql_lex.h 2011-04-10 12:23:55.000000000 +0400 ++++ b/sql/sql_lex.h 2011-04-10 12:25:07.000000000 +0400 +@@ -197,6 +197,9 @@ in "struct show_var_st status_vars[]= {" ... */ + SQLCOM_SHOW_TEMPORARY_TABLES, + // TODO(mcallaghan): update status_vars in mysqld to export these + SQLCOM_SHOW_USER_STATS, SQLCOM_SHOW_TABLE_STATS, SQLCOM_SHOW_INDEX_STATS, + SQLCOM_SHOW_CLIENT_STATS, SQLCOM_SHOW_THREAD_STATS, @@ -1780,8 +1780,8 @@ diff -ruN a/sql/sql_lex.h b/sql/sql_lex.h SQLCOM_END }; diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc ---- a/sql/sql_parse.cc 2010-12-03 20:58:26.000000000 +0300 -+++ b/sql/sql_parse.cc 2010-12-31 04:57:45.000000000 +0300 +--- a/sql/sql_parse.cc 2011-04-10 12:23:55.000000000 +0400 ++++ b/sql/sql_parse.cc 2011-04-10 12:24:34.000000000 +0400 @@ -116,6 +116,9 @@ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables); static void sql_kill(THD *thd, ulong id, bool only_kill_query); @@ -1792,7 +1792,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc const char *any_db="*any*"; // Special symbol for check_access const LEX_STRING command_name[]={ -@@ -701,6 +704,12 @@ +@@ -700,6 +703,12 @@ */ thd->clear_error(); // Clear error message thd->stmt_da->reset_diagnostics_area(); @@ -1805,7 +1805,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc net_new_transaction(net); -@@ -886,6 +895,10 @@ +@@ -885,6 +894,10 @@ (char *) thd->security_ctx->host_or_ip); thd->command=command; @@ -1816,7 +1816,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc /* Commands which always take a long time are logged into the slow log only if opt_log_slow_admin_statements is set. -@@ -1626,6 +1639,13 @@ +@@ -1663,6 +1676,13 @@ thd->profiling.discard_current_query(); #endif break; @@ -1830,7 +1830,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc case SCH_OPEN_TABLES: case SCH_VARIABLES: case SCH_STATUS: -@@ -1783,6 +1803,7 @@ +@@ -1820,6 +1840,7 @@ thd->security_ctx->priv_host)) && check_global_access(thd, SUPER_ACL)) { @@ -1838,7 +1838,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), "SUPER"); DBUG_RETURN(TRUE); } -@@ -4725,6 +4746,7 @@ +@@ -4753,6 +4774,7 @@ case ACL_INTERNAL_ACCESS_DENIED: if (! no_errors) { @@ -1846,7 +1846,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc my_error(ER_DBACCESS_DENIED_ERROR, MYF(0), sctx->priv_user, sctx->priv_host, db); } -@@ -4775,6 +4797,7 @@ +@@ -4803,6 +4825,7 @@ DBUG_PRINT("error",("No possible access")); if (!no_errors) { @@ -1854,7 +1854,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc if (thd->password == 2) my_error(ER_ACCESS_DENIED_NO_PASSWORD_ERROR, MYF(0), sctx->priv_user, -@@ -4891,6 +4914,7 @@ +@@ -4919,6 +4942,7 @@ if (!thd->col_access && check_grant_db(thd, dst_db_name)) { @@ -1862,7 +1862,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc my_error(ER_DBACCESS_DENIED_ERROR, MYF(0), thd->security_ctx->priv_user, thd->security_ctx->priv_host, -@@ -5161,6 +5185,7 @@ +@@ -5189,6 +5213,7 @@ if ((thd->security_ctx->master_access & want_access)) return 0; get_privilege_desc(command, sizeof(command), want_access); @@ -1870,7 +1870,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), command); return 1; #else -@@ -5542,6 +5567,32 @@ +@@ -5570,6 +5595,32 @@ lex_start(thd); mysql_reset_thd_for_next_command(thd); @@ -1903,7 +1903,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc if (query_cache_send_result_to_client(thd, rawbuf, length) <= 0) { LEX *lex= thd->lex; -@@ -5610,6 +5661,52 @@ +@@ -5638,6 +5689,52 @@ DBUG_ASSERT(thd->change_list.is_empty()); } @@ -1957,8 +1957,8 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc } diff -ruN a/sql/sql_prepare.cc b/sql/sql_prepare.cc ---- a/sql/sql_prepare.cc 2010-12-03 20:58:26.000000000 +0300 -+++ b/sql/sql_prepare.cc 2010-12-31 04:25:04.000000000 +0300 +--- a/sql/sql_prepare.cc 2011-04-10 12:16:42.000000000 +0400 ++++ b/sql/sql_prepare.cc 2011-04-10 12:24:34.000000000 +0400 @@ -114,6 +114,9 @@ #endif #include "lock.h" // MYSQL_OPEN_FORCE_SHARED_MDL @@ -2361,9 +2361,9 @@ diff -ruN a/sql/sql_prepare.cc b/sql/sql_prepare.cc } 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 -@@ -280,14 +280,48 @@ +--- a/sql/sql_reload.cc 2011-04-10 12:23:52.000000000 +0400 ++++ b/sql/sql_reload.cc 2011-04-10 12:24:34.000000000 +0400 +@@ -294,14 +294,48 @@ mysql_mutex_unlock(&LOCK_active_mi); } #endif @@ -2415,8 +2415,8 @@ diff -ruN a/sql/sql_reload.cc b/sql/sql_reload.cc *write_to_binlog= tmp_write_to_binlog; /* 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 +--- a/sql/sql_show.cc 2011-04-10 12:23:52.000000000 +0400 ++++ b/sql/sql_show.cc 2011-04-10 12:24:34.000000000 +0400 @@ -114,6 +114,43 @@ static COND * make_cond_for_info_schema(COND *cond, TABLE_LIST *table); @@ -2899,8 +2899,8 @@ diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc make_old_format, 0, 0, -1, 1, 0}, {"VIEWS", view_fields_info, create_schema_table, 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 +--- a/sql/sql_update.cc 2011-04-10 12:16:42.000000000 +0400 ++++ b/sql/sql_update.cc 2011-04-10 12:24:34.000000000 +0400 @@ -900,8 +900,10 @@ my_snprintf(buff, sizeof(buff), ER(ER_UPDATE_INFO), (ulong) found, (ulong) updated, @@ -2914,7 +2914,7 @@ diff -ruN a/sql/sql_update.cc b/sql/sql_update.cc DBUG_PRINT("info",("%ld records updated", (long) updated)); } thd->count_cuted_fields= CHECK_FIELD_IGNORE; /* calc cuted fields */ -@@ -2146,7 +2148,9 @@ +@@ -2242,7 +2244,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); @@ -2927,8 +2927,8 @@ diff -ruN a/sql/sql_update.cc b/sql/sql_update.cc DBUG_RETURN(FALSE); } diff -ruN a/sql/sql_yacc.yy b/sql/sql_yacc.yy ---- a/sql/sql_yacc.yy 2010-12-03 20:58:26.000000000 +0300 -+++ b/sql/sql_yacc.yy 2010-12-31 05:06:16.000000000 +0300 +--- a/sql/sql_yacc.yy 2011-04-10 12:23:55.000000000 +0400 ++++ b/sql/sql_yacc.yy 2011-04-10 12:24:34.000000000 +0400 @@ -864,6 +864,7 @@ %token CIPHER_SYM %token CLASS_ORIGIN_SYM /* SQL-2003-N */ @@ -2969,7 +2969,7 @@ diff -ruN a/sql/sql_yacc.yy b/sql/sql_yacc.yy %token USE_FRM %token USE_SYM %token USING /* SQL-2003-R */ -@@ -11109,6 +11114,41 @@ +@@ -11096,6 +11101,41 @@ MYSQL_YYABORT; #endif // HAVE_RESPONSE_TIME_DISTRIBUTION } @@ -3011,7 +3011,7 @@ diff -ruN a/sql/sql_yacc.yy b/sql/sql_yacc.yy | CREATE PROCEDURE_SYM sp_name { LEX *lex= Lex; -@@ -11351,6 +11391,16 @@ +@@ -11338,6 +11378,16 @@ Lex->type|= REFRESH_QUERY_RESPONSE_TIME; #endif // HAVE_RESPONSE_TIME_DISTRIBUTION } @@ -3028,7 +3028,7 @@ diff -ruN a/sql/sql_yacc.yy b/sql/sql_yacc.yy | MASTER_SYM { Lex->type|= REFRESH_MASTER; } | DES_KEY_FILE -@@ -12473,6 +12523,7 @@ +@@ -12460,6 +12510,7 @@ | CHAIN_SYM {} | CHANGED {} | CIPHER_SYM {} @@ -3036,7 +3036,7 @@ diff -ruN a/sql/sql_yacc.yy b/sql/sql_yacc.yy | CLIENT_SYM {} | CLASS_ORIGIN_SYM {} | COALESCE {} -@@ -12541,6 +12592,7 @@ +@@ -12528,6 +12579,7 @@ | HOSTS_SYM {} | HOUR_SYM {} | IDENTIFIED_SYM {} @@ -3044,7 +3044,7 @@ diff -ruN a/sql/sql_yacc.yy b/sql/sql_yacc.yy | IGNORE_SERVER_IDS_SYM {} | INVOKER_SYM {} | IMPORT {} -@@ -12692,6 +12744,7 @@ +@@ -12679,6 +12731,7 @@ | SUSPEND_SYM {} | SWAPS_SYM {} | SWITCHES_SYM {} @@ -3052,7 +3052,7 @@ diff -ruN a/sql/sql_yacc.yy b/sql/sql_yacc.yy | TABLE_NAME_SYM {} | TABLES {} | TABLE_CHECKSUM_SYM {} -@@ -12717,6 +12770,7 @@ +@@ -12704,6 +12757,7 @@ | UNKNOWN_SYM {} | UNTIL_SYM {} | USER {} @@ -3061,8 +3061,8 @@ diff -ruN a/sql/sql_yacc.yy b/sql/sql_yacc.yy | VARIABLES {} | VIEW_SYM {} diff -ruN a/sql/structs.h b/sql/structs.h ---- a/sql/structs.h 2010-12-03 20:58:26.000000000 +0300 -+++ b/sql/structs.h 2010-12-31 05:12:04.000000000 +0300 +--- a/sql/structs.h 2011-04-10 12:16:42.000000000 +0400 ++++ b/sql/structs.h 2011-04-10 12:24:34.000000000 +0400 @@ -25,6 +25,7 @@ #include "my_time.h" /* enum_mysql_timestamp_type */ #include "thr_lock.h" /* thr_lock_type */ @@ -3244,9 +3244,9 @@ diff -ruN a/sql/structs.h b/sql/structs.h #define REG_MAKE_DUPP 1 /* Make a copy of record when read */ #define REG_NEW_RECORD 2 /* Write a new record if not found */ 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 -@@ -1563,6 +1563,17 @@ +--- a/sql/sys_vars.cc 2011-04-10 12:23:56.000000000 +0400 ++++ b/sql/sys_vars.cc 2011-04-10 12:24:34.000000000 +0400 +@@ -1573,6 +1573,17 @@ NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_read_only), ON_UPDATE(fix_read_only)); @@ -3265,8 +3265,8 @@ diff -ruN a/sql/sys_vars.cc b/sql/sys_vars.cc static Sys_var_ulong Sys_read_rnd_buff_size( "read_rnd_buffer_size", 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 +--- a/storage/myisam/ha_myisam.cc 2011-04-10 12:16:42.000000000 +0400 ++++ b/storage/myisam/ha_myisam.cc 2011-04-10 12:24:34.000000000 +0400 @@ -768,6 +768,7 @@ int ha_myisam::write_row(uchar *buf) -- 2.44.0