Fix a bug for standalone where it appears that DEPLOY_MODE is get/used before set. (#15712)

Signed-off-by: Yuchen Gao <yuchen.gao@zilliz.com>
pull/15737/head
Nemo 2022-02-24 14:41:52 +08:00 committed by GitHub
parent 0527d11114
commit d1b8c9850b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 10 deletions

View File

@ -70,7 +70,7 @@ func stopRocksmq() {
rocksmq.CloseRocksMQ()
}
// MilvusRoles determines to run which components.
// MilvusRoles decides which components are brought up with Milvus.
type MilvusRoles struct {
EnableRootCoord bool `env:"ENABLE_ROOT_COORD"`
EnableProxy bool `env:"ENABLE_PROXY"`
@ -343,21 +343,14 @@ func (mr *MilvusRoles) runIndexNode(ctx context.Context, localMsg bool, alias st
// Run Milvus components.
func (mr *MilvusRoles) Run(local bool, alias string) {
if os.Getenv(metricsinfo.DeployModeEnvKey) == metricsinfo.StandaloneDeployMode {
closer := trace.InitTracing("standalone")
if closer != nil {
defer closer.Close()
}
}
ctx, cancel := context.WithCancel(context.Background())
// only standalone enable localMsg
if local {
Params.Init()
if err := os.Setenv(metricsinfo.DeployModeEnvKey, metricsinfo.StandaloneDeployMode); err != nil {
log.Error("Failed to set deploy mode: ", zap.Error(err))
}
Params.Init()
if err := initRocksmq(); err != nil {
panic(err)
@ -365,7 +358,7 @@ func (mr *MilvusRoles) Run(local bool, alias string) {
defer stopRocksmq()
if Params.EtcdCfg.UseEmbedEtcd {
// start etcd server
// Start etcd server.
etcd.InitEtcdServer(&Params.EtcdCfg)
defer etcd.StopEtcdServer()
}
@ -375,6 +368,13 @@ func (mr *MilvusRoles) Run(local bool, alias string) {
}
}
if os.Getenv(metricsinfo.DeployModeEnvKey) == metricsinfo.StandaloneDeployMode {
closer := trace.InitTracing("standalone")
if closer != nil {
defer closer.Close()
}
}
var rc *components.RootCoord
if mr.EnableRootCoord {
rc = mr.runRootCoord(ctx, local)