mirror of https://github.com/milvus-io/milvus.git
fix: check collection lazy load prop using schema (#30992)
issue: https://github.com/milvus-io/milvus/issues/30361 --------- Signed-off-by: sunby <sunbingyi1992@gmail.com>pull/31067/head
parent
df7aafa3ec
commit
fd17a5f050
|
@ -342,7 +342,6 @@ message SegmentLoadInfo {
|
||||||
int64 readableVersion = 16;
|
int64 readableVersion = 16;
|
||||||
data.SegmentLevel level = 17;
|
data.SegmentLevel level = 17;
|
||||||
int64 storageVersion = 18;
|
int64 storageVersion = 18;
|
||||||
bool lazy_load = 19;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message FieldIndexInfo {
|
message FieldIndexInfo {
|
||||||
|
|
|
@ -93,6 +93,7 @@ type baseSegment struct {
|
||||||
isLazyLoad bool
|
isLazyLoad bool
|
||||||
startPosition *msgpb.MsgPosition // for growing segment release
|
startPosition *msgpb.MsgPosition // for growing segment release
|
||||||
bloomFilterSet *pkoracle.BloomFilterSet
|
bloomFilterSet *pkoracle.BloomFilterSet
|
||||||
|
loadInfo *querypb.SegmentLoadInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
func newBaseSegment(id, partitionID, collectionID int64, shard string, typ SegmentType, level datapb.SegmentLevel, version int64, startPosition *msgpb.MsgPosition) baseSegment {
|
func newBaseSegment(id, partitionID, collectionID int64, shard string, typ SegmentType, level datapb.SegmentLevel, version int64, startPosition *msgpb.MsgPosition) baseSegment {
|
||||||
|
@ -156,8 +157,7 @@ func (s *baseSegment) IsLazyLoad() bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *baseSegment) LoadInfo() *querypb.SegmentLoadInfo {
|
func (s *baseSegment) LoadInfo() *querypb.SegmentLoadInfo {
|
||||||
// TODO
|
return s.loadInfo
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *baseSegment) UpdateBloomFilter(pks []storage.PrimaryKey) {
|
func (s *baseSegment) UpdateBloomFilter(pks []storage.PrimaryKey) {
|
||||||
|
|
|
@ -934,7 +934,8 @@ func (loader *segmentLoader) loadSegment(ctx context.Context,
|
||||||
|
|
||||||
if segment.Type() == SegmentTypeSealed {
|
if segment.Type() == SegmentTypeSealed {
|
||||||
loadStatus := LoadStatusInMemory
|
loadStatus := LoadStatusInMemory
|
||||||
if loadInfo.GetLazyLoad() {
|
if common.IsCollectionLazyLoadEnabled(collection.Schema().GetProperties()...) {
|
||||||
|
segment.baseSegment.loadInfo = loadInfo
|
||||||
loadStatus = LoadStatusMeta
|
loadStatus = LoadStatusMeta
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ package common
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/milvus-io/milvus-proto/go-api/v2/commonpb"
|
"github.com/milvus-io/milvus-proto/go-api/v2/commonpb"
|
||||||
"github.com/milvus-io/milvus-proto/go-api/v2/schemapb"
|
"github.com/milvus-io/milvus-proto/go-api/v2/schemapb"
|
||||||
|
@ -142,7 +143,7 @@ func IsSystemField(fieldID int64) bool {
|
||||||
|
|
||||||
func IsMmapEnabled(kvs ...*commonpb.KeyValuePair) bool {
|
func IsMmapEnabled(kvs ...*commonpb.KeyValuePair) bool {
|
||||||
for _, kv := range kvs {
|
for _, kv := range kvs {
|
||||||
if kv.Key == MmapEnabledKey && kv.Value == "true" {
|
if kv.Key == MmapEnabledKey && strings.ToLower(kv.Value) == "true" {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,7 +161,7 @@ func IsFieldMmapEnabled(schema *schemapb.CollectionSchema, fieldID int64) bool {
|
||||||
|
|
||||||
func IsCollectionLazyLoadEnabled(kvs ...*commonpb.KeyValuePair) bool {
|
func IsCollectionLazyLoadEnabled(kvs ...*commonpb.KeyValuePair) bool {
|
||||||
for _, kv := range kvs {
|
for _, kv := range kvs {
|
||||||
if kv.Key == LazyLoadEnableKey && kv.Value == "true" {
|
if kv.Key == LazyLoadEnableKey && strings.ToLower(kv.Value) == "true" {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue