Fix embedded milvus (#22077)

Signed-off-by: xiaofan-luan <xiaofan.luan@zilliz.com>
pull/22108/head
Xiaofan 2023-02-09 22:06:32 +08:00 committed by GitHub
parent 01e210854d
commit d3f8948c17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 1 deletions

View File

@ -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)

View File

@ -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) {