diff options
author | Jan Lindström <jan.lindstrom@mariadb.com> | 2016-08-12 11:17:45 +0300 |
---|---|---|
committer | Jan Lindström <jan.lindstrom@mariadb.com> | 2016-09-02 13:22:28 +0300 |
commit | 2e814d4702d71a04388386a9f591d14a35980bfe (patch) | |
tree | f3f9b48d116a3738c5e71f3a360ca61f16cfb632 /storage/innobase/include/hash0hash.h | |
parent | 848d211c5c4df00b819cd84d7530cf7d29bb0524 (diff) | |
download | mariadb-git-2e814d4702d71a04388386a9f591d14a35980bfe.tar.gz |
Merge InnoDB 5.7 from mysql-5.7.9.
Contains also
MDEV-10547: Test multi_update_innodb fails with InnoDB 5.7
The failure happened because 5.7 has changed the signature of
the bool handler::primary_key_is_clustered() const
virtual function ("const" was added). InnoDB was using the old
signature which caused the function not to be used.
MDEV-10550: Parallel replication lock waits/deadlock handling does not work with InnoDB 5.7
Fixed mutexing problem on lock_trx_handle_wait. Note that
rpl_parallel and rpl_optimistic_parallel tests still
fail.
MDEV-10156 : Group commit tests fail on 10.2 InnoDB (branch bb-10.2-jan)
Reason: incorrect merge
MDEV-10550: Parallel replication can't sync with master in InnoDB 5.7 (branch bb-10.2-jan)
Reason: incorrect merge
Diffstat (limited to 'storage/innobase/include/hash0hash.h')
-rw-r--r-- | storage/innobase/include/hash0hash.h | 92 |
1 files changed, 47 insertions, 45 deletions
diff --git a/storage/innobase/include/hash0hash.h b/storage/innobase/include/hash0hash.h index 9a4077befb1..a7bcee1185b 100644 --- a/storage/innobase/include/hash0hash.h +++ b/storage/innobase/include/hash0hash.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1997, 2011, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1997, 2015, 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 @@ -29,7 +29,6 @@ Created 5/20/1997 Heikki Tuuri #include "univ.i" #include "mem0mem.h" #ifndef UNIV_HOTBACKUP -# include "sync0sync.h" # include "sync0rw.h" #endif /* !UNIV_HOTBACKUP */ @@ -56,8 +55,7 @@ enum hash_table_sync_t { /*************************************************************//** Creates a hash table with >= n array cells. The actual number of cells is chosen to be a prime number slightly bigger than n. -@return own: created table */ -UNIV_INTERN +@return own: created table */ hash_table_t* hash_create( /*========*/ @@ -67,39 +65,26 @@ hash_create( Creates a sync object array array to protect a hash table. ::sync_obj can be mutexes or rw_locks depening on the type of hash table. */ -UNIV_INTERN void -hash_create_sync_obj_func( -/*======================*/ +hash_create_sync_obj( +/*=================*/ hash_table_t* table, /*!< in: hash table */ - enum hash_table_sync_t type, /*!< in: HASH_TABLE_SYNC_MUTEX + hash_table_sync_t type, /*!< in: HASH_TABLE_SYNC_MUTEX or HASH_TABLE_SYNC_RW_LOCK */ -#ifdef UNIV_SYNC_DEBUG - ulint sync_level,/*!< in: latching order level - of the mutexes: used in the - debug version */ -#endif /* UNIV_SYNC_DEBUG */ + latch_id_t id, /*!< in: mutex/rw_lock ID */ ulint n_sync_obj);/*!< in: number of sync objects, must be a power of 2 */ -#ifdef UNIV_SYNC_DEBUG -# define hash_create_sync_obj(t, s, n, level) \ - hash_create_sync_obj_func(t, s, level, n) -#else /* UNIV_SYNC_DEBUG */ -# define hash_create_sync_obj(t, s, n, level) \ - hash_create_sync_obj_func(t, s, n) -#endif /* UNIV_SYNC_DEBUG */ #endif /* !UNIV_HOTBACKUP */ /*************************************************************//** Frees a hash table. */ -UNIV_INTERN void hash_table_free( /*============*/ hash_table_t* table); /*!< in, own: hash table */ /**************************************************************//** Calculates the hash value from a folded value. -@return hashed value */ +@return hashed value */ UNIV_INLINE ulint hash_calc_hash( @@ -268,7 +253,7 @@ do { \ /************************************************************//** Gets the nth cell in a hash table. -@return pointer to cell */ +@return pointer to cell */ UNIV_INLINE hash_cell_t* hash_get_nth_cell( @@ -286,7 +271,7 @@ hash_table_clear( /*************************************************************//** Returns the number of cells in a hash table. -@return number of cells */ +@return number of cells */ UNIV_INLINE ulint hash_get_n_cells( @@ -364,10 +349,12 @@ do {\ cell_count2222 = hash_get_n_cells(OLD_TABLE);\ \ for (i2222 = 0; i2222 < cell_count2222; i2222++) {\ - NODE_TYPE* node2222 = HASH_GET_FIRST((OLD_TABLE), i2222);\ + NODE_TYPE* node2222 = static_cast<NODE_TYPE*>(\ + HASH_GET_FIRST((OLD_TABLE), i2222));\ \ while (node2222) {\ - NODE_TYPE* next2222 = node2222->PTR_NAME;\ + NODE_TYPE* next2222 = static_cast<NODE_TYPE*>(\ + node2222->PTR_NAME);\ ulint fold2222 = FOLD_FUNC(node2222);\ \ HASH_INSERT(NODE_TYPE, PTR_NAME, (NEW_TABLE),\ @@ -380,7 +367,7 @@ do {\ /************************************************************//** Gets the sync object index for a fold value in a hash table. -@return index */ +@return index */ UNIV_INLINE ulint hash_get_sync_obj_index( @@ -389,7 +376,7 @@ hash_get_sync_obj_index( ulint fold); /*!< in: fold */ /************************************************************//** Gets the nth heap in a hash table. -@return mem heap */ +@return mem heap */ UNIV_INLINE mem_heap_t* hash_get_nth_heap( @@ -398,7 +385,7 @@ hash_get_nth_heap( ulint i); /*!< in: index of the heap */ /************************************************************//** Gets the heap for a fold value in a hash table. -@return mem heap */ +@return mem heap */ UNIV_INLINE mem_heap_t* hash_get_heap( @@ -407,7 +394,7 @@ hash_get_heap( ulint fold); /*!< in: fold */ /************************************************************//** Gets the nth mutex in a hash table. -@return mutex */ +@return mutex */ UNIV_INLINE ib_mutex_t* hash_get_nth_mutex( @@ -416,7 +403,7 @@ hash_get_nth_mutex( ulint i); /*!< in: index of the mutex */ /************************************************************//** Gets the nth rw_lock in a hash table. -@return rw_lock */ +@return rw_lock */ UNIV_INLINE rw_lock_t* hash_get_nth_lock( @@ -425,7 +412,7 @@ hash_get_nth_lock( ulint i); /*!< in: index of the rw_lock */ /************************************************************//** Gets the mutex for a fold value in a hash table. -@return mutex */ +@return mutex */ UNIV_INLINE ib_mutex_t* hash_get_mutex( @@ -434,16 +421,42 @@ hash_get_mutex( ulint fold); /*!< in: fold */ /************************************************************//** Gets the rw_lock for a fold value in a hash table. -@return rw_lock */ +@return rw_lock */ UNIV_INLINE rw_lock_t* hash_get_lock( /*==========*/ hash_table_t* table, /*!< in: hash table */ ulint fold); /*!< in: fold */ + +/** If not appropriate rw_lock for a fold value in a hash table, +relock S-lock the another rw_lock until appropriate for a fold value. +@param[in] hash_lock latched rw_lock to be confirmed +@param[in] table hash table +@param[in] fold fold value +@return latched rw_lock */ +UNIV_INLINE +rw_lock_t* +hash_lock_s_confirm( + rw_lock_t* hash_lock, + hash_table_t* table, + ulint fold); + +/** If not appropriate rw_lock for a fold value in a hash table, +relock X-lock the another rw_lock until appropriate for a fold value. +@param[in] hash_lock latched rw_lock to be confirmed +@param[in] table hash table +@param[in] fold fold value +@return latched rw_lock */ +UNIV_INLINE +rw_lock_t* +hash_lock_x_confirm( + rw_lock_t* hash_lock, + hash_table_t* table, + ulint fold); + /************************************************************//** Reserves the mutex for a fold value in a hash table. */ -UNIV_INTERN void hash_mutex_enter( /*=============*/ @@ -451,7 +464,6 @@ hash_mutex_enter( ulint fold); /*!< in: fold */ /************************************************************//** Releases the mutex for a fold value in a hash table. */ -UNIV_INTERN void hash_mutex_exit( /*============*/ @@ -459,21 +471,18 @@ hash_mutex_exit( ulint fold); /*!< in: fold */ /************************************************************//** Reserves all the mutexes of a hash table, in an ascending order. */ -UNIV_INTERN void hash_mutex_enter_all( /*=================*/ hash_table_t* table); /*!< in: hash table */ /************************************************************//** Releases all the mutexes of a hash table. */ -UNIV_INTERN void hash_mutex_exit_all( /*================*/ hash_table_t* table); /*!< in: hash table */ /************************************************************//** Releases all but the passed in mutex of a hash table. */ -UNIV_INTERN void hash_mutex_exit_all_but( /*====================*/ @@ -481,7 +490,6 @@ hash_mutex_exit_all_but( ib_mutex_t* keep_mutex); /*!< in: mutex to keep */ /************************************************************//** s-lock a lock for a fold value in a hash table. */ -UNIV_INTERN void hash_lock_s( /*========*/ @@ -489,7 +497,6 @@ hash_lock_s( ulint fold); /*!< in: fold */ /************************************************************//** x-lock a lock for a fold value in a hash table. */ -UNIV_INTERN void hash_lock_x( /*========*/ @@ -497,7 +504,6 @@ hash_lock_x( ulint fold); /*!< in: fold */ /************************************************************//** unlock an s-lock for a fold value in a hash table. */ -UNIV_INTERN void hash_unlock_s( /*==========*/ @@ -506,7 +512,6 @@ hash_unlock_s( ulint fold); /*!< in: fold */ /************************************************************//** unlock x-lock for a fold value in a hash table. */ -UNIV_INTERN void hash_unlock_x( /*==========*/ @@ -514,21 +519,18 @@ hash_unlock_x( ulint fold); /*!< in: fold */ /************************************************************//** Reserves all the locks of a hash table, in an ascending order. */ -UNIV_INTERN void hash_lock_x_all( /*============*/ hash_table_t* table); /*!< in: hash table */ /************************************************************//** Releases all the locks of a hash table, in an ascending order. */ -UNIV_INTERN void hash_unlock_x_all( /*==============*/ hash_table_t* table); /*!< in: hash table */ /************************************************************//** Releases all but passed in lock of a hash table, */ -UNIV_INTERN void hash_unlock_x_all_but( /*==================*/ |