mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 06:44:16 +01:00
refs #5351 put this in the race tools header, make sure it does not break a release build
git-svn-id: file:///svn/toku/tokudb@49925 c7de825b-a66e-492c-adef-691d508d4ae1
This commit is contained in:
parent
1840969538
commit
3556f22396
2 changed files with 26 additions and 25 deletions
|
@ -347,28 +347,6 @@ bool treenode::right_imbalanced(int threshold) const {
|
|||
return m_right_child.ptr != nullptr && right_depth > threshold + left_depth;
|
||||
}
|
||||
|
||||
/*
|
||||
* How to make helgrind happy about tree rotations and new mutex orderings:
|
||||
*
|
||||
* // Tell helgrind that we unlocked it so that the next call doesn't get a "destroyed a locked mutex" error.
|
||||
* // Tell helgrind that we destroyed the mutex.
|
||||
* VALGRIND_HG_MUTEX_UNLOCK_PRE(&locka);
|
||||
* VALGRIND_HG_MUTEX_DESTROY_PRE(&locka);
|
||||
*
|
||||
* // And recreate it. It would be better to simply be able to say that the order on these two can now be reversed, because this code forgets all the ordering information for this mutex.
|
||||
* // Then tell helgrind that we have locked it again.
|
||||
* VALGRIND_HG_MUTEX_INIT_POST(&locka, 0);
|
||||
* VALGRIND_HG_MUTEX_LOCK_POST(&locka);
|
||||
*
|
||||
* When the ordering of two locks changes, we don't need tell Helgrind about do both locks. Just one is good enough.
|
||||
*/
|
||||
|
||||
#define RESET_LOCKED_MUTEX_ORDERING_INFO(mutex) \
|
||||
VALGRIND_HG_MUTEX_UNLOCK_PRE(mutex); \
|
||||
VALGRIND_HG_MUTEX_DESTROY_PRE(mutex); \
|
||||
VALGRIND_HG_MUTEX_INIT_POST(mutex, 0); \
|
||||
VALGRIND_HG_MUTEX_LOCK_POST(mutex);
|
||||
|
||||
// effect: rebalances the subtree rooted at this node
|
||||
// using AVL style O(1) rotations. unlocks this
|
||||
// node if it is not the new root of the subtree.
|
||||
|
@ -422,14 +400,14 @@ treenode *treenode::maybe_rebalance(void) {
|
|||
//
|
||||
// one of them is the new root. we unlock everything except the new root.
|
||||
if (child && child != new_root) {
|
||||
RESET_LOCKED_MUTEX_ORDERING_INFO(&child->m_mutex);
|
||||
TOKU_VALGRIND_RESET_MUTEX_ORDERING_INFO(&child->m_mutex);
|
||||
child->mutex_unlock();
|
||||
}
|
||||
if (this != new_root) {
|
||||
RESET_LOCKED_MUTEX_ORDERING_INFO(&m_mutex);
|
||||
TOKU_VALGRIND_RESET_MUTEX_ORDERING_INFO(&m_mutex);
|
||||
mutex_unlock();
|
||||
}
|
||||
RESET_LOCKED_MUTEX_ORDERING_INFO(&new_root->m_mutex);
|
||||
TOKU_VALGRIND_RESET_MUTEX_ORDERING_INFO(&new_root->m_mutex);
|
||||
return new_root;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,28 @@
|
|||
# define TOKU_DRD_IGNORE_VAR(v) DRD_IGNORE_VAR(v)
|
||||
# define TOKU_DRD_STOP_IGNORING_VAR(v) DRD_STOP_IGNORING_VAR(v)
|
||||
|
||||
/*
|
||||
* How to make helgrind happy about tree rotations and new mutex orderings:
|
||||
*
|
||||
* // Tell helgrind that we unlocked it so that the next call doesn't get a "destroyed a locked mutex" error.
|
||||
* // Tell helgrind that we destroyed the mutex.
|
||||
* VALGRIND_HG_MUTEX_UNLOCK_PRE(&locka);
|
||||
* VALGRIND_HG_MUTEX_DESTROY_PRE(&locka);
|
||||
*
|
||||
* // And recreate it. It would be better to simply be able to say that the order on these two can now be reversed, because this code forgets all the ordering information for this mutex.
|
||||
* // Then tell helgrind that we have locked it again.
|
||||
* VALGRIND_HG_MUTEX_INIT_POST(&locka, 0);
|
||||
* VALGRIND_HG_MUTEX_LOCK_POST(&locka);
|
||||
*
|
||||
* When the ordering of two locks changes, we don't need tell Helgrind about do both locks. Just one is good enough.
|
||||
*/
|
||||
|
||||
# define TOKU_VALGRIND_RESET_MUTEX_ORDERING_INFO(mutex) \
|
||||
VALGRIND_HG_MUTEX_UNLOCK_PRE(mutex); \
|
||||
VALGRIND_HG_MUTEX_DESTROY_PRE(mutex); \
|
||||
VALGRIND_HG_MUTEX_INIT_POST(mutex, 0); \
|
||||
VALGRIND_HG_MUTEX_LOCK_POST(mutex);
|
||||
|
||||
#else
|
||||
|
||||
# define NVALGRIND 1
|
||||
|
@ -27,6 +49,7 @@
|
|||
# define TOKU_VALGRIND_HG_DISABLE_CHECKING(p, size) ((void) 0)
|
||||
# define TOKU_DRD_IGNORE_VAR(v)
|
||||
# define TOKU_DRD_STOP_IGNORING_VAR(v)
|
||||
# define TOKU_VALGRIND_RESET_MUTEX_ORDERING_INFO(mutex)
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue