Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance: skip load bm25 sparse row data #39078

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions internal/querynodev2/segments/segment.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"github.com/milvus-io/milvus/pkg/util/indexparams"
"github.com/milvus-io/milvus/pkg/util/merr"
"github.com/milvus-io/milvus/pkg/util/metautil"
"github.com/milvus-io/milvus/pkg/util/metric"
"github.com/milvus-io/milvus/pkg/util/paramtable"
"github.com/milvus-io/milvus/pkg/util/timerecord"
"github.com/milvus-io/milvus/pkg/util/typeutil"
Expand Down Expand Up @@ -1054,10 +1055,24 @@
return err
}
updateIndexInfoSpan := tr.RecordSpan()
// Skip warnup chunk cache when
// . scalar data
// . index has row data
// . vector was bm25 function output

if !typeutil.IsVectorType(fieldType) || s.HasRawData(indexInfo.GetFieldID()) {
return nil
}

metricType, err := funcutil.GetAttrByKeyFromRepeatedKV(common.MetricTypeKey, indexInfo.IndexParams)
if err != nil {
return fmt.Errorf("metric type not exist in index params")
}

Check warning on line 1070 in internal/querynodev2/segments/segment.go

View check run for this annotation

Codecov / codecov/patch

internal/querynodev2/segments/segment.go#L1069-L1070

Added lines #L1069 - L1070 were not covered by tests

if metricType == metric.BM25 {
return nil
}

Check warning on line 1074 in internal/querynodev2/segments/segment.go

View check run for this annotation

Codecov / codecov/patch

internal/querynodev2/segments/segment.go#L1073-L1074

Added lines #L1073 - L1074 were not covered by tests

// 4.
mmapChunkCache := paramtable.Get().QueryNodeCfg.MmapChunkCache.GetAsBool()
s.WarmupChunkCache(ctx, indexInfo.GetFieldID(), mmapChunkCache)
Expand Down
21 changes: 16 additions & 5 deletions internal/querynodev2/segments/segment_loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"github.com/milvus-io/milvus/pkg/util/funcutil"
"github.com/milvus-io/milvus/pkg/util/hardware"
"github.com/milvus-io/milvus/pkg/util/merr"
"github.com/milvus-io/milvus/pkg/util/metric"
"github.com/milvus-io/milvus/pkg/util/paramtable"
"github.com/milvus-io/milvus/pkg/util/syncutil"
"github.com/milvus-io/milvus/pkg/util/timerecord"
Expand Down Expand Up @@ -1509,12 +1510,22 @@
if !estimateResult.HasRawData && !isVectorType {
shouldCalculateDataSize = true
}

if !estimateResult.HasRawData && isVectorType {
mmapChunkCache := paramtable.Get().QueryNodeCfg.MmapChunkCache.GetAsBool()
if mmapChunkCache {
segmentDiskSize += binlogSize
} else {
segmentMemorySize += binlogSize
metricType, err := funcutil.GetAttrByKeyFromRepeatedKV(common.MetricTypeKey, fieldIndexInfo.IndexParams)
if err != nil {
return nil, errors.Wrapf(err, "failed to estimate resource usage of index, metric type nout found, collection %d, segment %d, indexBuildID %d",
loadInfo.GetCollectionID(),
loadInfo.GetSegmentID(),
fieldIndexInfo.GetBuildID())
}
if metricType != metric.BM25 {
mmapChunkCache := paramtable.Get().QueryNodeCfg.MmapChunkCache.GetAsBool()
if mmapChunkCache {
segmentDiskSize += binlogSize
} else {
segmentMemorySize += binlogSize
}

Check warning on line 1528 in internal/querynodev2/segments/segment_loader.go

View check run for this annotation

Codecov / codecov/patch

internal/querynodev2/segments/segment_loader.go#L1515-L1528

Added lines #L1515 - L1528 were not covered by tests
}
}
} else {
Expand Down
Loading