Skip to content

Commit

Permalink
Fix merge mem contro 1.2 (#17479)
Browse files Browse the repository at this point in the history
check memory usage first when considering popping

Approved by: @XuPeng-SH, @sukki37
  • Loading branch information
aptend authored Jul 11, 2024
1 parent 58b49cc commit 424f10d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pkg/vm/engine/tae/db/merge/policyBasic.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,12 +325,15 @@ func (o *basic) controlMem(objs []*catalog.ObjectEntry, mem int64) []*catalog.Ob
}

needPopout := func(ss []*catalog.ObjectEntry) bool {
_, esize, _ := estimateMergeConsume(ss)
if esize > int(2*mem/3) {
return true
}

if len(ss) <= 2 {
return false
}

_, esize, _ := estimateMergeConsume(ss)
return esize > int(2*mem/3)
return false
}
for needPopout(objs) {
objs = objs[:len(objs)-1]
Expand Down

0 comments on commit 424f10d

Please sign in to comment.