Skip to content

Commit

Permalink
enhance: add switch for local rpc enabled
Browse files Browse the repository at this point in the history
Signed-off-by: chyezh <[email protected]>
  • Loading branch information
chyezh committed Nov 25, 2024
1 parent 4cd7932 commit fb7e097
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions configs/milvus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,7 @@ common:
usePartitionKeyAsClusteringKey: false # if true, do clustering compaction and segment prune on partition key field
useVectorAsClusteringKey: false # if true, do clustering compaction and segment prune on vector field
enableVectorClusteringKey: false # if true, enable vector clustering key and vector clustering compaction
localRPCEnabled: false # enable local rpc for internal communication when mix or standalone mode.

# QuotaConfig, configurations of Milvus quota and limits.
# By default, we enable:
Expand Down
4 changes: 4 additions & 0 deletions internal/coordinator/coordclient/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/milvus-io/milvus/internal/types"
"github.com/milvus-io/milvus/internal/util/grpcclient"
"github.com/milvus-io/milvus/pkg/log"
"github.com/milvus-io/milvus/pkg/util/paramtable"
"github.com/milvus-io/milvus/pkg/util/syncutil"
"github.com/milvus-io/milvus/pkg/util/typeutil"
)
Expand Down Expand Up @@ -49,6 +50,9 @@ type LocalClientRoleConfig struct {

// EnableLocalClientRole init localable roles
func EnableLocalClientRole(cfg *LocalClientRoleConfig) {
if !paramtable.Get().CommonCfg.LocalRPCEnabled.GetAsBool() {
return
}

Check warning on line 55 in internal/coordinator/coordclient/registry.go

View check run for this annotation

Codecov / codecov/patch

internal/coordinator/coordclient/registry.go#L54-L55

Added lines #L54 - L55 were not covered by tests
if cfg.ServerType != typeutil.StandaloneRole && cfg.ServerType != typeutil.MixtureRole {
return
}
Expand Down
4 changes: 4 additions & 0 deletions internal/coordinator/coordclient/registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@ import (
"github.com/milvus-io/milvus/internal/proto/datapb"
"github.com/milvus-io/milvus/internal/proto/querypb"
"github.com/milvus-io/milvus/internal/proto/rootcoordpb"
"github.com/milvus-io/milvus/pkg/util/paramtable"
"github.com/milvus-io/milvus/pkg/util/typeutil"
)

func TestRegistry(t *testing.T) {
paramtable.Init()
paramtable.Get().Save(paramtable.Get().CommonCfg.LocalRPCEnabled.Key, "true")

assert.False(t, enableLocal.EnableQueryCoord)
assert.False(t, enableLocal.EnableDataCoord)
assert.False(t, enableLocal.EnableRootCoord)
Expand Down
12 changes: 12 additions & 0 deletions pkg/util/paramtable/component_param.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,9 @@ type commonConfig struct {
ReadOnlyPrivileges ParamItem `refreshable:"false"`
ReadWritePrivileges ParamItem `refreshable:"false"`
AdminPrivileges ParamItem `refreshable:"false"`

// Local RPC enabled for milvus internal communication when mix or standalone mode.
LocalRPCEnabled ParamItem `refreshable:"false"`
}

func (p *commonConfig) init(base *BaseTable) {
Expand Down Expand Up @@ -924,6 +927,15 @@ This helps Milvus-CDC synchronize incremental data`,
Doc: `use to override the default value of admin privileges, example: "PrivilegeCreateOwnership,PrivilegeDropOwnership"`,
}
p.AdminPrivileges.Init(base.mgr)

p.LocalRPCEnabled = ParamItem{
Key: "common.localRPCEnabled",
Version: "2.4.18",
DefaultValue: "false",
Doc: `enable local rpc for internal communication when mix or standalone mode.`,
Export: true,
}
p.LocalRPCEnabled.Init(base.mgr)
}

type gpuConfig struct {
Expand Down
4 changes: 4 additions & 0 deletions pkg/util/paramtable/component_param_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ func TestComponentParam(t *testing.T) {
assert.Equal(t, 0, len(Params.ReadOnlyPrivileges.GetAsStrings()))
assert.Equal(t, 0, len(Params.ReadWritePrivileges.GetAsStrings()))
assert.Equal(t, 0, len(Params.AdminPrivileges.GetAsStrings()))

assert.False(t, params.CommonCfg.LocalRPCEnabled.GetAsBool())
params.Save("common.localRPCEnabled", "true")
assert.True(t, params.CommonCfg.LocalRPCEnabled.GetAsBool())
})

t.Run("test rootCoordConfig", func(t *testing.T) {
Expand Down

0 comments on commit fb7e097

Please sign in to comment.