Commit 153e5c90 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 aa0d3514
......@@ -270,17 +270,11 @@ struct ftnode {
// that have a read lock on an internal node may try to touch the clock
// simultaneously
//
#define BP_TOUCH_CLOCK(node, i) do { \
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_TOUCH_CLOCK(node, i) ((node)->bp[i].clock_count = 1)
#define BP_SWEEP_CLOCK(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
// nodes, such as in splits and creating new roots, and the other is for when
// nodes, such as in splits and creating new roots, and the other is for when
// we are deserializing a node and not all bp's are touched
#define BP_INIT_TOUCHED_CLOCK(node, i) ((node)->bp[i].clock_count = 1)
#define BP_INIT_UNTOUCHED_CLOCK(node, i) ((node)->bp[i].clock_count = 0)
......
......@@ -1038,6 +1038,14 @@ int toku_ftnode_pe_callback (void *ftnode_pv, PAIR_ATTR UU(old_attr), PAIR_ATTR*
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
// 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) {
else if (bfe->type == ftnode_fetch_all) {
retval = false;
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,
// then a partial fetch is required because
// the entire node must be made available
......@@ -1090,7 +1098,7 @@ bool toku_ftnode_pf_req_callback(void* ftnode_pv, void* read_extraargs) {
node,
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
retval = (BP_STATE(node, bfe->child_to_read) != PT_AVAIL);
}
......
......@@ -77,3 +77,10 @@
...
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