From d718bbb4de0e07fe9886afbcea17c32afea2fedf Mon Sep 17 00:00:00 2001 From: Xianhui Lin <35839735+JsDove@users.noreply.github.com> Date: Mon, 23 Dec 2024 18:24:48 +0800 Subject: [PATCH] fix: fix altercollectionfield interceptor dbname (#38662) fix altercollectionfield interceptor dbname issue: https://github.com/milvus-io/milvus/issues/37436 Signed-off-by: Xianhui.Lin --- internal/proxy/database_interceptor.go | 5 +++++ internal/proxy/database_interceptor_test.go | 1 + 2 files changed, 6 insertions(+) diff --git a/internal/proxy/database_interceptor.go b/internal/proxy/database_interceptor.go index 85578d5029df5..2b12a9fe6b6c6 100644 --- a/internal/proxy/database_interceptor.go +++ b/internal/proxy/database_interceptor.go @@ -68,6 +68,11 @@ func fillDatabase(ctx context.Context, req interface{}) (context.Context, interf r.DbName = GetCurDBNameFromContextOrDefault(ctx) } return ctx, r + case *milvuspb.AlterCollectionFieldRequest: + if r.DbName == "" { + r.DbName = GetCurDBNameFromContextOrDefault(ctx) + } + return ctx, r case *milvuspb.CreatePartitionRequest: if r.DbName == "" { r.DbName = GetCurDBNameFromContextOrDefault(ctx) diff --git a/internal/proxy/database_interceptor_test.go b/internal/proxy/database_interceptor_test.go index bf989c76e632c..d5c84e721f816 100644 --- a/internal/proxy/database_interceptor_test.go +++ b/internal/proxy/database_interceptor_test.go @@ -57,6 +57,7 @@ func TestDatabaseInterceptor(t *testing.T) { &milvuspb.GetCollectionStatisticsRequest{}, &milvuspb.ShowCollectionsRequest{}, &milvuspb.AlterCollectionRequest{}, + &milvuspb.AlterCollectionFieldRequest{}, &milvuspb.CreatePartitionRequest{}, &milvuspb.DropPartitionRequest{}, &milvuspb.HasPartitionRequest{},