mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-08 10:08:42 +08:00
Improve log print in OOM error info (#16170)
Signed-off-by: bigsheeper <yihao.dai@zilliz.com>
This commit is contained in:
parent
92b5436bbd
commit
7fee4743f5
@ -665,20 +665,24 @@ func (loader *segmentLoader) checkSegmentSize(collectionID UniqueID, segmentLoad
|
|||||||
return fmt.Errorf("get memory failed when checkSegmentSize, collectionID = %d", collectionID)
|
return fmt.Errorf("get memory failed when checkSegmentSize, collectionID = %d", collectionID)
|
||||||
}
|
}
|
||||||
|
|
||||||
usedMemAfterLoad := int64(usedMem)
|
usedMemAfterLoad := usedMem
|
||||||
maxSegmentSize := int64(0)
|
maxSegmentSize := uint64(0)
|
||||||
for _, loadInfo := range segmentLoadInfos {
|
for _, loadInfo := range segmentLoadInfos {
|
||||||
segmentSize := loadInfo.SegmentSize
|
segmentSize := uint64(loadInfo.SegmentSize)
|
||||||
usedMemAfterLoad += segmentSize
|
usedMemAfterLoad += segmentSize
|
||||||
if segmentSize > maxSegmentSize {
|
if segmentSize > maxSegmentSize {
|
||||||
maxSegmentSize = segmentSize
|
maxSegmentSize = segmentSize
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toMB := func(mem uint64) float64 {
|
||||||
|
return float64(mem) / 1024 / 1024
|
||||||
|
}
|
||||||
|
|
||||||
// when load segment, data will be copied from go memory to c++ memory
|
// when load segment, data will be copied from go memory to c++ memory
|
||||||
if uint64(usedMemAfterLoad+maxSegmentSize*int64(concurrency)) > uint64(float64(totalMem)*Params.QueryNodeCfg.OverloadedMemoryThresholdPercentage) {
|
if usedMemAfterLoad+maxSegmentSize*uint64(concurrency) > uint64(float64(totalMem)*Params.QueryNodeCfg.OverloadedMemoryThresholdPercentage) {
|
||||||
return fmt.Errorf("load segment failed, OOM if load, collectionID = %d, maxSegmentSize = %d, usedMemAfterLoad = %d, totalMem = %d, thresholdFactor = %f",
|
return fmt.Errorf("load segment failed, OOM if load, collectionID = %d, maxSegmentSize = %.2f MB, concurrency = %d, usedMemAfterLoad = %.2f MB, totalMem = %.2f MB, thresholdFactor = %f",
|
||||||
collectionID, maxSegmentSize, usedMemAfterLoad, totalMem, Params.QueryNodeCfg.OverloadedMemoryThresholdPercentage)
|
collectionID, toMB(maxSegmentSize), concurrency, toMB(usedMemAfterLoad), toMB(totalMem), Params.QueryNodeCfg.OverloadedMemoryThresholdPercentage)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@ -23,13 +23,12 @@ import (
|
|||||||
"runtime"
|
"runtime"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/milvus-io/milvus/internal/mq/msgstream"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/milvus-io/milvus/internal/proto/internalpb"
|
|
||||||
"github.com/stretchr/testify/mock"
|
"github.com/stretchr/testify/mock"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/milvus-io/milvus/internal/mq/msgstream"
|
||||||
|
|
||||||
"github.com/milvus-io/milvus/internal/proto/commonpb"
|
"github.com/milvus-io/milvus/internal/proto/commonpb"
|
||||||
|
"github.com/milvus-io/milvus/internal/proto/internalpb"
|
||||||
"github.com/milvus-io/milvus/internal/proto/querypb"
|
"github.com/milvus-io/milvus/internal/proto/querypb"
|
||||||
"github.com/milvus-io/milvus/internal/proto/schemapb"
|
"github.com/milvus-io/milvus/internal/proto/schemapb"
|
||||||
"github.com/milvus-io/milvus/internal/util/funcutil"
|
"github.com/milvus-io/milvus/internal/util/funcutil"
|
||||||
@ -321,13 +320,8 @@ func TestSegmentLoader_checkSegmentSize(t *testing.T) {
|
|||||||
loader := node.loader
|
loader := node.loader
|
||||||
assert.NotNil(t, loader)
|
assert.NotNil(t, loader)
|
||||||
|
|
||||||
err = loader.checkSegmentSize(defaultSegmentID, []*querypb.SegmentLoadInfo{{SegmentID: defaultSegmentID, SegmentSize: 1024}}, runtime.GOMAXPROCS(0))
|
err = loader.checkSegmentSize(defaultCollectionID, []*querypb.SegmentLoadInfo{{SegmentID: defaultSegmentID, SegmentSize: 1024}}, runtime.GOMAXPROCS(0))
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
//totalMem, err := getTotalMemory()
|
|
||||||
//assert.NoError(t, err)
|
|
||||||
//err = historical.loader.checkSegmentSize(defaultSegmentID, map[UniqueID]int64{defaultSegmentID: int64(totalMem * 2)})
|
|
||||||
//assert.Error(t, err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSegmentLoader_testLoadGrowing(t *testing.T) {
|
func TestSegmentLoader_testLoadGrowing(t *testing.T) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user