Skip to content
Snippets Groups Projects
Commit 197f6d23 authored by Manish R Jain's avatar Manish R Jain
Browse files

Pick the number of dirty posting lists to merge, based on the size of the dirtymap.

parent f8a11bda
No related branches found
No related tags found
No related merge requests found
......@@ -101,22 +101,18 @@ func gentlyMerge(ms runtime.MemStats) {
ctr := NewCounters()
defer ctr.ticker.Stop()
// Pick 400 keys from dirty map.
// Pick 1% of the dirty map or 400 keys, whichever is higher.
pick := int(float64(dirtymap.Size()) * 0.01)
if pick < 400 {
pick = 400
}
var hs []gotomic.Hashable
dirtymap.Each(func(k gotomic.Hashable, v gotomic.Thing) bool {
hs = append(hs, k)
return len(hs) >= 400
return len(hs) >= pick
})
idx := 0
t := time.NewTicker(10 * time.Millisecond)
defer t.Stop()
for _ = range t.C {
if idx >= len(hs) {
break
}
hid := hs[idx]
idx += 1
for _, hid := range hs {
dirtymap.Delete(hid)
ret, ok := lhmap.Get(hid)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment