mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 20:42:30 +01:00
MDEV-19513: Remove rw_lock_t::magic_n
The magic_n only complicated object destruction and did not serve any useful purpose.
This commit is contained in:
parent
5fd7502e77
commit
b390447e71
4 changed files with 1 additions and 43 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2008, Google Inc.
|
||||
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
|
||||
Copyright (c) 2017, 2019, MariaDB Corporation.
|
||||
|
||||
Portions of this file contain modifications contributed and copyrighted by
|
||||
Google, Inc. Those modifications are gratefully acknowledged and are described
|
||||
|
@ -625,35 +625,14 @@ struct rw_lock_t
|
|||
#endif /* UNIV_PFS_RWLOCK */
|
||||
|
||||
#ifdef UNIV_DEBUG
|
||||
/** Value of rw_lock_t::magic_n */
|
||||
# define RW_LOCK_MAGIC_N 22643
|
||||
|
||||
/** Constructor */
|
||||
rw_lock_t()
|
||||
{
|
||||
magic_n = RW_LOCK_MAGIC_N;
|
||||
}
|
||||
|
||||
/** Destructor */
|
||||
virtual ~rw_lock_t()
|
||||
{
|
||||
ut_ad(magic_n == RW_LOCK_MAGIC_N);
|
||||
magic_n = 0;
|
||||
}
|
||||
|
||||
virtual std::string to_string() const;
|
||||
|
||||
/** For checking memory corruption. */
|
||||
ulint magic_n;
|
||||
|
||||
/** In the debug version: pointer to the debug info list of the lock */
|
||||
UT_LIST_BASE_NODE_T(rw_lock_debug_t) debug_list;
|
||||
|
||||
/** Level in the global latching order. */
|
||||
latch_level_t level;
|
||||
|
||||
#endif /* UNIV_DEBUG */
|
||||
|
||||
};
|
||||
#ifdef UNIV_DEBUG
|
||||
/** The structure for storing debug info of an rw-lock. All access to this
|
||||
|
|
|
@ -2011,11 +2011,6 @@ void log_t::close()
|
|||
os_event_destroy(flush_event);
|
||||
|
||||
rw_lock_free(&checkpoint_lock);
|
||||
/* rw_lock_free() already called checkpoint_lock.~rw_lock_t();
|
||||
tame the debug assertions when the destructor will be called once more. */
|
||||
ut_ad(checkpoint_lock.magic_n == 0);
|
||||
ut_d(checkpoint_lock.magic_n = RW_LOCK_MAGIC_N);
|
||||
|
||||
mutex_free(&mutex);
|
||||
mutex_free(&write_mutex);
|
||||
mutex_free(&log_flush_order_mutex);
|
||||
|
|
|
@ -238,12 +238,7 @@ rw_lock_create_func(
|
|||
lock->is_block_lock = 0;
|
||||
|
||||
mutex_enter(&rw_lock_list_mutex);
|
||||
|
||||
ut_ad(UT_LIST_GET_FIRST(rw_lock_list) == NULL
|
||||
|| UT_LIST_GET_FIRST(rw_lock_list)->magic_n == RW_LOCK_MAGIC_N);
|
||||
|
||||
UT_LIST_ADD_FIRST(rw_lock_list, lock);
|
||||
|
||||
mutex_exit(&rw_lock_list_mutex);
|
||||
}
|
||||
|
||||
|
@ -268,12 +263,6 @@ rw_lock_free_func(
|
|||
UT_LIST_REMOVE(rw_lock_list, lock);
|
||||
|
||||
mutex_exit(&rw_lock_list_mutex);
|
||||
|
||||
/* We did an in-place new in rw_lock_create_func() */
|
||||
ut_d(lock->~rw_lock_t());
|
||||
/* Sometimes (maybe when compiled with GCC -O3) the above call
|
||||
to rw_lock_t::~rw_lock_t() will not actually assign magic_n=0. */
|
||||
ut_d(lock->magic_n = 0);
|
||||
}
|
||||
|
||||
/******************************************************************//**
|
||||
|
@ -858,7 +847,6 @@ rw_lock_validate(
|
|||
|
||||
lock_word = lock->lock_word.load(std::memory_order_relaxed);
|
||||
|
||||
ut_ad(lock->magic_n == RW_LOCK_MAGIC_N);
|
||||
ut_ad(lock->waiters.load(std::memory_order_relaxed) < 2);
|
||||
ut_ad(lock_word > -(2 * X_LOCK_DECR));
|
||||
ut_ad(lock_word <= X_LOCK_DECR);
|
||||
|
|
|
@ -192,10 +192,6 @@ void purge_sys_t::close()
|
|||
trx->state= TRX_STATE_NOT_STARTED;
|
||||
trx_free(trx);
|
||||
rw_lock_free(&latch);
|
||||
/* rw_lock_free() already called latch.~rw_lock_t(); tame the
|
||||
debug assertions when the destructor will be called once more. */
|
||||
ut_ad(latch.magic_n == 0);
|
||||
ut_d(latch.magic_n= RW_LOCK_MAGIC_N);
|
||||
mutex_free(&pq_mutex);
|
||||
os_event_destroy(event);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue