未验证 提交 b883d1f5 编写于 作者: C cai.zhang 提交者: GitHub

Make sure indexes are successfully dropped when DropCollection (#17780)

Signed-off-by: NCai.Zhang <cai.zhang@zilliz.com>
上级 6b79d4f7
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册