mirror of https://github.com/milvus-io/milvus.git
Fix index not exist (#20027)
Signed-off-by: longjiquan <jiquan.long@zilliz.com> Signed-off-by: longjiquan <jiquan.long@zilliz.com>pull/20041/head
parent
7a13b1c329
commit
db4ede217f
|
@ -21,6 +21,9 @@ func (t *createAliasTask) Prepare(ctx context.Context) error {
|
|||
}
|
||||
|
||||
func (t *createAliasTask) Execute(ctx context.Context) error {
|
||||
if err := t.core.ExpireMetaCache(ctx, []string{t.Req.GetAlias(), t.Req.GetCollectionName()}, InvalidCollectionID, t.GetTs()); err != nil {
|
||||
return err
|
||||
}
|
||||
// create alias is atomic enough.
|
||||
return t.core.meta.CreateAlias(ctx, t.Req.GetAlias(), t.Req.GetCollectionName(), t.GetTs())
|
||||
}
|
||||
|
|
|
@ -25,8 +25,21 @@ func Test_createAliasTask_Prepare(t *testing.T) {
|
|||
}
|
||||
|
||||
func Test_createAliasTask_Execute(t *testing.T) {
|
||||
t.Run("failed to expire cache", func(t *testing.T) {
|
||||
core := newTestCore(withInvalidProxyManager())
|
||||
task := &createAliasTask{
|
||||
baseTask: baseTask{core: core},
|
||||
Req: &milvuspb.CreateAliasRequest{
|
||||
Base: &commonpb.MsgBase{MsgType: commonpb.MsgType_CreateAlias},
|
||||
Alias: "test",
|
||||
},
|
||||
}
|
||||
err := task.Execute(context.Background())
|
||||
assert.Error(t, err)
|
||||
})
|
||||
|
||||
t.Run("failed to create alias", func(t *testing.T) {
|
||||
core := newTestCore(withInvalidMeta())
|
||||
core := newTestCore(withInvalidMeta(), withValidProxyManager())
|
||||
task := &createAliasTask{
|
||||
baseTask: baseTask{core: core},
|
||||
Req: &milvuspb.CreateAliasRequest{
|
||||
|
|
|
@ -271,6 +271,12 @@ func (t *createCollectionTask) Execute(ctx context.Context) error {
|
|||
}
|
||||
|
||||
undoTask := newBaseUndoTask(t.core.stepExecutor)
|
||||
undoTask.AddStep(&expireCacheStep{
|
||||
baseStep: baseStep{core: t.core},
|
||||
collectionNames: []string{t.Req.GetCollectionName()},
|
||||
collectionID: InvalidCollectionID,
|
||||
ts: ts,
|
||||
}, &nullStep{})
|
||||
undoTask.AddStep(&nullStep{}, &removeDmlChannelsStep{
|
||||
baseStep: baseStep{core: t.core},
|
||||
pChannels: chanNames,
|
||||
|
|
|
@ -397,6 +397,7 @@ func Test_createCollectionTask_Execute(t *testing.T) {
|
|||
core := newTestCore(withValidIDAllocator(),
|
||||
withMeta(meta),
|
||||
withTtSynchronizer(ticker),
|
||||
withValidProxyManager(),
|
||||
withDataCoord(dc))
|
||||
core.broker = newServerBroker(core)
|
||||
|
||||
|
@ -480,6 +481,7 @@ func Test_createCollectionTask_Execute(t *testing.T) {
|
|||
withMeta(meta),
|
||||
withTtSynchronizer(ticker),
|
||||
withGarbageCollector(gc),
|
||||
withValidProxyManager(),
|
||||
withBroker(broker))
|
||||
|
||||
schema := &schemapb.CollectionSchema{
|
||||
|
|
Loading…
Reference in New Issue