Commit c653563d authored by Leif Walsh's avatar Leif Walsh Committed by Yoni Fogel

refs #5672 use a valgrind suppression to ignore the race on the clock

git-svn-id: file:///svn/toku/tokudb@50717 c7de825b-a66e-492c-adef-691d508d4ae1
parent d26168d6
...@@ -270,13 +270,7 @@ struct ftnode { ...@@ -270,13 +270,7 @@ struct ftnode {
// that have a read lock on an internal node may try to touch the clock // that have a read lock on an internal node may try to touch the clock
// simultaneously // simultaneously
// //
#define BP_TOUCH_CLOCK(node, i) do { \ #define BP_TOUCH_CLOCK(node, i) ((node)->bp[i].clock_count = 1)
TOKU_VALGRIND_HG_DISABLE_CHECKING(&(node)->bp[i].clock_count, sizeof (node)->bp[i].clock_count); \
TOKU_DRD_IGNORE_VAR((node)->bp[i].clock_count); \
(node)->bp[i].clock_count = 1; \
TOKU_DRD_STOP_IGNORING_VAR((node)->bp[i].clock_count); \
TOKU_VALGRIND_HG_ENABLE_CHECKING(&(node)->bp[i].clock_count, sizeof (node)->bp[i].clock_count); \
} while (0)
#define BP_SWEEP_CLOCK(node, i) ((node)->bp[i].clock_count = 0) #define BP_SWEEP_CLOCK(node, i) ((node)->bp[i].clock_count = 0)
#define BP_SHOULD_EVICT(node, i) ((node)->bp[i].clock_count == 0) #define BP_SHOULD_EVICT(node, i) ((node)->bp[i].clock_count == 0)
// not crazy about having these two here, one is for the case where we create new // not crazy about having these two here, one is for the case where we create new
......
...@@ -1038,6 +1038,14 @@ exit: ...@@ -1038,6 +1038,14 @@ exit:
return 0; return 0;
} }
// We touch the clock while holding a read lock.
// DRD reports a race but we want to ignore it.
// Using a valgrind suppressions file is better than the DRD_IGNORE_VAR macro because it's more targeted.
// We need a function to have something a drd suppression can reference
// see src/tests/drd.suppressions (unsafe_touch_clock)
static inline void unsafe_touch_clock(FTNODE node, int i) {
BP_TOUCH_CLOCK(node, i);
}
// Callback that states if a partial fetch of the node is necessary // Callback that states if a partial fetch of the node is necessary
// Currently, this function is responsible for the following things: // Currently, this function is responsible for the following things:
...@@ -1067,7 +1075,7 @@ bool toku_ftnode_pf_req_callback(void* ftnode_pv, void* read_extraargs) { ...@@ -1067,7 +1075,7 @@ bool toku_ftnode_pf_req_callback(void* ftnode_pv, void* read_extraargs) {
else if (bfe->type == ftnode_fetch_all) { else if (bfe->type == ftnode_fetch_all) {
retval = false; retval = false;
for (int i = 0; i < node->n_children; i++) { for (int i = 0; i < node->n_children; i++) {
BP_TOUCH_CLOCK(node,i); unsafe_touch_clock(node,i);
// if we find a partition that is not available, // if we find a partition that is not available,
// then a partial fetch is required because // then a partial fetch is required because
// the entire node must be made available // the entire node must be made available
...@@ -1090,7 +1098,7 @@ bool toku_ftnode_pf_req_callback(void* ftnode_pv, void* read_extraargs) { ...@@ -1090,7 +1098,7 @@ bool toku_ftnode_pf_req_callback(void* ftnode_pv, void* read_extraargs) {
node, node,
bfe->search bfe->search
); );
BP_TOUCH_CLOCK(node,bfe->child_to_read); unsafe_touch_clock(node,bfe->child_to_read);
// child we want to read is not available, must set retval to true // child we want to read is not available, must set retval to true
retval = (BP_STATE(node, bfe->child_to_read) != PT_AVAIL); retval = (BP_STATE(node, bfe->child_to_read) != PT_AVAIL);
} }
......
...@@ -77,3 +77,10 @@ ...@@ -77,3 +77,10 @@
... ...
fun:random fun:random
} }
{
unsafe_touch_clock
drd:ConflictingAccess
fun:_ZL18unsafe_touch_clockP6ftnodei
...
}
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment