2021-12-17 10:23:15 +08:00
|
|
|
// Copyright (C) 2019-2020 Zilliz. All rights reserved.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
|
|
|
|
// with the License. You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software distributed under the License
|
|
|
|
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
|
|
|
// or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
|
|
|
|
|
|
package paramtable
|
|
|
|
|
|
|
|
import (
|
|
|
|
"math"
|
2021-12-23 18:39:11 +08:00
|
|
|
"os"
|
|
|
|
"path"
|
2021-12-17 10:23:15 +08:00
|
|
|
"strconv"
|
2021-12-23 18:39:11 +08:00
|
|
|
"strings"
|
2021-12-17 10:23:15 +08:00
|
|
|
"sync"
|
2021-12-23 18:39:11 +08:00
|
|
|
"time"
|
2021-12-17 10:23:15 +08:00
|
|
|
|
|
|
|
"github.com/go-basic/ipv4"
|
|
|
|
"github.com/milvus-io/milvus/internal/log"
|
2021-12-23 18:39:11 +08:00
|
|
|
"go.uber.org/zap"
|
2021-12-17 10:23:15 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
// DefaultServerMaxSendSize defines the maximum size of data per grpc request can send by server side.
|
|
|
|
DefaultServerMaxSendSize = math.MaxInt32
|
|
|
|
|
|
|
|
// DefaultServerMaxRecvSize defines the maximum size of data per grpc request can receive by server side.
|
|
|
|
DefaultServerMaxRecvSize = math.MaxInt32
|
|
|
|
|
|
|
|
// DefaultClientMaxSendSize defines the maximum size of data per grpc request can send by client side.
|
|
|
|
DefaultClientMaxSendSize = 100 * 1024 * 1024
|
|
|
|
|
|
|
|
// DefaultClientMaxRecvSize defines the maximum size of data per grpc request can receive by client side.
|
|
|
|
DefaultClientMaxRecvSize = 100 * 1024 * 1024
|
2021-12-23 18:39:11 +08:00
|
|
|
|
|
|
|
// SuggestPulsarMaxMessageSize defines the maximum size of Pulsar message.
|
|
|
|
SuggestPulsarMaxMessageSize = 5 * 1024 * 1024
|
2021-12-29 21:29:45 +08:00
|
|
|
|
|
|
|
// DefaultRetentionDuration defines the default duration for retention which is 5 days in seconds.
|
|
|
|
DefaultRetentionDuration = 3600 * 24 * 5
|
2021-12-17 10:23:15 +08:00
|
|
|
)
|
|
|
|
|
2021-12-23 18:39:11 +08:00
|
|
|
// GlobalParamTable is a derived struct of BaseParamTable.
|
|
|
|
// It is used to quickly and easily access global system configuration.
|
|
|
|
type GlobalParamTable struct {
|
2022-02-07 10:09:45 +08:00
|
|
|
BaseParamTable
|
|
|
|
once sync.Once
|
2022-01-10 19:03:35 +08:00
|
|
|
|
2022-02-02 00:35:43 +08:00
|
|
|
CommonCfg commonConfig
|
|
|
|
KnowhereCfg knowhereConfig
|
|
|
|
MsgChannelCfg msgChannelConfig
|
2021-12-23 18:39:11 +08:00
|
|
|
|
|
|
|
RootCoordCfg rootCoordConfig
|
|
|
|
ProxyCfg proxyConfig
|
|
|
|
QueryCoordCfg queryCoordConfig
|
|
|
|
QueryNodeCfg queryNodeConfig
|
|
|
|
DataCoordCfg dataCoordConfig
|
|
|
|
DataNodeCfg dataNodeConfig
|
|
|
|
IndexCoordCfg indexCoordConfig
|
|
|
|
IndexNodeCfg indexNodeConfig
|
|
|
|
}
|
|
|
|
|
|
|
|
// InitOnce initialize once
|
|
|
|
func (p *GlobalParamTable) InitOnce() {
|
|
|
|
p.once.Do(func() {
|
|
|
|
p.Init()
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2022-01-06 13:51:21 +08:00
|
|
|
// Init initialize the global param table
|
2021-12-23 18:39:11 +08:00
|
|
|
func (p *GlobalParamTable) Init() {
|
2022-02-07 10:09:45 +08:00
|
|
|
p.BaseParamTable.Init()
|
2022-01-10 14:51:34 +08:00
|
|
|
|
2022-02-07 10:09:45 +08:00
|
|
|
p.CommonCfg.init(&p.BaseParamTable)
|
|
|
|
p.KnowhereCfg.init(&p.BaseParamTable)
|
|
|
|
p.MsgChannelCfg.init(&p.BaseParamTable)
|
2022-01-10 17:29:34 +08:00
|
|
|
|
2022-02-07 10:09:45 +08:00
|
|
|
p.RootCoordCfg.init(&p.BaseParamTable)
|
|
|
|
p.ProxyCfg.init(&p.BaseParamTable)
|
|
|
|
p.QueryCoordCfg.init(&p.BaseParamTable)
|
|
|
|
p.QueryNodeCfg.init(&p.BaseParamTable)
|
|
|
|
p.DataCoordCfg.init(&p.BaseParamTable)
|
|
|
|
p.DataNodeCfg.init(&p.BaseParamTable)
|
|
|
|
p.IndexCoordCfg.init(&p.BaseParamTable)
|
|
|
|
p.IndexNodeCfg.init(&p.BaseParamTable)
|
2022-01-10 17:29:34 +08:00
|
|
|
}
|
|
|
|
|
2022-02-07 10:09:45 +08:00
|
|
|
// SetLogConfig set log config with given role
|
|
|
|
func (p *GlobalParamTable) SetLogConfig(role string) {
|
|
|
|
p.BaseTable.RoleName = role
|
|
|
|
p.BaseTable.SetLogConfig()
|
2022-01-10 17:29:34 +08:00
|
|
|
}
|
|
|
|
|
2022-01-10 14:51:34 +08:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2021-12-23 18:39:11 +08:00
|
|
|
// --- common ---
|
2022-01-10 19:03:35 +08:00
|
|
|
type commonConfig struct {
|
|
|
|
BaseParams *BaseParamTable
|
|
|
|
|
|
|
|
DefaultPartitionName string
|
|
|
|
DefaultIndexName string
|
|
|
|
RetentionDuration int64
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *commonConfig) init(bp *BaseParamTable) {
|
|
|
|
p.BaseParams = bp
|
|
|
|
|
|
|
|
p.initDefaultPartitionName()
|
|
|
|
p.initDefaultIndexName()
|
|
|
|
p.initRetentionDuration()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *commonConfig) initDefaultPartitionName() {
|
2022-01-11 09:35:34 +08:00
|
|
|
p.DefaultPartitionName = p.BaseParams.LoadWithDefault("common.defaultPartitionName", "_default")
|
2022-01-10 19:03:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (p *commonConfig) initDefaultIndexName() {
|
2022-01-11 09:35:34 +08:00
|
|
|
p.DefaultIndexName = p.BaseParams.LoadWithDefault("common.defaultIndexName", "_default_idx")
|
2022-01-10 19:03:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (p *commonConfig) initRetentionDuration() {
|
|
|
|
p.RetentionDuration = p.BaseParams.ParseInt64WithDefault("common.retentionDuration", DefaultRetentionDuration)
|
|
|
|
}
|
2021-12-23 18:39:11 +08:00
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// --- knowhere ---
|
2022-01-11 09:35:34 +08:00
|
|
|
type knowhereConfig struct {
|
|
|
|
BaseParams *BaseParamTable
|
|
|
|
|
|
|
|
SimdType string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *knowhereConfig) init(bp *BaseParamTable) {
|
|
|
|
p.BaseParams = bp
|
|
|
|
|
|
|
|
p.initSimdType()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *knowhereConfig) initSimdType() {
|
|
|
|
p.SimdType = p.BaseParams.LoadWithDefault("knowhere.simdType", "auto")
|
|
|
|
}
|
2021-12-23 18:39:11 +08:00
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// --- msgChannel ---
|
2022-02-02 00:35:43 +08:00
|
|
|
type msgChannelConfig struct {
|
2021-12-23 18:39:11 +08:00
|
|
|
BaseParams *BaseParamTable
|
|
|
|
|
2022-02-02 00:35:43 +08:00
|
|
|
ClusterPrefix string
|
2021-12-23 18:39:11 +08:00
|
|
|
|
2022-02-02 00:35:43 +08:00
|
|
|
RootCoordTimeTick string
|
|
|
|
RootCoordStatistics string
|
|
|
|
RootCoordDml string
|
|
|
|
RootCoordDelta string
|
|
|
|
RootCoordSubName string
|
2021-12-23 18:39:11 +08:00
|
|
|
|
2022-02-02 00:35:43 +08:00
|
|
|
QueryCoordSearch string
|
|
|
|
QueryCoordSearchResult string
|
|
|
|
QueryCoordTimeTick string
|
|
|
|
QueryNodeStats string
|
2021-12-23 18:39:11 +08:00
|
|
|
|
2022-02-02 00:35:43 +08:00
|
|
|
DataCoordStatistic string
|
|
|
|
DataCoordTimeTick string
|
|
|
|
DataCoordSegmentInfo string
|
|
|
|
DataCoordSubName string
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
2022-02-02 00:35:43 +08:00
|
|
|
func (p *msgChannelConfig) init(bp *BaseParamTable) {
|
2021-12-23 18:39:11 +08:00
|
|
|
p.BaseParams = bp
|
|
|
|
|
2022-02-02 00:35:43 +08:00
|
|
|
// must init cluster prefix first
|
|
|
|
p.initClusterPrefix()
|
2021-12-23 18:39:11 +08:00
|
|
|
|
2022-02-02 00:35:43 +08:00
|
|
|
p.initRootCoordTimeTick()
|
|
|
|
p.initRootCoordStatistics()
|
|
|
|
p.initRootCoordDml()
|
|
|
|
p.initRootCoordDelta()
|
|
|
|
p.initRootCoordSubName()
|
|
|
|
|
|
|
|
p.initQueryCoordSearch()
|
|
|
|
p.initQueryCoordSearchResult()
|
|
|
|
p.initQueryCoordTimeTick()
|
|
|
|
p.initQueryNodeStats()
|
|
|
|
|
|
|
|
p.initDataCoordStatistic()
|
|
|
|
p.initDataCoordTimeTick()
|
|
|
|
p.initDataCoordSegmentInfo()
|
|
|
|
p.initDataCoordSubName()
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
2022-02-02 00:35:43 +08:00
|
|
|
func (p *msgChannelConfig) initClusterPrefix() {
|
|
|
|
str, err := p.BaseParams.Load("msgChannel.chanNamePrefix.cluster")
|
2021-12-23 18:39:11 +08:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2022-02-02 00:35:43 +08:00
|
|
|
p.ClusterPrefix = str
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
2022-02-02 00:35:43 +08:00
|
|
|
func (p *msgChannelConfig) initChanNamePrefix(cfg string) string {
|
|
|
|
value, err := p.BaseParams.Load(cfg)
|
2021-12-23 18:39:11 +08:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2022-02-02 00:35:43 +08:00
|
|
|
s := []string{p.ClusterPrefix, value}
|
|
|
|
return strings.Join(s, "-")
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
2022-02-02 00:35:43 +08:00
|
|
|
// --- rootcoord ---
|
|
|
|
func (p *msgChannelConfig) initRootCoordTimeTick() {
|
|
|
|
p.RootCoordTimeTick = p.initChanNamePrefix("msgChannel.chanNamePrefix.rootCoordTimeTick")
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
2022-02-02 00:35:43 +08:00
|
|
|
func (p *msgChannelConfig) initRootCoordStatistics() {
|
|
|
|
p.RootCoordStatistics = p.initChanNamePrefix("msgChannel.chanNamePrefix.rootCoordStatistics")
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
2022-02-02 00:35:43 +08:00
|
|
|
func (p *msgChannelConfig) initRootCoordDml() {
|
|
|
|
p.RootCoordDml = p.initChanNamePrefix("msgChannel.chanNamePrefix.rootCoordDml")
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
2022-02-02 00:35:43 +08:00
|
|
|
func (p *msgChannelConfig) initRootCoordDelta() {
|
|
|
|
p.RootCoordDelta = p.initChanNamePrefix("msgChannel.chanNamePrefix.rootCoordDelta")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *msgChannelConfig) initRootCoordSubName() {
|
|
|
|
p.RootCoordSubName = p.initChanNamePrefix("msgChannel.subNamePrefix.rootCoordSubNamePrefix")
|
|
|
|
}
|
|
|
|
|
|
|
|
// --- querycoord ---
|
|
|
|
func (p *msgChannelConfig) initQueryCoordSearch() {
|
|
|
|
p.QueryCoordSearch = p.initChanNamePrefix("msgChannel.chanNamePrefix.search")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *msgChannelConfig) initQueryCoordSearchResult() {
|
|
|
|
p.QueryCoordSearchResult = p.initChanNamePrefix("msgChannel.chanNamePrefix.searchResult")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *msgChannelConfig) initQueryCoordTimeTick() {
|
|
|
|
p.QueryCoordTimeTick = p.initChanNamePrefix("msgChannel.chanNamePrefix.queryTimeTick")
|
|
|
|
}
|
|
|
|
|
|
|
|
// --- querynode ---
|
|
|
|
func (p *msgChannelConfig) initQueryNodeStats() {
|
|
|
|
p.QueryNodeStats = p.initChanNamePrefix("msgChannel.chanNamePrefix.queryNodeStats")
|
|
|
|
}
|
|
|
|
|
|
|
|
// --- datacoord ---
|
|
|
|
func (p *msgChannelConfig) initDataCoordStatistic() {
|
|
|
|
p.DataCoordStatistic = p.initChanNamePrefix("msgChannel.chanNamePrefix.dataCoordStatistic")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *msgChannelConfig) initDataCoordTimeTick() {
|
|
|
|
p.DataCoordTimeTick = p.initChanNamePrefix("msgChannel.chanNamePrefix.dataCoordTimeTick")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *msgChannelConfig) initDataCoordSegmentInfo() {
|
|
|
|
p.DataCoordSegmentInfo = p.initChanNamePrefix("msgChannel.chanNamePrefix.dataCoordSegmentInfo")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *msgChannelConfig) initDataCoordSubName() {
|
|
|
|
p.DataCoordSubName = p.initChanNamePrefix("msgChannel.subNamePrefix.dataCoordSubNamePrefix")
|
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// --- rootcoord ---
|
|
|
|
type rootCoordConfig struct {
|
|
|
|
BaseParams *BaseParamTable
|
|
|
|
|
|
|
|
Address string
|
|
|
|
Port int
|
|
|
|
|
|
|
|
DmlChannelNum int64
|
|
|
|
MaxPartitionNum int64
|
|
|
|
MinSegmentSizeToEnableIndex int64
|
|
|
|
|
|
|
|
CreatedTime time.Time
|
|
|
|
UpdatedTime time.Time
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *rootCoordConfig) init(bp *BaseParamTable) {
|
|
|
|
p.BaseParams = bp
|
|
|
|
|
|
|
|
p.initDmlChannelNum()
|
|
|
|
p.initMaxPartitionNum()
|
|
|
|
p.initMinSegmentSizeToEnableIndex()
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (p *rootCoordConfig) initDmlChannelNum() {
|
|
|
|
p.DmlChannelNum = p.BaseParams.ParseInt64WithDefault("rootCoord.dmlChannelNum", 256)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *rootCoordConfig) initMaxPartitionNum() {
|
|
|
|
p.MaxPartitionNum = p.BaseParams.ParseInt64WithDefault("rootCoord.maxPartitionNum", 4096)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *rootCoordConfig) initMinSegmentSizeToEnableIndex() {
|
|
|
|
p.MinSegmentSizeToEnableIndex = p.BaseParams.ParseInt64WithDefault("rootCoord.minSegmentSizeToEnableIndex", 1024)
|
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// --- proxy ---
|
|
|
|
type proxyConfig struct {
|
|
|
|
BaseParams *BaseParamTable
|
|
|
|
|
|
|
|
// NetworkPort & IP are not used
|
2022-01-10 14:51:34 +08:00
|
|
|
NetworkPort int
|
|
|
|
IP string
|
2021-12-23 18:39:11 +08:00
|
|
|
NetworkAddress string
|
|
|
|
|
|
|
|
Alias string
|
|
|
|
|
|
|
|
ProxyID UniqueID
|
|
|
|
TimeTickInterval time.Duration
|
|
|
|
MsgStreamTimeTickBufSize int64
|
|
|
|
MaxNameLength int64
|
|
|
|
MaxFieldNum int64
|
|
|
|
MaxShardNum int32
|
|
|
|
MaxDimension int64
|
|
|
|
BufFlagExpireTime time.Duration
|
|
|
|
BufFlagCleanupInterval time.Duration
|
|
|
|
|
|
|
|
// --- Channels ---
|
2022-02-02 00:35:43 +08:00
|
|
|
ProxySubName string
|
2021-12-23 18:39:11 +08:00
|
|
|
|
2022-01-06 13:09:49 +08:00
|
|
|
// required from QueryCoord
|
2021-12-23 18:39:11 +08:00
|
|
|
SearchResultChannelNames []string
|
|
|
|
RetrieveResultChannelNames []string
|
|
|
|
|
|
|
|
MaxTaskNum int64
|
|
|
|
|
|
|
|
CreatedTime time.Time
|
|
|
|
UpdatedTime time.Time
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *proxyConfig) init(bp *BaseParamTable) {
|
|
|
|
p.BaseParams = bp
|
|
|
|
|
|
|
|
p.initTimeTickInterval()
|
|
|
|
|
|
|
|
p.initProxySubName()
|
2022-02-02 00:35:43 +08:00
|
|
|
|
2021-12-23 18:39:11 +08:00
|
|
|
p.initMsgStreamTimeTickBufSize()
|
|
|
|
p.initMaxNameLength()
|
|
|
|
p.initMaxFieldNum()
|
|
|
|
p.initMaxShardNum()
|
|
|
|
p.initMaxDimension()
|
|
|
|
|
|
|
|
p.initMaxTaskNum()
|
|
|
|
p.initBufFlagExpireTime()
|
|
|
|
p.initBufFlagCleanupInterval()
|
|
|
|
}
|
|
|
|
|
2021-12-24 22:22:17 +08:00
|
|
|
// Refresh is called after session init
|
|
|
|
func (p *proxyConfig) Refresh() {
|
|
|
|
p.initProxySubName()
|
|
|
|
}
|
|
|
|
|
2021-12-23 18:39:11 +08:00
|
|
|
// InitAlias initialize Alias member.
|
|
|
|
func (p *proxyConfig) InitAlias(alias string) {
|
|
|
|
p.Alias = alias
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *proxyConfig) initTimeTickInterval() {
|
|
|
|
interval := p.BaseParams.ParseIntWithDefault("proxy.timeTickInterval", 200)
|
|
|
|
p.TimeTickInterval = time.Duration(interval) * time.Millisecond
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *proxyConfig) initProxySubName() {
|
2022-02-02 00:35:43 +08:00
|
|
|
cluster, err := p.BaseParams.Load("msgChannel.chanNamePrefix.cluster")
|
2021-12-23 18:39:11 +08:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2022-02-02 00:35:43 +08:00
|
|
|
subname, err := p.BaseParams.Load("msgChannel.subNamePrefix.proxySubNamePrefix")
|
2021-12-23 18:39:11 +08:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2022-02-02 00:35:43 +08:00
|
|
|
s := []string{cluster, subname, strconv.FormatInt(p.ProxyID, 10)}
|
|
|
|
p.ProxySubName = strings.Join(s, "-")
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (p *proxyConfig) initMsgStreamTimeTickBufSize() {
|
|
|
|
p.MsgStreamTimeTickBufSize = p.BaseParams.ParseInt64WithDefault("proxy.msgStream.timeTick.bufSize", 512)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *proxyConfig) initMaxNameLength() {
|
|
|
|
str := p.BaseParams.LoadWithDefault("proxy.maxNameLength", "255")
|
|
|
|
maxNameLength, err := strconv.ParseInt(str, 10, 64)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.MaxNameLength = maxNameLength
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *proxyConfig) initMaxShardNum() {
|
|
|
|
str := p.BaseParams.LoadWithDefault("proxy.maxShardNum", "256")
|
|
|
|
maxShardNum, err := strconv.ParseInt(str, 10, 64)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.MaxShardNum = int32(maxShardNum)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *proxyConfig) initMaxFieldNum() {
|
|
|
|
str := p.BaseParams.LoadWithDefault("proxy.maxFieldNum", "64")
|
|
|
|
maxFieldNum, err := strconv.ParseInt(str, 10, 64)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.MaxFieldNum = maxFieldNum
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *proxyConfig) initMaxDimension() {
|
|
|
|
str := p.BaseParams.LoadWithDefault("proxy.maxDimension", "32768")
|
|
|
|
maxDimension, err := strconv.ParseInt(str, 10, 64)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.MaxDimension = maxDimension
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *proxyConfig) initMaxTaskNum() {
|
|
|
|
p.MaxTaskNum = p.BaseParams.ParseInt64WithDefault("proxy.maxTaskNum", 1024)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *proxyConfig) initBufFlagExpireTime() {
|
|
|
|
expireTime := p.BaseParams.ParseInt64WithDefault("proxy.bufFlagExpireTime", 3600)
|
|
|
|
p.BufFlagExpireTime = time.Duration(expireTime) * time.Second
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *proxyConfig) initBufFlagCleanupInterval() {
|
|
|
|
interval := p.BaseParams.ParseInt64WithDefault("proxy.bufFlagCleanupInterval", 600)
|
|
|
|
p.BufFlagCleanupInterval = time.Duration(interval) * time.Second
|
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// --- querycoord ---
|
|
|
|
type queryCoordConfig struct {
|
|
|
|
BaseParams *BaseParamTable
|
|
|
|
|
|
|
|
NodeID uint64
|
|
|
|
|
|
|
|
Address string
|
|
|
|
Port int
|
|
|
|
QueryCoordID UniqueID
|
|
|
|
|
|
|
|
CreatedTime time.Time
|
|
|
|
UpdatedTime time.Time
|
|
|
|
|
|
|
|
//---- Handoff ---
|
|
|
|
AutoHandoff bool
|
|
|
|
|
|
|
|
//---- Balance ---
|
|
|
|
AutoBalance bool
|
|
|
|
OverloadedMemoryThresholdPercentage float64
|
|
|
|
BalanceIntervalSeconds int64
|
|
|
|
MemoryUsageMaxDifferencePercentage float64
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *queryCoordConfig) init(bp *BaseParamTable) {
|
|
|
|
p.BaseParams = bp
|
|
|
|
|
|
|
|
//---- Handoff ---
|
|
|
|
p.initAutoHandoff()
|
|
|
|
|
|
|
|
//---- Balance ---
|
|
|
|
p.initAutoBalance()
|
|
|
|
p.initOverloadedMemoryThresholdPercentage()
|
|
|
|
p.initBalanceIntervalSeconds()
|
|
|
|
p.initMemoryUsageMaxDifferencePercentage()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *queryCoordConfig) initAutoHandoff() {
|
|
|
|
handoff, err := p.BaseParams.Load("queryCoord.autoHandoff")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.AutoHandoff, err = strconv.ParseBool(handoff)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *queryCoordConfig) initAutoBalance() {
|
|
|
|
balanceStr := p.BaseParams.LoadWithDefault("queryCoord.autoBalance", "false")
|
|
|
|
autoBalance, err := strconv.ParseBool(balanceStr)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.AutoBalance = autoBalance
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *queryCoordConfig) initOverloadedMemoryThresholdPercentage() {
|
|
|
|
overloadedMemoryThresholdPercentage := p.BaseParams.LoadWithDefault("queryCoord.overloadedMemoryThresholdPercentage", "90")
|
|
|
|
thresholdPercentage, err := strconv.ParseInt(overloadedMemoryThresholdPercentage, 10, 64)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.OverloadedMemoryThresholdPercentage = float64(thresholdPercentage) / 100
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *queryCoordConfig) initBalanceIntervalSeconds() {
|
|
|
|
balanceInterval := p.BaseParams.LoadWithDefault("queryCoord.balanceIntervalSeconds", "60")
|
|
|
|
interval, err := strconv.ParseInt(balanceInterval, 10, 64)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.BalanceIntervalSeconds = interval
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *queryCoordConfig) initMemoryUsageMaxDifferencePercentage() {
|
|
|
|
maxDiff := p.BaseParams.LoadWithDefault("queryCoord.memoryUsageMaxDifferencePercentage", "30")
|
|
|
|
diffPercentage, err := strconv.ParseInt(maxDiff, 10, 64)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.MemoryUsageMaxDifferencePercentage = float64(diffPercentage) / 100
|
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// --- querynode ---
|
|
|
|
type queryNodeConfig struct {
|
|
|
|
BaseParams *BaseParamTable
|
|
|
|
|
|
|
|
Alias string
|
|
|
|
QueryNodeIP string
|
|
|
|
QueryNodePort int64
|
|
|
|
QueryNodeID UniqueID
|
|
|
|
// TODO: remove cacheSize
|
|
|
|
CacheSize int64 // deprecated
|
|
|
|
|
|
|
|
// channel prefix
|
2022-02-02 00:35:43 +08:00
|
|
|
QueryNodeSubName string
|
2021-12-23 18:39:11 +08:00
|
|
|
|
|
|
|
FlowGraphMaxQueueLength int32
|
|
|
|
FlowGraphMaxParallelism int32
|
|
|
|
|
|
|
|
// search
|
|
|
|
SearchChannelNames []string
|
|
|
|
SearchResultChannelNames []string
|
|
|
|
SearchReceiveBufSize int64
|
|
|
|
SearchPulsarBufSize int64
|
|
|
|
SearchResultReceiveBufSize int64
|
|
|
|
|
|
|
|
// Retrieve
|
|
|
|
RetrieveChannelNames []string
|
|
|
|
RetrieveResultChannelNames []string
|
|
|
|
RetrieveReceiveBufSize int64
|
|
|
|
RetrievePulsarBufSize int64
|
|
|
|
RetrieveResultReceiveBufSize int64
|
|
|
|
|
|
|
|
// stats
|
|
|
|
StatsPublishInterval int
|
|
|
|
|
|
|
|
GracefulTime int64
|
|
|
|
SliceIndex int
|
|
|
|
|
|
|
|
// segcore
|
|
|
|
ChunkRows int64
|
|
|
|
|
|
|
|
CreatedTime time.Time
|
|
|
|
UpdatedTime time.Time
|
|
|
|
|
|
|
|
// memory limit
|
|
|
|
OverloadedMemoryThresholdPercentage float64
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *queryNodeConfig) init(bp *BaseParamTable) {
|
|
|
|
p.BaseParams = bp
|
|
|
|
|
|
|
|
p.initCacheSize()
|
|
|
|
p.initGracefulTime()
|
|
|
|
|
|
|
|
p.initFlowGraphMaxQueueLength()
|
|
|
|
p.initFlowGraphMaxParallelism()
|
|
|
|
|
|
|
|
p.initSearchReceiveBufSize()
|
|
|
|
p.initSearchPulsarBufSize()
|
|
|
|
p.initSearchResultReceiveBufSize()
|
|
|
|
|
2022-02-02 00:35:43 +08:00
|
|
|
p.initQueryNodeSubName()
|
2021-12-23 18:39:11 +08:00
|
|
|
|
|
|
|
p.initStatsPublishInterval()
|
|
|
|
|
|
|
|
p.initSegcoreChunkRows()
|
|
|
|
|
|
|
|
p.initOverloadedMemoryThresholdPercentage()
|
|
|
|
}
|
|
|
|
|
|
|
|
// InitAlias initializes an alias for the QueryNode role.
|
|
|
|
func (p *queryNodeConfig) InitAlias(alias string) {
|
|
|
|
p.Alias = alias
|
|
|
|
}
|
|
|
|
|
2021-12-24 22:22:17 +08:00
|
|
|
// Refresh is called after session init
|
|
|
|
func (p *queryNodeConfig) Refresh() {
|
2022-02-02 00:35:43 +08:00
|
|
|
p.initQueryNodeSubName()
|
2021-12-24 22:22:17 +08:00
|
|
|
}
|
|
|
|
|
2021-12-23 18:39:11 +08:00
|
|
|
func (p *queryNodeConfig) initCacheSize() {
|
|
|
|
defer log.Debug("init cacheSize", zap.Any("cacheSize (GB)", p.CacheSize))
|
|
|
|
|
|
|
|
const defaultCacheSize = 32 // GB
|
|
|
|
p.CacheSize = defaultCacheSize
|
|
|
|
|
|
|
|
var err error
|
|
|
|
cacheSize := os.Getenv("CACHE_SIZE")
|
|
|
|
if cacheSize == "" {
|
|
|
|
cacheSize, err = p.BaseParams.Load("queryNode.cacheSize")
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
value, err := strconv.ParseInt(cacheSize, 10, 64)
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
p.CacheSize = value
|
|
|
|
}
|
|
|
|
|
|
|
|
// advanced params
|
|
|
|
// stats
|
|
|
|
func (p *queryNodeConfig) initStatsPublishInterval() {
|
|
|
|
p.StatsPublishInterval = p.BaseParams.ParseIntWithDefault("queryNode.stats.publishInterval", 1000)
|
|
|
|
}
|
|
|
|
|
|
|
|
// dataSync:
|
|
|
|
func (p *queryNodeConfig) initFlowGraphMaxQueueLength() {
|
|
|
|
p.FlowGraphMaxQueueLength = p.BaseParams.ParseInt32WithDefault("queryNode.dataSync.flowGraph.maxQueueLength", 1024)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *queryNodeConfig) initFlowGraphMaxParallelism() {
|
|
|
|
p.FlowGraphMaxParallelism = p.BaseParams.ParseInt32WithDefault("queryNode.dataSync.flowGraph.maxParallelism", 1024)
|
|
|
|
}
|
|
|
|
|
|
|
|
// msgStream
|
|
|
|
func (p *queryNodeConfig) initSearchReceiveBufSize() {
|
|
|
|
p.SearchReceiveBufSize = p.BaseParams.ParseInt64WithDefault("queryNode.msgStream.search.recvBufSize", 512)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *queryNodeConfig) initSearchPulsarBufSize() {
|
|
|
|
p.SearchPulsarBufSize = p.BaseParams.ParseInt64WithDefault("queryNode.msgStream.search.pulsarBufSize", 512)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *queryNodeConfig) initSearchResultReceiveBufSize() {
|
|
|
|
p.SearchResultReceiveBufSize = p.BaseParams.ParseInt64WithDefault("queryNode.msgStream.searchResult.recvBufSize", 64)
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------ channel names
|
2022-02-02 00:35:43 +08:00
|
|
|
func (p *queryNodeConfig) initQueryNodeSubName() {
|
|
|
|
cluster, err := p.BaseParams.Load("msgChannel.chanNamePrefix.cluster")
|
2021-12-23 18:39:11 +08:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2022-02-02 00:35:43 +08:00
|
|
|
subname, err := p.BaseParams.Load("msgChannel.subNamePrefix.queryNodeSubNamePrefix")
|
2021-12-23 18:39:11 +08:00
|
|
|
if err != nil {
|
|
|
|
log.Warn(err.Error())
|
|
|
|
}
|
|
|
|
|
2022-02-02 00:35:43 +08:00
|
|
|
s := []string{cluster, subname}
|
|
|
|
p.QueryNodeSubName = strings.Join(s, "-")
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (p *queryNodeConfig) initGracefulTime() {
|
|
|
|
p.GracefulTime = p.BaseParams.ParseInt64("queryNode.gracefulTime")
|
|
|
|
log.Debug("query node init gracefulTime", zap.Any("gracefulTime", p.GracefulTime))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *queryNodeConfig) initSegcoreChunkRows() {
|
|
|
|
p.ChunkRows = p.BaseParams.ParseInt64WithDefault("queryNode.segcore.chunkRows", 32768)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *queryNodeConfig) initOverloadedMemoryThresholdPercentage() {
|
|
|
|
overloadedMemoryThresholdPercentage := p.BaseParams.LoadWithDefault("queryCoord.overloadedMemoryThresholdPercentage", "90")
|
|
|
|
thresholdPercentage, err := strconv.ParseInt(overloadedMemoryThresholdPercentage, 10, 64)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.OverloadedMemoryThresholdPercentage = float64(thresholdPercentage) / 100
|
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// --- datacoord ---
|
|
|
|
type dataCoordConfig struct {
|
|
|
|
BaseParams *BaseParamTable
|
|
|
|
|
|
|
|
NodeID int64
|
|
|
|
|
|
|
|
IP string
|
|
|
|
Port int
|
|
|
|
Address string
|
|
|
|
|
|
|
|
// --- ETCD ---
|
2022-01-06 14:49:20 +08:00
|
|
|
ChannelWatchSubPath string
|
2021-12-23 18:39:11 +08:00
|
|
|
|
|
|
|
// --- SEGMENTS ---
|
|
|
|
SegmentMaxSize float64
|
|
|
|
SegmentSealProportion float64
|
|
|
|
SegAssignmentExpiration int64
|
|
|
|
|
|
|
|
CreatedTime time.Time
|
|
|
|
UpdatedTime time.Time
|
|
|
|
|
|
|
|
EnableCompaction bool
|
2022-01-10 19:03:35 +08:00
|
|
|
EnableAutoCompaction bool
|
2021-12-23 18:39:11 +08:00
|
|
|
EnableGarbageCollection bool
|
|
|
|
|
2022-02-07 22:45:46 +08:00
|
|
|
RetentionDuration int64
|
|
|
|
CompactionEntityExpiration int64
|
|
|
|
|
2021-12-23 18:39:11 +08:00
|
|
|
// Garbage Collection
|
|
|
|
GCInterval time.Duration
|
|
|
|
GCMissingTolerance time.Duration
|
|
|
|
GCDropTolerance time.Duration
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *dataCoordConfig) init(bp *BaseParamTable) {
|
|
|
|
p.BaseParams = bp
|
|
|
|
|
|
|
|
p.initChannelWatchPrefix()
|
|
|
|
|
|
|
|
p.initSegmentMaxSize()
|
|
|
|
p.initSegmentSealProportion()
|
|
|
|
p.initSegAssignmentExpiration()
|
|
|
|
|
|
|
|
p.initEnableCompaction()
|
|
|
|
p.initEnableAutoCompaction()
|
2022-02-07 22:45:46 +08:00
|
|
|
p.initCompactionEntityExpiration()
|
2021-12-23 18:39:11 +08:00
|
|
|
|
|
|
|
p.initEnableGarbageCollection()
|
|
|
|
p.initGCInterval()
|
|
|
|
p.initGCMissingTolerance()
|
|
|
|
p.initGCDropTolerance()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *dataCoordConfig) initSegmentMaxSize() {
|
|
|
|
p.SegmentMaxSize = p.BaseParams.ParseFloatWithDefault("dataCoord.segment.maxSize", 512.0)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *dataCoordConfig) initSegmentSealProportion() {
|
|
|
|
p.SegmentSealProportion = p.BaseParams.ParseFloatWithDefault("dataCoord.segment.sealProportion", 0.75)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *dataCoordConfig) initSegAssignmentExpiration() {
|
|
|
|
p.SegAssignmentExpiration = p.BaseParams.ParseInt64WithDefault("dataCoord.segment.assignmentExpiration", 2000)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *dataCoordConfig) initChannelWatchPrefix() {
|
|
|
|
// WARN: this value should not be put to milvus.yaml. It's a default value for channel watch path.
|
|
|
|
// This will be removed after we reconstruct our config module.
|
|
|
|
p.ChannelWatchSubPath = "channelwatch"
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *dataCoordConfig) initEnableCompaction() {
|
|
|
|
p.EnableCompaction = p.BaseParams.ParseBool("dataCoord.enableCompaction", false)
|
|
|
|
}
|
|
|
|
|
|
|
|
// -- GC --
|
|
|
|
func (p *dataCoordConfig) initEnableGarbageCollection() {
|
|
|
|
p.EnableGarbageCollection = p.BaseParams.ParseBool("dataCoord.enableGarbageCollection", false)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *dataCoordConfig) initGCInterval() {
|
|
|
|
p.GCInterval = time.Duration(p.BaseParams.ParseInt64WithDefault("dataCoord.gc.interval", 60*60)) * time.Second
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *dataCoordConfig) initGCMissingTolerance() {
|
|
|
|
p.GCMissingTolerance = time.Duration(p.BaseParams.ParseInt64WithDefault("dataCoord.gc.missingTolerance", 24*60*60)) * time.Second
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *dataCoordConfig) initGCDropTolerance() {
|
|
|
|
p.GCDropTolerance = time.Duration(p.BaseParams.ParseInt64WithDefault("dataCoord.gc.dropTolerance", 24*60*60)) * time.Second
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *dataCoordConfig) initEnableAutoCompaction() {
|
|
|
|
p.EnableAutoCompaction = p.BaseParams.ParseBool("dataCoord.compaction.enableAutoCompaction", false)
|
|
|
|
}
|
|
|
|
|
2022-02-07 22:45:46 +08:00
|
|
|
func (p *dataCoordConfig) initCompactionEntityExpiration() {
|
|
|
|
p.CompactionEntityExpiration = p.BaseParams.ParseInt64WithDefault("dataCoord.compaction.entityExpiration", math.MaxInt64)
|
|
|
|
p.CompactionEntityExpiration = func(x, y int64) int64 {
|
|
|
|
if x > y {
|
|
|
|
return x
|
|
|
|
}
|
|
|
|
return y
|
|
|
|
}(p.CompactionEntityExpiration, p.RetentionDuration)
|
|
|
|
}
|
|
|
|
|
2021-12-23 18:39:11 +08:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// --- datanode ---
|
|
|
|
type dataNodeConfig struct {
|
|
|
|
BaseParams *BaseParamTable
|
|
|
|
|
|
|
|
// ID of the current DataNode
|
|
|
|
NodeID UniqueID
|
|
|
|
|
|
|
|
// IP of the current DataNode
|
|
|
|
IP string
|
|
|
|
|
|
|
|
// Port of the current DataNode
|
|
|
|
Port int
|
|
|
|
FlowGraphMaxQueueLength int32
|
|
|
|
FlowGraphMaxParallelism int32
|
|
|
|
FlushInsertBufferSize int64
|
|
|
|
InsertBinlogRootPath string
|
|
|
|
StatsBinlogRootPath string
|
|
|
|
DeleteBinlogRootPath string
|
|
|
|
Alias string // Different datanode in one machine
|
|
|
|
|
|
|
|
// Channel subscribition name -
|
2022-02-02 00:35:43 +08:00
|
|
|
DataNodeSubName string
|
2021-12-23 18:39:11 +08:00
|
|
|
|
|
|
|
// etcd
|
|
|
|
ChannelWatchSubPath string
|
|
|
|
|
|
|
|
CreatedTime time.Time
|
|
|
|
UpdatedTime time.Time
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *dataNodeConfig) init(bp *BaseParamTable) {
|
|
|
|
p.BaseParams = bp
|
|
|
|
|
|
|
|
p.initFlowGraphMaxQueueLength()
|
|
|
|
p.initFlowGraphMaxParallelism()
|
|
|
|
p.initFlushInsertBufferSize()
|
|
|
|
p.initInsertBinlogRootPath()
|
|
|
|
p.initStatsBinlogRootPath()
|
|
|
|
p.initDeleteBinlogRootPath()
|
|
|
|
|
2022-02-02 00:35:43 +08:00
|
|
|
p.initDataNodeSubName()
|
2021-12-23 18:39:11 +08:00
|
|
|
p.initChannelWatchPath()
|
|
|
|
}
|
|
|
|
|
2021-12-24 22:22:17 +08:00
|
|
|
// Refresh is called after session init
|
|
|
|
func (p *dataNodeConfig) Refresh() {
|
2022-02-02 00:35:43 +08:00
|
|
|
p.initDataNodeSubName()
|
2021-12-24 22:22:17 +08:00
|
|
|
}
|
|
|
|
|
2021-12-23 18:39:11 +08:00
|
|
|
// InitAlias init this DataNode alias
|
|
|
|
func (p *dataNodeConfig) InitAlias(alias string) {
|
|
|
|
p.Alias = alias
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *dataNodeConfig) initFlowGraphMaxQueueLength() {
|
|
|
|
p.FlowGraphMaxQueueLength = p.BaseParams.ParseInt32WithDefault("dataNode.dataSync.flowGraph.maxQueueLength", 1024)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *dataNodeConfig) initFlowGraphMaxParallelism() {
|
|
|
|
p.FlowGraphMaxParallelism = p.BaseParams.ParseInt32WithDefault("dataNode.dataSync.flowGraph.maxParallelism", 1024)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *dataNodeConfig) initFlushInsertBufferSize() {
|
|
|
|
p.FlushInsertBufferSize = p.BaseParams.ParseInt64("_DATANODE_INSERTBUFSIZE")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *dataNodeConfig) initInsertBinlogRootPath() {
|
2022-01-10 17:29:34 +08:00
|
|
|
// GOOSE TODO: rootPath change to TenentID
|
2021-12-23 18:39:11 +08:00
|
|
|
rootPath, err := p.BaseParams.Load("minio.rootPath")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.InsertBinlogRootPath = path.Join(rootPath, "insert_log")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *dataNodeConfig) initStatsBinlogRootPath() {
|
|
|
|
rootPath, err := p.BaseParams.Load("minio.rootPath")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.StatsBinlogRootPath = path.Join(rootPath, "stats_log")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *dataNodeConfig) initDeleteBinlogRootPath() {
|
|
|
|
rootPath, err := p.BaseParams.Load("minio.rootPath")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.DeleteBinlogRootPath = path.Join(rootPath, "delta_log")
|
|
|
|
}
|
|
|
|
|
2022-02-02 00:35:43 +08:00
|
|
|
func (p *dataNodeConfig) initDataNodeSubName() {
|
|
|
|
cluster, err := p.BaseParams.Load("msgChannel.chanNamePrefix.cluster")
|
2021-12-23 18:39:11 +08:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2022-02-02 00:35:43 +08:00
|
|
|
subname, err := p.BaseParams.Load("msgChannel.subNamePrefix.dataNodeSubNamePrefix")
|
2021-12-23 18:39:11 +08:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2022-02-02 00:35:43 +08:00
|
|
|
s := []string{cluster, subname, strconv.FormatInt(p.NodeID, 10)}
|
|
|
|
p.DataNodeSubName = strings.Join(s, "-")
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (p *dataNodeConfig) initChannelWatchPath() {
|
|
|
|
p.ChannelWatchSubPath = "channelwatch"
|
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// --- indexcoord ---
|
|
|
|
type indexCoordConfig struct {
|
|
|
|
BaseParams *BaseParamTable
|
|
|
|
|
|
|
|
Address string
|
|
|
|
Port int
|
|
|
|
|
|
|
|
IndexStorageRootPath string
|
|
|
|
|
|
|
|
CreatedTime time.Time
|
|
|
|
UpdatedTime time.Time
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *indexCoordConfig) init(bp *BaseParamTable) {
|
|
|
|
p.BaseParams = bp
|
|
|
|
|
|
|
|
p.initIndexStorageRootPath()
|
|
|
|
}
|
|
|
|
|
|
|
|
// initIndexStorageRootPath initializes the root path of index files.
|
|
|
|
func (p *indexCoordConfig) initIndexStorageRootPath() {
|
|
|
|
rootPath, err := p.BaseParams.Load("minio.rootPath")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.IndexStorageRootPath = path.Join(rootPath, "index_files")
|
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// --- indexnode ---
|
|
|
|
type indexNodeConfig struct {
|
|
|
|
BaseParams *BaseParamTable
|
|
|
|
|
|
|
|
IP string
|
|
|
|
Address string
|
|
|
|
Port int
|
|
|
|
|
|
|
|
NodeID int64
|
|
|
|
Alias string
|
|
|
|
|
|
|
|
IndexStorageRootPath string
|
|
|
|
|
|
|
|
CreatedTime time.Time
|
|
|
|
UpdatedTime time.Time
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *indexNodeConfig) init(bp *BaseParamTable) {
|
|
|
|
p.BaseParams = bp
|
|
|
|
|
|
|
|
p.initIndexStorageRootPath()
|
|
|
|
}
|
|
|
|
|
|
|
|
// InitAlias initializes an alias for the IndexNode role.
|
|
|
|
func (p *indexNodeConfig) InitAlias(alias string) {
|
|
|
|
p.Alias = alias
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *indexNodeConfig) initIndexStorageRootPath() {
|
|
|
|
rootPath, err := p.BaseParams.Load("minio.rootPath")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.IndexStorageRootPath = path.Join(rootPath, "index_files")
|
|
|
|
}
|
|
|
|
|
2021-12-17 10:23:15 +08:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2021-12-23 18:39:11 +08:00
|
|
|
// --- grpc ---
|
2021-12-17 10:23:15 +08:00
|
|
|
type grpcConfig struct {
|
|
|
|
BaseParamTable
|
|
|
|
|
2022-01-14 18:29:34 +08:00
|
|
|
once sync.Once
|
|
|
|
Domain string
|
|
|
|
IP string
|
|
|
|
Port int
|
2021-12-17 10:23:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (p *grpcConfig) init(domain string) {
|
|
|
|
p.BaseParamTable.Init()
|
|
|
|
p.Domain = domain
|
|
|
|
|
|
|
|
p.LoadFromEnv()
|
|
|
|
p.LoadFromArgs()
|
|
|
|
p.initPort()
|
|
|
|
}
|
|
|
|
|
|
|
|
// LoadFromEnv is used to initialize configuration items from env.
|
|
|
|
func (p *grpcConfig) LoadFromEnv() {
|
|
|
|
p.IP = ipv4.LocalIP()
|
|
|
|
}
|
|
|
|
|
|
|
|
// LoadFromArgs is used to initialize configuration items from args.
|
|
|
|
func (p *grpcConfig) LoadFromArgs() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *grpcConfig) initPort() {
|
|
|
|
p.Port = p.ParseInt(p.Domain + ".port")
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetAddress return grpc address
|
|
|
|
func (p *grpcConfig) GetAddress() string {
|
|
|
|
return p.IP + ":" + strconv.Itoa(p.Port)
|
|
|
|
}
|
|
|
|
|
2022-01-07 13:27:38 +08:00
|
|
|
// GrpcServerConfig is configuration for grpc server.
|
2021-12-17 10:23:15 +08:00
|
|
|
type GrpcServerConfig struct {
|
|
|
|
grpcConfig
|
|
|
|
|
|
|
|
ServerMaxSendSize int
|
|
|
|
ServerMaxRecvSize int
|
|
|
|
}
|
|
|
|
|
|
|
|
// InitOnce initialize grpc server config once
|
|
|
|
func (p *GrpcServerConfig) InitOnce(domain string) {
|
|
|
|
p.once.Do(func() {
|
|
|
|
p.init(domain)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *GrpcServerConfig) init(domain string) {
|
|
|
|
p.grpcConfig.init(domain)
|
|
|
|
|
|
|
|
p.initServerMaxSendSize()
|
|
|
|
p.initServerMaxRecvSize()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *GrpcServerConfig) initServerMaxSendSize() {
|
|
|
|
var err error
|
|
|
|
|
|
|
|
valueStr, err := p.Load(p.Domain + ".grpc.serverMaxSendSize")
|
|
|
|
if err != nil {
|
|
|
|
p.ServerMaxSendSize = DefaultServerMaxSendSize
|
|
|
|
}
|
|
|
|
|
|
|
|
value, err := strconv.Atoi(valueStr)
|
|
|
|
if err != nil {
|
|
|
|
log.Warn("Failed to parse grpc.serverMaxSendSize, set to default",
|
|
|
|
zap.String("rol", p.Domain), zap.String("grpc.serverMaxSendSize", valueStr),
|
|
|
|
zap.Error(err))
|
|
|
|
|
|
|
|
p.ServerMaxSendSize = DefaultServerMaxSendSize
|
|
|
|
} else {
|
|
|
|
p.ServerMaxSendSize = value
|
|
|
|
}
|
|
|
|
|
|
|
|
log.Debug("initServerMaxSendSize",
|
|
|
|
zap.String("role", p.Domain), zap.Int("grpc.serverMaxSendSize", p.ServerMaxSendSize))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *GrpcServerConfig) initServerMaxRecvSize() {
|
|
|
|
var err error
|
|
|
|
|
|
|
|
valueStr, err := p.Load(p.Domain + ".grpc.serverMaxRecvSize")
|
|
|
|
if err != nil {
|
|
|
|
p.ServerMaxRecvSize = DefaultServerMaxRecvSize
|
|
|
|
}
|
|
|
|
|
|
|
|
value, err := strconv.Atoi(valueStr)
|
|
|
|
if err != nil {
|
|
|
|
log.Warn("Failed to parse grpc.serverMaxRecvSize, set to default",
|
|
|
|
zap.String("role", p.Domain), zap.String("grpc.serverMaxRecvSize", valueStr),
|
|
|
|
zap.Error(err))
|
|
|
|
|
|
|
|
p.ServerMaxRecvSize = DefaultServerMaxRecvSize
|
|
|
|
} else {
|
|
|
|
p.ServerMaxRecvSize = value
|
|
|
|
}
|
|
|
|
|
|
|
|
log.Debug("initServerMaxRecvSize",
|
|
|
|
zap.String("role", p.Domain), zap.Int("grpc.serverMaxRecvSize", p.ServerMaxRecvSize))
|
|
|
|
}
|
|
|
|
|
2022-01-07 13:27:38 +08:00
|
|
|
// GrpcClientConfig is configuration for grpc client.
|
2021-12-17 10:23:15 +08:00
|
|
|
type GrpcClientConfig struct {
|
|
|
|
grpcConfig
|
|
|
|
|
|
|
|
ClientMaxSendSize int
|
|
|
|
ClientMaxRecvSize int
|
|
|
|
}
|
|
|
|
|
|
|
|
// InitOnce initialize grpc client config once
|
|
|
|
func (p *GrpcClientConfig) InitOnce(domain string) {
|
|
|
|
p.once.Do(func() {
|
|
|
|
p.init(domain)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *GrpcClientConfig) init(domain string) {
|
|
|
|
p.grpcConfig.init(domain)
|
|
|
|
|
|
|
|
p.initClientMaxSendSize()
|
|
|
|
p.initClientMaxRecvSize()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *GrpcClientConfig) initClientMaxSendSize() {
|
|
|
|
var err error
|
|
|
|
|
|
|
|
valueStr, err := p.Load(p.Domain + ".grpc.clientMaxSendSize")
|
|
|
|
if err != nil {
|
|
|
|
p.ClientMaxSendSize = DefaultClientMaxSendSize
|
|
|
|
}
|
|
|
|
|
|
|
|
value, err := strconv.Atoi(valueStr)
|
|
|
|
if err != nil {
|
|
|
|
log.Warn("Failed to parse grpc.clientMaxSendSize, set to default",
|
|
|
|
zap.String("role", p.Domain), zap.String("grpc.clientMaxSendSize", valueStr),
|
|
|
|
zap.Error(err))
|
|
|
|
|
|
|
|
p.ClientMaxSendSize = DefaultClientMaxSendSize
|
|
|
|
} else {
|
|
|
|
p.ClientMaxSendSize = value
|
|
|
|
}
|
|
|
|
|
|
|
|
log.Debug("initClientMaxSendSize",
|
|
|
|
zap.String("role", p.Domain), zap.Int("grpc.clientMaxSendSize", p.ClientMaxSendSize))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *GrpcClientConfig) initClientMaxRecvSize() {
|
|
|
|
var err error
|
|
|
|
|
|
|
|
valueStr, err := p.Load(p.Domain + ".grpc.clientMaxRecvSize")
|
|
|
|
if err != nil {
|
|
|
|
p.ClientMaxRecvSize = DefaultClientMaxRecvSize
|
|
|
|
}
|
|
|
|
|
|
|
|
value, err := strconv.Atoi(valueStr)
|
|
|
|
if err != nil {
|
|
|
|
log.Warn("Failed to parse grpc.clientMaxRecvSize, set to default",
|
|
|
|
zap.String("role", p.Domain), zap.String("grpc.clientMaxRecvSize", valueStr),
|
|
|
|
zap.Error(err))
|
|
|
|
|
|
|
|
p.ClientMaxRecvSize = DefaultClientMaxRecvSize
|
|
|
|
} else {
|
|
|
|
p.ClientMaxRecvSize = value
|
|
|
|
}
|
|
|
|
|
|
|
|
log.Debug("initClientMaxRecvSize",
|
|
|
|
zap.String("role", p.Domain), zap.Int("grpc.clientMaxRecvSize", p.ClientMaxRecvSize))
|
|
|
|
}
|