From: Elan Ruusamäe Date: Thu, 10 Mar 2011 18:02:59 +0000 (+0000) Subject: - update percona patches (mysql_dump_ignore_ct.patch needs updating) X-Git-Tag: auto/th/mysql-5_5_9-6~1 X-Git-Url: http://git.pld-linux.org/?a=commitdiff_plain;h=a9ee80b9809796bc6dee209fff0dae00e9fe760b;p=packages%2Fmysql.git - update percona patches (mysql_dump_ignore_ct.patch needs updating) Changed files: innodb_adaptive_hash_index_partitions.patch -> 1.3 innodb_buffer_pool_pages_i_s.patch -> 1.3 innodb_buffer_pool_shm.patch -> 1.3 innodb_deadlock_count.patch -> 1.3 innodb_expand_import.patch -> 1.3 innodb_fast_checksum.patch -> 1.3 innodb_files_extend.patch -> 1.3 innodb_fix_misc.patch -> 1.3 innodb_lru_dump_restore.patch -> 1.3 innodb_overwrite_relay_log_info.patch -> 1.3 innodb_pass_corrupt_table.patch -> 1.3 innodb_recovery_patches.patch -> 1.3 innodb_separate_doublewrite.patch -> 1.3 innodb_show_status_extend.patch -> 1.3 innodb_stats.patch -> 1.3 log_warnings_suppress.patch -> 1.1 mysql.spec -> 1.537 percona.sh -> 1.13 query_cache_enhance.patch -> 1.3 remove_fcntl_excessive_calls.patch -> 1.3 slow_extended.patch -> 1.3 userstat.patch -> 1.3 --- diff --git a/innodb_adaptive_hash_index_partitions.patch b/innodb_adaptive_hash_index_partitions.patch index 9434353..67cc640 100644 --- a/innodb_adaptive_hash_index_partitions.patch +++ b/innodb_adaptive_hash_index_partitions.patch @@ -1017,7 +1017,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c --- a/storage/innobase/buf/buf0lru.c 2010-12-04 15:35:29.137347521 +0900 +++ b/storage/innobase/buf/buf0lru.c 2010-12-04 16:12:48.658550840 +0900 -@@ -1775,7 +1775,7 @@ +@@ -1810,7 +1810,7 @@ UNIV_MEM_VALID(((buf_block_t*) bpage)->frame, UNIV_PAGE_SIZE); @@ -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 " -@@ -11964,6 +11969,7 @@ +@@ -11981,6 +11986,7 @@ MYSQL_SYSVAR(use_sys_stats_table), MYSQL_SYSVAR(stats_sample_pages), MYSQL_SYSVAR(adaptive_hash_index), @@ -1262,7 +1262,7 @@ diff -ruN a/storage/innobase/include/btr0sea.ic b/storage/innobase/include/btr0s diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h --- a/storage/innobase/include/buf0buf.h 2010-12-15 19:00:07.713604580 +0900 +++ b/storage/innobase/include/buf0buf.h 2010-12-15 20:58:03.546839883 +0900 -@@ -1544,7 +1544,7 @@ +@@ -1545,7 +1545,7 @@ pointers in the adaptive hash index pointing to this frame */ #endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */ @@ -1271,7 +1271,7 @@ diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0bu already been built on this page; note that it does not guarantee that the index is -@@ -1558,6 +1558,7 @@ +@@ -1559,6 +1559,7 @@ unsigned curr_left_side:1;/*!< TRUE or FALSE in hash indexing */ dict_index_t* index; /*!< Index for which the adaptive hash index has been created. */ @@ -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 -@@ -2042,7 +2042,9 @@ +@@ -2044,7 +2044,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", -@@ -2067,14 +2069,15 @@ +@@ -2069,14 +2071,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) { -@@ -2101,10 +2104,10 @@ +@@ -2103,10 +2106,10 @@ " Threads %lu \t(%lu + %lu)\n", (ulong) (btr_search_sys @@ -1516,15 +1516,15 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c diff -ruN a/storage/innobase/sync/sync0sync.c b/storage/innobase/sync/sync0sync.c --- a/storage/innobase/sync/sync0sync.c 2010-12-03 17:36:44.300986571 +0900 +++ b/storage/innobase/sync/sync0sync.c 2010-12-04 16:12:48.729513564 +0900 -@@ -1183,7 +1183,6 @@ - case SYNC_ANY_LATCH: +@@ -1184,7 +1184,6 @@ + case SYNC_OUTER_ANY_LATCH: case SYNC_FILE_FORMAT_TAG: case SYNC_DOUBLEWRITE: - case SYNC_SEARCH_SYS: case SYNC_SEARCH_SYS_CONF: case SYNC_TRX_LOCK_HEAP: case SYNC_KERNEL: -@@ -1204,6 +1203,7 @@ +@@ -1205,6 +1204,7 @@ ut_error; } break; diff --git a/innodb_buffer_pool_pages_i_s.patch b/innodb_buffer_pool_pages_i_s.patch index 64385fe..e3fa085 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 -@@ -4515,6 +4515,36 @@ +@@ -4516,6 +4516,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 -@@ -12042,6 +12042,9 @@ +@@ -12060,6 +12060,9 @@ i_s_innodb_sys_stats, i_s_innodb_table_stats, i_s_innodb_index_stats, diff --git a/innodb_buffer_pool_shm.patch b/innodb_buffer_pool_shm.patch index 4097046..8efacad 100644 --- a/innodb_buffer_pool_shm.patch +++ b/innodb_buffer_pool_shm.patch @@ -131,7 +131,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c /********************************************************************//** Allocates a chunk of buffer frames. @return chunk, or NULL on failure */ -@@ -1001,26 +1082,188 @@ +@@ -1001,26 +1082,190 @@ { buf_block_t* block; byte* frame; @@ -139,11 +139,13 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c + ulint zip_hash_mem_size = 0; + hash_table_t* zip_hash_tmp = NULL; ulint i; ++ ulint size_target; + buf_shm_info_t* shm_info = NULL; /* Round down to a multiple of page size, although it already should be. */ mem_size = ut_2pow_round(mem_size, UNIV_PAGE_SIZE); ++ size_target = (mem_size / UNIV_PAGE_SIZE) - 1; + + srv_buffer_pool_shm_is_reused = FALSE; + @@ -320,7 +322,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c /* Align a pointer to the first frame. Note that when os_large_page_size is smaller than UNIV_PAGE_SIZE, -@@ -1028,8 +1271,13 @@ +@@ -1028,8 +1273,13 @@ it is bigger, we may allocate more blocks than requested. */ frame = ut_align(chunk->mem, UNIV_PAGE_SIZE); @@ -334,10 +336,14 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c /* Subtract the space needed for block descriptors. */ { -@@ -1043,6 +1291,98 @@ +@@ -1043,6 +1293,102 @@ chunk->size = size; } ++ if (chunk->size > size_target) { ++ chunk->size = size_target; ++ } ++ + if (shm_info && !(shm_info->is_new)) { + /* convert the shared memory segment for reuse */ + ptrdiff_t phys_offset; @@ -433,7 +439,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c /* Init block structs and assign frames for them. Then we assign the frames to the first blocks (we already mapped the memory above). */ -@@ -1068,6 +1408,11 @@ +@@ -1068,6 +1414,11 @@ block++; frame += UNIV_PAGE_SIZE; } @@ -445,7 +451,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c #ifdef PFS_GROUP_BUFFER_SYNC pfs_register_buffer_block(chunk); -@@ -1249,6 +1594,8 @@ +@@ -1249,6 +1600,8 @@ UNIV_MEM_UNDESC(block); } @@ -454,7 +460,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c os_mem_free_large(chunk->mem, chunk->mem_size); } -@@ -1289,7 +1636,7 @@ +@@ -1289,7 +1642,7 @@ ulint instance_no) /*!< in: id of the instance */ { ulint i; @@ -463,7 +469,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c /* 1. Initialize general fields ------------------------------- */ -@@ -1335,7 +1682,10 @@ +@@ -1335,7 +1688,10 @@ buf_pool->curr_pool_size = buf_pool->curr_size * UNIV_PAGE_SIZE; buf_pool->page_hash = hash_create(2 * buf_pool->curr_size); @@ -474,7 +480,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c buf_pool->last_printout_time = ut_time(); } -@@ -1354,6 +1704,86 @@ +@@ -1354,6 +1710,86 @@ /* All fields are initialized by mem_zalloc(). */ @@ -561,7 +567,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c mutex_exit(&buf_pool->LRU_list_mutex); rw_lock_x_unlock(&buf_pool->page_hash_latch); buf_pool_mutex_exit(buf_pool); -@@ -1373,6 +1803,42 @@ +@@ -1373,6 +1809,42 @@ buf_chunk_t* chunk; buf_chunk_t* chunks; @@ -604,7 +610,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c chunks = buf_pool->chunks; chunk = chunks + buf_pool->n_chunks; -@@ -1381,10 +1847,13 @@ +@@ -1381,10 +1853,13 @@ would fail at shutdown. */ os_mem_free_large(chunk->mem, chunk->mem_size); } @@ -618,7 +624,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c } /********************************************************************//** -@@ -1668,6 +2137,11 @@ +@@ -1668,6 +2143,11 @@ //buf_pool_mutex_enter(buf_pool); mutex_enter(&buf_pool->LRU_list_mutex); @@ -630,7 +636,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c shrink_again: if (buf_pool->n_chunks <= 1) { -@@ -1848,7 +2322,7 @@ +@@ -1848,7 +2328,7 @@ zip_hash = hash_create(2 * buf_pool->curr_size); HASH_MIGRATE(buf_pool->zip_hash, zip_hash, buf_page_t, hash, @@ -639,7 +645,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c hash_table_free(buf_pool->zip_hash); buf_pool->zip_hash = zip_hash; -@@ -2130,6 +2604,11 @@ +@@ -2130,6 +2610,11 @@ ulint change_size; ulint min_change_size = 1048576 * srv_buf_pool_instances; @@ -776,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.", -@@ -11922,6 +11942,8 @@ +@@ -11939,6 +11959,8 @@ MYSQL_SYSVAR(autoextend_increment), MYSQL_SYSVAR(buffer_pool_size), MYSQL_SYSVAR(buffer_pool_instances), @@ -796,7 +802,7 @@ diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0bu /** @name Modes for buf_page_get_gen */ /* @{ */ -@@ -1591,9 +1592,12 @@ +@@ -1592,9 +1593,12 @@ /**********************************************************************//** Compute the hash fold value for blocks in buf_pool->zip_hash. */ /* @{ */ diff --git a/innodb_deadlock_count.patch b/innodb_deadlock_count.patch index ff8f579..6a88649 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 -@@ -758,6 +758,7 @@ +@@ -760,6 +760,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 -@@ -467,6 +467,7 @@ +@@ -469,6 +469,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; -@@ -2285,6 +2286,7 @@ +@@ -2287,6 +2288,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_expand_import.patch b/innodb_expand_import.patch index f380182..2d7a12c 100644 --- a/innodb_expand_import.patch +++ b/innodb_expand_import.patch @@ -241,7 +241,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c + file_is_corrupt = TRUE; + descr_is_corrupt = TRUE; + } else { -+ ut_a(fil_page_get_type(page) == FIL_PAGE_TYPE_XDES); ++ ut_ad(fil_page_get_type(page) == FIL_PAGE_TYPE_XDES); + descr_is_corrupt = FALSE; + } + @@ -519,7 +519,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ "Choose method of innodb_adaptive_flushing. (native, [estimate], keep_average)", NULL, innodb_adaptive_flushing_method_update, 1, &adaptive_flushing_method_typelib); -+static MYSQL_SYSVAR_ULONG(expand_import, srv_expand_import, ++static MYSQL_SYSVAR_ULONG(import_table_from_xtrabackup, srv_expand_import, + PLUGIN_VAR_RQCMDARG, + "Enable/Disable converting automatically *.ibd files when import tablespace.", + NULL, NULL, 0, 0, 1, 0); @@ -531,7 +531,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ MYSQL_SYSVAR(flush_neighbor_pages), MYSQL_SYSVAR(read_ahead), MYSQL_SYSVAR(adaptive_flushing_method), -+ MYSQL_SYSVAR(expand_import), ++ MYSQL_SYSVAR(import_table_from_xtrabackup), MYSQL_SYSVAR(extra_rsegments), MYSQL_SYSVAR(dict_size_limit), MYSQL_SYSVAR(use_sys_malloc), diff --git a/innodb_fast_checksum.patch b/innodb_fast_checksum.patch index 5f1a52e..a7b7f76 100644 --- a/innodb_fast_checksum.patch +++ b/innodb_fast_checksum.patch @@ -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.", -@@ -11831,6 +11842,7 @@ +@@ -11842,6 +11853,7 @@ MYSQL_SYSVAR(buffer_pool_size), MYSQL_SYSVAR(buffer_pool_instances), MYSQL_SYSVAR(checksums), diff --git a/innodb_files_extend.patch b/innodb_files_extend.patch index b75018a..d6bbf20 100644 --- a/innodb_files_extend.patch +++ b/innodb_files_extend.patch @@ -217,8 +217,8 @@ 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.", -@@ -11837,6 +11909,8 @@ - NULL, NULL, 0, 0, 1, 0); +@@ -11848,6 +11920,8 @@ + NULL, NULL, 0, &corrupt_table_action_typelib); static struct st_mysql_sys_var* innobase_system_variables[]= { + MYSQL_SYSVAR(page_size), diff --git a/innodb_fix_misc.patch b/innodb_fix_misc.patch index e252ef1..089a0c0 100644 --- a/innodb_fix_misc.patch +++ b/innodb_fix_misc.patch @@ -2,12 +2,106 @@ # introduced : 11 or before # maintainer : Yasufumi # +# Bug fix for +# http://bugs.mysql.com/56433 (always: because good for all users, and safe) +# and http://bugs.mysql.com/51325 (optional: innodb_lazy_drop_table) +# were added. They may be removed in the future when will be fixed officially. +# #!!! 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 @@ + bpage->state = BUF_BLOCK_ZIP_PAGE; + bpage->space = space; + bpage->offset = offset; ++ bpage->space_was_being_deleted = FALSE; + + + #ifdef UNIV_DEBUG +diff -ruN a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c +--- a/storage/innobase/buf/buf0flu.c 2011-02-23 19:00:48.182659256 +0900 ++++ b/storage/innobase/buf/buf0flu.c 2011-02-23 19:01:19.138826278 +0900 +@@ -439,7 +439,7 @@ + + if (UNIV_LIKELY(bpage->in_LRU_list && buf_page_in_file(bpage))) { + +- return(bpage->oldest_modification == 0 ++ return((bpage->oldest_modification == 0 || bpage->space_was_being_deleted) + && buf_page_get_io_fix(bpage) == BUF_IO_NONE + && bpage->buf_fix_count == 0); + } +@@ -481,6 +481,13 @@ + && buf_page_get_io_fix(bpage) == BUF_IO_NONE) { + ut_ad(bpage->in_flush_list); + ++ if (bpage->space_was_being_deleted) { ++ /* should be removed from flush_list here */ ++ /* because buf_flush_try_neighbors() cannot flush without fil_space_get_size(space) */ ++ buf_flush_remove(bpage); ++ return(FALSE); ++ } ++ + if (flush_type != BUF_FLUSH_LRU) { + + return(TRUE); +diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c +--- a/storage/innobase/buf/buf0lru.c 2011-02-23 19:00:47.939695791 +0900 ++++ b/storage/innobase/buf/buf0lru.c 2011-02-23 19:01:19.142741970 +0900 +@@ -554,6 +554,37 @@ + } + } + ++/******************************************************************//** ++*/ ++UNIV_INTERN ++void ++buf_LRU_mark_space_was_deleted( ++/*===========================*/ ++ ulint id) /*!< in: space id */ ++{ ++ ulint i; ++ ++ for (i = 0; i < srv_buf_pool_instances; i++) { ++ buf_pool_t* buf_pool; ++ buf_page_t* bpage; ++ ++ buf_pool = buf_pool_from_array(i); ++ ++ mutex_enter(&buf_pool->LRU_list_mutex); ++ ++ bpage = UT_LIST_GET_FIRST(buf_pool->LRU); ++ ++ while (bpage != NULL) { ++ if (buf_page_get_space(bpage) == id) { ++ bpage->space_was_being_deleted = TRUE; ++ } ++ bpage = UT_LIST_GET_NEXT(LRU, bpage); ++ } ++ ++ mutex_exit(&buf_pool->LRU_list_mutex); ++ } ++} ++ + /********************************************************************//** + Insert a compressed block into buf_pool->zip_clean in the LRU order. */ + UNIV_INTERN +@@ -1568,6 +1599,10 @@ + return(BUF_LRU_NOT_FREED); + } + ++ if (bpage->space_was_being_deleted && bpage->oldest_modification != 0) { ++ buf_flush_remove(bpage); ++ } ++ + #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 @@ -68,10 +162,223 @@ diff -ruN a/storage/innobase/dict/dict0load.c b/storage/innobase/dict/dict0load. 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 +@@ -252,6 +252,7 @@ + struct fil_system_struct { + #ifndef UNIV_HOTBACKUP + mutex_t mutex; /*!< The mutex protecting the cache */ ++ mutex_t file_extend_mutex; + #endif /* !UNIV_HOTBACKUP */ + hash_table_t* spaces; /*!< The hash table of spaces in the + system; they are hashed on the space +@@ -861,7 +862,7 @@ + ut_ad(node && system); + 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_flushes == 0); + ut_a(node->modification_counter == node->flush_counter); + +@@ -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); + + if (node->open) { + /* We fool the assertion in fil_node_close_file() to think +@@ -1595,6 +1596,8 @@ + + mutex_create(fil_system_mutex_key, + &fil_system->mutex, SYNC_ANY_LATCH); ++ mutex_create(fil_system_mutex_key, ++ &fil_system->file_extend_mutex, SYNC_OUTER_ANY_LATCH); + + fil_system->spaces = hash_create(hash_size); + fil_system->name_hash = hash_create(hash_size); +@@ -2341,7 +2344,11 @@ + completely and permanently. The flag is_being_deleted also prevents + fil_flush() from being applied to this tablespace. */ + ++ if (srv_lazy_drop_table) { ++ buf_LRU_mark_space_was_deleted(id); ++ } else { + buf_LRU_invalidate_tablespace(id); ++ } + #endif + /* printf("Deleting tablespace %s id %lu\n", space->name, id); */ + +@@ -4400,6 +4407,10 @@ + ulint page_size; + ibool success = TRUE; + ++ /* file_extend_mutex is for http://bugs.mysql.com/56433 */ ++ /* to protect from the other fil_extend_space_to_desired_size() */ ++ /* during temprary releasing &fil_system->mutex */ ++ mutex_enter(&fil_system->file_extend_mutex); + fil_mutex_enter_and_prepare_for_io(space_id); + + space = fil_space_get_by_id(space_id); +@@ -4411,6 +4422,7 @@ + *actual_size = space->size; + + mutex_exit(&fil_system->mutex); ++ mutex_exit(&fil_system->file_extend_mutex); + + return(TRUE); + } +@@ -4443,6 +4455,8 @@ + offset_low = ((start_page_no - file_start_page_no) + % (4096 * ((1024 * 1024) / page_size))) + * page_size; ++ ++ mutex_exit(&fil_system->mutex); + #ifdef UNIV_HOTBACKUP + success = os_file_write(node->name, node->handle, buf, + offset_low, offset_high, +@@ -4452,8 +4466,10 @@ + node->name, node->handle, buf, + offset_low, offset_high, + page_size * n_pages, +- NULL, NULL, NULL); ++ NULL, NULL, space_id, NULL); + #endif ++ mutex_enter(&fil_system->mutex); ++ + if (success) { + node->size += n_pages; + space->size += n_pages; +@@ -4499,6 +4515,7 @@ + printf("Extended %s to %lu, actual size %lu pages\n", space->name, + size_after_extend, *actual_size); */ + mutex_exit(&fil_system->mutex); ++ mutex_exit(&fil_system->file_extend_mutex); + + fil_flush(space_id); + +@@ -4863,6 +4880,22 @@ + srv_data_written+= len; + } + ++ /* if the table space was already deleted, space might not exist already. */ ++ if (message ++ && space_id < SRV_LOG_SPACE_FIRST_ID ++ && ((buf_page_t*)message)->space_was_being_deleted) { ++ ++ if (mode == OS_AIO_NORMAL) { ++ buf_page_io_complete(message, trx); ++ return(DB_SUCCESS); /*fake*/ ++ } ++ if (type == OS_FILE_READ) { ++ return(DB_TABLESPACE_DELETED); ++ } else { ++ return(DB_SUCCESS); /*fake*/ ++ } ++ } ++ + /* Reserve the fil_system mutex and make sure that we can open at + least one file while holding it, if the file is not already open */ + +@@ -4992,10 +5025,24 @@ + #else + /* Queue the aio request */ + ret = os_aio(type, mode | wake_later, node->name, node->handle, buf, +- offset_low, offset_high, len, node, message, trx); ++ offset_low, offset_high, len, node, message, space_id, trx); + #endif + } /**/ + ++ /* if the table space was already deleted, space might not exist already. */ ++ if (message ++ && space_id < SRV_LOG_SPACE_FIRST_ID ++ && ((buf_page_t*)message)->space_was_being_deleted) { ++ ++ if (mode == OS_AIO_SYNC) { ++ if (type == OS_FILE_READ) { ++ return(DB_TABLESPACE_DELETED); ++ } else { ++ return(DB_SUCCESS); /*fake*/ ++ } ++ } ++ } ++ + ut_a(ret); + + if (mode == OS_AIO_SYNC) { +@@ -5095,6 +5142,7 @@ + fil_node_t* fil_node; + void* message; + ulint type; ++ ulint space_id = 0; + + ut_ad(fil_validate_skip()); + +@@ -5102,10 +5150,10 @@ + srv_set_io_thread_op_info(segment, "native aio handle"); + #ifdef WIN_ASYNC_IO + ret = os_aio_windows_handle(segment, 0, &fil_node, +- &message, &type); ++ &message, &type, &space_id); + #elif defined(LINUX_NATIVE_AIO) + ret = os_aio_linux_handle(segment, &fil_node, +- &message, &type); ++ &message, &type, &space_id); + #else + ret = 0; /* Eliminate compiler warning */ + ut_error; +@@ -5114,7 +5162,22 @@ + srv_set_io_thread_op_info(segment, "simulated aio handle"); + + ret = os_aio_simulated_handle(segment, &fil_node, +- &message, &type); ++ &message, &type, &space_id); ++ } ++ ++ /* if the table space was already deleted, fil_node might not exist already. */ ++ if (message ++ && space_id < SRV_LOG_SPACE_FIRST_ID ++ && ((buf_page_t*)message)->space_was_being_deleted) { ++ ++ /* intended not to be uncompress read page */ ++ ut_a(buf_page_get_io_fix(message) == BUF_IO_WRITE ++ || !buf_page_get_zip_size(message) ++ || buf_page_get_state(message) != BUF_BLOCK_FILE_PAGE); ++ ++ srv_set_io_thread_op_info(segment, "complete io for buf page"); ++ buf_page_io_complete(message, NULL); ++ return; + } + + ut_a(ret); 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 -@@ -12007,7 +12007,7 @@ +@@ -11919,6 +11919,12 @@ + "except for the deletion.", + NULL, NULL, 0, &corrupt_table_action_typelib); + ++static MYSQL_SYSVAR_ULONG(lazy_drop_table, srv_lazy_drop_table, ++ PLUGIN_VAR_RQCMDARG, ++ "At deleting tablespace, only miminum needed processes at the time are done. " ++ "e.g. for http://bugs.mysql.com/51325", ++ NULL, NULL, 0, 0, 1, 0); ++ + static struct st_mysql_sys_var* innobase_system_variables[]= { + MYSQL_SYSVAR(page_size), + MYSQL_SYSVAR(log_block_size), +@@ -12009,6 +12015,7 @@ + MYSQL_SYSVAR(purge_threads), + MYSQL_SYSVAR(purge_batch_size), + MYSQL_SYSVAR(corrupt_table_action), ++ MYSQL_SYSVAR(lazy_drop_table), + NULL + }; + +@@ -12018,7 +12025,7 @@ &innobase_storage_engine, innobase_hton_name, "Innobase Oy", @@ -80,6 +387,161 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ PLUGIN_LICENSE_GPL, innobase_init, /* Plugin Init */ NULL, /* Plugin Deinit */ +diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h +--- a/storage/innobase/include/buf0buf.h 2011-02-23 19:00:48.252696774 +0900 ++++ b/storage/innobase/include/buf0buf.h 2011-02-23 19:01:19.182655902 +0900 +@@ -1437,6 +1437,7 @@ + 0 if the block was never accessed + in the buffer pool */ + /* @} */ ++ ibool space_was_being_deleted; + ibool is_corrupt; + # ifdef UNIV_DEBUG_FILE_ACCESSES + ibool file_page_was_freed; +diff -ruN a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0buf.ic +--- a/storage/innobase/include/buf0buf.ic 2011-02-23 19:00:48.130659154 +0900 ++++ b/storage/innobase/include/buf0buf.ic 2011-02-23 19:01:19.185655906 +0900 +@@ -406,6 +406,7 @@ + buf_block_set_state(block, BUF_BLOCK_FILE_PAGE); + block->page.space = space; + block->page.offset = page_no; ++ block->page.space_was_being_deleted = FALSE; + } + + /*********************************************************************//** +diff -ruN a/storage/innobase/include/buf0lru.h b/storage/innobase/include/buf0lru.h +--- a/storage/innobase/include/buf0lru.h 2011-02-23 19:00:47.977658923 +0900 ++++ b/storage/innobase/include/buf0lru.h 2011-02-23 19:01:19.188625768 +0900 +@@ -85,6 +85,13 @@ + buf_LRU_invalidate_tablespace( + /*==========================*/ + ulint id); /*!< in: space id */ ++/******************************************************************//** ++*/ ++UNIV_INTERN ++void ++buf_LRU_mark_space_was_deleted( ++/*===========================*/ ++ ulint id); /*!< in: space id */ + /********************************************************************//** + Insert a compressed block into buf_pool->zip_clean in the LRU order. */ + UNIV_INTERN +diff -ruN a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h +--- a/storage/innobase/include/os0file.h 2011-02-23 19:00:48.260696646 +0900 ++++ b/storage/innobase/include/os0file.h 2011-02-23 19:01:19.190656054 +0900 +@@ -280,9 +280,9 @@ + pfs_os_file_close_func(file, __FILE__, __LINE__) + + # define os_aio(type, mode, name, file, buf, offset, offset_high, \ +- n, message1, message2, trx) \ ++ n, message1, message2, space_id, trx) \ + pfs_os_aio_func(type, mode, name, file, buf, offset, \ +- offset_high, n, message1, message2, trx, \ ++ offset_high, n, message1, message2, space_id, trx,\ + __FILE__, __LINE__) + + # define os_file_read(file, buf, offset, offset_high, n) \ +@@ -326,9 +326,9 @@ + # define os_file_close(file) os_file_close_func(file) + + # define os_aio(type, mode, name, file, buf, offset, offset_high, \ +- n, message1, message2, trx) \ ++ n, message1, message2, space_id, trx) \ + os_aio_func(type, mode, name, file, buf, offset, offset_high, n,\ +- message1, message2, trx) ++ message1, message2, space_id, trx) + + # define os_file_read(file, buf, offset, offset_high, n) \ + os_file_read_func(file, buf, offset, offset_high, n, NULL) +@@ -757,6 +757,7 @@ + (can be used to identify a completed + aio operation); ignored if mode is + OS_AIO_SYNC */ ++ ulint space_id, + trx_t* trx, + const char* src_file,/*!< in: file name where func invoked */ + ulint src_line);/*!< in: line where the func invoked */ +@@ -1063,6 +1064,7 @@ + (can be used to identify a completed + aio operation); ignored if mode is + OS_AIO_SYNC */ ++ ulint space_id, + trx_t* trx); + /************************************************************************//** + Wakes up all async i/o threads so that they know to exit themselves in +@@ -1123,7 +1125,8 @@ + parameters are valid and can be used to + restart the operation, for example */ + void** message2, +- ulint* type); /*!< out: OS_FILE_WRITE or ..._READ */ ++ ulint* type, /*!< out: OS_FILE_WRITE or ..._READ */ ++ ulint* space_id); + #endif + + /**********************************************************************//** +@@ -1145,7 +1148,8 @@ + parameters are valid and can be used to + restart the operation, for example */ + void** message2, +- ulint* type); /*!< out: OS_FILE_WRITE or ..._READ */ ++ ulint* type, /*!< out: OS_FILE_WRITE or ..._READ */ ++ ulint* space_id); + /**********************************************************************//** + Validates the consistency of the aio system. + @return TRUE if ok */ +@@ -1224,7 +1228,8 @@ + aio operation failed, these output + parameters are valid and can be used to + restart the operation. */ +- ulint* type); /*!< out: OS_FILE_WRITE or ..._READ */ ++ ulint* type, /*!< out: OS_FILE_WRITE or ..._READ */ ++ ulint* space_id); + #endif /* LINUX_NATIVE_AIO */ + + #ifndef UNIV_NONINL +diff -ruN a/storage/innobase/include/os0file.ic b/storage/innobase/include/os0file.ic +--- a/storage/innobase/include/os0file.ic 2011-02-23 19:00:47.915696756 +0900 ++++ b/storage/innobase/include/os0file.ic 2011-02-23 19:01:19.191625891 +0900 +@@ -229,6 +229,7 @@ + (can be used to identify a completed + aio operation); ignored if mode is + OS_AIO_SYNC */ ++ ulint space_id, + trx_t* trx, + const char* src_file,/*!< in: file name where func invoked */ + ulint src_line)/*!< in: line where the func invoked */ +@@ -245,7 +246,7 @@ + src_file, src_line); + + result = os_aio_func(type, mode, name, file, buf, offset, offset_high, +- n, message1, message2, trx); ++ n, message1, message2, space_id, trx); + + register_pfs_file_io_end(locker, n); + +diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h +--- a/storage/innobase/include/srv0srv.h 2011-02-23 19:00:48.212625715 +0900 ++++ b/storage/innobase/include/srv0srv.h 2011-02-23 19:01:19.193655990 +0900 +@@ -247,6 +247,8 @@ + + extern ulint srv_extra_rsegments; + extern ulint srv_dict_size_limit; ++ ++extern ulint srv_lazy_drop_table; + /*-------------------------------------------*/ + + extern ulint srv_n_rows_inserted; +diff -ruN a/storage/innobase/include/sync0sync.h b/storage/innobase/include/sync0sync.h +--- a/storage/innobase/include/sync0sync.h 2011-02-23 19:00:47.875625940 +0900 ++++ b/storage/innobase/include/sync0sync.h 2011-02-23 19:01:19.195703856 +0900 +@@ -683,6 +683,7 @@ + #define SYNC_BUF_POOL 150 /* Buffer pool mutex */ + #define SYNC_BUF_FLUSH_LIST 145 /* Buffer flush list mutex */ + #define SYNC_DOUBLEWRITE 140 ++#define SYNC_OUTER_ANY_LATCH 136 + #define SYNC_ANY_LATCH 135 + #define SYNC_THR_LOCAL 133 + #define SYNC_MEM_HASH 131 diff -ruN a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i --- a/storage/innobase/include/univ.i 2010-12-04 15:57:13.050485224 +0900 +++ b/storage/innobase/include/univ.i 2010-12-04 15:57:53.091592933 +0900 @@ -117,6 +579,106 @@ diff -ruN a/storage/innobase/mtr/mtr0log.c b/storage/innobase/mtr/mtr0log.c recv_sys->found_corrupt_log = TRUE; return(NULL); +diff -ruN a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c +--- a/storage/innobase/os/os0file.c 2011-02-23 19:00:47.928696481 +0900 ++++ b/storage/innobase/os/os0file.c 2011-02-23 19:01:19.200696353 +0900 +@@ -180,6 +180,7 @@ + made and only the slot message + needs to be passed to the caller + of os_aio_simulated_handle */ ++ ulint space_id; + fil_node_t* message1; /*!< message which is given by the */ + void* message2; /*!< the requester of an aio operation + and which can be used to identify +@@ -3675,7 +3676,8 @@ + offset */ + ulint offset_high, /*!< in: most significant 32 bits of + offset */ +- ulint len) /*!< in: length of the block to read or write */ ++ ulint len, /*!< in: length of the block to read or write */ ++ ulint space_id) + { + os_aio_slot_t* slot = NULL; + #ifdef WIN_ASYNC_IO +@@ -3764,6 +3766,7 @@ + slot->offset = offset; + slot->offset_high = offset_high; + slot->io_already_done = FALSE; ++ slot->space_id = space_id; + + #ifdef WIN_ASYNC_IO + control = &(slot->control); +@@ -4051,6 +4054,7 @@ + (can be used to identify a completed + aio operation); ignored if mode is + OS_AIO_SYNC */ ++ ulint space_id, + trx_t* trx) + { + os_aio_array_t* array; +@@ -4137,7 +4141,7 @@ + trx->io_read += n; + } + slot = os_aio_array_reserve_slot(type, array, message1, message2, file, +- name, buf, offset, offset_high, n); ++ name, buf, offset, offset_high, n, space_id); + if (type == OS_FILE_READ) { + if (srv_use_native_aio) { + os_n_file_reads++; +@@ -4256,7 +4260,8 @@ + parameters are valid and can be used to + restart the operation, for example */ + void** message2, +- ulint* type) /*!< out: OS_FILE_WRITE or ..._READ */ ++ ulint* type, /*!< out: OS_FILE_WRITE or ..._READ */ ++ ulint* space_id) + { + ulint orig_seg = segment; + os_aio_array_t* array; +@@ -4329,6 +4334,7 @@ + *message2 = slot->message2; + + *type = slot->type; ++ *space_id = slot->space_id; + + if (ret && len == slot->len) { + ret_val = TRUE; +@@ -4569,7 +4575,8 @@ + aio operation failed, these output + parameters are valid and can be used to + restart the operation. */ +- ulint* type) /*!< out: OS_FILE_WRITE or ..._READ */ ++ ulint* type, /*!< out: OS_FILE_WRITE or ..._READ */ ++ ulint* space_id) + { + ulint segment; + os_aio_array_t* array; +@@ -4627,6 +4634,7 @@ + *message2 = slot->message2; + + *type = slot->type; ++ *space_id = slot->space_id; + + if ((slot->ret == 0) && (slot->n_bytes == (long)slot->len)) { + ret = TRUE; +@@ -4680,7 +4688,8 @@ + parameters are valid and can be used to + restart the operation, for example */ + void** message2, +- ulint* type) /*!< out: OS_FILE_WRITE or ..._READ */ ++ ulint* type, /*!< out: OS_FILE_WRITE or ..._READ */ ++ ulint* space_id) + { + os_aio_array_t* array; + ulint segment; +@@ -4958,6 +4967,7 @@ + *message2 = slot->message2; + + *type = slot->type; ++ *space_id = slot->space_id; + + os_mutex_exit(array->mutex); + diff -ruN a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c --- a/storage/innobase/row/row0mysql.c 2010-12-04 15:37:50.598481116 +0900 +++ b/storage/innobase/row/row0mysql.c 2010-12-04 15:57:53.092563335 +0900 @@ -190,6 +752,18 @@ diff -ruN a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c trx_print(stderr, trx, 600); fputc('\n', stderr); ut_error; +diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c +--- a/storage/innobase/srv/srv0srv.c 2011-02-23 19:00:48.283695497 +0900 ++++ b/storage/innobase/srv/srv0srv.c 2011-02-23 19:01:19.204696643 +0900 +@@ -442,6 +442,8 @@ + + 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; + /*-------------------------------------------*/ + UNIV_INTERN ulong srv_n_spin_wait_rounds = 30; + UNIV_INTERN ulong srv_n_free_tickets_to_enter = 500; 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 @@ -202,6 +776,17 @@ diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c "log sequence number %llu\n", INNODB_VERSION_STR, srv_start_lsn); } +diff -ruN a/storage/innobase/sync/sync0sync.c b/storage/innobase/sync/sync0sync.c +--- a/storage/innobase/sync/sync0sync.c 2011-02-25 14:18:55.817202060 +0900 ++++ b/storage/innobase/sync/sync0sync.c 2011-02-25 14:19:44.596202017 +0900 +@@ -1181,6 +1181,7 @@ + case SYNC_LOG_FLUSH_ORDER: + case SYNC_THR_LOCAL: + case SYNC_ANY_LATCH: ++ case SYNC_OUTER_ANY_LATCH: + case SYNC_FILE_FORMAT_TAG: + case SYNC_DOUBLEWRITE: + case SYNC_SEARCH_SYS: 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 diff --git a/innodb_lru_dump_restore.patch b/innodb_lru_dump_restore.patch index 5348b93..353cc19 100644 --- a/innodb_lru_dump_restore.patch +++ b/innodb_lru_dump_restore.patch @@ -386,7 +386,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ "Limit the allocated memory for dictionary cache. (0: unlimited)", NULL, NULL, 0, 0, LONG_MAX, 0); -+static MYSQL_SYSVAR_UINT(auto_lru_dump, srv_auto_lru_dump, ++static MYSQL_SYSVAR_UINT(buffer_pool_restore_at_startup, srv_auto_lru_dump, + PLUGIN_VAR_RQCMDARG, + "Time in seconds between automatic buffer pool dumps. " + "0 (the default) disables automatic dumps.", @@ -399,7 +399,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ MYSQL_SYSVAR(read_ahead_threshold), MYSQL_SYSVAR(io_capacity), -+ MYSQL_SYSVAR(auto_lru_dump), ++ MYSQL_SYSVAR(buffer_pool_restore_at_startup), MYSQL_SYSVAR(purge_threads), MYSQL_SYSVAR(purge_batch_size), NULL diff --git a/innodb_overwrite_relay_log_info.patch b/innodb_overwrite_relay_log_info.patch index c4a2e99..4fb1820 100644 --- a/innodb_overwrite_relay_log_info.patch +++ b/innodb_overwrite_relay_log_info.patch @@ -253,7 +253,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ "The common part for InnoDB table spaces.", NULL, NULL, NULL); -+static MYSQL_SYSVAR_BOOL(overwrite_relay_log_info, innobase_overwrite_relay_log_info, ++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 " + "to align master log file position if information in InnoDB and relay-log.info is different.", @@ -266,7 +266,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ MYSQL_SYSVAR(old_blocks_pct), MYSQL_SYSVAR(old_blocks_time), MYSQL_SYSVAR(open_files), -+ MYSQL_SYSVAR(overwrite_relay_log_info), ++ MYSQL_SYSVAR(recovery_update_relay_log), MYSQL_SYSVAR(rollback_on_timeout), MYSQL_SYSVAR(stats_on_metadata), MYSQL_SYSVAR(stats_sample_pages), diff --git a/innodb_pass_corrupt_table.patch b/innodb_pass_corrupt_table.patch index bf18308..74867b4 100644 --- a/innodb_pass_corrupt_table.patch +++ b/innodb_pass_corrupt_table.patch @@ -1048,26 +1048,37 @@ 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, -@@ -11720,6 +11817,14 @@ +@@ -11720,6 +11817,25 @@ "0 (the default) disables automatic dumps.", NULL, NULL, 0, 0, UINT_MAX32, 0); -+static MYSQL_SYSVAR_ULONG(pass_corrupt_table, srv_pass_corrupt_table, ++const char *corrupt_table_action_names[]= ++{ ++ "assert", /* 0 */ ++ "warn", /* 1 */ ++ NullS ++}; ++TYPELIB corrupt_table_action_typelib= ++{ ++ array_elements(corrupt_table_action_names) - 1, "corrupt_table_action_typelib", ++ corrupt_table_action_names, NULL ++}; ++static MYSQL_SYSVAR_ENUM(corrupt_table_action, srv_pass_corrupt_table, + PLUGIN_VAR_RQCMDARG, -+ "Pass corruptions of user tables as 'corrupt table' instead of not crashing itself, " ++ "Warn corruptions of user tables as 'corrupt table' instead of not crashing itself, " + "when used with file_per_table. " + "All file io for the datafile after detected as corrupt are disabled, " + "except for the deletion.", -+ NULL, NULL, 0, 0, 1, 0); ++ NULL, NULL, 0, &corrupt_table_action_typelib); + static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(additional_mem_pool_size), MYSQL_SYSVAR(autoextend_increment), -@@ -11806,6 +11911,7 @@ - MYSQL_SYSVAR(auto_lru_dump), +@@ -11806,6 +11922,7 @@ + MYSQL_SYSVAR(buffer_pool_restore_at_startup), MYSQL_SYSVAR(purge_threads), MYSQL_SYSVAR(purge_batch_size), -+ MYSQL_SYSVAR(pass_corrupt_table), ++ MYSQL_SYSVAR(corrupt_table_action), NULL }; diff --git a/innodb_recovery_patches.patch b/innodb_recovery_patches.patch index 847ad8c..f6ac467 100644 --- a/innodb_recovery_patches.patch +++ b/innodb_recovery_patches.patch @@ -135,7 +135,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ + "Output statistics of recovery process after it.", + NULL, NULL, FALSE); + - static MYSQL_SYSVAR_BOOL(overwrite_relay_log_info, innobase_overwrite_relay_log_info, + static MYSQL_SYSVAR_BOOL(recovery_update_relay_log, innobase_overwrite_relay_log_info, PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY, "During InnoDB crash recovery on slave overwrite relay-log.info " @@ -11656,6 +11664,7 @@ diff --git a/innodb_separate_doublewrite.patch b/innodb_separate_doublewrite.patch index 9514cec..7dc779b 100644 --- a/innodb_separate_doublewrite.patch +++ b/innodb_separate_doublewrite.patch @@ -658,7 +658,7 @@ diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c + + if (*create_new_db == FALSE) { + fprintf(stderr, -+ "InnoDB: Warning: Previous version's ibdata files may cause crash.\n" ++ "InnoDB: Notice: Previous version's ibdata files may cause crash.\n" + " If you use that, please use the ibdata files of this version.\n"); + } + diff --git a/innodb_show_status_extend.patch b/innodb_show_status_extend.patch index 1f9f86c..d35813d 100644 --- a/innodb_show_status_extend.patch +++ b/innodb_show_status_extend.patch @@ -130,8 +130,8 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ + (char*) &export_vars.innodb_purge_undo_no, SHOW_LONGLONG}, {"row_lock_current_waits", (char*) &export_vars.innodb_row_lock_current_waits, SHOW_LONG}, -+ {"row_lock_numbers", -+ (char*) &export_vars.innodb_row_lock_numbers, SHOW_LONG}, ++ {"current_row_locks", ++ (char*) &export_vars.innodb_current_row_locks, SHOW_LONG}, {"row_lock_time", (char*) &export_vars.innodb_row_lock_time, SHOW_LONGLONG}, {"row_lock_time_avg", @@ -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 -@@ -735,6 +735,11 @@ +@@ -737,6 +737,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 */ -@@ -752,6 +757,9 @@ +@@ -754,6 +759,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 */ -@@ -760,13 +768,43 @@ +@@ -762,13 +770,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 */ -@@ -775,6 +813,8 @@ +@@ -777,6 +815,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,11 +320,11 @@ 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 -@@ -784,11 +824,18 @@ +@@ -786,11 +826,18 @@ / srv_n_lock_wait_count */ ulint innodb_row_lock_time_max; /*!< srv_n_lock_max_wait_time / 1000 */ -+ ulint innodb_row_lock_numbers; ++ ulint innodb_current_row_locks; ulint innodb_rows_read; /*!< srv_n_rows_read */ ulint innodb_rows_inserted; /*!< srv_n_rows_inserted */ ulint innodb_rows_updated; /*!< srv_n_rows_updated */ @@ -342,7 +342,7 @@ diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0sr diff -ruN a/storage/innobase/include/sync0sync.h b/storage/innobase/include/sync0sync.h --- a/storage/innobase/include/sync0sync.h 2011-01-21 19:48:45.982637372 +0900 +++ b/storage/innobase/include/sync0sync.h 2011-01-21 19:54:44.664638235 +0900 -@@ -760,6 +760,10 @@ +@@ -761,6 +761,10 @@ #define SYNC_SPIN_ROUNDS srv_n_spin_wait_rounds @@ -391,7 +391,7 @@ diff -ruN a/storage/innobase/lock/lock0lock.c b/storage/innobase/lock/lock0lock. diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c --- a/storage/innobase/srv/srv0srv.c 2011-01-21 19:53:42.390637840 +0900 +++ b/storage/innobase/srv/srv0srv.c 2011-01-21 19:54:44.673637084 +0900 -@@ -2261,12 +2261,49 @@ +@@ -2263,12 +2263,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 -@@ -2303,6 +2340,92 @@ +@@ -2305,6 +2342,92 @@ export_vars.innodb_buffer_pool_pages_misc = buf_pool_get_n_pages() - LRU_len - free_len; @@ -528,7 +528,7 @@ diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c + = purge_sys->purge_trx_no; + export_vars.innodb_purge_undo_no + = purge_sys->purge_undo_no; -+ export_vars.innodb_row_lock_numbers ++ export_vars.innodb_current_row_locks + = lock_sys->rec_num; + #ifdef HAVE_ATOMIC_BUILTINS diff --git a/innodb_stats.patch b/innodb_stats.patch index 2567289..70af576 100644 --- a/innodb_stats.patch +++ b/innodb_stats.patch @@ -1304,7 +1304,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_ PLUGIN_VAR_OPCMDARG, "Enable InnoDB adaptive hash index (enabled by default). " @@ -11604,6 +11688,10 @@ - MYSQL_SYSVAR(overwrite_relay_log_info), + MYSQL_SYSVAR(recovery_update_relay_log), MYSQL_SYSVAR(rollback_on_timeout), MYSQL_SYSVAR(stats_on_metadata), + MYSQL_SYSVAR(stats_method), diff --git a/log_warnings_suppress.patch b/log_warnings_suppress.patch new file mode 100644 index 0000000..d55045e --- /dev/null +++ b/log_warnings_suppress.patch @@ -0,0 +1,86 @@ +# name : log_warnings_suppress.patch +# introduced : 11 or before +# maintainer : Oleg +# +#!!! notice !!! +# Any small change to this file in the main branch +# should be done or reviewed by the maintainer! +diff -ruN a/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 +@@ -0,0 +1,9 @@ ++File=log_warnings_suppress.patch ++Name=Disable log warnings for enumerated warnings (old name:suppress_log_warning_1592.patch) ++Version=1.0 ++Author=Percona ++License=GPL ++Comment= ++Changelog ++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 +@@ -620,6 +620,8 @@ + SHOW_COMP_OPTION have_crypt, have_compress; + SHOW_COMP_OPTION have_profiling; + ++ulonglong opt_log_warnings_suppress= 0; ++ + /* Thread specific variables */ + + 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 @@ + extern TYPELIB thread_handling_typelib; + extern my_decimal decimal_zero; + ++extern ulonglong opt_log_warnings_suppress; ++ + extern pthread_key(MEM_ROOT**,THR_MALLOC); + + #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 +@@ -4578,7 +4578,7 @@ + ER_BINLOG_UNSAFE_STATEMENT, + ER(ER_BINLOG_UNSAFE_STATEMENT), + ER(LEX::binlog_stmt_unsafe_errcode[unsafe_type])); +- if (global_system_variables.log_warnings) ++ if (global_system_variables.log_warnings && ((opt_log_warnings_suppress & (ULL(1) << log_warnings_suppress_1592)) == 0)) + { + 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 +@@ -90,6 +90,7 @@ + SLOG_F_TMP_TABLE, SLOG_F_TMP_DISK, SLOG_F_FILESORT, + SLOG_F_FILESORT_DISK + }; ++enum enum_log_warnings_suppress { log_warnings_suppress_1592 }; + enum enum_slave_exec_mode { SLAVE_EXEC_MODE_STRICT, + 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 @@ + READ_ONLY GLOBAL_VAR(mysqld_port), CMD_LINE(REQUIRED_ARG, 'P'), + VALID_RANGE(0, UINT_MAX32), DEFAULT(0), BLOCK_SIZE(1)); + ++const char *log_warnings_suppress_name[]= { "1592" }; ++static Sys_var_set Sys_log_warnings_suppress( ++ "log_warnings_suppress", ++ "disable logging of enumerated warnings: " ++ "1592: unsafe statements for binary logging; " ++ "possible values : [1592]", ++ GLOBAL_VAR(opt_log_warnings_suppress), CMD_LINE(REQUIRED_ARG), ++ log_warnings_suppress_name, DEFAULT(0)); ++ + static Sys_var_ulong Sys_preload_buff_size( + "preload_buffer_size", + "The size of the buffer that is allocated when preloading indexes", diff --git a/mysql.spec b/mysql.spec index aff35d2..a55532f 100644 --- a/mysql.spec +++ b/mysql.spec @@ -74,54 +74,51 @@ Patch12: %{name}-config.patch Patch14: %{name}-bug-43594.patch Patch18: %{name}-sphinx.patch Patch19: %{name}-chain-certs.patch -# -# series file shows the order of patches +# Patch100: microsec_process.patch Patch101: optimizer_fix.patch -Patch102: %{name}_dump_ignore_ct.patch -Patch103: control_online_alter_index.patch -Patch104: show_temp.patch -Patch105: innodb_show_status.patch -Patch106: innodb_io_patches.patch -Patch107: innodb_opt_lru_count.patch -Patch108: innodb_extra_rseg.patch -Patch109: innodb_overwrite_relay_log_info.patch -Patch110: innodb_thread_concurrency_timer_based.patch -Patch111: innodb_dict_size_limit.patch -Patch112: innodb_split_buf_pool_mutex.patch -Patch113: innodb_expand_import.patch -Patch114: innodb_show_sys_tables.patch -Patch115: innodb_stats.patch -Patch116: innodb_recovery_patches.patch -Patch117: innodb_admin_command_base.patch -Patch118: innodb_show_lock_name.patch -Patch119: innodb_extend_slow.patch -Patch120: innodb_lru_dump_restore.patch -Patch121: innodb_separate_doublewrite.patch -Patch122: innodb_pass_corrupt_table.patch -Patch123: innodb_fast_checksum.patch -Patch124: innodb_files_extend.patch -Patch125: innodb_fix_misc.patch -Patch126: innodb_deadlock_count.patch -Patch127: innodb_adaptive_hash_index_partitions.patch -Patch128: innodb_buffer_pool_pages_i_s.patch -Patch129: innodb_buffer_pool_shm.patch -Patch130: innodb_show_status_extend.patch -Patch131: slow_extended.patch -Patch132: percona_support.patch -Patch133: query_cache_enhance.patch -Patch134: log_connection_error.patch -Patch135: mysql_syslog.patch -Patch136: response_time_distribution.patch -Patch137: error_pad.patch -Patch138: remove_fcntl_excessive_calls.patch -Patch139: sql_no_fcache.patch -Patch140: show_slave_status_nolock.patch -Patch141: log_warnings_silence.patch -Patch142: userstat.patch -Patch143: bug580324.patch -Patch144: mysql_remove_eol_carret.patch -Patch145: mysql-test.diff +Patch102: control_online_alter_index.patch +Patch103: show_temp.patch +Patch104: innodb_show_status.patch +Patch105: innodb_io_patches.patch +Patch106: innodb_opt_lru_count.patch +Patch107: innodb_extra_rseg.patch +Patch108: innodb_overwrite_relay_log_info.patch +Patch109: innodb_thread_concurrency_timer_based.patch +Patch110: innodb_dict_size_limit.patch +Patch111: innodb_split_buf_pool_mutex.patch +Patch112: innodb_expand_import.patch +Patch113: innodb_show_sys_tables.patch +Patch114: innodb_stats.patch +Patch115: innodb_recovery_patches.patch +Patch116: innodb_admin_command_base.patch +Patch117: innodb_show_lock_name.patch +Patch118: innodb_extend_slow.patch +Patch119: innodb_lru_dump_restore.patch +Patch120: innodb_separate_doublewrite.patch +Patch121: innodb_pass_corrupt_table.patch +Patch122: innodb_fast_checksum.patch +Patch123: innodb_files_extend.patch +Patch124: innodb_fix_misc.patch +Patch125: innodb_deadlock_count.patch +Patch126: innodb_adaptive_hash_index_partitions.patch +Patch127: innodb_buffer_pool_pages_i_s.patch +Patch128: innodb_buffer_pool_shm.patch +Patch129: innodb_show_status_extend.patch +Patch130: slow_extended.patch +Patch131: percona_support.patch +Patch132: query_cache_enhance.patch +Patch133: log_connection_error.patch +Patch134: mysql_syslog.patch +Patch135: response_time_distribution.patch +Patch136: error_pad.patch +Patch137: remove_fcntl_excessive_calls.patch +Patch138: sql_no_fcache.patch +Patch139: show_slave_status_nolock.patch +Patch140: log_warnings_suppress.patch +Patch141: userstat.patch +Patch142: bug580324.patch +Patch143: mysql_remove_eol_carret.patch # URL: http://www.mysql.com/products/community/ BuildRequires: bison @@ -563,7 +560,7 @@ mv sphinx-*/mysqlse storage/sphinx # %patch100 -p1 %patch101 -p1 -#%patch102 -p1 +%patch102 -p1 %patch103 -p1 %patch104 -p1 %patch105 -p1 @@ -605,8 +602,6 @@ mv sphinx-*/mysqlse storage/sphinx %patch141 -p1 %patch142 -p1 %patch143 -p1 -%patch144 -p1 -%patch145 -p1 # # to get these files rebuild diff --git a/percona.sh b/percona.sh index ef15c59..ddfecd3 100644 --- a/percona.sh +++ b/percona.sh @@ -1,14 +1,18 @@ #!/bin/sh # updates percona patches # http://www.percona.com/docs/wiki/repositories:start +# http://bazaar.launchpad.net/~percona-dev/percona-server/5.5.8/files # https://launchpad.net/percona-server/5.5 # bzr branch lp:percona-server/5.5 version=5.5 bzr_branch=lp:percona-server/$version +#version=5.5.9 +#bzr_branch=lp:percona-dev/percona-server/$version branch= filter_names() { + grep -v 'mysql_dump_ignore_ct.patch' | \ grep -v 'percona-support.patch' | \ grep -v 'mysqld_safe_syslog.patch' | \ grep -v 'mysql-test.diff' @@ -18,6 +22,8 @@ filter_files() { filterdiff -x '*/configure' } +set -e + if [ -d $version ]; then cd $version bzr pull diff --git a/query_cache_enhance.patch b/query_cache_enhance.patch index 0a3f2b5..f39c593 100644 --- a/query_cache_enhance.patch +++ b/query_cache_enhance.patch @@ -464,7 +464,7 @@ diff -ruN a/sql/sql_class.h b/sql/sql_class.h class Reprepare_observer; class Relay_log_info; -@@ -758,6 +761,9 @@ +@@ -765,6 +768,9 @@ statement lifetime. FIXME: must be const */ ulong id; diff --git a/remove_fcntl_excessive_calls.patch b/remove_fcntl_excessive_calls.patch index bf6397e..faed803 100644 --- a/remove_fcntl_excessive_calls.patch +++ b/remove_fcntl_excessive_calls.patch @@ -18,6 +18,15 @@ diff -ruN a/patch_info/remove_fcntl_excessive_calls.info b/patch_info/remove_fcn diff -ruN a/sql/net_serv.cc b/sql/net_serv.cc --- a/sql/net_serv.cc 2010-06-03 19:50:27.000000000 +0400 +++ b/sql/net_serv.cc 2010-07-22 21:40:30.680424001 +0400 +@@ -61,7 +61,7 @@ + the client should have a bigger max_allowed_packet. + */ + +-#if defined(__WIN__) || !defined(MYSQL_SERVER) ++#if (defined(__WIN__) || !defined(MYSQL_SERVER)) && !defined(NO_ALARM) + /* The following is because alarms doesn't work on windows. */ + #ifndef NO_ALARM + #define NO_ALARM @@ -133,7 +133,7 @@ if (vio != 0) /* If real connection */ { @@ -36,15 +45,6 @@ diff -ruN a/sql/net_serv.cc b/sql/net_serv.cc if ((interrupted || length == 0) && !thr_alarm_in_use(&alarmed)) { if (!thr_alarm(&alarmed, net->write_timeout, &alarm_buff)) -@@ -670,7 +670,7 @@ - my_progname); - #endif /* EXTRA_DEBUG */ - } --#if defined(THREAD_SAFE_CLIENT) && !defined(MYSQL_SERVER) -+#if defined(THREAD_SAFE_CLIENT) && defined(NO_ALARM) - if (vio_errno(net->vio) == SOCKET_EINTR) - { - DBUG_PRINT("warning",("Interrupted write. Retrying...")); @@ -688,7 +688,7 @@ pos+=length; update_statistics(thd_increment_bytes_sent(length)); @@ -71,12 +71,3 @@ diff -ruN a/sql/net_serv.cc b/sql/net_serv.cc /* We got an error that there was no data on the socket. We now set up an alarm to not 'read forever', change the socket to non blocking -@@ -881,7 +882,7 @@ - my_progname,vio_errno(net->vio)); - #endif /* EXTRA_DEBUG */ - } --#if defined(THREAD_SAFE_CLIENT) && !defined(MYSQL_SERVER) -+#if defined(THREAD_SAFE_CLIENT) && defined(NO_ALARM) - if (vio_errno(net->vio) == SOCKET_EINTR) - { - DBUG_PRINT("warning",("Interrupted read. Retrying...")); diff --git a/slow_extended.patch b/slow_extended.patch index a5d993f..e318886 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 2010-11-03 01:01:11.000000000 +0300 -+++ b/include/mysql/plugin_audit.h.pp 2010-12-16 04:27:46.000000000 +0300 +--- 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 @@ -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 2010-11-03 01:01:11.000000000 +0300 -+++ b/include/mysql/plugin_auth.h.pp 2010-12-16 04:27:46.000000000 +0300 +--- 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 @@ -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 2010-11-03 01:01:11.000000000 +0300 -+++ b/include/mysql/plugin_ftparser.h.pp 2010-12-16 04:27:46.000000000 +0300 +--- 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 @@ -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 2010-11-03 01:01:11.000000000 +0300 -+++ b/include/mysql/plugin.h 2010-12-16 04:27:46.000000000 +0300 +--- 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 @@ -536,6 +536,17 @@ /* Increments the row counter, see THD::row_count */ void thd_inc_row_count(MYSQL_THD thd); @@ -88,7 +88,7 @@ diff -ruN a/include/mysql/plugin.h b/include/mysql/plugin.h 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 2010-12-16 04:27:46.000000000 +0300 ++++ b/patch_info/slow_extended.info 2011-02-21 22:57:48.818765423 +0200 @@ -0,0 +1,25 @@ +File=slow_extended.patch +Name=Extended statistics in slow.log (not InnoDB part) @@ -113,11 +113,17 @@ diff -ruN a/patch_info/slow_extended.info b/patch_info/slow_extended.info +4) Now use_global_long_query_time and use_global_log_slow_control are synonims. Add value "all" for use_global_log_slow_control (contol-global_slow-2.patch merged) +5) Fix innodb_stats on replication (Bug 600684) +6) Change variable types (system/command-line) -+2010-01 ++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 2010-11-03 01:01:13.000000000 +0300 -+++ b/scripts/mysqldumpslow.sh 2010-12-16 04:27:46.000000000 +0300 +--- a/scripts/mysqldumpslow.sh 2011-01-20 00:37:09.000000000 +0200 ++++ b/scripts/mysqldumpslow.sh 2011-02-21 22:57:48.818765423 +0200 @@ -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) : ('',''); @@ -130,8 +136,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 2010-11-03 01:01:14.000000000 +0300 -+++ b/sql/event_scheduler.cc 2010-12-16 04:27:46.000000000 +0300 +--- 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 @@ -195,6 +195,7 @@ thd->client_capabilities|= CLIENT_MULTI_RESULTS; mysql_mutex_lock(&LOCK_thread_count); @@ -141,8 +147,8 @@ 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 2010-11-03 01:01:14.000000000 +0300 -+++ b/sql/filesort.cc 2010-12-16 04:27:46.000000000 +0300 +--- 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 @@ { status_var_increment(thd->status_var.filesort_scan_count); @@ -168,8 +174,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 2010-11-03 07:01:14.000000000 +0900 -+++ b/sql/log.cc 2010-12-02 19:28:31.337989417 +0900 +--- a/sql/log.cc 2011-01-20 00:37:09.000000000 +0200 ++++ b/sql/log.cc 2011-02-21 23:14:33.973714581 +0200 @@ -715,11 +715,13 @@ */ @@ -278,7 +284,7 @@ diff -ruN a/sql/log.cc b/sql/log.cc if (!(specialflag & SPECIAL_SHORT_LOG_FORMAT)) { - if (current_time != last_time) -+ if (opt_log_slow_timestamp_every || current_time != last_time) ++ if (opt_slow_query_log_timestamp_always || current_time != last_time) { last_time= current_time; struct tm start; @@ -289,7 +295,7 @@ diff -ruN a/sql/log.cc b/sql/log.cc - start.tm_year % 100, start.tm_mon + 1, - start.tm_mday, start.tm_hour, - start.tm_min, start.tm_sec); -+ if(opt_slow_query_log_microseconds_timestamp) ++ if(opt_slow_query_log_timestamp_precision & SLOG_MICROSECOND) + { + ulonglong microsecond = current_utime % (1000 * 1000); + buff_len= snprintf(buff, sizeof buff, @@ -309,7 +315,7 @@ diff -ruN a/sql/log.cc b/sql/log.cc /* Note that my_b_write() assumes it knows the length for this */ if (my_b_write(&log_file, (uchar*) buff, buff_len)) -@@ -2711,12 +2751,69 @@ +@@ -2711,12 +2752,69 @@ sprintf(query_time_buff, "%.6f", ulonglong2double(query_utime)/1000000.0); sprintf(lock_time_buff, "%.6f", ulonglong2double(lock_utime)/1000000.0); if (my_b_printf(&log_file, @@ -383,8 +389,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 2010-11-03 01:01:14.000000000 +0300 -+++ b/sql/log.h 2010-12-16 04:27:46.000000000 +0300 +--- a/sql/log.h 2011-01-20 00:37:09.000000000 +0200 ++++ b/sql/log.h 2011-02-21 22:57:48.826764006 +0200 @@ -242,7 +242,7 @@ uint user_host_len, int thread_id, const char *command_type, uint command_type_len, @@ -422,16 +428,16 @@ 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 2010-12-16 04:27:10.000000000 +0300 -+++ b/sql/mysqld.cc 2010-12-16 04:27:46.000000000 +0300 +--- a/sql/mysqld.cc 2011-02-21 22:57:24.442081625 +0200 ++++ b/sql/mysqld.cc 2011-02-21 22:59:30.845699981 +0200 @@ -418,6 +418,10 @@ char* opt_secure_file_priv; my_bool opt_log_slow_admin_statements= 0; my_bool opt_log_slow_slave_statements= 0; +my_bool opt_log_slow_sp_statements= 0; -+my_bool opt_log_slow_timestamp_every= 0; -+ulonglong opt_use_global_log_slow_control= 0; -+my_bool opt_slow_query_log_microseconds_timestamp= 0; ++my_bool opt_slow_query_log_timestamp_always= 0; ++ulonglong opt_slow_query_log_use_global_control= 0; ++ulonglong opt_slow_query_log_timestamp_precision= 0; my_bool lower_case_file_system= 0; my_bool opt_large_pages= 0; my_bool opt_super_large_pages= 0; @@ -454,7 +460,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc +/* defined in sys_vars.cc */ +extern void init_log_slow_verbosity(); -+extern void init_use_global_log_slow_control(); ++extern void init_slow_query_log_use_global_control(); + /** Get server options from the command line, @@ -464,27 +470,27 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc (global_system_variables.long_query_time_double * 1e6); + init_log_slow_verbosity(); -+ init_use_global_log_slow_control(); ++ init_slow_query_log_use_global_control(); if (opt_short_log_format) opt_specialflag|= SPECIAL_SHORT_LOG_FORMAT; diff -ruN a/sql/mysqld.h b/sql/mysqld.h ---- a/sql/mysqld.h 2010-12-16 04:27:10.000000000 +0300 -+++ b/sql/mysqld.h 2010-12-16 04:27:46.000000000 +0300 +--- a/sql/mysqld.h 2011-02-21 22:57:24.398089415 +0200 ++++ b/sql/mysqld.h 2011-02-21 23:01:50.079045873 +0200 @@ -116,6 +116,10 @@ extern char* opt_secure_backup_file_priv; extern size_t opt_secure_backup_file_priv_len; extern my_bool opt_log_slow_admin_statements, opt_log_slow_slave_statements; +extern my_bool opt_log_slow_sp_statements; -+extern my_bool opt_log_slow_timestamp_every; -+extern ulonglong opt_use_global_log_slow_control; -+extern my_bool opt_slow_query_log_microseconds_timestamp; ++extern my_bool opt_slow_query_log_timestamp_always; ++extern ulonglong opt_slow_query_log_use_global_control; ++extern ulonglong opt_slow_query_log_timestamp_precision; extern my_bool sp_automatic_privileges, opt_noacl; 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 2010-11-03 01:01:14.000000000 +0300 -+++ b/sql/slave.cc 2010-12-16 04:27:46.000000000 +0300 +--- a/sql/slave.cc 2011-01-20 00:37:09.000000000 +0200 ++++ b/sql/slave.cc 2011-02-21 22:57:48.834762590 +0200 @@ -2038,6 +2038,7 @@ + MAX_LOG_EVENT_HEADER; /* note, incr over the global not session var */ thd->slave_thread = 1; @@ -494,8 +500,8 @@ 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 2010-12-16 04:27:10.000000000 +0300 -+++ b/sql/sp_head.cc 2010-12-16 04:27:46.000000000 +0300 +--- 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 @@ DBUG_PRINT("info",(" %.*s: eval args done", (int) m_name.length, m_name.str)); @@ -506,8 +512,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 2010-11-03 01:01:14.000000000 +0300 -+++ b/sql/sql_cache.cc 2010-12-16 04:27:46.000000000 +0300 +--- 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 @@ -1756,6 +1756,7 @@ response, we can't handle it anyway. */ @@ -525,8 +531,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 2010-11-03 01:01:14.000000000 +0300 -+++ b/sql/sql_class.cc 2010-12-16 04:27:46.000000000 +0300 +--- a/sql/sql_class.cc 2011-01-20 00:37:09.000000000 +0200 ++++ b/sql/sql_class.cc 2011-02-21 22:57:48.843760997 +0200 @@ -367,6 +367,37 @@ thd->warning_info->inc_current_row_for_warning(); } @@ -615,18 +621,25 @@ 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-16 04:27:10.000000000 +0300 -+++ b/sql/sql_class.h 2010-12-16 04:27:46.000000000 +0300 -@@ -60,6 +60,26 @@ +--- 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 +@@ -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, DELAY_KEY_WRITE_ALL }; -+enum enum_use_global_log_slow_control { SLOG_UG_LOG_SLOW_FILTER, SLOG_UG_LOG_SLOW_RATE_LIMIT, SLOG_UG_LOG_SLOW_VERBOSITY, SLOG_UG_LONG_QUERY_TIME, SLOG_UG_MIN_EXAMINED_ROW_LIMIT, SLOG_UG_ALL }; ++enum enum_slow_query_log_use_global_control { ++ SLOG_UG_LOG_SLOW_FILTER, SLOG_UG_LOG_SLOW_RATE_LIMIT ++ , SLOG_UG_LOG_SLOW_VERBOSITY, SLOG_UG_LONG_QUERY_TIME ++ , SLOG_UG_MIN_EXAMINED_ROW_LIMIT, SLOG_UG_ALL ++}; +enum enum_log_slow_verbosity { + SLOG_V_MICROTIME, SLOG_V_QUERY_PLAN, SLOG_V_INNODB, + SLOG_V_PROFILING, SLOG_V_PROFILING_USE_GETRUSAGE, + SLOG_V_MINIMAL, SLOG_V_STANDARD, SLOG_V_FULL +}; ++enum enum_slow_query_log_timestamp_precision { ++ SLOG_SECOND, SLOG_MICROSECOND ++}; +#define QPLAN_NONE 0 +#define QPLAN_QC 1 << 0 +#define QPLAN_QC_NO 1 << 1 @@ -644,7 +657,7 @@ diff -ruN a/sql/sql_class.h b/sql/sql_class.h enum enum_slave_exec_mode { SLAVE_EXEC_MODE_STRICT, SLAVE_EXEC_MODE_IDEMPOTENT, SLAVE_EXEC_MODE_LAST_BIT}; -@@ -508,6 +528,17 @@ +@@ -508,6 +535,17 @@ my_bool sysdate_is_now; @@ -662,7 +675,7 @@ diff -ruN a/sql/sql_class.h b/sql/sql_class.h double long_query_time_double; } SV; -@@ -1140,6 +1171,14 @@ +@@ -1140,6 +1178,14 @@ uint in_sub_stmt; bool enable_slow_log; bool last_insert_id_used; @@ -677,7 +690,7 @@ diff -ruN a/sql/sql_class.h b/sql/sql_class.h SAVEPOINT *savepoints; enum enum_check_fields count_cuted_fields; }; -@@ -1575,6 +1614,26 @@ +@@ -1575,6 +1621,26 @@ thr_lock_type update_lock_default; Delayed_insert *di; @@ -705,8 +718,8 @@ 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 2010-11-03 01:01:14.000000000 +0300 -+++ b/sql/sql_connect.cc 2010-12-16 04:27:46.000000000 +0300 +--- 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 @@ prepare_new_connection_state(thd); @@ -724,8 +737,8 @@ 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 2010-12-16 04:27:10.000000000 +0300 -+++ b/sql/sql_parse.cc 2010-12-16 04:47:41.000000000 +0300 +--- 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 @@ DBUG_RETURN(error); } @@ -754,7 +767,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc + + ulonglong end_utime_of_query= thd->current_utime(); +#define USE_GLOBAL_UPDATE(variable_name,enum_value_name) \ -+ if (opt_use_global_log_slow_control & (ULL(1) << enum_value_name)) \ ++ if (opt_slow_query_log_use_global_control & (ULL(1) << enum_value_name)) \ + { \ + thd->variables. variable_name= \ + global_system_variables. variable_name; \ @@ -810,8 +823,8 @@ 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 2010-12-16 04:27:10.000000000 +0300 -+++ b/sql/sql_select.cc 2010-12-16 04:27:47.000000000 +0300 +--- a/sql/sql_select.cc 2011-02-21 22:57:24.411087114 +0200 ++++ b/sql/sql_select.cc 2011-02-21 22:57:48.867756749 +0200 @@ -6872,7 +6872,10 @@ { join->thd->server_status|=SERVER_QUERY_NO_INDEX_USED; @@ -866,8 +879,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 2010-12-16 04:27:10.000000000 +0300 -+++ b/sql/sql_show.cc 2010-12-16 04:27:47.000000000 +0300 +--- a/sql/sql_show.cc 2011-02-21 22:57:24.456079146 +0200 ++++ b/sql/sql_show.cc 2011-02-21 22:57:48.873755686 +0200 @@ -1942,8 +1942,17 @@ table->field[4]->store(command_name[tmp->command].str, command_name[tmp->command].length, cs); @@ -889,9 +902,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 2010-12-16 04:27:10.000000000 +0300 -+++ b/sql/sys_vars.cc 2010-12-16 04:36:12.000000000 +0300 -@@ -2852,6 +2852,116 @@ +--- 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 @@ DEFAULT(FALSE), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(fix_log_state)); @@ -949,7 +962,7 @@ diff -ruN a/sql/sys_vars.cc b/sql/sys_vars.cc + } + return false; +} -+void init_use_global_log_slow_control() ++void init_slow_query_log_use_global_control() +{ + update_log_slow_verbosity(&(global_system_variables.log_slow_verbosity)); +} @@ -971,18 +984,18 @@ diff -ruN a/sql/sys_vars.cc b/sql/sys_vars.cc + "Log slow statements executed by stored procedure to the slow log if it is open.", + GLOBAL_VAR(opt_log_slow_sp_statements), CMD_LINE(OPT_ARG), + DEFAULT(TRUE)); -+static Sys_var_mybool Sys_log_slow_timestamp_every( -+ "log_slow_timestamp_every", ++static Sys_var_mybool Sys_slow_query_log_timestamp_always( ++ "slow_query_log_timestamp_always", + "Timestamp is printed for all records of the slow log even if they are same time.", -+ GLOBAL_VAR(opt_log_slow_timestamp_every), CMD_LINE(OPT_ARG), ++ GLOBAL_VAR(opt_slow_query_log_timestamp_always), CMD_LINE(OPT_ARG), + DEFAULT(FALSE)); -+const char *use_global_log_slow_control_name[]= { "log_slow_filter", "log_slow_rate_limit", "log_slow_verbosity", "long_query_time", "min_examined_row_limit", "all", 0}; -+static bool update_use_global_log_slow_control(sys_var */*self*/, THD */*thd*/, ++const char *slow_query_log_use_global_control_name[]= { "log_slow_filter", "log_slow_rate_limit", "log_slow_verbosity", "long_query_time", "min_examined_row_limit", "all", 0}; ++static bool update_slow_query_log_use_global_control(sys_var */*self*/, THD */*thd*/, + enum_var_type /*type*/) +{ -+ if(opt_use_global_log_slow_control & (ULL(1) << SLOG_UG_ALL)) ++ if(opt_slow_query_log_use_global_control & (ULL(1) << SLOG_UG_ALL)) + { -+ opt_use_global_log_slow_control= ++ opt_slow_query_log_use_global_control= + SLOG_UG_LOG_SLOW_FILTER | SLOG_UG_LOG_SLOW_RATE_LIMIT | SLOG_UG_LOG_SLOW_VERBOSITY | + SLOG_UG_LONG_QUERY_TIME | SLOG_UG_MIN_EXAMINED_ROW_LIMIT; + } @@ -990,27 +1003,28 @@ diff -ruN a/sql/sys_vars.cc b/sql/sys_vars.cc +} +void init_log_slow_verbosity() +{ -+ update_use_global_log_slow_control(0,0,OPT_GLOBAL); ++ update_slow_query_log_use_global_control(0,0,OPT_GLOBAL); +} -+static Sys_var_set Sys_use_global_log_slow_control( -+ "use_global_log_slow_control", ++static Sys_var_set Sys_slow_query_log_use_global_control( ++ "slow_query_log_use_global_control", + "Choose flags, wich always use the global variables. Multiple flags allowed in a comma-separated string. [none, log_slow_filter, log_slow_rate_limit, log_slow_verbosity, long_query_time, min_examined_row_limit, all]", -+ GLOBAL_VAR(opt_use_global_log_slow_control), CMD_LINE(REQUIRED_ARG), -+ use_global_log_slow_control_name, DEFAULT(0), ++ GLOBAL_VAR(opt_slow_query_log_use_global_control), CMD_LINE(REQUIRED_ARG), ++ slow_query_log_use_global_control_name, DEFAULT(0), + NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), -+ ON_UPDATE(update_use_global_log_slow_control)); -+static Sys_var_mybool Sys_slow_query_log_microseconds_timestamp( -+ "slow_query_log_microseconds_timestamp", -+ "Log slow statements executed by stored procedure to the slow log if it is open.", -+ GLOBAL_VAR(opt_slow_query_log_microseconds_timestamp), CMD_LINE(OPT_ARG), -+ DEFAULT(FALSE)); ++ ON_UPDATE(update_slow_query_log_use_global_control)); ++const char *slow_query_log_timestamp_precision_name[]= { "second", "microsecond", 0 }; ++static Sys_var_enum Sys_slow_query_log_timestamp_precision( ++ "slow_query_log_timestamp_precision", ++ "Log slow statements executed by stored procedure to the slow log if it is open. [second, microsecond]", ++ GLOBAL_VAR(opt_slow_query_log_timestamp_precision), CMD_LINE(REQUIRED_ARG), ++ slow_query_log_timestamp_precision_name, DEFAULT(SLOG_SECOND)); + /* Synonym of "slow_query_log" for consistency with SHOW VARIABLES output */ 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 2010-11-03 07:01:14.000000000 +0900 -+++ b/sql/sql_profile.cc 2010-12-02 20:26:35.448357413 +0900 +--- 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 @@ -243,7 +243,8 @@ { time_usecs= (double) my_getsystime() / 10.0; /* 1 sec was 1e7, now is 1e6 */ @@ -1181,8 +1195,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 2010-11-03 07:01:14.000000000 +0900 -+++ b/sql/sql_profile.h 2010-12-02 19:23:07.823955510 +0900 +--- 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 @@ -164,11 +164,15 @@ */ class PROF_MEASUREMENT diff --git a/userstat.patch b/userstat.patch index 722a27a..7a97be8 100644 --- a/userstat.patch +++ b/userstat.patch @@ -44,7 +44,7 @@ diff -ruN a/include/mysql_com.h b/include/mysql_com.h 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 -@@ -0,0 +1,15 @@ +@@ -0,0 +1,17 @@ +File=userstats.patch +Name=SHOW USER/TABLE/INDEX statistics +Version=V2 @@ -55,11 +55,13 @@ diff -ruN a/patch_info/userstats.patch b/patch_info/userstats.patch +YK: fix behavior for prepared statements + +2008-11-26 -+YK: add switch variable "userstat_running" to control INFORMATION_SCHEMA.*_STATISTICS (default:OFF) ++YK: add switch variable "userstat" to control INFORMATION_SCHEMA.*_STATISTICS (default:OFF) +2010-12-31 +Ported to 5.5.8 +2011-1-5 +Fix porting ++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 @@ -105,7 +107,7 @@ diff -ruN a/sql/handler.cc b/sql/handler.cc +// Updates the global table stats with the TABLE this handler represents. +void handler::update_global_table_stats() +{ -+ if (!opt_userstat_running) ++ if (!opt_userstat) + { + rows_read= rows_changed= 0; + return; @@ -167,7 +169,7 @@ diff -ruN a/sql/handler.cc b/sql/handler.cc + if (!table->s || !table->s->table_cache_key.str || !table->s->table_name.str) + return; + -+ if (!opt_userstat_running) ++ if (!opt_userstat) + { + for (uint x= 0; x < table->s->keys; ++x) + { @@ -368,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 @@ +@@ -5042,6 +5049,8 @@ thd->first_successful_insert_id_in_prev_stmt_for_binlog); if (e.write(file)) goto err; @@ -377,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 @@ +@@ -5053,12 +5062,16 @@ minimum()); if (e.write(file)) goto err; @@ -394,7 +396,7 @@ diff -ruN a/sql/log.cc b/sql/log.cc } if (thd->user_var_events.elements) { -@@ -5080,6 +5093,8 @@ +@@ -5081,6 +5094,8 @@ flags); if (e.write(file)) goto err; @@ -403,7 +405,7 @@ diff -ruN a/sql/log.cc b/sql/log.cc } } } -@@ -5091,6 +5106,8 @@ +@@ -5092,6 +5107,8 @@ if (event_info->write(file) || DBUG_EVALUATE_IF("injecting_fault_writing", 1, 0)) goto err; @@ -412,7 +414,7 @@ diff -ruN a/sql/log.cc b/sql/log.cc error= 0; err: -@@ -5276,7 +5293,8 @@ +@@ -5277,7 +5294,8 @@ be reset as a READ_CACHE to be able to read the contents from it. */ @@ -422,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 @@ +@@ -5324,6 +5342,7 @@ /* write the first half of the split header */ if (my_b_write(&log_file, header, carry)) return ER_ERROR_ON_WRITE; @@ -430,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 @@ +@@ -5392,6 +5411,7 @@ /* Write data to the binary log file */ if (my_b_write(&log_file, cache->read_pos, length)) return ER_ERROR_ON_WRITE; @@ -438,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 @@ +@@ -5506,20 +5526,23 @@ Query_log_event qinfo(thd, STRING_WITH_LEN("BEGIN"), TRUE, FALSE, TRUE, 0); if (qinfo.write(&log_file)) goto err; @@ -492,7 +494,7 @@ diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc uint opt_debug_sync_timeout= 0; #endif /* defined(ENABLED_DEBUG_SYNC) */ my_bool opt_old_style_user_limits= 0, trust_function_creators= 0; -+my_bool opt_userstat_running= 0, opt_thread_statistics= 0; ++my_bool opt_userstat= 0, opt_thread_statistics= 0; my_bool opt_optimizer_fix= 0; /* True if there is at least one per-hour limit for some user, so we should @@ -648,7 +650,7 @@ diff -ruN a/sql/mysqld.h b/sql/mysqld.h extern ulonglong slave_type_conversions_options; extern my_bool read_only, opt_readonly; extern my_bool lower_case_file_system; -+extern my_bool opt_userstat_running, opt_thread_statistics; ++extern my_bool opt_userstat, opt_thread_statistics; 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; @@ -795,7 +797,7 @@ diff -ruN a/sql/sql_class.cc b/sql/sql_class.cc +// Updates 'diff' stats of a THD. +void THD::update_stats(bool ran_command) +{ -+ if (opt_userstat_running) ++ if (opt_userstat) + { + diff_total_busy_time+= busy_time; + diff_total_cpu_time+= cpu_time; @@ -921,7 +923,7 @@ diff -ruN a/sql/sql_class.cc b/sql/sql_class.cc diff -ruN a/sql/sql_class.h b/sql/sql_class.h --- a/sql/sql_class.h 2010-12-03 20:58:26.000000000 +0300 +++ b/sql/sql_class.h 2010-12-31 05:15:57.000000000 +0300 -@@ -1610,6 +1610,8 @@ +@@ -1617,6 +1617,8 @@ */ enum enum_server_command command; uint32 server_id; @@ -930,7 +932,7 @@ diff -ruN a/sql/sql_class.h b/sql/sql_class.h uint32 file_id; // for LOAD DATA INFILE /* remote (peer) port */ uint16 peer_port; -@@ -2081,6 +2083,8 @@ +@@ -2088,6 +2090,8 @@ */ enum_tx_isolation tx_isolation; enum_check_fields count_cuted_fields; @@ -939,7 +941,7 @@ diff -ruN a/sql/sql_class.h b/sql/sql_class.h DYNAMIC_ARRAY user_var_events; /* For user variables replication */ MEM_ROOT *user_var_events_alloc; /* Allocate above array elements here */ -@@ -2176,6 +2180,49 @@ +@@ -2183,6 +2187,49 @@ */ LOG_INFO* current_linfo; NET* slave_net; // network connection from slave -> m. @@ -989,7 +991,7 @@ diff -ruN a/sql/sql_class.h b/sql/sql_class.h /* Used by the sys_var class to store temporary values */ union { -@@ -2256,6 +2303,11 @@ +@@ -2263,6 +2310,11 @@ alloc_root. */ void init_for_queries(); @@ -1001,7 +1003,7 @@ diff -ruN a/sql/sql_class.h b/sql/sql_class.h void change_user(void); void cleanup(void); void cleanup_after_query(); -@@ -2727,6 +2779,15 @@ +@@ -2734,6 +2786,15 @@ } thd_scheduler scheduler; @@ -1017,7 +1019,7 @@ diff -ruN a/sql/sql_class.h b/sql/sql_class.h public: inline Internal_error_handler *get_internal_handler() { return m_internal_handler; } -@@ -2914,6 +2975,10 @@ +@@ -2921,6 +2982,10 @@ LEX_STRING invoker_host; }; @@ -1475,7 +1477,7 @@ diff -ruN a/sql/sql_connect.cc b/sql/sql_connect.cc + const char* client_string= get_client_host(thd); + int return_value= 0; + -+ if (!opt_userstat_running) ++ if (!opt_userstat) + return return_value; + + if (use_lock) @@ -1563,7 +1565,7 @@ diff -ruN a/sql/sql_connect.cc b/sql/sql_connect.cc +// Updates the global stats of a user or client +void update_global_user_stats(THD* thd, bool create_user, time_t now) +{ -+ if (opt_userstat_running) ++ if (opt_userstat) + { + char* user_string= get_valid_user_string(thd->main_security_ctx.user); + const char* client_string= get_client_host(thd); @@ -1883,7 +1885,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc + double start_cpu_nsecs= 0; + double end_cpu_nsecs= 0; + -+ if (opt_userstat_running) ++ if (opt_userstat) + { +#ifdef HAVE_CLOCK_GETTIME + /* get start cputime */ @@ -1905,7 +1907,7 @@ diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc DBUG_ASSERT(thd->change_list.is_empty()); } -+ if (opt_userstat_running) ++ if (opt_userstat) + { + // Gets the end time. + if (!(end_time_error= gettimeofday(&end_time, NULL))) @@ -1982,7 +1984,7 @@ diff -ruN a/sql/sql_prepare.cc b/sql/sql_prepare.cc + double start_cpu_nsecs= 0; + double end_cpu_nsecs= 0; + -+ if (opt_userstat_running) ++ if (opt_userstat) + { +#ifdef HAVE_CLOCK_GETTIME + /* get start cputime */ @@ -2017,7 +2019,7 @@ diff -ruN a/sql/sql_prepare.cc b/sql/sql_prepare.cc /* check_prepared_statemnt sends the metadata packet in case of success */ +end: -+ if (opt_userstat_running) ++ if (opt_userstat) + { + // Gets the end time. + if (!(end_time_error= gettimeofday(&end_time, NULL))) @@ -2081,7 +2083,7 @@ diff -ruN a/sql/sql_prepare.cc b/sql/sql_prepare.cc + double start_cpu_nsecs= 0; + double end_cpu_nsecs= 0; + -+ if (opt_userstat_running) ++ if (opt_userstat) + { +#ifdef HAVE_CLOCK_GETTIME + /* get start cputime */ @@ -2111,7 +2113,7 @@ diff -ruN a/sql/sql_prepare.cc b/sql/sql_prepare.cc DBUG_EXECUTE_IF("close_conn_after_stmt_execute", vio_close(thd->net.vio);); +end: -+ if (opt_userstat_running) ++ if (opt_userstat) + { + // Gets the end time. + if (!(end_time_error= gettimeofday(&end_time, NULL))) @@ -2176,7 +2178,7 @@ diff -ruN a/sql/sql_prepare.cc b/sql/sql_prepare.cc + double start_cpu_nsecs= 0; + double end_cpu_nsecs= 0; + -+ if (opt_userstat_running) ++ if (opt_userstat) + { +#ifdef HAVE_CLOCK_GETTIME + /* get start cputime */ @@ -2215,7 +2217,7 @@ diff -ruN a/sql/sql_prepare.cc b/sql/sql_prepare.cc thd->stmt_arena= thd; +end: -+ if (opt_userstat_running) ++ if (opt_userstat) + { + // Gets the end time. + if (!(end_time_error = gettimeofday(&end_time, NULL))) @@ -2278,7 +2280,7 @@ diff -ruN a/sql/sql_prepare.cc b/sql/sql_prepare.cc + double start_cpu_nsecs= 0; + double end_cpu_nsecs= 0; + -+ if (opt_userstat_running) ++ if (opt_userstat) + { +#ifdef HAVE_CLOCK_GETTIME + /* get start cputime */ @@ -2309,7 +2311,7 @@ diff -ruN a/sql/sql_prepare.cc b/sql/sql_prepare.cc my_ok(thd); +end: -+ if (opt_userstat_running) ++ if (opt_userstat) + { + // Gets the end time. + if (!(end_time_error = gettimeofday(&end_time, NULL))) @@ -3248,15 +3250,15 @@ diff -ruN a/sql/sys_vars.cc b/sql/sys_vars.cc NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_read_only), ON_UPDATE(fix_read_only)); -+static Sys_var_mybool Sys_userstat_running( -+ "userstat_running", ++static Sys_var_mybool Sys_userstat( ++ "userstat", + "Control USER_STATISTICS, CLIENT_STATISTICS, THREAD_STATISTICS, " + "INDEX_STATISTICS and TABLE_STATISTICS running", -+ GLOBAL_VAR(opt_userstat_running), CMD_LINE(OPT_ARG), DEFAULT(FALSE)); ++ GLOBAL_VAR(opt_userstat), CMD_LINE(OPT_ARG), DEFAULT(FALSE)); + +static Sys_var_mybool Sys_thread_statistics( + "thread_statistics", -+ "Control TABLE_STATISTICS running, when userstat_running is enabled", ++ "Control TABLE_STATISTICS running, when userstat is enabled", + GLOBAL_VAR(opt_thread_statistics), CMD_LINE(OPT_ARG), DEFAULT(FALSE)); + // Small lower limit to be able to test MRR