Skip to content

Commit

Permalink
skip load bm25 field row data
Browse files Browse the repository at this point in the history
Signed-off-by: aoiasd <[email protected]>
  • Loading branch information
aoiasd committed Jan 16, 2025
1 parent dc1acb3 commit 6421d19
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 8 deletions.
15 changes: 13 additions & 2 deletions internal/querynodev2/segments/segment.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import (
"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 @@ -1057,8 +1058,18 @@ func (s *LocalSegment) innerLoadIndex(ctx context.Context,
// Skip warnup chunk cache when
// . scalar data
// . index has row data
// . vector was function output
if !typeutil.IsVectorType(fieldType) || s.HasRawData(indexInfo.GetFieldID()) || fieldSchema.IsFunctionOutput {
// . 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

Expand Down
23 changes: 17 additions & 6 deletions internal/querynodev2/segments/segment_loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import (
"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 @@ func getResourceUsageEstimateOfSegment(schema *schemapb.CollectionSchema, loadIn
if !estimateResult.HasRawData && !isVectorType {
shouldCalculateDataSize = true
}
if !estimateResult.HasRawData && isVectorType && !fieldSchema.IsFunctionOutput {
mmapChunkCache := paramtable.Get().QueryNodeCfg.MmapChunkCache.GetAsBool()
if mmapChunkCache {
segmentDiskSize += binlogSize
} else {
segmentMemorySize += binlogSize

if !estimateResult.HasRawData && isVectorType {
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

0 comments on commit 6421d19

Please sign in to comment.