Add (temporary, perhaps) locking on TestTx_CountRange

On roaring, CountRange needs to have exclusive access to a fragment, but
doesn't currently require a lock, because it's usually used from inside
other already-locked things.
This commit is contained in:
Seebs 2020-12-14 11:18:13 -06:00
parent de14762661
commit 0952db5af7

View file

@ -81,6 +81,11 @@ func TestTx_CountRange(t *testing.T) {
f, tx := requireCountRangeSampleData(t)
defer f.Clean(t)
defer tx.Rollback()
// CountRange accesses the fragment without locking. Normally we only
// call it from inside a fragment routine with locking. Otherwise, you
// can have a race condition with snapshots, for instance.
f.mu.Lock()
defer f.mu.Unlock()
expected := uint64(0)
j := uint64(0)