diff options
Diffstat (limited to 'storage/xtradb/include')
-rw-r--r-- | storage/xtradb/include/buf0buf.h | 8 | ||||
-rw-r--r-- | storage/xtradb/include/buf0buf.ic | 12 | ||||
-rw-r--r-- | storage/xtradb/include/buf0flu.h | 4 | ||||
-rw-r--r-- | storage/xtradb/include/db0err.h | 5 | ||||
-rw-r--r-- | storage/xtradb/include/dict0dict.h | 11 | ||||
-rw-r--r-- | storage/xtradb/include/dict0mem.h | 137 | ||||
-rw-r--r-- | storage/xtradb/include/fts0ast.h | 7 | ||||
-rw-r--r-- | storage/xtradb/include/ha_prototypes.h | 2 | ||||
-rw-r--r-- | storage/xtradb/include/lock0priv.h | 7 | ||||
-rw-r--r-- | storage/xtradb/include/os0file.h | 2 | ||||
-rw-r--r-- | storage/xtradb/include/os0sync.h | 4 | ||||
-rw-r--r-- | storage/xtradb/include/row0merge.h | 3 | ||||
-rw-r--r-- | storage/xtradb/include/sync0rw.ic | 7 | ||||
-rw-r--r-- | storage/xtradb/include/sync0sync.h | 1 | ||||
-rw-r--r-- | storage/xtradb/include/trx0roll.h | 4 | ||||
-rw-r--r-- | storage/xtradb/include/trx0trx.h | 15 | ||||
-rw-r--r-- | storage/xtradb/include/univ.i | 4 |
17 files changed, 199 insertions, 34 deletions
diff --git a/storage/xtradb/include/buf0buf.h b/storage/xtradb/include/buf0buf.h index 15f36e4343c..d8a3e77d820 100644 --- a/storage/xtradb/include/buf0buf.h +++ b/storage/xtradb/include/buf0buf.h @@ -1283,7 +1283,7 @@ page_hash lock is acquired in the specified lock mode. Otherwise, mode value is ignored. It is up to the caller to release the lock. If the block is found and the lock is NULL then the page_hash lock is released by this function. -@return block, NULL if not found */ +@return block, NULL if not found, or watch sentinel (if watch is true) */ UNIV_INLINE buf_page_t* buf_page_hash_get_locked( @@ -1299,9 +1299,11 @@ buf_page_hash_get_locked( found. NULL otherwise. If NULL is passed then the hash_lock is released by this function */ - ulint lock_mode); /*!< in: RW_LOCK_EX or + ulint lock_mode, /*!< in: RW_LOCK_EX or RW_LOCK_SHARED. Ignored if lock == NULL */ + bool watch = false); /*!< in: if true, return watch + sentinel also. */ /******************************************************************//** Returns the control block of a file page, NULL if not found. If the block is found and lock is not NULL then the appropriate @@ -1341,6 +1343,8 @@ buf_page_hash_get_low() function. buf_page_hash_get_locked(b, s, o, l, RW_LOCK_EX) #define buf_page_hash_get(b, s, o) \ buf_page_hash_get_locked(b, s, o, NULL, 0) +#define buf_page_get_also_watch(b, s, o) \ + buf_page_hash_get_locked(b, s, o, NULL, 0, true) #define buf_block_hash_get_s_locked(b, s, o, l) \ buf_block_hash_get_locked(b, s, o, l, RW_LOCK_SHARED) diff --git a/storage/xtradb/include/buf0buf.ic b/storage/xtradb/include/buf0buf.ic index 10f0e02cb8f..b40285ae3f0 100644 --- a/storage/xtradb/include/buf0buf.ic +++ b/storage/xtradb/include/buf0buf.ic @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. Portions of this file contain modifications contributed and copyrighted by @@ -1193,7 +1193,7 @@ page_hash lock is acquired in the specified lock mode. Otherwise, mode value is ignored. It is up to the caller to release the lock. If the block is found and the lock is NULL then the page_hash lock is released by this function. -@return block, NULL if not found */ +@return block, NULL if not found, or watch sentinel (if watch is true) */ UNIV_INLINE buf_page_t* buf_page_hash_get_locked( @@ -1209,9 +1209,11 @@ buf_page_hash_get_locked( found. NULL otherwise. If NULL is passed then the hash_lock is released by this function */ - ulint lock_mode) /*!< in: RW_LOCK_EX or + ulint lock_mode, /*!< in: RW_LOCK_EX or RW_LOCK_SHARED. Ignored if lock == NULL */ + bool watch) /*!< in: if true, return watch + sentinel also. */ { buf_page_t* bpage = NULL; ulint fold; @@ -1242,7 +1244,9 @@ buf_page_hash_get_locked( bpage = buf_page_hash_get_low(buf_pool, space, offset, fold); if (!bpage || buf_pool_watch_is_sentinel(buf_pool, bpage)) { - bpage = NULL; + if (!watch) { + bpage = NULL; + } goto unlock_and_exit; } diff --git a/storage/xtradb/include/buf0flu.h b/storage/xtradb/include/buf0flu.h index ab5349901e9..5cc0eb9d4cf 100644 --- a/storage/xtradb/include/buf0flu.h +++ b/storage/xtradb/include/buf0flu.h @@ -85,8 +85,8 @@ buf_flush_init_for_writing( # if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG /********************************************************************//** Writes a flushable page asynchronously from the buffer pool to a file. -NOTE: block->mutex must be held upon entering this function, and they will be -released by this function after flushing. This is loosely based on +NOTE: block and LRU list mutexes must be held upon entering this function, and +they will be released by this function after flushing. This is loosely based on buf_flush_batch() and buf_flush_page(). @return TRUE if the page was flushed and the mutexes released */ UNIV_INTERN diff --git a/storage/xtradb/include/db0err.h b/storage/xtradb/include/db0err.h index 744b80ecd05..dab917e18db 100644 --- a/storage/xtradb/include/db0err.h +++ b/storage/xtradb/include/db0err.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -130,7 +130,8 @@ enum dberr_t { DB_TEMP_FILE_WRITE_FAILURE, /*!< Temp file write failure */ DB_FTS_TOO_MANY_WORDS_IN_PHRASE, /*< Too many words in a phrase */ - + DB_TOO_BIG_FOR_REDO, /* Record length greater than 10% + of redo log */ /* The following are partial failure codes */ DB_FAIL = 1000, DB_OVERFLOW, diff --git a/storage/xtradb/include/dict0dict.h b/storage/xtradb/include/dict0dict.h index c2bf55a1a16..43fa613e756 100644 --- a/storage/xtradb/include/dict0dict.h +++ b/storage/xtradb/include/dict0dict.h @@ -600,6 +600,17 @@ dict_table_get_col_name( ulint col_nr) /*!< in: column number */ __attribute__((nonnull, warn_unused_result)); /**********************************************************************//** +Returns a column's name. +@return column name. NOTE: not guaranteed to stay valid if table is +modified in any way (columns added, etc.). */ +UNIV_INTERN +const char* +dict_table_get_col_name_for_mysql( +/*==============================*/ + const dict_table_t* table, /*!< in: table */ + const char* col_name)/*!< in: MySQL table column name */ + __attribute__((nonnull, warn_unused_result)); +/**********************************************************************//** Prints a table data. */ UNIV_INTERN void diff --git a/storage/xtradb/include/dict0mem.h b/storage/xtradb/include/dict0mem.h index 7bec1499fd2..473aefec418 100644 --- a/storage/xtradb/include/dict0mem.h +++ b/storage/xtradb/include/dict0mem.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. Copyright (c) 2013, SkySQL Ab. All Rights Reserved. @@ -54,6 +54,7 @@ Created 1/8/1996 Heikki Tuuri #include <set> #include <algorithm> #include <iterator> +#include <ostream> /* Forward declaration. */ struct ib_rbt_t; @@ -313,10 +314,7 @@ dict_mem_table_create( of the table is placed */ ulint n_cols, /*!< in: number of columns */ ulint flags, /*!< in: table flags */ - ulint flags2, /*!< in: table flags2 */ - bool nonshared);/*!< in: whether the table object is a dummy - one that does not need the initialization of - locking-related fields. */ + ulint flags2); /*!< in: table flags2 */ /**********************************************************************//** Determines if a table belongs to a system database @return true if table belong to a system database */ @@ -608,11 +606,12 @@ extern ulong zip_failure_threshold_pct; compression failures */ extern ulong zip_pad_max; -/** Data structure to hold information about about how much space in +/** Data structure to hold information about how much space in an uncompressed page should be left as padding to avoid compression failures. This estimate is based on a self-adapting heuristic. */ struct zip_pad_info_t { - os_fast_mutex_t mutex; /*!< mutex protecting the info */ + os_fast_mutex_t* + mutex; /*!< mutex protecting the info */ ulint pad; /*!< number of bytes used as pad */ ulint success;/*!< successful compression ops during current round */ @@ -620,6 +619,9 @@ struct zip_pad_info_t { current round */ ulint n_rounds;/*!< number of currently successful rounds */ + volatile os_once::state_t + mutex_created; + /*!< Creation state of mutex member */ }; /** Data structure for an index. Most fields will be @@ -1098,8 +1100,7 @@ struct dict_table_t{ dict_table_t::indexes*::stat_index_size dict_table_t::indexes*::stat_n_leaf_pages (*) those are not always protected for - performance reasons. NULL for dumy table - objects. */ + performance reasons. */ unsigned stat_initialized:1; /*!< TRUE if statistics have been calculated the first time after database startup or table creation */ @@ -1224,12 +1225,15 @@ struct dict_table_t{ and release it without a need to allocate space from the lock heap of the trx: otherwise the lock heap would grow rapidly - if we do a large insert from a select. NULL - for dummy table objects. */ - ib_mutex_t autoinc_mutex; + if we do a large insert from a select */ + ib_mutex_t* autoinc_mutex; /*!< mutex protecting the autoincrement - counter. Not initialized for dummy table - objects */ + counter */ + + /** Creation state of autoinc_mutex member */ + volatile os_once::state_t + autoinc_mutex_created; + ib_uint64_t autoinc;/*!< autoinc counter value to give to the next inserted row */ ulong n_waiting_or_granted_auto_inc_locks; @@ -1293,6 +1297,111 @@ struct dict_foreign_add_to_referenced_table { } }; +/** Destroy the autoinc latch of the given table. +This function is only called from either single threaded environment +or from a thread that has not shared the table object with other threads. +@param[in,out] table table whose stats latch to destroy */ +inline +void +dict_table_autoinc_destroy( + dict_table_t* table) +{ + if (table->autoinc_mutex_created == os_once::DONE + && table->autoinc_mutex != NULL) { + mutex_free(table->autoinc_mutex); + delete table->autoinc_mutex; + } +} + +/** Allocate and init the autoinc latch of a given table. +This function must not be called concurrently on the same table object. +@param[in,out] table_void table whose autoinc latch to create */ +void +dict_table_autoinc_alloc( + void* table_void); + +/** Allocate and init the zip_pad_mutex of a given index. +This function must not be called concurrently on the same index object. +@param[in,out] index_void index whose zip_pad_mutex to create */ +void +dict_index_zip_pad_alloc( + void* index_void); + +/** Request for lazy creation of the autoinc latch of a given table. +This function is only called from either single threaded environment +or from a thread that has not shared the table object with other threads. +@param[in,out] table table whose autoinc latch is to be created. */ +inline +void +dict_table_autoinc_create_lazy( + dict_table_t* table) +{ +#ifdef HAVE_ATOMIC_BUILTINS + table->autoinc_mutex = NULL; + table->autoinc_mutex_created = os_once::NEVER_DONE; +#else /* HAVE_ATOMIC_BUILTINS */ + dict_table_autoinc_alloc(table); + table->autoinc_mutex_created = os_once::DONE; +#endif /* HAVE_ATOMIC_BUILTINS */ +} + +/** Request a lazy creation of dict_index_t::zip_pad::mutex. +This function is only called from either single threaded environment +or from a thread that has not shared the table object with other threads. +@param[in,out] index index whose zip_pad mutex is to be created */ +inline +void +dict_index_zip_pad_mutex_create_lazy( + dict_index_t* index) +{ +#ifdef HAVE_ATOMIC_BUILTINS + index->zip_pad.mutex = NULL; + index->zip_pad.mutex_created = os_once::NEVER_DONE; +#else /* HAVE_ATOMIC_BUILTINS */ + dict_index_zip_pad_alloc(index); + index->zip_pad.mutex_created = os_once::DONE; +#endif /* HAVE_ATOMIC_BUILTINS */ +} + +/** Destroy the zip_pad_mutex of the given index. +This function is only called from either single threaded environment +or from a thread that has not shared the table object with other threads. +@param[in,out] table table whose stats latch to destroy */ +inline +void +dict_index_zip_pad_mutex_destroy( + dict_index_t* index) +{ + if (index->zip_pad.mutex_created == os_once::DONE + && index->zip_pad.mutex != NULL) { + os_fast_mutex_free(index->zip_pad.mutex); + delete index->zip_pad.mutex; + } +} + +/** Release the zip_pad_mutex of a given index. +@param[in,out] index index whose zip_pad_mutex is to be released */ +inline +void +dict_index_zip_pad_unlock( + dict_index_t* index) +{ + os_fast_mutex_unlock(index->zip_pad.mutex); +} + +#ifdef UNIV_DEBUG +/** Check if the current thread owns the autoinc_mutex of a given table. +@param[in] table the autoinc_mutex belongs to this table +@return true, if the current thread owns the autoinc_mutex, false otherwise.*/ +inline +bool +dict_table_autoinc_own( + const dict_table_t* table) +{ + return(mutex_own(table->autoinc_mutex)); +} +#endif /* UNIV_DEBUG */ + #ifndef UNIV_NONINL #include "dict0mem.ic" #endif diff --git a/storage/xtradb/include/fts0ast.h b/storage/xtradb/include/fts0ast.h index 50ee587e282..b2380f78b39 100644 --- a/storage/xtradb/include/fts0ast.h +++ b/storage/xtradb/include/fts0ast.h @@ -329,4 +329,11 @@ struct fts_ast_state_t { tokenization */ }; +#ifdef UNIV_DEBUG +const char* +fts_ast_oper_name_get(fts_ast_oper_t oper); +const char* +fts_ast_node_type_get(fts_ast_type_t type); +#endif /* UNIV_DEBUG */ + #endif /* INNOBASE_FSTS0AST_H */ diff --git a/storage/xtradb/include/ha_prototypes.h b/storage/xtradb/include/ha_prototypes.h index 66a96282b69..3c14828989b 100644 --- a/storage/xtradb/include/ha_prototypes.h +++ b/storage/xtradb/include/ha_prototypes.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2006, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2006, 2014, Oracle and/or its affiliates. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software diff --git a/storage/xtradb/include/lock0priv.h b/storage/xtradb/include/lock0priv.h index e564387ec53..90d5dc994a4 100644 --- a/storage/xtradb/include/lock0priv.h +++ b/storage/xtradb/include/lock0priv.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 2007, 2011, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2015, MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -72,6 +73,12 @@ struct lock_t { hash_node_t hash; /*!< hash chain node for a record lock */ dict_index_t* index; /*!< index for a record lock */ + + /* Statistics for how long lock has been held and time + how long this lock had to be waited before it was granted */ + time_t requested_time; /*!< Lock request time */ + ulint wait_time; /*!< Time waited this lock or 0 */ + union { lock_table_t tab_lock;/*!< table lock */ lock_rec_t rec_lock;/*!< record lock */ diff --git a/storage/xtradb/include/os0file.h b/storage/xtradb/include/os0file.h index 89a1d8c0fe4..78af907c006 100644 --- a/storage/xtradb/include/os0file.h +++ b/storage/xtradb/include/os0file.h @@ -1,6 +1,6 @@ /*********************************************************************** -Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2009, Percona Inc. Copyright (c) 2013, SkySQL Ab. All Rights Reserved. diff --git a/storage/xtradb/include/os0sync.h b/storage/xtradb/include/os0sync.h index f968de7c6dd..3a7707ee130 100644 --- a/storage/xtradb/include/os0sync.h +++ b/storage/xtradb/include/os0sync.h @@ -452,7 +452,7 @@ Returns the old value of *ptr, atomically sets *ptr to new_val */ # define os_atomic_test_and_set_ulint(ptr, new_val) \ __sync_lock_test_and_set(ptr, new_val) -#ifdef __powerpc__ +#if defined(__powerpc__) || defined(__aarch64__) /* os_atomic_test_and_set_byte_release() should imply a release barrier before setting, and a full barrier after. But __sync_lock_test_and_set() is only @@ -531,7 +531,7 @@ amount of increment. */ os_atomic_increment_ulint((ulong_t*) ptr, amount) # define os_atomic_increment_uint64(ptr, amount) \ - atomic_add_64_nv(ptr, amount) + atomic_add_64_nv((uint64_t *) ptr, amount) /* Returns the resulting value, ptr is pointer to target, amount is the amount to decrement. */ diff --git a/storage/xtradb/include/row0merge.h b/storage/xtradb/include/row0merge.h index 390c0ce038b..de353d46202 100644 --- a/storage/xtradb/include/row0merge.h +++ b/storage/xtradb/include/row0merge.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2005, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2005, 2014, Oracle and/or its affiliates. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -95,6 +95,7 @@ struct index_field_t { ulint col_no; /*!< column offset */ ulint prefix_len; /*!< column prefix length, or 0 if indexing the whole column */ + const char* col_name; /*!< column name or NULL */ }; /** Definition of an index being created */ diff --git a/storage/xtradb/include/sync0rw.ic b/storage/xtradb/include/sync0rw.ic index 8aadc406132..d481d14009b 100644 --- a/storage/xtradb/include/sync0rw.ic +++ b/storage/xtradb/include/sync0rw.ic @@ -511,6 +511,7 @@ rw_lock_x_lock_func_nowait( ulint line) /*!< in: line where requested */ { ibool success; + ibool local_recursive= lock->recursive; #ifdef INNODB_RW_LOCKS_USE_ATOMICS success = os_compare_and_swap_lint(&lock->lock_word, X_LOCK_DECR, 0); @@ -525,10 +526,14 @@ rw_lock_x_lock_func_nowait( mutex_exit(&(lock->mutex)); #endif + /* 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 os_compare_and_swap_lint(), + which implies full memory barrier in current implementation. */ if (success) { rw_lock_set_writer_id_and_recursion_flag(lock, TRUE); - } else if (lock->recursive + } else if (local_recursive && os_thread_eq(lock->writer_thread, os_thread_get_curr_id())) { /* Relock: this lock_word modification is safe since no other diff --git a/storage/xtradb/include/sync0sync.h b/storage/xtradb/include/sync0sync.h index 788f765f919..ffe2d635fbd 100644 --- a/storage/xtradb/include/sync0sync.h +++ b/storage/xtradb/include/sync0sync.h @@ -69,7 +69,6 @@ instrumentation due to their large number of instances. */ /* Key defines to register InnoDB mutexes with performance schema */ extern mysql_pfs_key_t autoinc_mutex_key; extern mysql_pfs_key_t buffer_block_mutex_key; -extern mysql_pfs_key_t buf_pool_mutex_key; extern mysql_pfs_key_t buf_pool_zip_mutex_key; extern mysql_pfs_key_t buf_pool_LRU_list_mutex_key; extern mysql_pfs_key_t buf_pool_free_list_mutex_key; diff --git a/storage/xtradb/include/trx0roll.h b/storage/xtradb/include/trx0roll.h index aa3dbb1f6cd..629b41569f6 100644 --- a/storage/xtradb/include/trx0roll.h +++ b/storage/xtradb/include/trx0roll.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -33,6 +33,8 @@ Created 3/26/1996 Heikki Tuuri #include "mtr0mtr.h" #include "trx0sys.h" +extern bool trx_rollback_or_clean_is_active; + /*******************************************************************//** Determines if this transaction is rolling back an incomplete transaction in crash recovery. diff --git a/storage/xtradb/include/trx0trx.h b/storage/xtradb/include/trx0trx.h index c97be0e4f03..fc1871d438e 100644 --- a/storage/xtradb/include/trx0trx.h +++ b/storage/xtradb/include/trx0trx.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2015, MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -1058,6 +1059,20 @@ struct trx_t{ #define DPAH_SIZE 8192 byte* distinct_page_access_hash; ibool take_stats; + + /* Lock wait statistics */ + ulint n_rec_lock_waits; + /*!< Number of record lock waits, + might not be exactly correct. */ + ulint n_table_lock_waits; + /*!< Number of table lock waits, + might not be exactly correct. */ + ulint total_rec_lock_wait_time; + /*!< Total rec lock wait time up + to this moment. */ + ulint total_table_lock_wait_time; + /*!< Total table lock wait time + up to this moment. */ }; /* Transaction isolation levels (trx->isolation_level) */ diff --git a/storage/xtradb/include/univ.i b/storage/xtradb/include/univ.i index 24145d1cbb7..6b0c33df44c 100644 --- a/storage/xtradb/include/univ.i +++ b/storage/xtradb/include/univ.i @@ -45,10 +45,10 @@ Created 1/20/1994 Heikki Tuuri #define INNODB_VERSION_MAJOR 5 #define INNODB_VERSION_MINOR 6 -#define INNODB_VERSION_BUGFIX 22 +#define INNODB_VERSION_BUGFIX 24 #ifndef PERCONA_INNODB_VERSION -#define PERCONA_INNODB_VERSION 71.0 +#define PERCONA_INNODB_VERSION 72.2 #endif /* Enable UNIV_LOG_ARCHIVE in XtraDB */ |