mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-07 19:31:51 +08:00
fix: [10kcp] Fix rootcoord meta mutex contention (#38803)
RootCoord meta uses copy-on-write, allowing the removal of unnecessary copies. issue: https://github.com/milvus-io/milvus/issues/37630 pr: https://github.com/milvus-io/milvus/pull/38799 Signed-off-by: bigsheeper <yihao.dai@zilliz.com>
This commit is contained in:
parent
e13b8a2f58
commit
4d0594ba04
@ -34,6 +34,29 @@ func (c *Collection) Available() bool {
|
||||
return c.State == pb.CollectionState_CollectionCreated
|
||||
}
|
||||
|
||||
func (c *Collection) ShadowClone() *Collection {
|
||||
return &Collection{
|
||||
TenantID: c.TenantID,
|
||||
DBID: c.DBID,
|
||||
CollectionID: c.CollectionID,
|
||||
Name: c.Name,
|
||||
Description: c.Description,
|
||||
AutoID: c.AutoID,
|
||||
Fields: c.Fields,
|
||||
Partitions: c.Partitions,
|
||||
VirtualChannelNames: c.VirtualChannelNames,
|
||||
PhysicalChannelNames: c.PhysicalChannelNames,
|
||||
ShardsNum: c.ShardsNum,
|
||||
ConsistencyLevel: c.ConsistencyLevel,
|
||||
CreateTime: c.CreateTime,
|
||||
StartPositions: c.StartPositions,
|
||||
Aliases: c.Aliases,
|
||||
Properties: c.Properties,
|
||||
State: c.State,
|
||||
EnableDynamicField: c.EnableDynamicField,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Collection) Clone() *Collection {
|
||||
return &Collection{
|
||||
TenantID: c.TenantID,
|
||||
|
||||
@ -537,12 +537,12 @@ func (mt *MetaTable) RemoveCollection(ctx context.Context, collectionID UniqueID
|
||||
}
|
||||
|
||||
func filterUnavailable(coll *model.Collection) *model.Collection {
|
||||
clone := coll.Clone()
|
||||
clone := coll.ShadowClone()
|
||||
// pick available partitions.
|
||||
clone.Partitions = nil
|
||||
clone.Partitions = make([]*model.Partition, 0, len(coll.Partitions))
|
||||
for _, partition := range coll.Partitions {
|
||||
if partition.Available() {
|
||||
clone.Partitions = append(clone.Partitions, partition.Clone())
|
||||
clone.Partitions = append(clone.Partitions, partition)
|
||||
}
|
||||
}
|
||||
return clone
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user