summaryrefslogtreecommitdiff
path: root/innobase/ha/hash0hash.c
diff options
context:
space:
mode:
Diffstat (limited to 'innobase/ha/hash0hash.c')
-rw-r--r--innobase/ha/hash0hash.c38
1 files changed, 32 insertions, 6 deletions
diff --git a/innobase/ha/hash0hash.c b/innobase/ha/hash0hash.c
index 372104e54b3..facdea66198 100644
--- a/innobase/ha/hash0hash.c
+++ b/innobase/ha/hash0hash.c
@@ -22,7 +22,6 @@ hash_mutex_enter(
hash_table_t* table, /* in: hash table */
ulint fold) /* in: fold */
{
- ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
mutex_enter(hash_get_mutex(table, fold));
}
@@ -35,10 +34,41 @@ hash_mutex_exit(
hash_table_t* table, /* in: hash table */
ulint fold) /* in: fold */
{
- ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
mutex_exit(hash_get_mutex(table, fold));
}
+/****************************************************************
+Reserves all the mutexes of a hash table, in an ascending order. */
+
+void
+hash_mutex_enter_all(
+/*=================*/
+ hash_table_t* table) /* in: hash table */
+{
+ ulint i;
+
+ for (i = 0; i < table->n_mutexes; i++) {
+
+ mutex_enter(table->mutexes + i);
+ }
+}
+
+/****************************************************************
+Releases all the mutexes of a hash table. */
+
+void
+hash_mutex_exit_all(
+/*================*/
+ hash_table_t* table) /* in: hash table */
+{
+ ulint i;
+
+ for (i = 0; i < table->n_mutexes; i++) {
+
+ mutex_exit(table->mutexes + i);
+ }
+}
+
/*****************************************************************
Creates a hash table with >= n array cells. The actual number of cells is
chosen to be a prime number slightly bigger than n. */
@@ -68,9 +98,7 @@ hash_create(
table->mutexes = NULL;
table->heaps = NULL;
table->heap = NULL;
-#ifdef UNIV_DEBUG
table->magic_n = HASH_TABLE_MAGIC_N;
-#endif /* UNIV_DEBUG */
/* Initialize the cell array */
@@ -91,7 +119,6 @@ hash_table_free(
/*============*/
hash_table_t* table) /* in, own: hash table */
{
- ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
ut_a(table->mutexes == NULL);
ut_free(table->array);
@@ -113,7 +140,6 @@ hash_create_mutexes(
ulint i;
ut_a(n_mutexes == ut_2_power_up(n_mutexes));
- ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
table->mutexes = mem_alloc(n_mutexes * sizeof(mutex_t));