diff options
author | Jan Lindström <jan.lindstrom@mariadb.com> | 2016-09-06 09:43:16 +0300 |
---|---|---|
committer | Jan Lindström <jan.lindstrom@mariadb.com> | 2016-09-08 15:49:03 +0300 |
commit | fec844aca88e1c6b9c36bb0b811e92d9d023ffb9 (patch) | |
tree | 3e8602113e591b163bf23fffe95c8908cac88ea3 /storage/innobase/sync | |
parent | 2e814d4702d71a04388386a9f591d14a35980bfe (diff) | |
download | mariadb-git-fec844aca88e1c6b9c36bb0b811e92d9d023ffb9.tar.gz |
Merge InnoDB 5.7 from mysql-5.7.14.
Contains also:
MDEV-10549 mysqld: sql/handler.cc:2692: int handler::ha_index_first(uchar*): Assertion `table_share->tmp_table != NO_TMP_TABLE || m_lock_type != 2' failed. (branch bb-10.2-jan)
Unlike MySQL, InnoDB still uses THR_LOCK in MariaDB
MDEV-10548 Some of the debug sync waits do not work with InnoDB 5.7 (branch bb-10.2-jan)
enable tests that were fixed in MDEV-10549
MDEV-10548 Some of the debug sync waits do not work with InnoDB 5.7 (branch bb-10.2-jan)
fix main.innodb_mysql_sync - re-enable online alter for partitioned innodb tables
Diffstat (limited to 'storage/innobase/sync')
-rw-r--r-- | storage/innobase/sync/sync0arr.cc | 26 | ||||
-rw-r--r-- | storage/innobase/sync/sync0debug.cc | 17 | ||||
-rw-r--r-- | storage/innobase/sync/sync0rw.cc | 46 | ||||
-rw-r--r-- | storage/innobase/sync/sync0sync.cc | 10 |
4 files changed, 55 insertions, 44 deletions
diff --git a/storage/innobase/sync/sync0arr.cc b/storage/innobase/sync/sync0arr.cc index e311023223c..f6416263eee 100644 --- a/storage/innobase/sync/sync0arr.cc +++ b/storage/innobase/sync/sync0arr.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. Copyright (c) 2013, 2015, MariaDB Corporation. All Rights Reserved. @@ -530,9 +530,11 @@ sync_array_cell_print( #endif /* UNIV_DEBUG */ if (mutex) { - fprintf(file, - "Mutex at %p created file %s line %lu, lock var %lu\n" - "Last time reserved by thread %lu in file %s line %lu, " + fprintf(file, + "Mutex at %p, %s, lock var %lu\n" +#ifdef UNIV_DEBUG + "Last time reserved in file %s line %lu" +#endif /* UNIV_DEBUG */ "\n", (void*) mutex, policy.to_string().c_str(), @@ -607,13 +609,13 @@ sync_array_cell_print( " lock_word: %lx\n" "Last time read locked in file %s line %lu\n" "Last time write locked in file %s line %lu\n", - (ulong) rw_lock_get_reader_count(rwlock), - (ulong) rwlock->waiters, + (ulint) rw_lock_get_reader_count(rwlock), + (ulint) rwlock->waiters, rwlock->lock_word, innobase_basename(rwlock->last_s_file_name), - (ulong) rwlock->last_s_line, + (ulint) rwlock->last_s_line, rwlock->last_x_file_name, - (ulong) rwlock->last_x_line); + (ulint) rwlock->last_x_line); /* JAN: TODO: FIX LATER fprintf(file, @@ -735,7 +737,6 @@ sync_array_detect_deadlock( os_thread_id_t thread; ibool ret; rw_lock_debug_t*debug; - os_thread_id_t reserver=0; ut_a(arr); ut_a(start); @@ -834,7 +835,6 @@ sync_array_detect_deadlock( << " file " << name << " line " << policy.get_enter_line(); - sync_array_cell_print(stderr, cell, 0); return(true); } @@ -842,7 +842,8 @@ sync_array_detect_deadlock( /* No deadlock */ return(false); - } + } + case RW_LOCK_X: case RW_LOCK_X_WAIT: @@ -1133,7 +1134,7 @@ sync_array_print_long_waits_low( # define SYNC_ARRAY_TIMEOUT 240 #endif - for (i = 0; i < arr->n_cells; i++) { + for (ulint i = 0; i < arr->n_cells; i++) { sync_cell_t* cell; void* latch; @@ -1301,7 +1302,6 @@ sync_array_print_info_low( { ulint i; ulint count = 0; - os_thread_id_t r = 0; fprintf(file, "OS WAIT ARRAY INFO: reservation count " ULINTPF "\n", diff --git a/storage/innobase/sync/sync0debug.cc b/storage/innobase/sync/sync0debug.cc index f7fcc8d9727..accc9313653 100644 --- a/storage/innobase/sync/sync0debug.cc +++ b/storage/innobase/sync/sync0debug.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2014, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2014, 2016, Oracle and/or its affiliates. All Rights Reserved. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -485,6 +485,7 @@ LatchDebug::LatchDebug() LEVEL_MAP_INSERT(SYNC_RECV); LEVEL_MAP_INSERT(SYNC_LOG_FLUSH_ORDER); LEVEL_MAP_INSERT(SYNC_LOG); + LEVEL_MAP_INSERT(SYNC_LOG_WRITE); LEVEL_MAP_INSERT(SYNC_PAGE_CLEANER); LEVEL_MAP_INSERT(SYNC_PURGE_QUEUE); LEVEL_MAP_INSERT(SYNC_TRX_SYS_HEADER); @@ -766,6 +767,7 @@ LatchDebug::check_order( case SYNC_FTS_CACHE_INIT: case SYNC_PAGE_CLEANER: case SYNC_LOG: + case SYNC_LOG_WRITE: case SYNC_LOG_FLUSH_ORDER: case SYNC_FILE_FORMAT_TAG: case SYNC_DOUBLEWRITE: @@ -1389,6 +1391,8 @@ sync_latch_meta_init() LATCH_ADD(LOG_SYS, SYNC_LOG, log_sys_mutex_key); + LATCH_ADD(LOG_WRITE, SYNC_LOG_WRITE, log_sys_write_mutex_key); + LATCH_ADD(LOG_FLUSH_ORDER, SYNC_LOG_FLUSH_ORDER, log_flush_order_mutex_key); @@ -1538,16 +1542,16 @@ sync_latch_meta_init() LATCH_ADD(HASH_TABLE_RW_LOCK, SYNC_BUF_PAGE_HASH, hash_table_locks_key); -#ifdef UNIV_DEBUG - LATCH_ADD(BUF_CHUNK_MAP_LATCH, SYNC_ANY_LATCH, buf_chunk_map_latch_key); -#endif /* UNIV_DEBUG */ - LATCH_ADD(SYNC_DEBUG_MUTEX, SYNC_NO_ORDER_CHECK, PFS_NOT_INSTRUMENTED); + LATCH_ADD(MASTER_KEY_ID_MUTEX, SYNC_NO_ORDER_CHECK, master_key_id_mutex_key); + /* JAN: TODO: Add PFS instrumentation */ LATCH_ADD(SCRUB_STAT_MUTEX, SYNC_NO_ORDER_CHECK, PFS_NOT_INSTRUMENTED); LATCH_ADD(DEFRAGMENT_MUTEX, SYNC_NO_ORDER_CHECK, PFS_NOT_INSTRUMENTED); + LATCH_ADD(BTR_DEFRAGMENT_MUTEX, SYNC_NO_ORDER_CHECK, PFS_NOT_INSTRUMENTED); LATCH_ADD(MTFLUSH_THREAD_MUTEX, SYNC_NO_ORDER_CHECK, PFS_NOT_INSTRUMENTED); + LATCH_ADD(MTFLUSH_MUTEX, SYNC_NO_ORDER_CHECK, PFS_NOT_INSTRUMENTED); LATCH_ADD(FIL_CRYPT_MUTEX, SYNC_NO_ORDER_CHECK, PFS_NOT_INSTRUMENTED); LATCH_ADD(FIL_CRYPT_STAT_MUTEX, SYNC_NO_ORDER_CHECK, PFS_NOT_INSTRUMENTED); LATCH_ADD(FIL_CRYPT_DATA_MUTEX, SYNC_NO_ORDER_CHECK, PFS_NOT_INSTRUMENTED); @@ -1565,6 +1569,7 @@ sync_latch_meta_init() const latch_meta_t* meta = *it; + /* Skip blank entries */ if (meta == NULL || meta->get_id() == LATCH_ID_NONE) { continue; @@ -1803,6 +1808,6 @@ sync_check_close() create_tracker = NULL; - //sync_latch_meta_destroy(); + // sync_latch_meta_destroy(); } diff --git a/storage/innobase/sync/sync0rw.cc b/storage/innobase/sync/sync0rw.cc index a3eb4254f28..7c8aad640a2 100644 --- a/storage/innobase/sync/sync0rw.cc +++ b/storage/innobase/sync/sync0rw.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. Portions of this file contain modifications contributed and copyrighted by @@ -346,7 +346,7 @@ rw_lock_s_lock_spin( ulint i = 0; /* spin round count */ sync_array_t* sync_arr; ulint spin_count = 0; - ulint count_os_wait = 0; + uint64_t count_os_wait = 0; /* We reuse the thread id to index into the counter, cache it here for efficiency. */ @@ -378,7 +378,8 @@ lock_loop: if (rw_lock_s_lock_low(lock, pass, file_name, line)) { if (count_os_wait > 0) { - lock->count_os_wait += count_os_wait; + lock->count_os_wait += + static_cast<uint32_t>(count_os_wait); rw_lock_stats.rw_s_os_wait_count.add(count_os_wait); } @@ -409,7 +410,8 @@ lock_loop: if (count_os_wait > 0) { - lock->count_os_wait += count_os_wait; + lock->count_os_wait += + static_cast<uint32_t>(count_os_wait); rw_lock_stats.rw_s_os_wait_count.add( count_os_wait); @@ -476,13 +478,14 @@ rw_lock_x_lock_wait_func( ulint i = 0; ulint n_spins = 0; sync_array_t* sync_arr; - ulint count_os_wait = 0; + uint64_t count_os_wait = 0; os_rmb; ut_ad(lock->lock_word <= threshold); while (lock->lock_word < threshold) { + HMT_low(); if (srv_spin_wait_delay) { ut_delay(ut_rnd_interval(0, srv_spin_wait_delay)); @@ -544,6 +547,14 @@ rw_lock_x_lock_wait_func( lock->count_os_wait += count_os_wait; rw_lock_stats.rw_x_os_wait_count.add(count_os_wait); } + + rw_lock_stats.rw_x_spin_round_count.add(n_spins); + + if (count_os_wait > 0) { + lock->count_os_wait += + static_cast<uint32_t>(count_os_wait); + rw_lock_stats.rw_x_os_wait_count.add(count_os_wait); + } } #ifdef UNIV_DEBUG @@ -589,11 +600,7 @@ rw_lock_x_lock_low( os_rmb; } - /* Decrement failed: relock or failed lock - Note: recursive must be loaded before writer_thread see - comment for rw_lock_set_writer_id_and_recursion_flag(). - To achieve this we load it before rw_lock_lock_word_decr(), - An X or SX lock is held by either + /* Decrement failed: An X or SX lock is held by either this thread or another. Try to relock. */ if (!pass && lock->recursive @@ -671,7 +678,6 @@ rw_lock_sx_lock_low( lock, !pass); lock->sx_recursive = 1; - } else { os_thread_id_t thread_id = os_thread_get_curr_id(); @@ -747,7 +753,7 @@ rw_lock_x_lock_func( ulint i = 0; sync_array_t* sync_arr; ulint spin_count = 0; - ulint count_os_wait = 0; + uint64_t count_os_wait = 0; ut_ad(rw_lock_validate(lock)); ut_ad(!rw_lock_own(lock, RW_LOCK_S)); @@ -757,7 +763,8 @@ lock_loop: if (rw_lock_x_lock_low(lock, pass, file_name, line)) { if (count_os_wait > 0) { - lock->count_os_wait += count_os_wait; + lock->count_os_wait += + static_cast<uint32_t>(count_os_wait); rw_lock_stats.rw_x_os_wait_count.add(count_os_wait); } @@ -809,7 +816,8 @@ lock_loop: sync_array_free_cell(sync_arr, cell); if (count_os_wait > 0) { - lock->count_os_wait += count_os_wait; + lock->count_os_wait += + static_cast<uint32_t>(count_os_wait); rw_lock_stats.rw_x_os_wait_count.add(count_os_wait); } @@ -850,7 +858,7 @@ rw_lock_sx_lock_func( ulint i = 0; sync_array_t* sync_arr; ulint spin_count = 0; - ulint count_os_wait = 0; + uint64_t count_os_wait = 0; ulint spin_wait_count = 0; ut_ad(rw_lock_validate(lock)); @@ -861,7 +869,8 @@ lock_loop: if (rw_lock_sx_lock_low(lock, pass, file_name, line)) { if (count_os_wait > 0) { - lock->count_os_wait += count_os_wait; + lock->count_os_wait += + static_cast<uint32_t>(count_os_wait); rw_lock_stats.rw_sx_os_wait_count.add(count_os_wait); } @@ -914,7 +923,8 @@ lock_loop: sync_array_free_cell(sync_arr, cell); if (count_os_wait > 0) { - lock->count_os_wait += count_os_wait; + lock->count_os_wait += + static_cast<uint32_t>(count_os_wait); rw_lock_stats.rw_sx_os_wait_count.add(count_os_wait); } @@ -1249,7 +1259,7 @@ rw_lock_list_print_info( #endif /* INNODB_RW_LOCKS_USE_ATOMICS */ } - fprintf(file, "Total number of rw-locks %ld\n", count); + fprintf(file, "Total number of rw-locks " ULINTPF "\n", count); mutex_exit(&rw_lock_list_mutex); } diff --git a/storage/innobase/sync/sync0sync.cc b/storage/innobase/sync/sync0sync.cc index f304d7dbe15..9aba075caa6 100644 --- a/storage/innobase/sync/sync0sync.cc +++ b/storage/innobase/sync/sync0sync.cc @@ -56,6 +56,7 @@ mysql_pfs_key_t ibuf_bitmap_mutex_key; mysql_pfs_key_t ibuf_mutex_key; mysql_pfs_key_t ibuf_pessimistic_insert_mutex_key; mysql_pfs_key_t log_sys_mutex_key; +mysql_pfs_key_t log_sys_write_mutex_key; mysql_pfs_key_t log_cmdq_mutex_key; mysql_pfs_key_t log_flush_order_mutex_key; mysql_pfs_key_t mutex_list_mutex_key; @@ -68,6 +69,7 @@ mysql_pfs_key_t redo_rseg_mutex_key; mysql_pfs_key_t noredo_rseg_mutex_key; mysql_pfs_key_t page_zip_stat_per_index_mutex_key; # ifdef UNIV_DEBUG +mysql_pfs_key_t sync_thread_mutex_key; mysql_pfs_key_t rw_lock_debug_mutex_key; # endif /* UNIV_DEBUG */ mysql_pfs_key_t rtr_active_mutex_key; @@ -80,9 +82,6 @@ mysql_pfs_key_t srv_dict_tmpfile_mutex_key; mysql_pfs_key_t srv_innodb_monitor_mutex_key; mysql_pfs_key_t srv_misc_tmpfile_mutex_key; mysql_pfs_key_t srv_monitor_file_mutex_key; -# ifdef UNIV_DEBUG -mysql_pfs_key_t sync_thread_mutex_key; -# endif /* UNIV_DEBUG */ mysql_pfs_key_t buf_dblwr_mutex_key; mysql_pfs_key_t trx_undo_mutex_key; mysql_pfs_key_t trx_mutex_key; @@ -99,8 +98,8 @@ mysql_pfs_key_t sync_array_mutex_key; mysql_pfs_key_t thread_mutex_key; mysql_pfs_key_t zip_pad_mutex_key; mysql_pfs_key_t row_drop_list_mutex_key; +mysql_pfs_key_t master_key_id_mutex_key; #endif /* UNIV_PFS_MUTEX */ - #ifdef UNIV_PFS_RWLOCK mysql_pfs_key_t btr_search_latch_key; mysql_pfs_key_t buf_block_lock_key; @@ -118,9 +117,6 @@ mysql_pfs_key_t fts_cache_rw_lock_key; mysql_pfs_key_t fts_cache_init_rw_lock_key; mysql_pfs_key_t trx_i_s_cache_lock_key; mysql_pfs_key_t trx_purge_latch_key; -# ifdef UNIV_DEBUG -mysql_pfs_key_t buf_chunk_map_latch_key; -# endif /* UNIV_DEBUG */ #endif /* UNIV_PFS_RWLOCK */ /** For monitoring active mutexes */ |