mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-02 11:59:00 +08:00
enhance: Skip partition key name check if feature not enabled (#31067)
Skip partition key naming & hash value pre process if collection schema does not have partition key The PR removes mislead warning when collection has no partition key Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
parent
d0eeea4b44
commit
007fab183c
@ -370,10 +370,11 @@ func (m *MetaCache) update(ctx context.Context, database, collectionName string,
|
||||
m.collInfo[database] = make(map[string]*collectionInfo)
|
||||
}
|
||||
|
||||
schemaInfo := newSchemaInfo(collection.Schema)
|
||||
m.collInfo[database][collectionName] = &collectionInfo{
|
||||
collID: collection.CollectionID,
|
||||
schema: newSchemaInfo(collection.Schema),
|
||||
partInfo: parsePartitionsInfo(infos),
|
||||
schema: schemaInfo,
|
||||
partInfo: parsePartitionsInfo(infos, schemaInfo.hasPartitionKeyField),
|
||||
createdTimestamp: collection.CreatedTimestamp,
|
||||
createdUtcTimestamp: collection.CreatedUtcTimestamp,
|
||||
consistencyLevel: collection.ConsistencyLevel,
|
||||
@ -653,7 +654,7 @@ func (m *MetaCache) showPartitions(ctx context.Context, dbName string, collectio
|
||||
// parsePartitionsInfo parse partitionInfo list to partitionInfos struct.
|
||||
// prepare all name to id & info map
|
||||
// try parse partition names to partitionKey index.
|
||||
func parsePartitionsInfo(infos []*partitionInfo) *partitionInfos {
|
||||
func parsePartitionsInfo(infos []*partitionInfo, hasPartitionKey bool) *partitionInfos {
|
||||
name2ID := lo.SliceToMap(infos, func(info *partitionInfo) (string, int64) {
|
||||
return info.name, info.partitionID
|
||||
})
|
||||
@ -667,6 +668,10 @@ func parsePartitionsInfo(infos []*partitionInfo) *partitionInfos {
|
||||
name2Info: name2Info,
|
||||
}
|
||||
|
||||
if !hasPartitionKey {
|
||||
return result
|
||||
}
|
||||
|
||||
// Make sure the order of the partition names got every time is the same
|
||||
partitionNames := make([]string, len(infos))
|
||||
for _, info := range infos {
|
||||
@ -717,10 +722,11 @@ func (m *MetaCache) RemovePartition(ctx context.Context, database, collectionNam
|
||||
defer m.mu.Unlock()
|
||||
|
||||
var ok bool
|
||||
var collInfo *collectionInfo
|
||||
|
||||
db, dbOk := m.collInfo[database]
|
||||
if dbOk {
|
||||
_, ok = db[collectionName]
|
||||
collInfo, ok = db[collectionName]
|
||||
}
|
||||
|
||||
if !ok {
|
||||
@ -735,7 +741,7 @@ func (m *MetaCache) RemovePartition(ctx context.Context, database, collectionNam
|
||||
return info.name != partitionName
|
||||
})
|
||||
|
||||
m.collInfo[database][collectionName].partInfo = parsePartitionsInfo(filteredInfos)
|
||||
m.collInfo[database][collectionName].partInfo = parsePartitionsInfo(filteredInfos, collInfo.schema.hasPartitionKeyField)
|
||||
}
|
||||
|
||||
// GetCredentialInfo returns the credential related to provided username
|
||||
|
Loading…
Reference in New Issue
Block a user