From 032ed0c0ca1ed7c28abd66f563720016bfe2e952 Mon Sep 17 00:00:00 2001
From: Leif Walsh <leif@tokutek.com>
Date: Wed, 17 Apr 2013 00:01:21 -0400
Subject: [PATCH] refs #5742 #5672 suppress more valgrind stuff

git-svn-id: file:///svn/toku/tokudb@50720 c7de825b-a66e-492c-adef-691d508d4ae1
---
 locktree/locktree.cc            |  9 +++++----
 locktree/locktree.h             |  6 ++++++
 src/tests/drd.suppressions      |  7 ++++++-
 src/tests/helgrind.suppressions | 30 +++++++++++++++++++++++++++++-
 4 files changed, 46 insertions(+), 6 deletions(-)

diff --git a/locktree/locktree.cc b/locktree/locktree.cc
index 20ef9acd74..d228ebd204 100644
--- a/locktree/locktree.cc
+++ b/locktree/locktree.cc
@@ -323,12 +323,13 @@ void locktree::reset_single_txnid_optimization(TXNID txnid) {
     m_single_txnid_optimization_possible = true;
 }
 
+inline bool locktree::unsafe_read_single_txnid_optimization_possible(void) const {
+    return m_single_txnid_optimization_possible;
+}
+
 bool locktree::try_single_txnid_release_optimization(TXNID txnid) {
     bool released = false;
-    TOKU_DRD_IGNORE_VAR(m_single_txnid_optimization_possible);
-    bool optimization_possible = m_single_txnid_optimization_possible;
-    TOKU_DRD_STOP_IGNORING_VAR(m_single_txnid_optimization_possible);
-    if (optimization_possible) {
+    if (unsafe_read_single_txnid_optimization_possible()) {
         // check the bit again with a prepared locked keyrange,
         // which protects the optimization bits and rangetree data
         concurrent_tree::locked_keyrange lkr;
diff --git a/locktree/locktree.h b/locktree/locktree.h
index 23bb113375..cd87897358 100644
--- a/locktree/locktree.h
+++ b/locktree/locktree.h
@@ -283,6 +283,12 @@ private:
     // effect: Sets the single txnid bit to be true for the given txnid
     void reset_single_txnid_optimization(TXNID txnid);
 
+    // Effect:
+    //  Provides a hook for a helgrind suppression.
+    // Returns:
+    //  m_single_txnid_optimization_possible
+    bool unsafe_read_single_txnid_optimization_possible(void) const;
+
     // effect: Creates a locktree that uses the given memory tracker
     //         to report memory usage and honor memory constraints.
     void create(manager::memory_tracker *mem_tracker, DICTIONARY_ID dict_id,
diff --git a/src/tests/drd.suppressions b/src/tests/drd.suppressions
index b40308aedf..715a552271 100644
--- a/src/tests/drd.suppressions
+++ b/src/tests/drd.suppressions
@@ -83,4 +83,9 @@
    drd:ConflictingAccess
    fun:_ZL18unsafe_touch_clockP6ftnodei
    ...
-}
\ No newline at end of file
+}
+{
+   unsafe_read_single_txnid_optimization_possible
+   drd:ConflictingAccess
+   fun:_ZNK4toku8locktree46unsafe_read_single_txnid_optimization_possibleEv
+}
diff --git a/src/tests/helgrind.suppressions b/src/tests/helgrind.suppressions
index ed4a7d3947..5b02e9d9bd 100644
--- a/src/tests/helgrind.suppressions
+++ b/src/tests/helgrind.suppressions
@@ -33,7 +33,11 @@
    unsafe_touch_clock
    Helgrind:Race
    fun:_ZL18unsafe_touch_clockP6ftnodei
-   fun:_Z27toku_ftnode_pf_req_callbackPvS_
+}
+{
+   unsafe_read_single_txnid_optimization_possible
+   Helgrind:Race
+   fun:_ZNK4toku8locktree46unsafe_read_single_txnid_optimization_possibleEv
 }
 {
    kde_bug_307082_cond_destroy_without_signal
@@ -92,3 +96,27 @@
    fun:_Z16toku_ydb_destroyv
    fun:_ZL17libtokudb_destroyv
 }
+{
+   kde_bug_307082_cond_destroy_without_signal
+   Helgrind:Misc
+   ...
+   fun:pthread_cond_destroy@*
+   fun:_ZL17toku_cond_destroyP9toku_cond
+   fun:_Z22toku_minicron_shutdownP8minicron
+}
+{
+   kde_bug_307082_cond_destroy_without_signal
+   Helgrind:Misc
+   ...
+   fun:pthread_cond_destroy@*
+   fun:_ZL17toku_cond_destroyP9toku_cond
+   fun:_ZN4toku12lock_request7destroyEv
+}
+{
+   kde_bug_307082_cond_destroy_without_signal
+   Helgrind:Misc
+   ...
+   fun:pthread_cond_destroy@*
+   fun:_ZL17toku_cond_destroyP9toku_cond
+   fun:_Z17toku_logger_closePP10tokulogger
+}
-- 
2.30.9