mirror of https://github.com/milvus-io/milvus.git
fix: jsonstats check if cache schema is nil lazy describecollection (#41068)
fix: jsonstats check if cache schema is nil lazy describecollection pr:https://github.com/milvus-io/milvus/pull/38039 issue:https://github.com/milvus-io/milvus/issues/36995 --------- Signed-off-by: Xianhui.Lin <xianhui.lin@zilliz.com>pull/41080/head
parent
5be9cebd67
commit
249d5b9b41
|
@ -97,6 +97,13 @@ func (c *IndexChecker) Check(ctx context.Context) []task.Task {
|
|||
log.Warn("collection released during check index", zap.Int64("collection", collectionID))
|
||||
continue
|
||||
}
|
||||
if schema == nil && paramtable.Get().CommonCfg.EnabledJSONKeyStats.GetAsBool() {
|
||||
collectionSchema, err1 := c.broker.DescribeCollection(ctx, collectionID)
|
||||
if err1 == nil {
|
||||
schema = collectionSchema.GetSchema()
|
||||
c.meta.PutCollectionSchema(ctx, collectionID, collectionSchema.GetSchema())
|
||||
}
|
||||
}
|
||||
replicas := c.meta.ReplicaManager.GetByCollection(ctx, collectionID)
|
||||
for _, replica := range replicas {
|
||||
tasks = append(tasks, c.checkReplica(ctx, collection, replica, indexInfos, schema)...)
|
||||
|
|
|
@ -266,6 +266,17 @@ func (m *CollectionManager) GetCollectionSchema(ctx context.Context, collectionI
|
|||
return collection.Schema
|
||||
}
|
||||
|
||||
func (m *CollectionManager) PutCollectionSchema(ctx context.Context, collectionID typeutil.UniqueID, schema *schemapb.CollectionSchema) {
|
||||
m.rwmutex.Lock()
|
||||
defer m.rwmutex.Unlock()
|
||||
|
||||
collection, ok := m.collections[collectionID]
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
collection.Schema = schema
|
||||
}
|
||||
|
||||
func (m *CollectionManager) GetPartition(ctx context.Context, partitionID typeutil.UniqueID) *Partition {
|
||||
m.rwmutex.RLock()
|
||||
defer m.rwmutex.RUnlock()
|
||||
|
|
Loading…
Reference in New Issue