未验证 提交 d3f8948c 编写于 作者: X Xiaofan 提交者: GitHub

Fix embedded milvus (#22077)

Signed-off-by: Nxiaofan-luan <xiaofan.luan@zilliz.com>
上级 01e21085
......@@ -12,6 +12,7 @@ import (
"github.com/milvus-io/milvus/internal/log"
"github.com/milvus-io/milvus/internal/util/hardware"
"github.com/milvus-io/milvus/internal/util/metricsinfo"
"github.com/milvus-io/milvus/internal/util/paramtable"
"github.com/milvus-io/milvus/internal/util/typeutil"
)
......@@ -92,6 +93,12 @@ func (c *run) execute(args []string, flags *flag.FlagSet) {
os.Exit(-1)
}
// setup config for embedded milvus
if c.serverType == typeutil.EmbeddedRole {
var params paramtable.BaseTable
params.GlobalInitWithYaml("embedded-milvus.yaml")
}
runtimeDir := createRuntimeDir(c.serverType)
filename := getPidFileName(c.serverType, c.svrAlias)
......
......@@ -17,6 +17,7 @@ import (
"runtime"
"strconv"
"strings"
"sync"
"time"
config "github.com/milvus-io/milvus/internal/config"
......@@ -57,7 +58,8 @@ var defaultYaml = DefaultMilvusYaml
// BaseTable the basics of paramtable
type BaseTable struct {
mgr *config.Manager
once sync.Once
mgr *config.Manager
configDir string
YamlFile string
......@@ -76,6 +78,16 @@ func NewBaseTableFromYamlOnly(yaml string) *BaseTable {
return gp
}
// GlobalInitWithYaml initializes the param table with the given yaml.
// We will update the global DefaultYaml variable directly, once and for all.
// GlobalInitWithYaml shall be called at the very beginning before initiating the base table.
// GlobalInitWithYaml should be called only in standalone and embedded Milvus.
func (gp *BaseTable) GlobalInitWithYaml(yaml string) {
gp.once.Do(func() {
defaultYaml = yaml
})
}
// init initializes the param table.
// if refreshInterval greater than 0 will auto refresh config from source
func (gp *BaseTable) init(refreshInterval int) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册