From 651ac12e8821a994e6176e63eef3e87b70f9746c Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 22 Aug 2012 08:42:24 +0200 Subject: [PATCH] XtraDB 1.1.8-27.0 from Percona-Server-5.5.25a-rel27.1 --- btr/btr0cur.c | 2 ++ buf/buf0flu.c | 9 --------- dict/dict0load.c | 4 ++-- fil/fil0fil.c | 7 +++++-- handler/ha_innodb.cc | 25 +++++++++++++++++++++++-- handler/ha_innodb.h | 1 + handler/i_s.cc | 22 ++++++++++++++++++++++ include/srv0srv.h | 1 + include/univ.i | 2 +- srv/srv0start.c | 16 ++++++++++++---- sync/sync0arr.c | 5 +++++ 11 files changed, 74 insertions(+), 20 deletions(-) diff --git a/btr/btr0cur.c b/btr/btr0cur.c index e093dabebf1..26db7329b7e 100644 --- a/btr/btr0cur.c +++ b/btr/btr0cur.c @@ -3604,6 +3604,8 @@ btr_estimate_n_rows_in_range( n_rows = n_rows * 2; } + DBUG_EXECUTE_IF("bug14007649", return(n_rows);); + /* Do not estimate the number of rows in the range to over 1 / 2 of the estimated rows in the whole table */ diff --git a/buf/buf0flu.c b/buf/buf0flu.c index bb921928653..39351cd3678 100644 --- a/buf/buf0flu.c +++ b/buf/buf0flu.c @@ -1846,8 +1846,6 @@ buf_flush_batch( } #endif /* UNIV_DEBUG */ - srv_buf_pool_flushed += count; - return(count); } @@ -1874,13 +1872,6 @@ buf_flush_common( #endif /* UNIV_DEBUG */ srv_buf_pool_flushed += page_count; - - if (flush_type == BUF_FLUSH_LRU) { - /* We keep track of all flushes happening as part of LRU - flush. When estimating the desired rate at which flush_list - should be flushed we factor in this value. */ - buf_lru_flush_page_count += page_count; - } } /******************************************************************//** diff --git a/dict/dict0load.c b/dict/dict0load.c index 6029e6f0070..7ee120c19c8 100644 --- a/dict/dict0load.c +++ b/dict/dict0load.c @@ -179,7 +179,7 @@ dict_print(void) monitor printout */ mutex_enter(&kernel_mutex); - srv_fatal_semaphore_wait_threshold += 7200; /* 2 hours */ + srv_fatal_semaphore_wait_threshold += SRV_SEMAPHORE_WAIT_EXTENSION; mutex_exit(&kernel_mutex); heap = mem_heap_create(1000); @@ -216,7 +216,7 @@ dict_print(void) /* Restore the fatal semaphore wait timeout */ mutex_enter(&kernel_mutex); - srv_fatal_semaphore_wait_threshold -= 7200; /* 2 hours */ + srv_fatal_semaphore_wait_threshold -= SRV_SEMAPHORE_WAIT_EXTENSION; mutex_exit(&kernel_mutex); } diff --git a/fil/fil0fil.c b/fil/fil0fil.c index 66cbdf51140..32e78cf19b4 100644 --- a/fil/fil0fil.c +++ b/fil/fil0fil.c @@ -1932,7 +1932,7 @@ fil_inc_pending_ops( if (space == NULL) { fprintf(stderr, - "InnoDB: Error: trying to do ibuf merge to a" + "InnoDB: Error: trying to do an operation on a" " dropped tablespace %lu\n", (ulong) id); } @@ -3440,6 +3440,7 @@ skip_info: for (offset = 0; offset < free_limit_bytes; offset += zip_size ? zip_size : UNIV_PAGE_SIZE) { ibool page_is_corrupt; + ibool is_descr_page = FALSE; success = os_file_read(file, page, (ulint)(offset & 0xFFFFFFFFUL), @@ -3478,6 +3479,7 @@ skip_info: /* store as descr page */ memcpy(descr_page, page, (zip_size ? zip_size : UNIV_PAGE_SIZE)); + is_descr_page = TRUE; } else if (descr_is_corrupt) { /* unknown state of the page */ @@ -3554,7 +3556,8 @@ skip_info: } } - if (fil_page_get_type(page) == FIL_PAGE_INDEX) { + if (fil_page_get_type(page) == + FIL_PAGE_INDEX && !is_descr_page) { index_id_t tmp = mach_read_from_8(page + (PAGE_HEADER + PAGE_INDEX_ID)); for (i = 0; i < n_index; i++) { diff --git a/handler/ha_innodb.cc b/handler/ha_innodb.cc index 0d08cd2c1b6..a1a60aa2276 100644 --- a/handler/ha_innodb.cc +++ b/handler/ha_innodb.cc @@ -4807,6 +4807,27 @@ table_opened: DBUG_RETURN(0); } +UNIV_INTERN +handler* +ha_innobase::clone( +/*===============*/ + const char* name, /*!< in: table name */ + MEM_ROOT* mem_root) /*!< in: memory context */ +{ + ha_innobase* new_handler; + + DBUG_ENTER("ha_innobase::clone"); + + new_handler = static_cast(handler::clone(name, + mem_root)); + if (new_handler) { + new_handler->prebuilt->select_lock_type + = prebuilt->select_lock_type; + } + + DBUG_RETURN(new_handler); +} + UNIV_INTERN uint ha_innobase::max_supported_key_part_length() const @@ -9284,7 +9305,7 @@ ha_innobase::check( /* Enlarge the fatal lock wait timeout during CHECK TABLE. */ mutex_enter(&kernel_mutex); - srv_fatal_semaphore_wait_threshold += 7200; /* 2 hours */ + srv_fatal_semaphore_wait_threshold += SRV_SEMAPHORE_WAIT_EXTENSION; mutex_exit(&kernel_mutex); for (index = dict_table_get_first_index(prebuilt->table); @@ -9425,7 +9446,7 @@ ha_innobase::check( /* Restore the fatal lock wait timeout after CHECK TABLE. */ mutex_enter(&kernel_mutex); - srv_fatal_semaphore_wait_threshold -= 7200; /* 2 hours */ + srv_fatal_semaphore_wait_threshold -= SRV_SEMAPHORE_WAIT_EXTENSION; mutex_exit(&kernel_mutex); prebuilt->trx->op_info = ""; diff --git a/handler/ha_innodb.h b/handler/ha_innodb.h index 39ef3631138..abaafcf7978 100644 --- a/handler/ha_innodb.h +++ b/handler/ha_innodb.h @@ -134,6 +134,7 @@ class ha_innobase: public handler const key_map* keys_to_use_for_scanning(); int open(const char *name, int mode, uint test_if_locked); + handler* clone(const char *name, MEM_ROOT *mem_root); int close(void); double scan_time(); double read_time(uint index, uint ranges, ha_rows rows); diff --git a/handler/i_s.cc b/handler/i_s.cc index a2497518da3..a7b453846f7 100644 --- a/handler/i_s.cc +++ b/handler/i_s.cc @@ -1941,6 +1941,8 @@ i_s_sys_tables_fill_table( DBUG_ENTER("i_s_sys_tables_fill_table"); + RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name); + /* deny access to non-superusers */ if (check_global_access(thd, PROCESS_ACL)) { @@ -2248,6 +2250,8 @@ i_s_sys_tables_fill_table_stats( DBUG_ENTER("i_s_sys_tables_fill_table_stats"); + RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name); + /* deny access to non-superusers */ if (check_global_access(thd, PROCESS_ACL)) { @@ -2496,6 +2500,8 @@ i_s_sys_indexes_fill_table( DBUG_ENTER("i_s_sys_indexes_fill_table"); + RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name); + /* deny access to non-superusers */ if (check_global_access(thd, PROCESS_ACL)) { @@ -2737,6 +2743,8 @@ i_s_sys_columns_fill_table( DBUG_ENTER("i_s_sys_columns_fill_table"); + RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name); + /* deny access to non-superusers */ if (check_global_access(thd, PROCESS_ACL)) { @@ -2943,6 +2951,8 @@ i_s_sys_fields_fill_table( DBUG_ENTER("i_s_sys_fields_fill_table"); + RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name); + /* deny access to non-superusers */ if (check_global_access(thd, PROCESS_ACL)) { @@ -3176,6 +3186,8 @@ i_s_sys_foreign_fill_table( DBUG_ENTER("i_s_sys_foreign_fill_table"); + RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name); + /* deny access to non-superusers */ if (check_global_access(thd, PROCESS_ACL)) { @@ -3391,6 +3403,8 @@ i_s_sys_foreign_cols_fill_table( DBUG_ENTER("i_s_sys_foreign_cols_fill_table"); + RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name); + /* deny access to non-superusers */ if (check_global_access(thd, PROCESS_ACL)) { DBUG_RETURN(0); @@ -3610,6 +3624,8 @@ i_s_sys_stats_fill_table( DBUG_ENTER("i_s_sys_stats_fill_table"); + RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name); + /* deny access to non-superusers */ if (check_global_access(thd, PROCESS_ACL)) { DBUG_RETURN(0); @@ -4030,6 +4046,8 @@ i_s_innodb_table_stats_fill( DBUG_ENTER("i_s_innodb_table_stats_fill"); + RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name); + /* deny access to non-superusers */ if (check_global_access(thd, PROCESS_ACL)) { DBUG_RETURN(0); @@ -4093,6 +4111,8 @@ i_s_innodb_index_stats_fill( DBUG_ENTER("i_s_innodb_index_stats_fill"); + RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name); + /* deny access to non-superusers */ if (check_global_access(thd, PROCESS_ACL)) { DBUG_RETURN(0); @@ -4285,6 +4305,8 @@ i_s_innodb_admin_command_fill( DBUG_ENTER("i_s_innodb_admin_command_fill"); + RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name); + /* deny access to non-superusers */ if (check_global_access(thd, PROCESS_ACL)) { DBUG_RETURN(0); diff --git a/include/srv0srv.h b/include/srv0srv.h index 9e860ef285c..2a960089bc2 100644 --- a/include/srv0srv.h +++ b/include/srv0srv.h @@ -298,6 +298,7 @@ extern ibool srv_print_latch_waits; extern ulint srv_activity_count; extern ulint srv_fatal_semaphore_wait_threshold; +#define SRV_SEMAPHORE_WAIT_EXTENSION 7200 extern ulint srv_dml_needed_delay; extern lint srv_kill_idle_transaction; diff --git a/include/univ.i b/include/univ.i index 003f61ceb95..9a6142acf42 100644 --- a/include/univ.i +++ b/include/univ.i @@ -54,7 +54,7 @@ Created 1/20/1994 Heikki Tuuri #define INNODB_VERSION_BUGFIX 8 #ifndef PERCONA_INNODB_VERSION -#define PERCONA_INNODB_VERSION 20.1 +#define PERCONA_INNODB_VERSION 27.0 #endif diff --git a/srv/srv0start.c b/srv/srv0start.c index 34a2fdaa42a..ad9c73478c3 100644 --- a/srv/srv0start.c +++ b/srv/srv0start.c @@ -1507,10 +1507,18 @@ innobase_start_or_create_for_mysql(void) } # endif /* __WIN__ */ - os_aio_init(io_limit, - srv_n_read_io_threads, - srv_n_write_io_threads, - SRV_MAX_N_PENDING_SYNC_IOS); + if (!os_aio_init(io_limit, + srv_n_read_io_threads, + srv_n_write_io_threads, + SRV_MAX_N_PENDING_SYNC_IOS)) { + + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: Fatal error: cannot initialize AIO" + " sub-system\n"); + + return(DB_ERROR); + } fil_init(srv_file_per_table ? 50000 : 5000, srv_max_n_open_files); diff --git a/sync/sync0arr.c b/sync/sync0arr.c index b47c32f5bbf..5f293ad6a55 100644 --- a/sync/sync0arr.c +++ b/sync/sync0arr.c @@ -926,6 +926,11 @@ sync_array_print_long_waits( ibool fatal = FALSE; double longest_diff = 0; + /* For huge tables, skip the check during CHECK TABLE etc... */ + if (fatal_timeout > SRV_SEMAPHORE_WAIT_EXTENSION) { + return(FALSE); + } + #ifdef UNIV_DEBUG_VALGRIND /* Increase the timeouts if running under valgrind because it executes extremely slowly. UNIV_DEBUG_VALGRIND does not necessary mean that