mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-08 01:58:34 +08:00
fix: [2.5] Check field mmap property before apply collection level one (#43091)
Cherry-pick from master pr: #43090 Related to #43089 --------- Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
parent
3666fced6c
commit
2531ebda27
@ -386,6 +386,7 @@ func (ex *Executor) subscribeChannel(task *ChannelTask, step int) error {
|
|||||||
task,
|
task,
|
||||||
action,
|
action,
|
||||||
collectionInfo.GetSchema(),
|
collectionInfo.GetSchema(),
|
||||||
|
collectionInfo.GetProperties(),
|
||||||
loadMeta,
|
loadMeta,
|
||||||
dmChannel,
|
dmChannel,
|
||||||
indexInfo,
|
indexInfo,
|
||||||
|
|||||||
@ -101,7 +101,7 @@ func GetTaskType(task Task) Type {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func mergeCollectonProps(schemaProps []*commonpb.KeyValuePair, collectionProps []*commonpb.KeyValuePair) []*commonpb.KeyValuePair {
|
func mergeCollectionProps(schemaProps []*commonpb.KeyValuePair, collectionProps []*commonpb.KeyValuePair) []*commonpb.KeyValuePair {
|
||||||
// Merge the collectionProps and schemaProps maps, giving priority to the values in schemaProps if there are duplicate keys.
|
// Merge the collectionProps and schemaProps maps, giving priority to the values in schemaProps if there are duplicate keys.
|
||||||
props := make(map[string]string)
|
props := make(map[string]string)
|
||||||
for _, p := range collectionProps {
|
for _, p := range collectionProps {
|
||||||
@ -141,18 +141,8 @@ func packLoadSegmentRequest(
|
|||||||
if task.Source() == utils.LeaderChecker {
|
if task.Source() == utils.LeaderChecker {
|
||||||
loadScope = querypb.LoadScope_Delta
|
loadScope = querypb.LoadScope_Delta
|
||||||
}
|
}
|
||||||
// field mmap enabled if collection-level mmap enabled or the field mmap enabled
|
|
||||||
collectionMmapEnabled, exist := common.IsMmapDataEnabled(collectionProperties...)
|
|
||||||
for _, field := range schema.GetFields() {
|
|
||||||
if exist {
|
|
||||||
field.TypeParams = append(field.TypeParams, &commonpb.KeyValuePair{
|
|
||||||
Key: common.MmapEnabledKey,
|
|
||||||
Value: strconv.FormatBool(collectionMmapEnabled),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
schema.Properties = mergeCollectonProps(schema.Properties, collectionProperties)
|
schema = applyCollectionMmapSetting(schema, collectionProperties)
|
||||||
|
|
||||||
return &querypb.LoadSegmentsRequest{
|
return &querypb.LoadSegmentsRequest{
|
||||||
Base: commonpbutil.NewMsgBase(
|
Base: commonpbutil.NewMsgBase(
|
||||||
@ -204,10 +194,12 @@ func packSubChannelRequest(
|
|||||||
task *ChannelTask,
|
task *ChannelTask,
|
||||||
action Action,
|
action Action,
|
||||||
schema *schemapb.CollectionSchema,
|
schema *schemapb.CollectionSchema,
|
||||||
|
collectionProperties []*commonpb.KeyValuePair,
|
||||||
loadMeta *querypb.LoadMetaInfo,
|
loadMeta *querypb.LoadMetaInfo,
|
||||||
channel *meta.DmChannel,
|
channel *meta.DmChannel,
|
||||||
indexInfo []*indexpb.IndexInfo,
|
indexInfo []*indexpb.IndexInfo,
|
||||||
) *querypb.WatchDmChannelsRequest {
|
) *querypb.WatchDmChannelsRequest {
|
||||||
|
schema = applyCollectionMmapSetting(schema, collectionProperties)
|
||||||
return &querypb.WatchDmChannelsRequest{
|
return &querypb.WatchDmChannelsRequest{
|
||||||
Base: commonpbutil.NewMsgBase(
|
Base: commonpbutil.NewMsgBase(
|
||||||
commonpbutil.WithMsgType(commonpb.MsgType_WatchDmChannels),
|
commonpbutil.WithMsgType(commonpb.MsgType_WatchDmChannels),
|
||||||
@ -265,3 +257,23 @@ func packUnsubDmChannelRequest(task *ChannelTask, action Action) *querypb.UnsubD
|
|||||||
ChannelName: task.Channel(),
|
ChannelName: task.Channel(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func applyCollectionMmapSetting(schema *schemapb.CollectionSchema,
|
||||||
|
collectionProperties []*commonpb.KeyValuePair,
|
||||||
|
) *schemapb.CollectionSchema {
|
||||||
|
schema = typeutil.Clone(schema)
|
||||||
|
schema.Properties = mergeCollectionProps(schema.Properties, collectionProperties)
|
||||||
|
// field mmap enabled if collection-level mmap enabled or the field mmap enabled
|
||||||
|
collectionMmapEnabled, exist := common.IsMmapDataEnabled(collectionProperties...)
|
||||||
|
for _, field := range schema.GetFields() {
|
||||||
|
if exist &&
|
||||||
|
// field-level mmap setting has higher priority than collection-level mmap setting, skip if field-level mmap enabled
|
||||||
|
!common.FieldHasMmapKey(schema, field.GetFieldID()) {
|
||||||
|
field.TypeParams = append(field.TypeParams, &commonpb.KeyValuePair{
|
||||||
|
Key: common.MmapEnabledKey,
|
||||||
|
Value: strconv.FormatBool(collectionMmapEnabled),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return schema
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user