mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-03 04:19:18 +08:00
Make sure indexes are successfully dropped when DropCollection (#17780)
Signed-off-by: Cai.Zhang <cai.zhang@zilliz.com>
This commit is contained in:
parent
6b79d4f7bc
commit
b883d1f5dd
@ -1048,23 +1048,6 @@ func (c *Core) BuildIndex(ctx context.Context, segID UniqueID, numRows int64, bi
|
||||
return bldID, err
|
||||
}
|
||||
|
||||
// RemoveIndex will call drop index service
|
||||
func (c *Core) RemoveIndex(ctx context.Context, collName string, indexName string) error {
|
||||
_, indexInfos, err := c.MetaTable.GetIndexByName(collName, indexName)
|
||||
if err != nil {
|
||||
log.Error("GetIndexByName failed,", zap.String("collection name", collName),
|
||||
zap.String("index name", indexName), zap.Error(err))
|
||||
return err
|
||||
}
|
||||
for _, indexInfo := range indexInfos {
|
||||
if err = c.CallDropIndexService(ctx, indexInfo.IndexID); err != nil {
|
||||
log.Error("CallDropIndexService failed,", zap.String("collection name", collName), zap.Error(err))
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ExpireMetaCache will call invalidate collection meta cache
|
||||
func (c *Core) ExpireMetaCache(ctx context.Context, collNames []string, collectionID UniqueID, ts typeutil.Timestamp) error {
|
||||
// if collectionID is specified, invalidate all the collection meta cache with the specified collectionID and return
|
||||
|
@ -320,9 +320,13 @@ func (t *DropCollectionReqTask) Execute(ctx context.Context) error {
|
||||
}
|
||||
|
||||
// drop all indices
|
||||
if err = t.core.RemoveIndex(ctx, t.Req.CollectionName, ""); err != nil {
|
||||
for _, fieldIndex := range collMeta.FieldIndexes {
|
||||
if err := t.core.CallDropIndexService(t.core.ctx, fieldIndex.IndexID); err != nil {
|
||||
log.Error("DropCollection CallDropIndexService fail", zap.String("collName", t.Req.CollectionName),
|
||||
zap.Int64("indexID", fieldIndex.IndexID), zap.Error(err))
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// Allocate a new ts to make sure the channel timetick is consistent.
|
||||
ts, err = t.core.TSOAllocator(1)
|
||||
|
Loading…
Reference in New Issue
Block a user