diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-05-17 15:25:12 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-05-17 15:25:31 +0300 |
commit | b390447e71cc3cbd4dc677efeabef771a0a77d64 (patch) | |
tree | 8860beb5f15512adf69c8670d69700675b586542 | |
parent | 5fd7502e7797ecc9e9c5b5dbe35874c18839440c (diff) | |
download | mariadb-git-b390447e71cc3cbd4dc677efeabef771a0a77d64.tar.gz |
MDEV-19513: Remove rw_lock_t::magic_n
The magic_n only complicated object destruction and did not serve
any useful purpose.
-rw-r--r-- | storage/innobase/include/sync0rw.h | 23 | ||||
-rw-r--r-- | storage/innobase/log/log0log.cc | 5 | ||||
-rw-r--r-- | storage/innobase/sync/sync0rw.cc | 12 | ||||
-rw-r--r-- | storage/innobase/trx/trx0purge.cc | 4 |
4 files changed, 1 insertions, 43 deletions
diff --git a/storage/innobase/include/sync0rw.h b/storage/innobase/include/sync0rw.h index 4f23e81185c..34ff0ebb408 100644 --- a/storage/innobase/include/sync0rw.h +++ b/storage/innobase/include/sync0rw.h @@ -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 diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index 3a8bd63fcdd..4964f2bb5f1 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -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); diff --git a/storage/innobase/sync/sync0rw.cc b/storage/innobase/sync/sync0rw.cc index 0f78136c71c..a89c4c1bde4 100644 --- a/storage/innobase/sync/sync0rw.cc +++ b/storage/innobase/sync/sync0rw.cc @@ -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); diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc index 2b03b18d97c..656642b37c9 100644 --- a/storage/innobase/trx/trx0purge.cc +++ b/storage/innobase/trx/trx0purge.cc @@ -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); } |