mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-07 01:28:27 +08:00
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>
This commit is contained in:
parent
0527d11114
commit
d1b8c9850b
@ -70,7 +70,7 @@ func stopRocksmq() {
|
|||||||
rocksmq.CloseRocksMQ()
|
rocksmq.CloseRocksMQ()
|
||||||
}
|
}
|
||||||
|
|
||||||
// MilvusRoles determines to run which components.
|
// MilvusRoles decides which components are brought up with Milvus.
|
||||||
type MilvusRoles struct {
|
type MilvusRoles struct {
|
||||||
EnableRootCoord bool `env:"ENABLE_ROOT_COORD"`
|
EnableRootCoord bool `env:"ENABLE_ROOT_COORD"`
|
||||||
EnableProxy bool `env:"ENABLE_PROXY"`
|
EnableProxy bool `env:"ENABLE_PROXY"`
|
||||||
@ -343,21 +343,14 @@ func (mr *MilvusRoles) runIndexNode(ctx context.Context, localMsg bool, alias st
|
|||||||
|
|
||||||
// Run Milvus components.
|
// Run Milvus components.
|
||||||
func (mr *MilvusRoles) Run(local bool, alias string) {
|
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())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
|
|
||||||
// only standalone enable localMsg
|
// only standalone enable localMsg
|
||||||
if local {
|
if local {
|
||||||
Params.Init()
|
|
||||||
if err := os.Setenv(metricsinfo.DeployModeEnvKey, metricsinfo.StandaloneDeployMode); err != nil {
|
if err := os.Setenv(metricsinfo.DeployModeEnvKey, metricsinfo.StandaloneDeployMode); err != nil {
|
||||||
log.Error("Failed to set deploy mode: ", zap.Error(err))
|
log.Error("Failed to set deploy mode: ", zap.Error(err))
|
||||||
}
|
}
|
||||||
|
Params.Init()
|
||||||
|
|
||||||
if err := initRocksmq(); err != nil {
|
if err := initRocksmq(); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
@ -365,7 +358,7 @@ func (mr *MilvusRoles) Run(local bool, alias string) {
|
|||||||
defer stopRocksmq()
|
defer stopRocksmq()
|
||||||
|
|
||||||
if Params.EtcdCfg.UseEmbedEtcd {
|
if Params.EtcdCfg.UseEmbedEtcd {
|
||||||
// start etcd server
|
// Start etcd server.
|
||||||
etcd.InitEtcdServer(&Params.EtcdCfg)
|
etcd.InitEtcdServer(&Params.EtcdCfg)
|
||||||
defer etcd.StopEtcdServer()
|
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
|
var rc *components.RootCoord
|
||||||
if mr.EnableRootCoord {
|
if mr.EnableRootCoord {
|
||||||
rc = mr.runRootCoord(ctx, local)
|
rc = mr.runRootCoord(ctx, local)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user