diff --git a/lib/logstorage/bitmap.go b/lib/logstorage/bitmap.go index df72f7069..2c0ccd8f4 100644 --- a/lib/logstorage/bitmap.go +++ b/lib/logstorage/bitmap.go @@ -126,6 +126,7 @@ func (bm *bitmap) forEachSetBit(f func(idx int) bool) { if word == 0 { continue } + wordNew := word for j := 0; j < 64; j++ { mask := uint64(1) << j if (word & mask) == 0 { @@ -136,9 +137,12 @@ func (bm *bitmap) forEachSetBit(f func(idx int) bool) { break } if !f(idx) { - a[i] &= ^mask + wordNew &= ^mask } } + if word != wordNew { + a[i] = wordNew + } } }