Fix index not exist (#20027)

Signed-off-by: longjiquan <jiquan.long@zilliz.com>

Signed-off-by: longjiquan <jiquan.long@zilliz.com>
pull/20041/head
Jiquan Long 2022-10-25 10:01:30 +08:00 committed by GitHub
parent 7a13b1c329
commit db4ede217f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 1 deletions

View File

@ -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())
}

View File

@ -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{

View File

@ -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,

View File

@ -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{