enhance: add lazyload global config (#31610)

Signed-off-by: sunby <sunbingyi1992@gmail.com>
This commit is contained in:
Bingyi Sun 2024-03-27 20:23:10 +08:00 committed by GitHub
parent 4eb4df1e81
commit fbff46a005
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 22 additions and 1 deletions

View File

@ -358,6 +358,7 @@ queryNode:
maxPendingTaskPerUser: 1024 # 50 by default, max pending task in scheduler per user.
mmap:
mmapEnabled: false # enable mmap global, if set true, will use mmap to load segment data
lazyloadEnabled: false
# can specify ip for example
# ip: 127.0.0.1

View File

@ -611,7 +611,8 @@ func (loader *segmentLoader) Load(ctx context.Context,
return nil, err
}
if common.IsCollectionLazyLoadEnabled(collection.Schema().Properties...) {
if common.IsCollectionLazyLoadEnabled(collection.Schema().Properties...) ||
(!common.HasLazyload(collection.Schema().Properties) && params.Params.QueryNodeCfg.LazyLoadEnabled.GetAsBool()) {
loadStatus = LoadStatusMeta
}

View File

@ -179,6 +179,15 @@ func FieldHasMmapKey(schema *schemapb.CollectionSchema, fieldID int64) bool {
return false
}
func HasLazyload(props []*commonpb.KeyValuePair) bool {
for _, kv := range props {
if kv.Key == LazyLoadEnableKey {
return true
}
}
return false
}
func IsCollectionLazyLoadEnabled(kvs ...*commonpb.KeyValuePair) bool {
for _, kv := range kvs {
if kv.Key == LazyLoadEnableKey && strings.ToLower(kv.Value) == "true" {

View File

@ -1947,6 +1947,8 @@ type queryNodeConfig struct {
MmapDirPath ParamItem `refreshable:"false"`
MmapEnabled ParamItem `refreshable:"false"`
LazyLoadEnabled ParamItem `refreshable:"false"`
// chunk cache
ReadAheadPolicy ParamItem `refreshable:"false"`
ChunkCacheWarmingUp ParamItem `refreshable:"true"`
@ -2179,6 +2181,14 @@ func (p *queryNodeConfig) init(base *BaseTable) {
}
p.MmapEnabled.Init(base.mgr)
p.LazyLoadEnabled = ParamItem{
Key: "queryNode.lazyloadEnabled",
Version: "2.4.0",
DefaultValue: "false",
Doc: "Enable lazyload for loading data",
}
p.LazyLoadEnabled.Init(base.mgr)
p.ReadAheadPolicy = ParamItem{
Key: "queryNode.cache.readAheadPolicy",
Version: "2.3.2",