I was reading the code in __cursor_skip_prev and believe we are missing some read barriers there:
/* * Find the first node up the search stack that does not move. * * The depth of the current item must be at least this level, since we * see it in that many levels of the stack. * * !!! Watch these loops carefully: they all rely on the value of i, * and the exit conditions to end up with the right values are * non-trivial. */ ins = NULL; /* -Wconditional-uninitialized */ for (i = 0; i < WT_SKIP_MAXDEPTH - 1; i++) if ((ins = PREV_INS(cbt, i + 1)) != current) break; /* * Find a starting point for the new search. That is either at the non-moving node if we found a * valid node, or the beginning of the next list down that is not the current node. * * Since it is the beginning of a list, and we know the current node is has a skip depth at * least this high, any node we find must sort before the current node. */ if (ins == NULL || ins == current) for (; i >= 0; i--) { cbt->ins_stack[i] = NULL; cbt->next_stack[i] = NULL; ins = cbt->ins_head->head[i]; if (ins != NULL && ins != current) break; }
Here the compiler may choose to reread the ins variable.
else { /* Drop down a level */ cbt->ins_stack[i] = &ins->next[i]; cbt->next_stack[i] = ins->next[i]; --i; }
We may read stale data here.
- is related to
-
WT-10461 Fix key out of order in skip list on weakly ordered architecture
- Closed