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 (
|
2022-05-05 09:49:50 +08:00
|
|
|
"math"
|
2022-09-21 20:16:51 +08:00
|
|
|
"os"
|
2022-08-30 19:50:57 +08:00
|
|
|
"runtime"
|
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"
|
2022-04-24 22:03:44 +08:00
|
|
|
"sync/atomic"
|
2021-12-23 18:39:11 +08:00
|
|
|
"time"
|
2021-12-17 10:23:15 +08:00
|
|
|
|
2022-10-14 14:19:24 +08:00
|
|
|
"github.com/shirou/gopsutil/v3/disk"
|
2022-08-11 12:12:38 +08:00
|
|
|
"go.uber.org/zap"
|
2022-09-21 20:16:51 +08:00
|
|
|
|
|
|
|
"github.com/milvus-io/milvus/internal/log"
|
2021-12-17 10:23:15 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
2022-10-12 15:17:23 +08:00
|
|
|
// DefaultRetentionDuration defines the default duration for retention which is 1 days in seconds.
|
2022-08-25 10:42:53 +08:00
|
|
|
DefaultRetentionDuration = 3600 * 24
|
2022-04-08 20:29:33 +08:00
|
|
|
|
|
|
|
// DefaultIndexSliceSize defines the default slice size of index file when serializing.
|
2022-11-03 14:39:40 +08:00
|
|
|
DefaultIndexSliceSize = 16
|
|
|
|
DefaultGracefulTime = 5000 //ms
|
2022-11-04 12:41:35 +08:00
|
|
|
DefaultThreadCoreCoefficient = 10
|
2022-09-29 18:35:02 +08:00
|
|
|
|
|
|
|
DefaultSessionTTL = 60 //s
|
|
|
|
DefaultSessionRetryTimes = 30
|
2022-10-14 17:51:24 +08:00
|
|
|
|
|
|
|
DefaultMaxDegree = 56
|
|
|
|
DefaultSearchListSize = 100
|
|
|
|
DefaultPGCodeBudgetGBRatio = 0.125
|
|
|
|
DefaultBuildNumThreadsRatio = 1.0
|
|
|
|
DefaultSearchCacheBudgetGBRatio = 0.125
|
|
|
|
DefaultLoadNumThreadRatio = 8.0
|
|
|
|
DefaultBeamWidthRatio = 4.0
|
2021-12-17 10:23:15 +08:00
|
|
|
)
|
|
|
|
|
2022-02-09 14:41:45 +08:00
|
|
|
// ComponentParam is used to quickly and easily access all components' configurations.
|
2022-02-08 20:57:47 +08:00
|
|
|
type ComponentParam struct {
|
|
|
|
ServiceParam
|
2022-02-07 10:09:45 +08:00
|
|
|
once sync.Once
|
2022-01-10 19:03:35 +08:00
|
|
|
|
2022-10-08 15:38:58 +08:00
|
|
|
CommonCfg commonConfig
|
|
|
|
QuotaConfig quotaConfig
|
|
|
|
AutoIndexConfig autoIndexConfig
|
2021-12-23 18:39:11 +08:00
|
|
|
|
|
|
|
RootCoordCfg rootCoordConfig
|
|
|
|
ProxyCfg proxyConfig
|
|
|
|
QueryCoordCfg queryCoordConfig
|
|
|
|
QueryNodeCfg queryNodeConfig
|
|
|
|
DataCoordCfg dataCoordConfig
|
|
|
|
DataNodeCfg dataNodeConfig
|
|
|
|
IndexCoordCfg indexCoordConfig
|
|
|
|
IndexNodeCfg indexNodeConfig
|
2022-09-23 09:50:52 +08:00
|
|
|
HookCfg HookConfig
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// InitOnce initialize once
|
2022-02-08 20:57:47 +08:00
|
|
|
func (p *ComponentParam) InitOnce() {
|
2021-12-23 18:39:11 +08:00
|
|
|
p.once.Do(func() {
|
|
|
|
p.Init()
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2022-01-06 13:51:21 +08:00
|
|
|
// Init initialize the global param table
|
2022-02-08 20:57:47 +08:00
|
|
|
func (p *ComponentParam) Init() {
|
|
|
|
p.ServiceParam.Init()
|
2022-01-10 14:51:34 +08:00
|
|
|
|
2022-02-08 20:57:47 +08:00
|
|
|
p.CommonCfg.init(&p.BaseTable)
|
2022-09-16 09:56:47 +08:00
|
|
|
p.QuotaConfig.init(&p.BaseTable)
|
2022-10-08 15:38:58 +08:00
|
|
|
p.AutoIndexConfig.init(&p.BaseTable)
|
2022-01-10 17:29:34 +08:00
|
|
|
|
2022-02-08 20:57:47 +08:00
|
|
|
p.RootCoordCfg.init(&p.BaseTable)
|
|
|
|
p.ProxyCfg.init(&p.BaseTable)
|
|
|
|
p.QueryCoordCfg.init(&p.BaseTable)
|
|
|
|
p.QueryNodeCfg.init(&p.BaseTable)
|
|
|
|
p.DataCoordCfg.init(&p.BaseTable)
|
|
|
|
p.DataNodeCfg.init(&p.BaseTable)
|
|
|
|
p.IndexCoordCfg.init(&p.BaseTable)
|
|
|
|
p.IndexNodeCfg.init(&p.BaseTable)
|
2022-09-23 09:50:52 +08:00
|
|
|
p.HookCfg.init()
|
2022-01-10 17:29:34 +08:00
|
|
|
}
|
|
|
|
|
2022-02-07 10:09:45 +08:00
|
|
|
// SetLogConfig set log config with given role
|
2022-02-08 20:57:47 +08:00
|
|
|
func (p *ComponentParam) SetLogConfig(role string) {
|
2022-02-07 10:09:45 +08:00
|
|
|
p.BaseTable.RoleName = role
|
|
|
|
p.BaseTable.SetLogConfig()
|
2022-01-10 17:29:34 +08:00
|
|
|
}
|
|
|
|
|
2022-03-24 10:15:25 +08:00
|
|
|
func (p *ComponentParam) RocksmqEnable() bool {
|
|
|
|
return p.RocksmqCfg.Path != ""
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *ComponentParam) PulsarEnable() bool {
|
|
|
|
return p.PulsarCfg.Address != ""
|
|
|
|
}
|
|
|
|
|
2022-04-12 19:47:33 +08:00
|
|
|
func (p *ComponentParam) KafkaEnable() bool {
|
|
|
|
return p.KafkaCfg.Address != ""
|
|
|
|
}
|
|
|
|
|
2022-10-24 23:43:30 +08:00
|
|
|
// /////////////////////////////////////////////////////////////////////////////
|
2021-12-23 18:39:11 +08:00
|
|
|
// --- common ---
|
2022-01-10 19:03:35 +08:00
|
|
|
type commonConfig struct {
|
2022-02-08 20:57:47 +08:00
|
|
|
Base *BaseTable
|
2022-01-10 19:03:35 +08:00
|
|
|
|
2022-02-02 00:35:43 +08:00
|
|
|
ClusterPrefix string
|
2021-12-23 18:39:11 +08:00
|
|
|
|
2022-02-09 14:41:45 +08:00
|
|
|
ProxySubName string
|
|
|
|
|
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
|
2022-02-09 14:41:45 +08:00
|
|
|
QueryNodeSubName 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
|
2022-02-09 14:41:45 +08:00
|
|
|
DataNodeSubName string
|
2022-03-04 11:17:56 +08:00
|
|
|
|
|
|
|
DefaultPartitionName string
|
|
|
|
DefaultIndexName string
|
|
|
|
RetentionDuration int64
|
2022-04-28 11:51:47 +08:00
|
|
|
EntityExpirationTTL time.Duration
|
2022-03-04 11:17:56 +08:00
|
|
|
|
2022-10-14 17:51:24 +08:00
|
|
|
IndexSliceSize int64
|
2022-11-03 14:39:40 +08:00
|
|
|
ThreadCoreCoefficient int64
|
2022-10-14 17:51:24 +08:00
|
|
|
MaxDegree int64
|
|
|
|
SearchListSize int64
|
|
|
|
PGCodeBudgetGBRatio float64
|
|
|
|
BuildNumThreadsRatio float64
|
|
|
|
SearchCacheBudgetGBRatio float64
|
|
|
|
LoadNumThreadRatio float64
|
|
|
|
BeamWidthRatio float64
|
|
|
|
GracefulTime int64
|
2022-05-24 12:05:59 +08:00
|
|
|
|
|
|
|
StorageType string
|
|
|
|
SimdType string
|
2022-04-19 16:35:39 +08:00
|
|
|
|
|
|
|
AuthorizationEnabled bool
|
2022-08-11 12:12:38 +08:00
|
|
|
|
|
|
|
ClusterName string
|
2022-09-29 18:35:02 +08:00
|
|
|
|
|
|
|
SessionTTL int64
|
|
|
|
SessionRetryTimes int64
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
2022-03-04 11:17:56 +08:00
|
|
|
func (p *commonConfig) init(base *BaseTable) {
|
2022-02-08 20:57:47 +08:00
|
|
|
p.Base = base
|
2021-12-23 18:39:11 +08:00
|
|
|
|
2022-02-02 00:35:43 +08:00
|
|
|
// must init cluster prefix first
|
|
|
|
p.initClusterPrefix()
|
2022-02-09 14:41:45 +08:00
|
|
|
p.initProxySubName()
|
|
|
|
|
2022-02-02 00:35:43 +08:00
|
|
|
p.initRootCoordTimeTick()
|
|
|
|
p.initRootCoordStatistics()
|
|
|
|
p.initRootCoordDml()
|
|
|
|
p.initRootCoordDelta()
|
|
|
|
p.initRootCoordSubName()
|
|
|
|
|
|
|
|
p.initQueryCoordSearch()
|
|
|
|
p.initQueryCoordSearchResult()
|
|
|
|
p.initQueryCoordTimeTick()
|
2022-02-09 14:41:45 +08:00
|
|
|
p.initQueryNodeSubName()
|
2022-02-02 00:35:43 +08:00
|
|
|
|
|
|
|
p.initDataCoordStatistic()
|
|
|
|
p.initDataCoordTimeTick()
|
|
|
|
p.initDataCoordSegmentInfo()
|
|
|
|
p.initDataCoordSubName()
|
2022-02-09 14:41:45 +08:00
|
|
|
p.initDataNodeSubName()
|
2022-03-04 11:17:56 +08:00
|
|
|
|
|
|
|
p.initDefaultPartitionName()
|
|
|
|
p.initDefaultIndexName()
|
|
|
|
p.initRetentionDuration()
|
2022-04-28 11:51:47 +08:00
|
|
|
p.initEntityExpiration()
|
2022-03-04 11:17:56 +08:00
|
|
|
|
|
|
|
p.initSimdType()
|
2022-04-08 20:29:33 +08:00
|
|
|
p.initIndexSliceSize()
|
2022-10-14 17:51:24 +08:00
|
|
|
p.initMaxDegree()
|
|
|
|
p.initSearchListSize()
|
|
|
|
p.initPGCodeBudgetGBRatio()
|
|
|
|
p.initBuildNumThreadsRatio()
|
|
|
|
p.initSearchCacheBudgetGBRatio()
|
|
|
|
p.initLoadNumThreadRatio()
|
|
|
|
p.initBeamWidthRatio()
|
2022-05-24 12:05:59 +08:00
|
|
|
p.initGracefulTime()
|
2022-04-12 19:47:33 +08:00
|
|
|
p.initStorageType()
|
2022-11-03 14:39:40 +08:00
|
|
|
p.initThreadCoreCoefficient()
|
2022-04-19 16:35:39 +08:00
|
|
|
|
|
|
|
p.initEnableAuthorization()
|
2022-08-11 12:12:38 +08:00
|
|
|
|
|
|
|
p.initClusterName()
|
2022-09-29 18:35:02 +08:00
|
|
|
|
|
|
|
p.initSessionTTL()
|
|
|
|
p.initSessionRetryTimes()
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
2022-03-04 11:17:56 +08:00
|
|
|
func (p *commonConfig) initClusterPrefix() {
|
|
|
|
keys := []string{
|
|
|
|
"msgChannel.chanNamePrefix.cluster",
|
2022-06-07 14:52:06 +08:00
|
|
|
"common.chanNamePrefix.cluster",
|
2022-03-04 11:17:56 +08:00
|
|
|
}
|
2022-06-07 14:52:06 +08:00
|
|
|
str, err := p.Base.LoadWithPriority(keys)
|
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-03-04 11:17:56 +08:00
|
|
|
func (p *commonConfig) initChanNamePrefix(keys []string) string {
|
2022-06-07 14:52:06 +08:00
|
|
|
value, err := p.Base.LoadWithPriority(keys)
|
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-09 14:41:45 +08:00
|
|
|
// --- proxy ---
|
2022-03-04 11:17:56 +08:00
|
|
|
func (p *commonConfig) initProxySubName() {
|
|
|
|
keys := []string{
|
|
|
|
"msgChannel.subNamePrefix.proxySubNamePrefix",
|
2022-06-07 14:52:06 +08:00
|
|
|
"common.subNamePrefix.proxySubNamePrefix",
|
2022-03-04 11:17:56 +08:00
|
|
|
}
|
|
|
|
p.ProxySubName = p.initChanNamePrefix(keys)
|
2022-02-09 14:41:45 +08:00
|
|
|
}
|
|
|
|
|
2022-02-02 00:35:43 +08:00
|
|
|
// --- rootcoord ---
|
2022-04-17 23:47:36 +08:00
|
|
|
// Deprecate
|
2022-03-04 11:17:56 +08:00
|
|
|
func (p *commonConfig) initRootCoordTimeTick() {
|
|
|
|
keys := []string{
|
|
|
|
"msgChannel.chanNamePrefix.rootCoordTimeTick",
|
2022-06-07 14:52:06 +08:00
|
|
|
"common.chanNamePrefix.rootCoordTimeTick",
|
2022-03-04 11:17:56 +08:00
|
|
|
}
|
|
|
|
p.RootCoordTimeTick = p.initChanNamePrefix(keys)
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
2022-03-04 11:17:56 +08:00
|
|
|
func (p *commonConfig) initRootCoordStatistics() {
|
|
|
|
keys := []string{
|
|
|
|
"msgChannel.chanNamePrefix.rootCoordStatistics",
|
2022-06-07 14:52:06 +08:00
|
|
|
"common.chanNamePrefix.rootCoordStatistics",
|
2022-03-04 11:17:56 +08:00
|
|
|
}
|
|
|
|
p.RootCoordStatistics = p.initChanNamePrefix(keys)
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
2022-03-04 11:17:56 +08:00
|
|
|
func (p *commonConfig) initRootCoordDml() {
|
|
|
|
keys := []string{
|
|
|
|
"msgChannel.chanNamePrefix.rootCoordDml",
|
2022-06-07 14:52:06 +08:00
|
|
|
"common.chanNamePrefix.rootCoordDml",
|
2022-03-04 11:17:56 +08:00
|
|
|
}
|
|
|
|
p.RootCoordDml = p.initChanNamePrefix(keys)
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
2022-03-04 11:17:56 +08:00
|
|
|
func (p *commonConfig) initRootCoordDelta() {
|
|
|
|
keys := []string{
|
|
|
|
"msgChannel.chanNamePrefix.rootCoordDelta",
|
2022-06-07 14:52:06 +08:00
|
|
|
"common.chanNamePrefix.rootCoordDelta",
|
2022-03-04 11:17:56 +08:00
|
|
|
}
|
|
|
|
p.RootCoordDelta = p.initChanNamePrefix(keys)
|
2022-02-02 00:35:43 +08:00
|
|
|
}
|
|
|
|
|
2022-03-04 11:17:56 +08:00
|
|
|
func (p *commonConfig) initRootCoordSubName() {
|
|
|
|
keys := []string{
|
|
|
|
"msgChannel.subNamePrefix.rootCoordSubNamePrefix",
|
2022-06-07 14:52:06 +08:00
|
|
|
"common.subNamePrefix.rootCoordSubNamePrefix",
|
2022-03-04 11:17:56 +08:00
|
|
|
}
|
|
|
|
p.RootCoordSubName = p.initChanNamePrefix(keys)
|
2022-02-02 00:35:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// --- querycoord ---
|
2022-03-04 11:17:56 +08:00
|
|
|
func (p *commonConfig) initQueryCoordSearch() {
|
|
|
|
keys := []string{
|
|
|
|
"msgChannel.chanNamePrefix.search",
|
2022-06-07 14:52:06 +08:00
|
|
|
"common.chanNamePrefix.search",
|
2022-03-04 11:17:56 +08:00
|
|
|
}
|
|
|
|
p.QueryCoordSearch = p.initChanNamePrefix(keys)
|
2022-02-02 00:35:43 +08:00
|
|
|
}
|
|
|
|
|
2022-04-17 23:47:36 +08:00
|
|
|
// Deprecated, search result use grpc instead of a result channel
|
2022-03-04 11:17:56 +08:00
|
|
|
func (p *commonConfig) initQueryCoordSearchResult() {
|
|
|
|
keys := []string{
|
|
|
|
"msgChannel.chanNamePrefix.searchResult",
|
2022-06-07 14:52:06 +08:00
|
|
|
"common.chanNamePrefix.searchResult",
|
2022-03-04 11:17:56 +08:00
|
|
|
}
|
|
|
|
p.QueryCoordSearchResult = p.initChanNamePrefix(keys)
|
2022-02-02 00:35:43 +08:00
|
|
|
}
|
|
|
|
|
2022-04-17 23:47:36 +08:00
|
|
|
// Deprecate
|
2022-03-04 11:17:56 +08:00
|
|
|
func (p *commonConfig) initQueryCoordTimeTick() {
|
|
|
|
keys := []string{
|
|
|
|
"msgChannel.chanNamePrefix.queryTimeTick",
|
2022-06-07 14:52:06 +08:00
|
|
|
"common.chanNamePrefix.queryTimeTick",
|
2022-03-04 11:17:56 +08:00
|
|
|
}
|
|
|
|
p.QueryCoordTimeTick = p.initChanNamePrefix(keys)
|
2022-02-02 00:35:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// --- querynode ---
|
2022-03-04 11:17:56 +08:00
|
|
|
func (p *commonConfig) initQueryNodeSubName() {
|
|
|
|
keys := []string{
|
|
|
|
"msgChannel.subNamePrefix.queryNodeSubNamePrefix",
|
2022-06-07 14:52:06 +08:00
|
|
|
"common.subNamePrefix.queryNodeSubNamePrefix",
|
2022-03-04 11:17:56 +08:00
|
|
|
}
|
|
|
|
p.QueryNodeSubName = p.initChanNamePrefix(keys)
|
2022-02-09 14:41:45 +08:00
|
|
|
}
|
|
|
|
|
2022-02-02 00:35:43 +08:00
|
|
|
// --- datacoord ---
|
2022-03-04 11:17:56 +08:00
|
|
|
func (p *commonConfig) initDataCoordStatistic() {
|
|
|
|
keys := []string{
|
|
|
|
"msgChannel.chanNamePrefix.dataCoordStatistic",
|
2022-06-07 14:52:06 +08:00
|
|
|
"common.chanNamePrefix.dataCoordStatistic",
|
2022-03-04 11:17:56 +08:00
|
|
|
}
|
|
|
|
p.DataCoordStatistic = p.initChanNamePrefix(keys)
|
2022-02-02 00:35:43 +08:00
|
|
|
}
|
|
|
|
|
2022-04-17 23:47:36 +08:00
|
|
|
// Deprecate
|
2022-03-04 11:17:56 +08:00
|
|
|
func (p *commonConfig) initDataCoordTimeTick() {
|
|
|
|
keys := []string{
|
|
|
|
"msgChannel.chanNamePrefix.dataCoordTimeTick",
|
2022-06-07 14:52:06 +08:00
|
|
|
"common.chanNamePrefix.dataCoordTimeTick",
|
2022-03-04 11:17:56 +08:00
|
|
|
}
|
|
|
|
p.DataCoordTimeTick = p.initChanNamePrefix(keys)
|
2022-02-02 00:35:43 +08:00
|
|
|
}
|
|
|
|
|
2022-03-04 11:17:56 +08:00
|
|
|
func (p *commonConfig) initDataCoordSegmentInfo() {
|
|
|
|
keys := []string{
|
|
|
|
"msgChannel.chanNamePrefix.dataCoordSegmentInfo",
|
2022-06-07 14:52:06 +08:00
|
|
|
"common.chanNamePrefix.dataCoordSegmentInfo",
|
2022-03-04 11:17:56 +08:00
|
|
|
}
|
|
|
|
p.DataCoordSegmentInfo = p.initChanNamePrefix(keys)
|
2022-02-02 00:35:43 +08:00
|
|
|
}
|
|
|
|
|
2022-03-04 11:17:56 +08:00
|
|
|
func (p *commonConfig) initDataCoordSubName() {
|
|
|
|
keys := []string{
|
|
|
|
"msgChannel.subNamePrefix.dataCoordSubNamePrefix",
|
2022-06-07 14:52:06 +08:00
|
|
|
"common.subNamePrefix.dataCoordSubNamePrefix",
|
2022-03-04 11:17:56 +08:00
|
|
|
}
|
|
|
|
p.DataCoordSubName = p.initChanNamePrefix(keys)
|
2022-02-02 00:35:43 +08:00
|
|
|
}
|
|
|
|
|
2022-03-04 11:17:56 +08:00
|
|
|
func (p *commonConfig) initDataNodeSubName() {
|
|
|
|
keys := []string{
|
|
|
|
"msgChannel.subNamePrefix.dataNodeSubNamePrefix",
|
2022-06-07 14:52:06 +08:00
|
|
|
"common.subNamePrefix.dataNodeSubNamePrefix",
|
2022-03-04 11:17:56 +08:00
|
|
|
}
|
|
|
|
p.DataNodeSubName = p.initChanNamePrefix(keys)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *commonConfig) initDefaultPartitionName() {
|
|
|
|
p.DefaultPartitionName = p.Base.LoadWithDefault("common.defaultPartitionName", "_default")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *commonConfig) initDefaultIndexName() {
|
|
|
|
p.DefaultIndexName = p.Base.LoadWithDefault("common.defaultIndexName", "_default_idx")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *commonConfig) initRetentionDuration() {
|
|
|
|
p.RetentionDuration = p.Base.ParseInt64WithDefault("common.retentionDuration", DefaultRetentionDuration)
|
|
|
|
}
|
|
|
|
|
2022-04-28 11:51:47 +08:00
|
|
|
func (p *commonConfig) initEntityExpiration() {
|
|
|
|
ttl := p.Base.ParseInt64WithDefault("common.entityExpiration", -1)
|
|
|
|
if ttl < 0 {
|
|
|
|
p.EntityExpirationTTL = -1
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
// make sure ttl is larger than retention duration to ensure time travel works
|
|
|
|
if ttl > p.RetentionDuration {
|
|
|
|
p.EntityExpirationTTL = time.Duration(ttl) * time.Second
|
|
|
|
} else {
|
|
|
|
p.EntityExpirationTTL = time.Duration(p.RetentionDuration) * time.Second
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-04 11:17:56 +08:00
|
|
|
func (p *commonConfig) initSimdType() {
|
|
|
|
keys := []string{
|
|
|
|
"common.simdType",
|
|
|
|
"knowhere.simdType",
|
|
|
|
}
|
|
|
|
p.SimdType = p.Base.LoadWithDefault2(keys, "auto")
|
2022-02-09 14:41:45 +08:00
|
|
|
}
|
|
|
|
|
2022-04-08 20:29:33 +08:00
|
|
|
func (p *commonConfig) initIndexSliceSize() {
|
|
|
|
p.IndexSliceSize = p.Base.ParseInt64WithDefault("common.indexSliceSize", DefaultIndexSliceSize)
|
|
|
|
}
|
|
|
|
|
2022-11-03 14:39:40 +08:00
|
|
|
func (p *commonConfig) initThreadCoreCoefficient() {
|
|
|
|
p.ThreadCoreCoefficient = p.Base.ParseInt64WithDefault("common.threadCoreCoefficient", DefaultThreadCoreCoefficient)
|
|
|
|
}
|
|
|
|
|
2022-10-14 17:51:24 +08:00
|
|
|
func (p *commonConfig) initPGCodeBudgetGBRatio() {
|
|
|
|
p.PGCodeBudgetGBRatio = p.Base.ParseFloatWithDefault("common.DiskIndex.PGCodeBudgetGBRatio", DefaultPGCodeBudgetGBRatio)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *commonConfig) initBuildNumThreadsRatio() {
|
|
|
|
p.BuildNumThreadsRatio = p.Base.ParseFloatWithDefault("common.DiskIndex.BuildNumThreadsRatio", DefaultBuildNumThreadsRatio)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *commonConfig) initSearchCacheBudgetGBRatio() {
|
|
|
|
p.SearchCacheBudgetGBRatio = p.Base.ParseFloatWithDefault("common.DiskIndex.SearchCacheBudgetGBRatio", DefaultSearchCacheBudgetGBRatio)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *commonConfig) initLoadNumThreadRatio() {
|
|
|
|
p.LoadNumThreadRatio = p.Base.ParseFloatWithDefault("common.DiskIndex.LoadNumThreadRatio", DefaultLoadNumThreadRatio)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *commonConfig) initBeamWidthRatio() {
|
|
|
|
p.BeamWidthRatio = p.Base.ParseFloatWithDefault("common.DiskIndex.BeamWidthRatio", DefaultBeamWidthRatio)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *commonConfig) initMaxDegree() {
|
|
|
|
p.MaxDegree = p.Base.ParseInt64WithDefault("common.DiskIndex.MaxDegree", DefaultMaxDegree)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *commonConfig) initSearchListSize() {
|
|
|
|
p.SearchListSize = p.Base.ParseInt64WithDefault("common.DiskIndex.SearchListSize", DefaultSearchListSize)
|
|
|
|
}
|
|
|
|
|
2022-05-24 12:05:59 +08:00
|
|
|
func (p *commonConfig) initGracefulTime() {
|
|
|
|
p.GracefulTime = p.Base.ParseInt64WithDefault("common.gracefulTime", DefaultGracefulTime)
|
|
|
|
}
|
|
|
|
|
2022-04-12 19:47:33 +08:00
|
|
|
func (p *commonConfig) initStorageType() {
|
2022-04-19 17:47:39 +08:00
|
|
|
p.StorageType = p.Base.LoadWithDefault("common.storageType", "minio")
|
2022-04-12 19:47:33 +08:00
|
|
|
}
|
|
|
|
|
2022-04-19 16:35:39 +08:00
|
|
|
func (p *commonConfig) initEnableAuthorization() {
|
|
|
|
p.AuthorizationEnabled = p.Base.ParseBool("common.security.authorizationEnabled", false)
|
|
|
|
}
|
|
|
|
|
2022-08-11 12:12:38 +08:00
|
|
|
func (p *commonConfig) initClusterName() {
|
|
|
|
p.ClusterName = p.Base.LoadWithDefault("common.cluster.name", "")
|
|
|
|
}
|
|
|
|
|
2022-09-29 18:35:02 +08:00
|
|
|
func (p *commonConfig) initSessionTTL() {
|
|
|
|
p.SessionTTL = p.Base.ParseInt64WithDefault("common.session.ttl", 60)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *commonConfig) initSessionRetryTimes() {
|
|
|
|
p.SessionRetryTimes = p.Base.ParseInt64WithDefault("common.session.retryTimes", 30)
|
|
|
|
}
|
|
|
|
|
2022-10-24 23:43:30 +08:00
|
|
|
// /////////////////////////////////////////////////////////////////////////////
|
2022-02-02 00:35:43 +08:00
|
|
|
// --- rootcoord ---
|
|
|
|
type rootCoordConfig struct {
|
2022-02-08 20:57:47 +08:00
|
|
|
Base *BaseTable
|
2022-02-02 00:35:43 +08:00
|
|
|
|
2022-09-26 18:06:54 +08:00
|
|
|
DmlChannelNum int64
|
|
|
|
MaxPartitionNum int64
|
|
|
|
MinSegmentSizeToEnableIndex int64
|
|
|
|
ImportTaskExpiration float64
|
|
|
|
ImportTaskRetention float64
|
2022-02-02 00:35:43 +08:00
|
|
|
|
2022-03-25 11:03:25 +08:00
|
|
|
// --- ETCD Path ---
|
|
|
|
ImportTaskSubPath string
|
|
|
|
|
2022-02-02 00:35:43 +08:00
|
|
|
CreatedTime time.Time
|
|
|
|
UpdatedTime time.Time
|
2022-09-29 18:35:02 +08:00
|
|
|
|
|
|
|
EnableActiveStandby bool
|
2022-02-02 00:35:43 +08:00
|
|
|
}
|
|
|
|
|
2022-02-08 20:57:47 +08:00
|
|
|
func (p *rootCoordConfig) init(base *BaseTable) {
|
|
|
|
p.Base = base
|
|
|
|
p.DmlChannelNum = p.Base.ParseInt64WithDefault("rootCoord.dmlChannelNum", 256)
|
|
|
|
p.MaxPartitionNum = p.Base.ParseInt64WithDefault("rootCoord.maxPartitionNum", 4096)
|
|
|
|
p.MinSegmentSizeToEnableIndex = p.Base.ParseInt64WithDefault("rootCoord.minSegmentSizeToEnableIndex", 1024)
|
2022-06-15 12:20:10 +08:00
|
|
|
p.ImportTaskExpiration = p.Base.ParseFloatWithDefault("rootCoord.importTaskExpiration", 15*60)
|
|
|
|
p.ImportTaskRetention = p.Base.ParseFloatWithDefault("rootCoord.importTaskRetention", 24*60*60)
|
2022-03-25 11:03:25 +08:00
|
|
|
p.ImportTaskSubPath = "importtask"
|
2022-09-29 18:35:02 +08:00
|
|
|
p.EnableActiveStandby = p.Base.ParseBool("rootCoord.enableActiveStandby", false)
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
2022-10-24 23:43:30 +08:00
|
|
|
// /////////////////////////////////////////////////////////////////////////////
|
2021-12-23 18:39:11 +08:00
|
|
|
// --- proxy ---
|
|
|
|
type proxyConfig struct {
|
2022-02-08 20:57:47 +08:00
|
|
|
Base *BaseTable
|
2021-12-23 18:39:11 +08:00
|
|
|
|
2022-09-23 09:50:52 +08:00
|
|
|
Alias string
|
|
|
|
SoPath string
|
2021-12-23 18:39:11 +08:00
|
|
|
|
|
|
|
TimeTickInterval time.Duration
|
|
|
|
MsgStreamTimeTickBufSize int64
|
|
|
|
MaxNameLength int64
|
2022-04-11 19:49:34 +08:00
|
|
|
MaxUsernameLength int64
|
2022-04-20 13:03:40 +08:00
|
|
|
MinPasswordLength int64
|
2022-04-11 19:49:34 +08:00
|
|
|
MaxPasswordLength int64
|
2021-12-23 18:39:11 +08:00
|
|
|
MaxFieldNum int64
|
|
|
|
MaxShardNum int32
|
|
|
|
MaxDimension int64
|
2022-03-10 10:35:59 +08:00
|
|
|
GinLogging bool
|
2022-08-04 11:04:34 +08:00
|
|
|
MaxUserNum int
|
|
|
|
MaxRoleNum int
|
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
|
|
|
|
}
|
|
|
|
|
2022-02-08 20:57:47 +08:00
|
|
|
func (p *proxyConfig) init(base *BaseTable) {
|
|
|
|
p.Base = base
|
2021-12-23 18:39:11 +08:00
|
|
|
p.initTimeTickInterval()
|
|
|
|
|
|
|
|
p.initMsgStreamTimeTickBufSize()
|
|
|
|
p.initMaxNameLength()
|
2022-04-20 13:03:40 +08:00
|
|
|
p.initMinPasswordLength()
|
2022-04-11 19:49:34 +08:00
|
|
|
p.initMaxUsernameLength()
|
|
|
|
p.initMaxPasswordLength()
|
2021-12-23 18:39:11 +08:00
|
|
|
p.initMaxFieldNum()
|
|
|
|
p.initMaxShardNum()
|
|
|
|
p.initMaxDimension()
|
|
|
|
|
|
|
|
p.initMaxTaskNum()
|
2022-03-10 10:35:59 +08:00
|
|
|
p.initGinLogging()
|
2022-08-04 11:04:34 +08:00
|
|
|
p.initMaxUserNum()
|
|
|
|
p.initMaxRoleNum()
|
2022-09-23 09:50:52 +08:00
|
|
|
|
|
|
|
p.initSoPath()
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// InitAlias initialize Alias member.
|
|
|
|
func (p *proxyConfig) InitAlias(alias string) {
|
|
|
|
p.Alias = alias
|
|
|
|
}
|
|
|
|
|
2022-09-23 09:50:52 +08:00
|
|
|
func (p *proxyConfig) initSoPath() {
|
|
|
|
p.SoPath = p.Base.LoadWithDefault("proxy.soPath", "")
|
|
|
|
}
|
|
|
|
|
2021-12-23 18:39:11 +08:00
|
|
|
func (p *proxyConfig) initTimeTickInterval() {
|
2022-02-08 20:57:47 +08:00
|
|
|
interval := p.Base.ParseIntWithDefault("proxy.timeTickInterval", 200)
|
2021-12-23 18:39:11 +08:00
|
|
|
p.TimeTickInterval = time.Duration(interval) * time.Millisecond
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *proxyConfig) initMsgStreamTimeTickBufSize() {
|
2022-02-08 20:57:47 +08:00
|
|
|
p.MsgStreamTimeTickBufSize = p.Base.ParseInt64WithDefault("proxy.msgStream.timeTick.bufSize", 512)
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (p *proxyConfig) initMaxNameLength() {
|
2022-02-08 20:57:47 +08:00
|
|
|
str := p.Base.LoadWithDefault("proxy.maxNameLength", "255")
|
2021-12-23 18:39:11 +08:00
|
|
|
maxNameLength, err := strconv.ParseInt(str, 10, 64)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.MaxNameLength = maxNameLength
|
|
|
|
}
|
|
|
|
|
2022-04-11 19:49:34 +08:00
|
|
|
func (p *proxyConfig) initMaxUsernameLength() {
|
|
|
|
str := p.Base.LoadWithDefault("proxy.maxUsernameLength", "32")
|
|
|
|
maxUsernameLength, err := strconv.ParseInt(str, 10, 64)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.MaxUsernameLength = maxUsernameLength
|
|
|
|
}
|
|
|
|
|
2022-04-20 13:03:40 +08:00
|
|
|
func (p *proxyConfig) initMinPasswordLength() {
|
|
|
|
str := p.Base.LoadWithDefault("proxy.minPasswordLength", "6")
|
|
|
|
minPasswordLength, err := strconv.ParseInt(str, 10, 64)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.MinPasswordLength = minPasswordLength
|
|
|
|
}
|
|
|
|
|
2022-04-11 19:49:34 +08:00
|
|
|
func (p *proxyConfig) initMaxPasswordLength() {
|
|
|
|
str := p.Base.LoadWithDefault("proxy.maxPasswordLength", "256")
|
|
|
|
maxPasswordLength, err := strconv.ParseInt(str, 10, 64)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.MaxPasswordLength = maxPasswordLength
|
|
|
|
}
|
|
|
|
|
2021-12-23 18:39:11 +08:00
|
|
|
func (p *proxyConfig) initMaxShardNum() {
|
2022-02-08 20:57:47 +08:00
|
|
|
str := p.Base.LoadWithDefault("proxy.maxShardNum", "256")
|
2021-12-23 18:39:11 +08:00
|
|
|
maxShardNum, err := strconv.ParseInt(str, 10, 64)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.MaxShardNum = int32(maxShardNum)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *proxyConfig) initMaxFieldNum() {
|
2022-02-08 20:57:47 +08:00
|
|
|
str := p.Base.LoadWithDefault("proxy.maxFieldNum", "64")
|
2021-12-23 18:39:11 +08:00
|
|
|
maxFieldNum, err := strconv.ParseInt(str, 10, 64)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.MaxFieldNum = maxFieldNum
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *proxyConfig) initMaxDimension() {
|
2022-02-08 20:57:47 +08:00
|
|
|
str := p.Base.LoadWithDefault("proxy.maxDimension", "32768")
|
2021-12-23 18:39:11 +08:00
|
|
|
maxDimension, err := strconv.ParseInt(str, 10, 64)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.MaxDimension = maxDimension
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *proxyConfig) initMaxTaskNum() {
|
2022-02-08 20:57:47 +08:00
|
|
|
p.MaxTaskNum = p.Base.ParseInt64WithDefault("proxy.maxTaskNum", 1024)
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
2022-03-10 10:35:59 +08:00
|
|
|
func (p *proxyConfig) initGinLogging() {
|
|
|
|
// Gin logging is on by default.
|
|
|
|
p.GinLogging = p.Base.ParseBool("proxy.ginLogging", true)
|
|
|
|
}
|
|
|
|
|
2022-08-04 11:04:34 +08:00
|
|
|
func (p *proxyConfig) initMaxUserNum() {
|
|
|
|
str := p.Base.LoadWithDefault("proxy.maxUserNum", "100")
|
|
|
|
maxUserNum, err := strconv.ParseInt(str, 10, 64)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.MaxUserNum = int(maxUserNum)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *proxyConfig) initMaxRoleNum() {
|
|
|
|
str := p.Base.LoadWithDefault("proxy.maxRoleNum", "10")
|
|
|
|
maxRoleNum, err := strconv.ParseInt(str, 10, 64)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.MaxRoleNum = int(maxRoleNum)
|
|
|
|
}
|
|
|
|
|
2022-10-24 23:43:30 +08:00
|
|
|
// /////////////////////////////////////////////////////////////////////////////
|
2021-12-23 18:39:11 +08:00
|
|
|
// --- querycoord ---
|
|
|
|
type queryCoordConfig struct {
|
2022-02-08 20:57:47 +08:00
|
|
|
Base *BaseTable
|
2021-12-23 18:39:11 +08:00
|
|
|
|
|
|
|
CreatedTime time.Time
|
|
|
|
UpdatedTime time.Time
|
|
|
|
|
2022-07-18 13:06:28 +08:00
|
|
|
//---- Task ---
|
|
|
|
RetryNum int32
|
|
|
|
RetryInterval int64
|
2022-09-24 17:56:51 +08:00
|
|
|
TaskMergeCap int32
|
2022-07-18 13:06:28 +08:00
|
|
|
|
2021-12-23 18:39:11 +08:00
|
|
|
//---- Handoff ---
|
|
|
|
AutoHandoff bool
|
|
|
|
|
|
|
|
//---- Balance ---
|
|
|
|
AutoBalance bool
|
|
|
|
OverloadedMemoryThresholdPercentage float64
|
|
|
|
BalanceIntervalSeconds int64
|
|
|
|
MemoryUsageMaxDifferencePercentage float64
|
2022-09-15 18:48:32 +08:00
|
|
|
CheckInterval time.Duration
|
|
|
|
ChannelTaskTimeout time.Duration
|
|
|
|
SegmentTaskTimeout time.Duration
|
|
|
|
DistPullInterval time.Duration
|
|
|
|
LoadTimeoutSeconds time.Duration
|
|
|
|
CheckHandoffInterval time.Duration
|
2022-09-29 18:35:02 +08:00
|
|
|
EnableActiveStandby bool
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
2022-02-08 20:57:47 +08:00
|
|
|
func (p *queryCoordConfig) init(base *BaseTable) {
|
|
|
|
p.Base = base
|
2022-07-18 13:06:28 +08:00
|
|
|
//---- Task ---
|
|
|
|
p.initTaskRetryNum()
|
|
|
|
p.initTaskRetryInterval()
|
2022-09-24 17:56:51 +08:00
|
|
|
p.initTaskMergeCap()
|
2022-07-18 13:06:28 +08:00
|
|
|
|
2021-12-23 18:39:11 +08:00
|
|
|
//---- Handoff ---
|
|
|
|
p.initAutoHandoff()
|
|
|
|
|
|
|
|
//---- Balance ---
|
|
|
|
p.initAutoBalance()
|
|
|
|
p.initOverloadedMemoryThresholdPercentage()
|
|
|
|
p.initBalanceIntervalSeconds()
|
|
|
|
p.initMemoryUsageMaxDifferencePercentage()
|
2022-09-15 18:48:32 +08:00
|
|
|
p.initCheckInterval()
|
|
|
|
p.initChannelTaskTimeout()
|
|
|
|
p.initSegmentTaskTimeout()
|
|
|
|
p.initDistPullInterval()
|
|
|
|
p.initLoadTimeoutSeconds()
|
|
|
|
p.initCheckHandoffInterval()
|
2022-09-29 18:35:02 +08:00
|
|
|
p.initEnableActiveStandby()
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
2022-07-18 13:06:28 +08:00
|
|
|
func (p *queryCoordConfig) initTaskRetryNum() {
|
|
|
|
p.RetryNum = p.Base.ParseInt32WithDefault("queryCoord.task.retrynum", 5)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *queryCoordConfig) initTaskRetryInterval() {
|
|
|
|
p.RetryInterval = p.Base.ParseInt64WithDefault("queryCoord.task.retryinterval", int64(10*time.Second))
|
|
|
|
}
|
|
|
|
|
2022-09-24 17:56:51 +08:00
|
|
|
func (p *queryCoordConfig) initTaskMergeCap() {
|
2022-09-30 19:48:55 +08:00
|
|
|
p.TaskMergeCap = p.Base.ParseInt32WithDefault("queryCoord.taskMergeCap", 16)
|
2022-09-24 17:56:51 +08:00
|
|
|
}
|
|
|
|
|
2021-12-23 18:39:11 +08:00
|
|
|
func (p *queryCoordConfig) initAutoHandoff() {
|
2022-02-08 20:57:47 +08:00
|
|
|
handoff, err := p.Base.Load("queryCoord.autoHandoff")
|
2021-12-23 18:39:11 +08:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.AutoHandoff, err = strconv.ParseBool(handoff)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *queryCoordConfig) initAutoBalance() {
|
2022-02-08 20:57:47 +08:00
|
|
|
balanceStr := p.Base.LoadWithDefault("queryCoord.autoBalance", "false")
|
2021-12-23 18:39:11 +08:00
|
|
|
autoBalance, err := strconv.ParseBool(balanceStr)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.AutoBalance = autoBalance
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *queryCoordConfig) initOverloadedMemoryThresholdPercentage() {
|
2022-02-08 20:57:47 +08:00
|
|
|
overloadedMemoryThresholdPercentage := p.Base.LoadWithDefault("queryCoord.overloadedMemoryThresholdPercentage", "90")
|
2021-12-23 18:39:11 +08:00
|
|
|
thresholdPercentage, err := strconv.ParseInt(overloadedMemoryThresholdPercentage, 10, 64)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.OverloadedMemoryThresholdPercentage = float64(thresholdPercentage) / 100
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *queryCoordConfig) initBalanceIntervalSeconds() {
|
2022-02-08 20:57:47 +08:00
|
|
|
balanceInterval := p.Base.LoadWithDefault("queryCoord.balanceIntervalSeconds", "60")
|
2021-12-23 18:39:11 +08:00
|
|
|
interval, err := strconv.ParseInt(balanceInterval, 10, 64)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.BalanceIntervalSeconds = interval
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *queryCoordConfig) initMemoryUsageMaxDifferencePercentage() {
|
2022-02-08 20:57:47 +08:00
|
|
|
maxDiff := p.Base.LoadWithDefault("queryCoord.memoryUsageMaxDifferencePercentage", "30")
|
2021-12-23 18:39:11 +08:00
|
|
|
diffPercentage, err := strconv.ParseInt(maxDiff, 10, 64)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.MemoryUsageMaxDifferencePercentage = float64(diffPercentage) / 100
|
|
|
|
}
|
|
|
|
|
2022-09-29 18:35:02 +08:00
|
|
|
func (p *queryCoordConfig) initEnableActiveStandby() {
|
|
|
|
p.EnableActiveStandby = p.Base.ParseBool("queryCoord.enableActiveStandby", false)
|
|
|
|
}
|
|
|
|
|
2022-09-15 18:48:32 +08:00
|
|
|
func (p *queryCoordConfig) initCheckInterval() {
|
|
|
|
interval := p.Base.LoadWithDefault("queryCoord.checkInterval", "1000")
|
|
|
|
checkInterval, err := strconv.ParseInt(interval, 10, 64)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.CheckInterval = time.Duration(checkInterval) * time.Millisecond
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *queryCoordConfig) initChannelTaskTimeout() {
|
|
|
|
timeout := p.Base.LoadWithDefault("queryCoord.channelTaskTimeout", "60000")
|
|
|
|
taskTimeout, err := strconv.ParseInt(timeout, 10, 64)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.ChannelTaskTimeout = time.Duration(taskTimeout) * time.Millisecond
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *queryCoordConfig) initSegmentTaskTimeout() {
|
2022-09-22 14:14:52 +08:00
|
|
|
timeout := p.Base.LoadWithDefault("queryCoord.segmentTaskTimeout", "120000")
|
2022-09-15 18:48:32 +08:00
|
|
|
taskTimeout, err := strconv.ParseInt(timeout, 10, 64)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.SegmentTaskTimeout = time.Duration(taskTimeout) * time.Millisecond
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *queryCoordConfig) initDistPullInterval() {
|
|
|
|
interval := p.Base.LoadWithDefault("queryCoord.distPullInterval", "500")
|
|
|
|
pullInterval, err := strconv.ParseInt(interval, 10, 64)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.DistPullInterval = time.Duration(pullInterval) * time.Millisecond
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *queryCoordConfig) initLoadTimeoutSeconds() {
|
|
|
|
timeout := p.Base.LoadWithDefault("queryCoord.loadTimeoutSeconds", "600")
|
|
|
|
loadTimeout, err := strconv.ParseInt(timeout, 10, 64)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.LoadTimeoutSeconds = time.Duration(loadTimeout) * time.Second
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *queryCoordConfig) initCheckHandoffInterval() {
|
|
|
|
interval := p.Base.LoadWithDefault("queryCoord.checkHandoffInterval", "5000")
|
|
|
|
checkHandoffInterval, err := strconv.ParseInt(interval, 10, 64)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.CheckHandoffInterval = time.Duration(checkHandoffInterval) * time.Millisecond
|
|
|
|
}
|
|
|
|
|
2022-10-24 23:43:30 +08:00
|
|
|
// /////////////////////////////////////////////////////////////////////////////
|
2021-12-23 18:39:11 +08:00
|
|
|
// --- querynode ---
|
|
|
|
type queryNodeConfig struct {
|
2022-02-08 20:57:47 +08:00
|
|
|
Base *BaseTable
|
2021-12-23 18:39:11 +08:00
|
|
|
|
2022-11-04 14:25:38 +08:00
|
|
|
Alias string
|
2021-12-23 18:39:11 +08:00
|
|
|
|
|
|
|
FlowGraphMaxQueueLength int32
|
|
|
|
FlowGraphMaxParallelism int32
|
|
|
|
|
|
|
|
// stats
|
|
|
|
StatsPublishInterval int
|
|
|
|
|
2022-05-24 12:05:59 +08:00
|
|
|
SliceIndex int
|
2021-12-23 18:39:11 +08:00
|
|
|
|
|
|
|
// segcore
|
2022-05-05 09:49:50 +08:00
|
|
|
ChunkRows int64
|
|
|
|
SmallIndexNlist int64
|
|
|
|
SmallIndexNProbe int64
|
2021-12-23 18:39:11 +08:00
|
|
|
|
|
|
|
CreatedTime time.Time
|
|
|
|
UpdatedTime time.Time
|
|
|
|
|
|
|
|
// memory limit
|
2022-06-09 18:16:07 +08:00
|
|
|
LoadMemoryUsageFactor float64
|
2021-12-23 18:39:11 +08:00
|
|
|
OverloadedMemoryThresholdPercentage float64
|
2022-03-26 22:05:26 +08:00
|
|
|
|
2022-09-21 20:16:51 +08:00
|
|
|
// enable disk
|
|
|
|
EnableDisk bool
|
|
|
|
DiskCapacityLimit int64
|
|
|
|
MaxDiskUsagePercentage float64
|
|
|
|
|
2022-03-26 22:05:26 +08:00
|
|
|
// cache limit
|
2022-04-07 22:05:32 +08:00
|
|
|
CacheEnabled bool
|
|
|
|
CacheMemoryLimit int64
|
2022-05-23 16:41:58 +08:00
|
|
|
|
|
|
|
GroupEnabled bool
|
|
|
|
MaxReceiveChanSize int32
|
|
|
|
MaxUnsolvedQueueSize int32
|
2022-07-04 15:10:20 +08:00
|
|
|
MaxReadConcurrency int32
|
2022-05-23 16:41:58 +08:00
|
|
|
MaxGroupNQ int64
|
|
|
|
TopKMergeRatio float64
|
2022-07-04 15:10:20 +08:00
|
|
|
CPURatio float64
|
2022-11-04 22:25:01 +08:00
|
|
|
|
|
|
|
GCHelperEnabled bool
|
|
|
|
MinimumGOGCConfig int
|
|
|
|
MaximumGOGCConfig int
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
2022-02-08 20:57:47 +08:00
|
|
|
func (p *queryNodeConfig) init(base *BaseTable) {
|
|
|
|
p.Base = base
|
2021-12-23 18:39:11 +08:00
|
|
|
|
|
|
|
p.initFlowGraphMaxQueueLength()
|
|
|
|
p.initFlowGraphMaxParallelism()
|
|
|
|
|
|
|
|
p.initStatsPublishInterval()
|
|
|
|
|
2022-05-05 09:49:50 +08:00
|
|
|
p.initSmallIndexParams()
|
2021-12-23 18:39:11 +08:00
|
|
|
|
2022-06-09 18:16:07 +08:00
|
|
|
p.initLoadMemoryUsageFactor()
|
2021-12-23 18:39:11 +08:00
|
|
|
p.initOverloadedMemoryThresholdPercentage()
|
2022-03-26 22:05:26 +08:00
|
|
|
|
2022-04-07 22:05:32 +08:00
|
|
|
p.initCacheMemoryLimit()
|
|
|
|
p.initCacheEnabled()
|
2022-05-23 16:41:58 +08:00
|
|
|
|
|
|
|
p.initGroupEnabled()
|
|
|
|
p.initMaxReceiveChanSize()
|
2022-07-04 15:10:20 +08:00
|
|
|
p.initMaxReadConcurrency()
|
2022-05-23 16:41:58 +08:00
|
|
|
p.initMaxUnsolvedQueueSize()
|
|
|
|
p.initMaxGroupNQ()
|
|
|
|
p.initTopKMergeRatio()
|
2022-07-04 15:10:20 +08:00
|
|
|
p.initCPURatio()
|
2022-09-21 20:16:51 +08:00
|
|
|
p.initEnableDisk()
|
|
|
|
p.initDiskCapacity()
|
|
|
|
p.initMaxDiskUsagePercentage()
|
2022-11-04 22:25:01 +08:00
|
|
|
|
|
|
|
p.initGCTunerEnbaled()
|
|
|
|
p.initMaximumGOGC()
|
|
|
|
p.initMinimumGOGC()
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// InitAlias initializes an alias for the QueryNode role.
|
|
|
|
func (p *queryNodeConfig) InitAlias(alias string) {
|
|
|
|
p.Alias = alias
|
|
|
|
}
|
|
|
|
|
|
|
|
// advanced params
|
|
|
|
// stats
|
|
|
|
func (p *queryNodeConfig) initStatsPublishInterval() {
|
2022-02-08 20:57:47 +08:00
|
|
|
p.StatsPublishInterval = p.Base.ParseIntWithDefault("queryNode.stats.publishInterval", 1000)
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// dataSync:
|
|
|
|
func (p *queryNodeConfig) initFlowGraphMaxQueueLength() {
|
2022-02-08 20:57:47 +08:00
|
|
|
p.FlowGraphMaxQueueLength = p.Base.ParseInt32WithDefault("queryNode.dataSync.flowGraph.maxQueueLength", 1024)
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (p *queryNodeConfig) initFlowGraphMaxParallelism() {
|
2022-02-08 20:57:47 +08:00
|
|
|
p.FlowGraphMaxParallelism = p.Base.ParseInt32WithDefault("queryNode.dataSync.flowGraph.maxParallelism", 1024)
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
2022-05-05 09:49:50 +08:00
|
|
|
func (p *queryNodeConfig) initSmallIndexParams() {
|
2022-07-19 13:50:28 +08:00
|
|
|
p.ChunkRows = p.Base.ParseInt64WithDefault("queryNode.segcore.chunkRows", 1024)
|
2022-05-05 09:49:50 +08:00
|
|
|
if p.ChunkRows < 1024 {
|
|
|
|
log.Warn("chunk rows can not be less than 1024, force set to 1024", zap.Any("current", p.ChunkRows))
|
|
|
|
p.ChunkRows = 1024
|
|
|
|
}
|
|
|
|
|
|
|
|
// default NList is the first nlist
|
|
|
|
var defaultNList int64
|
|
|
|
for i := int64(0); i < p.ChunkRows; i++ {
|
|
|
|
if math.Pow(2.0, float64(i)) > math.Sqrt(float64(p.ChunkRows)) {
|
|
|
|
defaultNList = int64(math.Pow(2, float64(i)))
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
p.SmallIndexNlist = p.Base.ParseInt64WithDefault("queryNode.segcore.smallIndex.nlist", defaultNList)
|
|
|
|
if p.SmallIndexNlist > p.ChunkRows/8 {
|
|
|
|
log.Warn("small index nlist must smaller than chunkRows/8, force set to", zap.Any("nliit", p.ChunkRows/8))
|
|
|
|
p.SmallIndexNlist = p.ChunkRows / 8
|
|
|
|
}
|
|
|
|
|
|
|
|
defaultNprobe := p.SmallIndexNlist / 16
|
|
|
|
p.SmallIndexNProbe = p.Base.ParseInt64WithDefault("queryNode.segcore.smallIndex.nprobe", defaultNprobe)
|
|
|
|
if p.SmallIndexNProbe > p.SmallIndexNlist {
|
|
|
|
log.Warn("small index nprobe must smaller than nlist, force set to", zap.Any("nprobe", p.SmallIndexNlist))
|
|
|
|
p.SmallIndexNProbe = p.SmallIndexNlist
|
|
|
|
}
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
2022-06-09 18:16:07 +08:00
|
|
|
func (p *queryNodeConfig) initLoadMemoryUsageFactor() {
|
|
|
|
loadMemoryUsageFactor := p.Base.LoadWithDefault("queryNode.loadMemoryUsageFactor", "3")
|
|
|
|
factor, err := strconv.ParseFloat(loadMemoryUsageFactor, 64)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.LoadMemoryUsageFactor = factor
|
|
|
|
}
|
|
|
|
|
2021-12-23 18:39:11 +08:00
|
|
|
func (p *queryNodeConfig) initOverloadedMemoryThresholdPercentage() {
|
2022-02-08 20:57:47 +08:00
|
|
|
overloadedMemoryThresholdPercentage := p.Base.LoadWithDefault("queryCoord.overloadedMemoryThresholdPercentage", "90")
|
2021-12-23 18:39:11 +08:00
|
|
|
thresholdPercentage, err := strconv.ParseInt(overloadedMemoryThresholdPercentage, 10, 64)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.OverloadedMemoryThresholdPercentage = float64(thresholdPercentage) / 100
|
|
|
|
}
|
|
|
|
|
2022-04-07 22:05:32 +08:00
|
|
|
func (p *queryNodeConfig) initCacheMemoryLimit() {
|
|
|
|
overloadedMemoryThresholdPercentage := p.Base.LoadWithDefault("queryNode.cache.memoryLimit", "2147483648")
|
|
|
|
cacheMemoryLimit, err := strconv.ParseInt(overloadedMemoryThresholdPercentage, 10, 64)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.CacheMemoryLimit = cacheMemoryLimit
|
|
|
|
}
|
2022-04-24 22:03:44 +08:00
|
|
|
|
2022-04-07 22:05:32 +08:00
|
|
|
func (p *queryNodeConfig) initCacheEnabled() {
|
|
|
|
var err error
|
|
|
|
cacheEnabled := p.Base.LoadWithDefault("queryNode.cache.enabled", "true")
|
|
|
|
p.CacheEnabled, err = strconv.ParseBool(cacheEnabled)
|
2022-03-26 22:05:26 +08:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-23 16:41:58 +08:00
|
|
|
func (p *queryNodeConfig) initGroupEnabled() {
|
|
|
|
p.GroupEnabled = p.Base.ParseBool("queryNode.grouping.enabled", true)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *queryNodeConfig) initMaxReceiveChanSize() {
|
2022-07-04 15:10:20 +08:00
|
|
|
p.MaxReceiveChanSize = p.Base.ParseInt32WithDefault("queryNode.scheduler.receiveChanSize", 10240)
|
2022-05-23 16:41:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (p *queryNodeConfig) initMaxUnsolvedQueueSize() {
|
2022-07-04 15:10:20 +08:00
|
|
|
p.MaxUnsolvedQueueSize = p.Base.ParseInt32WithDefault("queryNode.scheduler.unsolvedQueueSize", 10240)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *queryNodeConfig) initCPURatio() {
|
|
|
|
p.CPURatio = p.Base.ParseFloatWithDefault("queryNode.scheduler.cpuRatio", 10.0)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *queryNodeConfig) initMaxReadConcurrency() {
|
2022-08-30 19:50:57 +08:00
|
|
|
readConcurrencyRatio := p.Base.ParseFloatWithDefault("queryNode.scheduler.maxReadConcurrentRatio", 2.0)
|
|
|
|
cpuNum := int32(runtime.GOMAXPROCS(0))
|
|
|
|
p.MaxReadConcurrency = int32(float64(cpuNum) * readConcurrencyRatio)
|
|
|
|
if p.MaxReadConcurrency < 1 {
|
|
|
|
p.MaxReadConcurrency = 1 // MaxReadConcurrency must >= 1
|
|
|
|
} else if p.MaxReadConcurrency > cpuNum*100 {
|
|
|
|
p.MaxReadConcurrency = cpuNum * 100 // MaxReadConcurrency must <= 100*cpuNum
|
2022-07-04 15:10:20 +08:00
|
|
|
}
|
2022-05-23 16:41:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (p *queryNodeConfig) initMaxGroupNQ() {
|
|
|
|
p.MaxGroupNQ = p.Base.ParseInt64WithDefault("queryNode.grouping.maxNQ", 1000)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *queryNodeConfig) initTopKMergeRatio() {
|
|
|
|
p.TopKMergeRatio = p.Base.ParseFloatWithDefault("queryNode.grouping.topKMergeRatio", 10.0)
|
|
|
|
}
|
|
|
|
|
2022-09-21 20:16:51 +08:00
|
|
|
func (p *queryNodeConfig) initEnableDisk() {
|
|
|
|
var err error
|
|
|
|
enableDisk := p.Base.LoadWithDefault("queryNode.enableDisk", "false")
|
|
|
|
p.EnableDisk, err = strconv.ParseBool(enableDisk)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *queryNodeConfig) initMaxDiskUsagePercentage() {
|
|
|
|
maxDiskUsagePercentageStr := p.Base.LoadWithDefault("queryNode.maxDiskUsagePercentage", "95")
|
|
|
|
maxDiskUsagePercentage, err := strconv.ParseInt(maxDiskUsagePercentageStr, 10, 64)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.MaxDiskUsagePercentage = float64(maxDiskUsagePercentage) / 100
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *queryNodeConfig) initDiskCapacity() {
|
|
|
|
diskSizeStr := os.Getenv("LOCAL_STORAGE_SIZE")
|
|
|
|
if len(diskSizeStr) == 0 {
|
|
|
|
diskUsage, err := disk.Usage("/")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.DiskCapacityLimit = int64(diskUsage.Total)
|
|
|
|
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
diskSize, err := strconv.ParseInt(diskSizeStr, 10, 64)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.DiskCapacityLimit = diskSize * 1024 * 1024 * 1024
|
|
|
|
}
|
|
|
|
|
2022-11-04 22:25:01 +08:00
|
|
|
func (p *queryNodeConfig) initGCTunerEnbaled() {
|
|
|
|
p.GCHelperEnabled = p.Base.ParseBool("queryNode.gchelper.enabled", true)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *queryNodeConfig) initMinimumGOGC() {
|
|
|
|
p.MinimumGOGCConfig = p.Base.ParseIntWithDefault("queryNode.gchelper.minimumGoGC", 30)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *queryNodeConfig) initMaximumGOGC() {
|
|
|
|
p.MaximumGOGCConfig = p.Base.ParseIntWithDefault("queryNode.gchelper.maximumGoGC", 200)
|
|
|
|
}
|
|
|
|
|
2022-10-24 23:43:30 +08:00
|
|
|
// /////////////////////////////////////////////////////////////////////////////
|
2021-12-23 18:39:11 +08:00
|
|
|
// --- datacoord ---
|
|
|
|
type dataCoordConfig struct {
|
2022-02-08 20:57:47 +08:00
|
|
|
Base *BaseTable
|
2021-12-23 18:39:11 +08:00
|
|
|
|
|
|
|
// --- ETCD ---
|
2022-01-06 14:49:20 +08:00
|
|
|
ChannelWatchSubPath string
|
2021-12-23 18:39:11 +08:00
|
|
|
|
|
|
|
// --- SEGMENTS ---
|
2022-09-20 20:54:50 +08:00
|
|
|
SegmentMaxSize float64
|
2022-09-25 20:12:52 +08:00
|
|
|
DiskSegmentMaxSize float64
|
2022-09-20 20:54:50 +08:00
|
|
|
SegmentSealProportion float64
|
|
|
|
SegAssignmentExpiration int64
|
|
|
|
SegmentMaxLifetime time.Duration
|
|
|
|
SegmentMaxIdleTime time.Duration
|
|
|
|
SegmentMinSizeFromIdleToSealed float64
|
2021-12-23 18:39:11 +08:00
|
|
|
|
|
|
|
CreatedTime time.Time
|
|
|
|
UpdatedTime time.Time
|
|
|
|
|
2022-06-15 23:14:10 +08:00
|
|
|
// compaction
|
|
|
|
EnableCompaction bool
|
|
|
|
EnableAutoCompaction atomic.Value
|
|
|
|
|
|
|
|
MinSegmentToMerge int
|
|
|
|
MaxSegmentToMerge int
|
|
|
|
SegmentSmallProportion float64
|
|
|
|
CompactionTimeoutInSeconds int32
|
2022-08-23 15:50:52 +08:00
|
|
|
CompactionCheckIntervalInSeconds int64
|
2022-06-15 23:14:10 +08:00
|
|
|
SingleCompactionRatioThreshold float32
|
|
|
|
SingleCompactionDeltaLogMaxSize int64
|
|
|
|
SingleCompactionExpiredLogMaxSize int64
|
|
|
|
SingleCompactionBinlogMaxNum int64
|
|
|
|
GlobalCompactionInterval time.Duration
|
2021-12-23 18:39:11 +08:00
|
|
|
|
|
|
|
// Garbage Collection
|
2022-06-15 23:14:10 +08:00
|
|
|
EnableGarbageCollection bool
|
|
|
|
GCInterval time.Duration
|
|
|
|
GCMissingTolerance time.Duration
|
|
|
|
GCDropTolerance time.Duration
|
2022-09-29 18:35:02 +08:00
|
|
|
EnableActiveStandby bool
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
2022-02-08 20:57:47 +08:00
|
|
|
func (p *dataCoordConfig) init(base *BaseTable) {
|
|
|
|
p.Base = base
|
2021-12-23 18:39:11 +08:00
|
|
|
p.initChannelWatchPrefix()
|
|
|
|
|
|
|
|
p.initSegmentMaxSize()
|
2022-09-25 20:12:52 +08:00
|
|
|
p.initDiskSegmentMaxSize()
|
2021-12-23 18:39:11 +08:00
|
|
|
p.initSegmentSealProportion()
|
|
|
|
p.initSegAssignmentExpiration()
|
2022-05-06 23:41:51 +08:00
|
|
|
p.initSegmentMaxLifetime()
|
2022-09-20 20:54:50 +08:00
|
|
|
p.initSegmentMaxIdleTime()
|
|
|
|
p.initSegmentMinSizeFromIdleToSealed()
|
2021-12-23 18:39:11 +08:00
|
|
|
|
|
|
|
p.initEnableCompaction()
|
|
|
|
p.initEnableAutoCompaction()
|
|
|
|
|
2022-06-15 23:14:10 +08:00
|
|
|
p.initCompactionMinSegment()
|
|
|
|
p.initCompactionMaxSegment()
|
|
|
|
p.initSegmentSmallProportion()
|
|
|
|
p.initCompactionTimeoutInSeconds()
|
2022-08-23 15:50:52 +08:00
|
|
|
p.initCompactionCheckIntervalInSeconds()
|
2022-06-15 23:14:10 +08:00
|
|
|
p.initSingleCompactionRatioThreshold()
|
|
|
|
p.initSingleCompactionDeltaLogMaxSize()
|
|
|
|
p.initSingleCompactionExpiredLogMaxSize()
|
|
|
|
p.initSingleCompactionBinlogMaxNum()
|
|
|
|
p.initGlobalCompactionInterval()
|
|
|
|
|
2021-12-23 18:39:11 +08:00
|
|
|
p.initEnableGarbageCollection()
|
|
|
|
p.initGCInterval()
|
|
|
|
p.initGCMissingTolerance()
|
|
|
|
p.initGCDropTolerance()
|
2022-09-29 18:35:02 +08:00
|
|
|
p.initEnableActiveStandby()
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (p *dataCoordConfig) initSegmentMaxSize() {
|
2022-02-08 20:57:47 +08:00
|
|
|
p.SegmentMaxSize = p.Base.ParseFloatWithDefault("dataCoord.segment.maxSize", 512.0)
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
2022-09-25 20:12:52 +08:00
|
|
|
func (p *dataCoordConfig) initDiskSegmentMaxSize() {
|
|
|
|
p.DiskSegmentMaxSize = p.Base.ParseFloatWithDefault("dataCoord.segment.diskSegmentMaxSize", 512.0*4)
|
|
|
|
}
|
|
|
|
|
2021-12-23 18:39:11 +08:00
|
|
|
func (p *dataCoordConfig) initSegmentSealProportion() {
|
2022-05-31 12:02:04 +08:00
|
|
|
p.SegmentSealProportion = p.Base.ParseFloatWithDefault("dataCoord.segment.sealProportion", 0.25)
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (p *dataCoordConfig) initSegAssignmentExpiration() {
|
2022-02-08 20:57:47 +08:00
|
|
|
p.SegAssignmentExpiration = p.Base.ParseInt64WithDefault("dataCoord.segment.assignmentExpiration", 2000)
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
2022-05-06 23:41:51 +08:00
|
|
|
func (p *dataCoordConfig) initSegmentMaxLifetime() {
|
|
|
|
p.SegmentMaxLifetime = time.Duration(p.Base.ParseInt64WithDefault("dataCoord.segment.maxLife", 24*60*60)) * time.Second
|
|
|
|
}
|
|
|
|
|
2022-09-20 20:54:50 +08:00
|
|
|
func (p *dataCoordConfig) initSegmentMaxIdleTime() {
|
|
|
|
p.SegmentMaxIdleTime = time.Duration(p.Base.ParseInt64WithDefault("dataCoord.segment.maxIdleTime", 60*60)) * time.Second
|
|
|
|
log.Info("init segment max idle time", zap.String("value", p.SegmentMaxIdleTime.String()))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *dataCoordConfig) initSegmentMinSizeFromIdleToSealed() {
|
|
|
|
p.SegmentMinSizeFromIdleToSealed = p.Base.ParseFloatWithDefault("dataCoord.segment.minSizeFromIdleToSealed", 16.0)
|
|
|
|
log.Info("init segment min size from idle to sealed", zap.Float64("value", p.SegmentMinSizeFromIdleToSealed))
|
|
|
|
}
|
|
|
|
|
2021-12-23 18:39:11 +08:00
|
|
|
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() {
|
2022-02-08 20:57:47 +08:00
|
|
|
p.EnableCompaction = p.Base.ParseBool("dataCoord.enableCompaction", false)
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
2022-06-15 23:14:10 +08:00
|
|
|
func (p *dataCoordConfig) initEnableAutoCompaction() {
|
|
|
|
p.EnableAutoCompaction.Store(p.Base.ParseBool("dataCoord.compaction.enableAutoCompaction", false))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *dataCoordConfig) initCompactionMinSegment() {
|
|
|
|
p.MinSegmentToMerge = p.Base.ParseIntWithDefault("dataCoord.compaction.min.segment", 4)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *dataCoordConfig) initCompactionMaxSegment() {
|
|
|
|
p.MaxSegmentToMerge = p.Base.ParseIntWithDefault("dataCoord.compaction.max.segment", 30)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *dataCoordConfig) initSegmentSmallProportion() {
|
|
|
|
p.SegmentSmallProportion = p.Base.ParseFloatWithDefault("dataCoord.segment.smallProportion", 0.5)
|
|
|
|
}
|
|
|
|
|
|
|
|
// compaction execution timeout
|
|
|
|
func (p *dataCoordConfig) initCompactionTimeoutInSeconds() {
|
|
|
|
p.CompactionTimeoutInSeconds = p.Base.ParseInt32WithDefault("dataCoord.compaction.timeout", 60*3)
|
|
|
|
}
|
|
|
|
|
2022-08-23 15:50:52 +08:00
|
|
|
func (p *dataCoordConfig) initCompactionCheckIntervalInSeconds() {
|
|
|
|
p.CompactionCheckIntervalInSeconds = p.Base.ParseInt64WithDefault("dataCoord.compaction.check.interval", 10)
|
|
|
|
}
|
|
|
|
|
2022-06-15 23:14:10 +08:00
|
|
|
// if total delete entities is large than a ratio of total entities, trigger single compaction.
|
|
|
|
func (p *dataCoordConfig) initSingleCompactionRatioThreshold() {
|
|
|
|
p.SingleCompactionRatioThreshold = float32(p.Base.ParseFloatWithDefault("dataCoord.compaction.single.ratio.threshold", 0.2))
|
|
|
|
}
|
|
|
|
|
|
|
|
// if total delta file size > SingleCompactionDeltaLogMaxSize, trigger single compaction
|
|
|
|
func (p *dataCoordConfig) initSingleCompactionDeltaLogMaxSize() {
|
|
|
|
p.SingleCompactionDeltaLogMaxSize = p.Base.ParseInt64WithDefault("dataCoord.compaction.single.deltalog.maxsize", 2*1024*1024)
|
|
|
|
}
|
|
|
|
|
|
|
|
// if total expired file size > SingleCompactionExpiredLogMaxSize, trigger single compaction
|
|
|
|
func (p *dataCoordConfig) initSingleCompactionExpiredLogMaxSize() {
|
|
|
|
p.SingleCompactionExpiredLogMaxSize = p.Base.ParseInt64WithDefault("dataCoord.compaction.single.expiredlog.maxsize", 10*1024*1024)
|
|
|
|
}
|
|
|
|
|
|
|
|
// if total binlog number > SingleCompactionBinlogMaxNum, trigger single compaction to ensure binlog number per segment is limited
|
|
|
|
func (p *dataCoordConfig) initSingleCompactionBinlogMaxNum() {
|
|
|
|
p.SingleCompactionBinlogMaxNum = p.Base.ParseInt64WithDefault("dataCoord.compaction.single.binlog.maxnum", 1000)
|
|
|
|
}
|
|
|
|
|
|
|
|
// interval we check and trigger global compaction
|
|
|
|
func (p *dataCoordConfig) initGlobalCompactionInterval() {
|
|
|
|
p.GlobalCompactionInterval = time.Duration(p.Base.ParseInt64WithDefault("dataCoord.compaction.global.interval", int64(60*time.Second)))
|
|
|
|
}
|
|
|
|
|
2021-12-23 18:39:11 +08:00
|
|
|
// -- GC --
|
|
|
|
func (p *dataCoordConfig) initEnableGarbageCollection() {
|
2022-07-18 16:34:28 +08:00
|
|
|
p.EnableGarbageCollection = p.Base.ParseBool("dataCoord.enableGarbageCollection", true)
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (p *dataCoordConfig) initGCInterval() {
|
2022-02-08 20:57:47 +08:00
|
|
|
p.GCInterval = time.Duration(p.Base.ParseInt64WithDefault("dataCoord.gc.interval", 60*60)) * time.Second
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (p *dataCoordConfig) initGCMissingTolerance() {
|
2022-02-08 20:57:47 +08:00
|
|
|
p.GCMissingTolerance = time.Duration(p.Base.ParseInt64WithDefault("dataCoord.gc.missingTolerance", 24*60*60)) * time.Second
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (p *dataCoordConfig) initGCDropTolerance() {
|
2022-02-08 20:57:47 +08:00
|
|
|
p.GCDropTolerance = time.Duration(p.Base.ParseInt64WithDefault("dataCoord.gc.dropTolerance", 24*60*60)) * time.Second
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
2022-06-06 15:10:05 +08:00
|
|
|
func (p *dataCoordConfig) SetEnableAutoCompaction(enable bool) {
|
|
|
|
p.EnableAutoCompaction.Store(enable)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *dataCoordConfig) GetEnableAutoCompaction() bool {
|
|
|
|
enable := p.EnableAutoCompaction.Load()
|
|
|
|
if enable != nil {
|
|
|
|
return enable.(bool)
|
|
|
|
}
|
|
|
|
return false
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
2022-09-29 18:35:02 +08:00
|
|
|
func (p *dataCoordConfig) initEnableActiveStandby() {
|
|
|
|
p.EnableActiveStandby = p.Base.ParseBool("dataCoord.enableActiveStandby", false)
|
|
|
|
}
|
|
|
|
|
2022-10-24 23:43:30 +08:00
|
|
|
// /////////////////////////////////////////////////////////////////////////////
|
2021-12-23 18:39:11 +08:00
|
|
|
// --- datanode ---
|
|
|
|
type dataNodeConfig struct {
|
2022-02-08 20:57:47 +08:00
|
|
|
Base *BaseTable
|
2021-12-23 18:39:11 +08:00
|
|
|
|
|
|
|
FlowGraphMaxQueueLength int32
|
|
|
|
FlowGraphMaxParallelism int32
|
|
|
|
FlushInsertBufferSize int64
|
2022-11-07 18:49:02 +08:00
|
|
|
FlushDeleteBufferBytes int64
|
2022-08-25 19:32:53 +08:00
|
|
|
|
|
|
|
Alias string // Different datanode in one machine
|
2021-12-23 18:39:11 +08:00
|
|
|
|
|
|
|
// etcd
|
|
|
|
ChannelWatchSubPath string
|
|
|
|
|
2022-07-07 14:32:21 +08:00
|
|
|
// io concurrency to fetch stats logs
|
|
|
|
IOConcurrency int
|
|
|
|
|
2021-12-23 18:39:11 +08:00
|
|
|
CreatedTime time.Time
|
|
|
|
UpdatedTime time.Time
|
|
|
|
}
|
|
|
|
|
2022-02-08 20:57:47 +08:00
|
|
|
func (p *dataNodeConfig) init(base *BaseTable) {
|
|
|
|
p.Base = base
|
2021-12-23 18:39:11 +08:00
|
|
|
p.initFlowGraphMaxQueueLength()
|
|
|
|
p.initFlowGraphMaxParallelism()
|
|
|
|
p.initFlushInsertBufferSize()
|
2022-11-07 18:49:02 +08:00
|
|
|
p.initFlushDeleteBufferSize()
|
2022-07-07 14:32:21 +08:00
|
|
|
p.initIOConcurrency()
|
2021-12-23 18:39:11 +08:00
|
|
|
|
|
|
|
p.initChannelWatchPath()
|
|
|
|
}
|
|
|
|
|
|
|
|
// InitAlias init this DataNode alias
|
|
|
|
func (p *dataNodeConfig) InitAlias(alias string) {
|
|
|
|
p.Alias = alias
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *dataNodeConfig) initFlowGraphMaxQueueLength() {
|
2022-02-08 20:57:47 +08:00
|
|
|
p.FlowGraphMaxQueueLength = p.Base.ParseInt32WithDefault("dataNode.dataSync.flowGraph.maxQueueLength", 1024)
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (p *dataNodeConfig) initFlowGraphMaxParallelism() {
|
2022-02-08 20:57:47 +08:00
|
|
|
p.FlowGraphMaxParallelism = p.Base.ParseInt32WithDefault("dataNode.dataSync.flowGraph.maxParallelism", 1024)
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (p *dataNodeConfig) initFlushInsertBufferSize() {
|
2022-08-01 10:04:33 +08:00
|
|
|
bufferSize := p.Base.LoadWithDefault2([]string{"DATA_NODE_IBUFSIZE", "datanode.flush.insertBufSize"}, "0")
|
|
|
|
bs, err := strconv.ParseInt(bufferSize, 10, 64)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.FlushInsertBufferSize = bs
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
2022-11-07 18:49:02 +08:00
|
|
|
func (p *dataNodeConfig) initFlushDeleteBufferSize() {
|
|
|
|
deleteBufBytes := p.Base.ParseInt64WithDefault("datanode.flush.deleteBufBytes",
|
|
|
|
64*1024*1024)
|
|
|
|
p.FlushDeleteBufferBytes = deleteBufBytes
|
|
|
|
}
|
|
|
|
|
2021-12-23 18:39:11 +08:00
|
|
|
func (p *dataNodeConfig) initChannelWatchPath() {
|
|
|
|
p.ChannelWatchSubPath = "channelwatch"
|
|
|
|
}
|
|
|
|
|
2022-07-07 14:32:21 +08:00
|
|
|
func (p *dataNodeConfig) initIOConcurrency() {
|
|
|
|
p.IOConcurrency = p.Base.ParseIntWithDefault("dataNode.dataSync.ioConcurrency", 10)
|
|
|
|
}
|
|
|
|
|
2022-10-24 23:43:30 +08:00
|
|
|
// /////////////////////////////////////////////////////////////////////////////
|
2021-12-23 18:39:11 +08:00
|
|
|
// --- indexcoord ---
|
|
|
|
type indexCoordConfig struct {
|
2022-02-08 20:57:47 +08:00
|
|
|
Base *BaseTable
|
2021-12-23 18:39:11 +08:00
|
|
|
|
2022-09-27 22:38:55 +08:00
|
|
|
BindIndexNodeMode bool
|
|
|
|
IndexNodeAddress string
|
|
|
|
WithCredential bool
|
|
|
|
IndexNodeID int64
|
|
|
|
|
2022-08-25 15:48:54 +08:00
|
|
|
MinSegmentNumRowsToEnableIndex int64
|
2021-12-23 18:39:11 +08:00
|
|
|
|
2022-07-07 14:44:21 +08:00
|
|
|
GCInterval time.Duration
|
|
|
|
|
2021-12-23 18:39:11 +08:00
|
|
|
CreatedTime time.Time
|
|
|
|
UpdatedTime time.Time
|
2022-09-29 18:35:02 +08:00
|
|
|
|
|
|
|
EnableActiveStandby bool
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
2022-02-08 20:57:47 +08:00
|
|
|
func (p *indexCoordConfig) init(base *BaseTable) {
|
|
|
|
p.Base = base
|
2021-12-23 18:39:11 +08:00
|
|
|
|
2022-07-07 14:44:21 +08:00
|
|
|
p.initGCInterval()
|
2022-08-25 15:48:54 +08:00
|
|
|
p.initMinSegmentNumRowsToEnableIndex()
|
2022-09-27 22:38:55 +08:00
|
|
|
p.initBindIndexNodeMode()
|
|
|
|
p.initIndexNodeAddress()
|
|
|
|
p.initWithCredential()
|
|
|
|
p.initIndexNodeID()
|
2022-09-29 18:35:02 +08:00
|
|
|
p.initEnableActiveStandby()
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
2022-08-25 15:48:54 +08:00
|
|
|
func (p *indexCoordConfig) initMinSegmentNumRowsToEnableIndex() {
|
|
|
|
p.MinSegmentNumRowsToEnableIndex = p.Base.ParseInt64WithDefault("indexCoord.minSegmentNumRowsToEnableIndex", 1024)
|
|
|
|
}
|
|
|
|
|
2022-07-07 14:44:21 +08:00
|
|
|
func (p *indexCoordConfig) initGCInterval() {
|
|
|
|
p.GCInterval = time.Duration(p.Base.ParseInt64WithDefault("indexCoord.gc.interval", 60*10)) * time.Second
|
|
|
|
}
|
|
|
|
|
2022-09-27 22:38:55 +08:00
|
|
|
func (p *indexCoordConfig) initBindIndexNodeMode() {
|
|
|
|
p.BindIndexNodeMode = p.Base.ParseBool("indexCoord.bindIndexNodeMode.enable", false)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *indexCoordConfig) initIndexNodeAddress() {
|
|
|
|
p.IndexNodeAddress = p.Base.LoadWithDefault("indexCoord.bindIndexNodeMode.address", "localhost:22930")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *indexCoordConfig) initWithCredential() {
|
|
|
|
p.WithCredential = p.Base.ParseBool("indexCoord.bindIndexNodeMode.withCred", false)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *indexCoordConfig) initIndexNodeID() {
|
|
|
|
p.IndexNodeID = p.Base.ParseInt64WithDefault("indexCoord.bindIndexNodeMode.nodeID", 0)
|
|
|
|
}
|
|
|
|
|
2022-09-29 18:35:02 +08:00
|
|
|
func (p *indexCoordConfig) initEnableActiveStandby() {
|
|
|
|
p.EnableActiveStandby = p.Base.ParseBool("indexCoord.enableActiveStandby", false)
|
|
|
|
}
|
|
|
|
|
2022-10-24 23:43:30 +08:00
|
|
|
// /////////////////////////////////////////////////////////////////////////////
|
2021-12-23 18:39:11 +08:00
|
|
|
// --- indexnode ---
|
|
|
|
type indexNodeConfig struct {
|
2022-02-08 20:57:47 +08:00
|
|
|
Base *BaseTable
|
2021-12-23 18:39:11 +08:00
|
|
|
|
2022-04-24 22:03:44 +08:00
|
|
|
Alias string
|
2021-12-23 18:39:11 +08:00
|
|
|
|
2022-08-25 19:32:53 +08:00
|
|
|
BuildParallel int
|
2021-12-23 18:39:11 +08:00
|
|
|
|
|
|
|
CreatedTime time.Time
|
|
|
|
UpdatedTime time.Time
|
2022-09-21 20:16:51 +08:00
|
|
|
|
|
|
|
// enable disk
|
|
|
|
EnableDisk bool
|
|
|
|
DiskCapacityLimit int64
|
|
|
|
MaxDiskUsagePercentage float64
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
2022-02-08 20:57:47 +08:00
|
|
|
func (p *indexNodeConfig) init(base *BaseTable) {
|
|
|
|
p.Base = base
|
2022-07-07 14:44:21 +08:00
|
|
|
p.initBuildParallel()
|
2022-09-21 20:16:51 +08:00
|
|
|
p.initEnableDisk()
|
|
|
|
p.initDiskCapacity()
|
|
|
|
p.initMaxDiskUsagePercentage()
|
2021-12-23 18:39:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// InitAlias initializes an alias for the IndexNode role.
|
|
|
|
func (p *indexNodeConfig) InitAlias(alias string) {
|
|
|
|
p.Alias = alias
|
|
|
|
}
|
|
|
|
|
2022-07-07 14:44:21 +08:00
|
|
|
func (p *indexNodeConfig) initBuildParallel() {
|
|
|
|
p.BuildParallel = p.Base.ParseIntWithDefault("indexNode.scheduler.buildParallel", 1)
|
|
|
|
}
|
|
|
|
|
2022-09-21 20:16:51 +08:00
|
|
|
func (p *indexNodeConfig) initEnableDisk() {
|
|
|
|
var err error
|
|
|
|
enableDisk := p.Base.LoadWithDefault("indexNode.enableDisk", "false")
|
|
|
|
p.EnableDisk, err = strconv.ParseBool(enableDisk)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *indexNodeConfig) initDiskCapacity() {
|
|
|
|
diskSizeStr := os.Getenv("LOCAL_STORAGE_SIZE")
|
|
|
|
if len(diskSizeStr) == 0 {
|
|
|
|
diskUsage, err := disk.Usage("/")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
p.DiskCapacityLimit = int64(diskUsage.Total)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
diskSize, err := strconv.ParseInt(diskSizeStr, 10, 64)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.DiskCapacityLimit = diskSize * 1024 * 1024 * 1024
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *indexNodeConfig) initMaxDiskUsagePercentage() {
|
|
|
|
maxDiskUsagePercentageStr := p.Base.LoadWithDefault("indexNode.maxDiskUsagePercentage", "95")
|
|
|
|
maxDiskUsagePercentage, err := strconv.ParseInt(maxDiskUsagePercentageStr, 10, 64)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.MaxDiskUsagePercentage = float64(maxDiskUsagePercentage) / 100
|
|
|
|
}
|