28 #include "hash0hash.ic"
33 #ifndef UNIV_HOTBACKUP
35 # ifdef UNIV_PFS_MUTEX
36 UNIV_INTERN mysql_pfs_key_t hash_table_mutex_key;
39 # ifdef UNIV_PFS_RWLOCK
40 UNIV_INTERN mysql_pfs_key_t hash_table_rw_lock_key;
79 for (i = 0; i < table->n_sync_obj; i++) {
81 mutex_enter(table->sync_obj.mutexes + i);
96 for (i = 0; i < table->n_sync_obj; i++) {
98 mutex_exit(table->sync_obj.mutexes + i);
114 for (i = 0; i < table->n_sync_obj; i++) {
117 if (UNIV_LIKELY(keep_mutex != mutex)) {
122 ut_ad(mutex_own(keep_mutex));
140 #ifdef UNIV_SYNC_DEBUG
141 ut_ad(!rw_lock_own(lock, RW_LOCK_SHARED));
142 ut_ad(!rw_lock_own(lock, RW_LOCK_EX));
163 #ifdef UNIV_SYNC_DEBUG
164 ut_ad(!rw_lock_own(lock, RW_LOCK_SHARED));
165 ut_ad(!rw_lock_own(lock, RW_LOCK_EX));
168 rw_lock_x_lock(lock);
187 #ifdef UNIV_SYNC_DEBUG
188 ut_ad(rw_lock_own(lock, RW_LOCK_SHARED));
191 rw_lock_s_unlock(lock);
208 #ifdef UNIV_SYNC_DEBUG
209 ut_ad(rw_lock_own(lock, RW_LOCK_EX));
212 rw_lock_x_unlock(lock);
226 for (i = 0; i < table->n_sync_obj; i++) {
228 rw_lock_t* lock = table->sync_obj.rw_locks +
i;
229 #ifdef UNIV_SYNC_DEBUG
230 ut_ad(!rw_lock_own(lock, RW_LOCK_SHARED));
231 ut_ad(!rw_lock_own(lock, RW_LOCK_EX));
234 rw_lock_x_lock(lock);
249 for (i = 0; i < table->n_sync_obj; i++) {
251 rw_lock_t* lock = table->sync_obj.rw_locks +
i;
252 #ifdef UNIV_SYNC_DEBUG
253 ut_ad(rw_lock_own(lock, RW_LOCK_EX));
256 rw_lock_x_unlock(lock);
272 for (i = 0; i < table->n_sync_obj; i++) {
274 rw_lock_t* lock = table->sync_obj.rw_locks +
i;
275 #ifdef UNIV_SYNC_DEBUG
276 ut_ad(rw_lock_own(lock, RW_LOCK_EX));
279 if (UNIV_LIKELY(keep_lock != lock)) {
280 rw_lock_x_unlock(lock);
311 table->
array = array;
312 table->n_cells = prime;
313 #ifndef UNIV_HOTBACKUP
314 # if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
315 table->adaptive = FALSE;
317 table->n_sync_obj = 0;
318 table->sync_obj.mutexes = NULL;
322 ut_d(table->magic_n = HASH_TABLE_MAGIC_N);
339 ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
345 #ifndef UNIV_HOTBACKUP
357 #ifdef UNIV_SYNC_DEBUG
368 ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
369 ut_a(n_sync_obj > 0);
376 table->sync_obj.mutexes =
static_cast<ib_mutex_t*
>(
379 for (i = 0; i < n_sync_obj; i++) {
380 mutex_create(hash_table_mutex_key,
381 table->sync_obj.mutexes + i, sync_level);
387 table->sync_obj.rw_locks =
static_cast<rw_lock_t*
>(
388 mem_alloc(n_sync_obj *
sizeof(
rw_lock_t)));
390 for (i = 0; i < n_sync_obj; i++) {
392 table->sync_obj.rw_locks + i, sync_level);
401 table->n_sync_obj = n_sync_obj;