milvus/internal/util/paramtable/component_param.go

1616 lines
42 KiB
Go
Raw Normal View History

// 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 (
"fmt"
"math"
"runtime"
"strconv"
"strings"
"sync"
"time"
"github.com/shirou/gopsutil/v3/disk"
)
const (
// DefaultRetentionDuration defines the default duration for retention which is 1 days in seconds.
DefaultRetentionDuration = 3600 * 24
// DefaultIndexSliceSize defines the default slice size of index file when serializing.
DefaultIndexSliceSize = 16
DefaultGracefulTime = 5000 //ms
DefaultGracefulStopTimeout = 30 // s
DefaultThreadCoreCoefficient = 10
DefaultSessionTTL = 60 //s
DefaultSessionRetryTimes = 30
DefaultMaxDegree = 56
DefaultSearchListSize = 100
DefaultPQCodeBudgetGBRatio = 0.125
DefaultBuildNumThreadsRatio = 1.0
DefaultSearchCacheBudgetGBRatio = 0.10
DefaultLoadNumThreadRatio = 8.0
DefaultBeamWidthRatio = 4.0
)
// ComponentParam is used to quickly and easily access all components' configurations.
type ComponentParam struct {
ServiceParam
once sync.Once
CommonCfg commonConfig
QuotaConfig quotaConfig
AutoIndexConfig autoIndexConfig
RootCoordCfg rootCoordConfig
ProxyCfg proxyConfig
QueryCoordCfg queryCoordConfig
QueryNodeCfg queryNodeConfig
DataCoordCfg dataCoordConfig
DataNodeCfg dataNodeConfig
IndexCoordCfg indexCoordConfig
IndexNodeCfg indexNodeConfig
HookCfg hookConfig
}
// InitOnce initialize once
func (p *ComponentParam) InitOnce() {
p.once.Do(func() {
p.Init()
})
}
// Init initialize the global param table
func (p *ComponentParam) Init() {
p.ServiceParam.Init()
p.CommonCfg.init(&p.BaseTable)
p.QuotaConfig.init(&p.BaseTable)
p.AutoIndexConfig.init(&p.BaseTable)
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)
p.HookCfg.init()
}
func (p *ComponentParam) RocksmqEnable() bool {
return p.RocksmqCfg.Path.GetValue() != ""
}
func (p *ComponentParam) PulsarEnable() bool {
return p.PulsarCfg.Address.GetValue() != ""
}
func (p *ComponentParam) KafkaEnable() bool {
return p.KafkaCfg.Address.GetValue() != ""
}
// /////////////////////////////////////////////////////////////////////////////
// --- common ---
type commonConfig struct {
ClusterPrefix ParamItem
ProxySubName ParamItem
RootCoordTimeTick ParamItem
RootCoordStatistics ParamItem
RootCoordDml ParamItem
RootCoordDelta ParamItem
RootCoordSubName ParamItem
QueryCoordSearch ParamItem
QueryCoordSearchResult ParamItem
QueryCoordTimeTick ParamItem
QueryNodeSubName ParamItem
DataCoordStatistic ParamItem
DataCoordTimeTick ParamItem
DataCoordSegmentInfo ParamItem
DataCoordSubName ParamItem
DataCoordWatchSubPath ParamItem
DataNodeSubName ParamItem
DefaultPartitionName ParamItem
DefaultIndexName ParamItem
RetentionDuration ParamItem
EntityExpirationTTL ParamItem
IndexSliceSize ParamItem
ThreadCoreCoefficient ParamItem
MaxDegree ParamItem
SearchListSize ParamItem
PQCodeBudgetGBRatio ParamItem
BuildNumThreadsRatio ParamItem
SearchCacheBudgetGBRatio ParamItem
LoadNumThreadRatio ParamItem
BeamWidthRatio ParamItem
GracefulTime ParamItem
GracefulStopTimeout ParamItem // unit: s
StorageType ParamItem
SimdType ParamItem
AuthorizationEnabled ParamItem
ClusterName ParamItem
SessionTTL ParamItem
SessionRetryTimes ParamItem
}
func (p *commonConfig) init(base *BaseTable) {
// must init cluster prefix first
p.ClusterPrefix = ParamItem{
Key: "common.chanNamePrefix.cluster",
Version: "2.1.0",
FallbackKeys: []string{"msgChannel.chanNamePrefix.cluster"},
PanicIfEmpty: true,
}
p.ClusterPrefix.Init(base.mgr)
chanNamePrefix := func(prefix string) string {
return strings.Join([]string{p.ClusterPrefix.GetValue(), prefix}, "-")
}
p.ProxySubName = ParamItem{
Key: "common.subNamePrefix.proxySubNamePrefix",
Version: "2.1.0",
FallbackKeys: []string{"msgChannel.subNamePrefix.proxySubNamePrefix"},
PanicIfEmpty: true,
Formatter: chanNamePrefix,
}
p.ProxySubName.Init(base.mgr)
// --- rootcoord ---
p.RootCoordTimeTick = ParamItem{
Key: "common.chanNamePrefix.rootCoordTimeTick",
Version: "2.1.0",
FallbackKeys: []string{"msgChannel.chanNamePrefix.rootCoordTimeTick"},
PanicIfEmpty: true,
Formatter: chanNamePrefix,
}
p.RootCoordTimeTick.Init(base.mgr)
p.RootCoordStatistics = ParamItem{
Key: "common.chanNamePrefix.rootCoordStatistics",
Version: "2.1.0",
FallbackKeys: []string{"msgChannel.chanNamePrefix.rootCoordStatistics"},
PanicIfEmpty: true,
Formatter: chanNamePrefix,
}
p.RootCoordStatistics.Init(base.mgr)
p.RootCoordDml = ParamItem{
Key: "common.chanNamePrefix.rootCoordDml",
Version: "2.1.0",
FallbackKeys: []string{"msgChannel.chanNamePrefix.rootCoordDml"},
PanicIfEmpty: true,
Formatter: chanNamePrefix,
}
p.RootCoordDml.Init(base.mgr)
p.RootCoordDelta = ParamItem{
Key: "common.chanNamePrefix.rootCoordDelta",
Version: "2.1.0",
FallbackKeys: []string{"msgChannel.chanNamePrefix.rootCoordDelta"},
PanicIfEmpty: true,
Formatter: chanNamePrefix,
}
p.RootCoordDelta.Init(base.mgr)
p.RootCoordSubName = ParamItem{
Key: "common.subNamePrefix.rootCoordSubNamePrefix",
Version: "2.1.0",
FallbackKeys: []string{"msgChannel.subNamePrefix.rootCoordSubNamePrefix"},
PanicIfEmpty: true,
Formatter: chanNamePrefix,
}
p.RootCoordSubName.Init(base.mgr)
p.QueryCoordSearch = ParamItem{
Key: "common.chanNamePrefix.search",
Version: "2.1.0",
FallbackKeys: []string{"msgChannel.chanNamePrefix.search"},
PanicIfEmpty: true,
Formatter: chanNamePrefix,
}
p.QueryCoordSearch.Init(base.mgr)
p.QueryCoordSearchResult = ParamItem{
Key: "common.chanNamePrefix.searchResult",
Version: "2.1.0",
FallbackKeys: []string{"msgChannel.chanNamePrefix.searchResult"},
PanicIfEmpty: true,
Formatter: chanNamePrefix,
}
p.QueryCoordSearchResult.Init(base.mgr)
p.QueryCoordTimeTick = ParamItem{
Key: "common.chanNamePrefix.queryTimeTick",
Version: "2.1.0",
FallbackKeys: []string{"msgChannel.chanNamePrefix.queryTimeTick"},
PanicIfEmpty: true,
Formatter: chanNamePrefix,
}
p.QueryCoordTimeTick.Init(base.mgr)
p.QueryNodeSubName = ParamItem{
Key: "common.subNamePrefix.queryNodeSubNamePrefix",
Version: "2.1.0",
FallbackKeys: []string{"msgChannel.subNamePrefix.queryNodeSubNamePrefix"},
PanicIfEmpty: true,
Formatter: chanNamePrefix,
}
p.QueryNodeSubName.Init(base.mgr)
p.DataCoordStatistic = ParamItem{
Key: "common.chanNamePrefix.dataCoordStatistic",
Version: "2.1.0",
FallbackKeys: []string{"msgChannel.chanNamePrefix.dataCoordStatistic"},
PanicIfEmpty: true,
Formatter: chanNamePrefix,
}
p.DataCoordStatistic.Init(base.mgr)
p.DataCoordTimeTick = ParamItem{
Key: "common.chanNamePrefix.dataCoordTimeTick",
Version: "2.1.0",
FallbackKeys: []string{"msgChannel.chanNamePrefix.dataCoordTimeTick"},
PanicIfEmpty: true,
Formatter: chanNamePrefix,
}
p.DataCoordTimeTick.Init(base.mgr)
p.DataCoordSegmentInfo = ParamItem{
Key: "common.chanNamePrefix.dataCoordSegmentInfo",
Version: "2.1.0",
FallbackKeys: []string{"msgChannel.chanNamePrefix.dataCoordSegmentInfo"},
PanicIfEmpty: true,
Formatter: chanNamePrefix,
}
p.DataCoordSegmentInfo.Init(base.mgr)
p.DataCoordSubName = ParamItem{
Key: "common.subNamePrefix.dataCoordSubNamePrefix",
Version: "2.1.0",
FallbackKeys: []string{"msgChannel.subNamePrefix.dataCoordSubNamePrefix"},
PanicIfEmpty: true,
Formatter: chanNamePrefix,
}
p.DataCoordSubName.Init(base.mgr)
p.DataCoordWatchSubPath = ParamItem{
Key: "common.subNamePrefix.dataCoordWatchSubPath",
Version: "2.1.0",
DefaultValue: "channelwatch",
PanicIfEmpty: true,
}
p.DataCoordWatchSubPath.Init(base.mgr)
p.DataNodeSubName = ParamItem{
Key: "common.subNamePrefix.dataNodeSubNamePrefix",
Version: "2.1.0",
FallbackKeys: []string{"msgChannel.subNamePrefix.dataNodeSubNamePrefix"},
PanicIfEmpty: true,
Formatter: chanNamePrefix,
}
p.DataNodeSubName.Init(base.mgr)
p.DefaultPartitionName = ParamItem{
Key: "common.defaultPartitionName",
Version: "2.0.0",
DefaultValue: "_default",
}
p.DefaultPartitionName.Init(base.mgr)
p.DefaultIndexName = ParamItem{
Key: "common.defaultIndexName",
Version: "2.0.0",
DefaultValue: "_default_idx",
}
p.DefaultIndexName.Init(base.mgr)
p.RetentionDuration = ParamItem{
Key: "common.retentionDuration",
Version: "2.0.0",
DefaultValue: strconv.Itoa(DefaultRetentionDuration),
}
p.RetentionDuration.Init(base.mgr)
p.EntityExpirationTTL = ParamItem{
Key: "common.entityExpiration",
Version: "2.1.0",
DefaultValue: "-1",
Formatter: func(value string) string {
ttl := getAsInt(value)
if ttl < 0 {
return "-1"
}
// make sure ttl is larger than retention duration to ensure time travel works
if ttl > p.RetentionDuration.GetAsInt() {
return strconv.Itoa(ttl)
}
return p.RetentionDuration.GetValue()
},
}
p.EntityExpirationTTL.Init(base.mgr)
p.SimdType = ParamItem{
Key: "common.simdType",
Version: "2.1.0",
DefaultValue: "auto",
FallbackKeys: []string{"knowhere.simdType"},
}
p.SimdType.Init(base.mgr)
p.IndexSliceSize = ParamItem{
Key: "common.indexSliceSize",
Version: "2.0.0",
DefaultValue: strconv.Itoa(DefaultIndexSliceSize),
}
p.IndexSliceSize.Init(base.mgr)
p.MaxDegree = ParamItem{
Key: "common.DiskIndex.MaxDegree",
Version: "2.0.0",
DefaultValue: strconv.Itoa(DefaultMaxDegree),
}
p.MaxDegree.Init(base.mgr)
p.SearchListSize = ParamItem{
Key: "common.DiskIndex.SearchListSize",
Version: "2.0.0",
DefaultValue: strconv.Itoa(DefaultSearchListSize),
}
p.SearchListSize.Init(base.mgr)
p.PQCodeBudgetGBRatio = ParamItem{
Key: "common.DiskIndex.PQCodeBudgetGBRatio",
Version: "2.0.0",
DefaultValue: fmt.Sprintf("%f", DefaultPQCodeBudgetGBRatio),
}
p.PQCodeBudgetGBRatio.Init(base.mgr)
p.BuildNumThreadsRatio = ParamItem{
Key: "common.DiskIndex.BuildNumThreadsRatio",
Version: "2.0.0",
DefaultValue: strconv.Itoa(DefaultBuildNumThreadsRatio),
}
p.BuildNumThreadsRatio.Init(base.mgr)
p.SearchCacheBudgetGBRatio = ParamItem{
Key: "common.DiskIndex.SearchCacheBudgetGBRatio",
Version: "2.0.0",
DefaultValue: fmt.Sprintf("%f", DefaultSearchCacheBudgetGBRatio),
}
p.SearchCacheBudgetGBRatio.Init(base.mgr)
p.LoadNumThreadRatio = ParamItem{
Key: "common.DiskIndex.LoadNumThreadRatio",
Version: "2.0.0",
DefaultValue: strconv.Itoa(DefaultLoadNumThreadRatio),
}
p.LoadNumThreadRatio.Init(base.mgr)
p.GracefulStopTimeout = ParamItem{
Key: "common.gracefulStopTimeout",
Version: "2.2.1",
DefaultValue: "30",
}
p.GracefulStopTimeout.Init(base.mgr)
p.BeamWidthRatio = ParamItem{
Key: "common.DiskIndex.BeamWidthRatio",
Version: "2.0.0",
DefaultValue: strconv.Itoa(DefaultBeamWidthRatio),
}
p.BeamWidthRatio.Init(base.mgr)
p.GracefulTime = ParamItem{
Key: "common.gracefulTime",
Version: "2.0.0",
DefaultValue: strconv.Itoa(DefaultGracefulTime),
}
p.GracefulTime.Init(base.mgr)
p.StorageType = ParamItem{
Key: "common.storageType",
Version: "2.0.0",
DefaultValue: "minio",
}
p.StorageType.Init(base.mgr)
p.ThreadCoreCoefficient = ParamItem{
Key: "common.threadCoreCoefficient",
Version: "2.0.0",
DefaultValue: strconv.Itoa(DefaultThreadCoreCoefficient),
}
p.ThreadCoreCoefficient.Init(base.mgr)
p.AuthorizationEnabled = ParamItem{
Key: "common.security.authorizationEnabled",
Version: "2.0.0",
DefaultValue: "false",
}
p.AuthorizationEnabled.Init(base.mgr)
p.ClusterName = ParamItem{
Key: "common.cluster.name",
Version: "2.0.0",
DefaultValue: "",
}
p.ClusterName.Init(base.mgr)
p.SessionTTL = ParamItem{
Key: "common.session.ttl",
Version: "2.0.0",
DefaultValue: "60",
}
p.SessionTTL.Init(base.mgr)
p.SessionRetryTimes = ParamItem{
Key: "common.session.retryTimes",
Version: "2.0.0",
DefaultValue: "30",
}
p.SessionRetryTimes.Init(base.mgr)
}
// /////////////////////////////////////////////////////////////////////////////
// --- rootcoord ---
type rootCoordConfig struct {
DmlChannelNum ParamItem
MaxPartitionNum ParamItem
MinSegmentSizeToEnableIndex ParamItem
ImportTaskExpiration ParamItem
ImportTaskRetention ParamItem
ImportTaskSubPath ParamItem
// CreatedTime ParamItem
// UpdatedTime ParamItem
EnableActiveStandby ParamItem
}
func (p *rootCoordConfig) init(base *BaseTable) {
p.DmlChannelNum = ParamItem{
Key: "rootCoord.dmlChannelNum",
Version: "2.0.0",
DefaultValue: "256",
}
p.DmlChannelNum.Init(base.mgr)
p.MaxPartitionNum = ParamItem{
Key: "rootCoord.maxPartitionNum",
Version: "2.0.0",
DefaultValue: "4096",
}
p.MaxPartitionNum.Init(base.mgr)
p.MinSegmentSizeToEnableIndex = ParamItem{
Key: "rootCoord.minSegmentSizeToEnableIndex",
Version: "2.0.0",
DefaultValue: "1024",
}
p.MinSegmentSizeToEnableIndex.Init(base.mgr)
p.ImportTaskExpiration = ParamItem{
Key: "rootCoord.importTaskExpiration",
Version: "2.2.0",
DefaultValue: "15",
}
p.ImportTaskExpiration.Init(base.mgr)
p.ImportTaskRetention = ParamItem{
Key: "rootCoord.importTaskRetention",
Version: "2.2.0",
DefaultValue: strconv.Itoa(24 * 60 * 60),
}
p.ImportTaskRetention.Init(base.mgr)
p.ImportTaskSubPath = ParamItem{
Key: "rootCoord.ImportTaskSubPath",
Version: "2.2.0",
DefaultValue: "importtask",
}
p.ImportTaskSubPath.Init(base.mgr)
p.EnableActiveStandby = ParamItem{
Key: "rootCoord.enableActiveStandby",
Version: "2.2.0",
DefaultValue: "false",
}
p.EnableActiveStandby.Init(base.mgr)
}
// /////////////////////////////////////////////////////////////////////////////
// --- proxy ---
type AccessLogConfig struct {
// if use access log
Enable ParamItem
// if upload sealed access log file to minio
MinioEnable ParamItem
// Log path
LocalPath ParamItem
// Log filename, leave empty to disable file log.
Filename ParamItem
// Max size for a single file, in MB.
MaxSize ParamItem
// Max time for single access log file in seconds
RotatedTime ParamItem
// Maximum number of old log files to retain.
MaxBackups ParamItem
//File path in minIO
RemotePath ParamItem
}
type proxyConfig struct {
// Alias string
SoPath ParamItem
TimeTickInterval ParamItem
MsgStreamTimeTickBufSize ParamItem
MaxNameLength ParamItem
MaxUsernameLength ParamItem
MinPasswordLength ParamItem
MaxPasswordLength ParamItem
MaxFieldNum ParamItem
MaxShardNum ParamItem
MaxDimension ParamItem
GinLogging ParamItem
MaxUserNum ParamItem
MaxRoleNum ParamItem
AccessLog AccessLogConfig
// required from QueryCoord
SearchResultChannelNames ParamItem
RetrieveResultChannelNames ParamItem
MaxTaskNum ParamItem
}
func (p *proxyConfig) init(base *BaseTable) {
p.TimeTickInterval = ParamItem{
Key: "proxy.timeTickInterval",
Version: "2.2.0",
DefaultValue: "200",
PanicIfEmpty: true,
}
p.TimeTickInterval.Init(base.mgr)
p.MsgStreamTimeTickBufSize = ParamItem{
Key: "proxy.msgStream.timeTick.bufSize",
Version: "2.2.0",
DefaultValue: "512",
PanicIfEmpty: true,
}
p.MsgStreamTimeTickBufSize.Init(base.mgr)
p.MaxNameLength = ParamItem{
Key: "proxy.maxNameLength",
DefaultValue: "255",
Version: "2.0.0",
PanicIfEmpty: true,
}
p.MaxNameLength.Init(base.mgr)
p.MinPasswordLength = ParamItem{
Key: "proxy.minPasswordLength",
DefaultValue: "6",
Version: "2.0.0",
PanicIfEmpty: true,
}
p.MinPasswordLength.Init(base.mgr)
p.MaxUsernameLength = ParamItem{
Key: "proxy.maxUsernameLength",
DefaultValue: "32",
Version: "2.0.0",
PanicIfEmpty: true,
}
p.MaxUsernameLength.Init(base.mgr)
p.MaxPasswordLength = ParamItem{
Key: "proxy.maxPasswordLength",
DefaultValue: "256",
Version: "2.0.0",
PanicIfEmpty: true,
}
p.MaxPasswordLength.Init(base.mgr)
p.MaxFieldNum = ParamItem{
Key: "proxy.maxFieldNum",
DefaultValue: "64",
Version: "2.0.0",
PanicIfEmpty: true,
}
p.MaxFieldNum.Init(base.mgr)
p.MaxShardNum = ParamItem{
Key: "proxy.maxShardNum",
DefaultValue: "256",
Version: "2.0.0",
PanicIfEmpty: true,
}
p.MaxShardNum.Init(base.mgr)
p.MaxDimension = ParamItem{
Key: "proxy.maxDimension",
DefaultValue: "32768",
Version: "2.0.0",
PanicIfEmpty: true,
}
p.MaxDimension.Init(base.mgr)
p.MaxTaskNum = ParamItem{
Key: "proxy.maxTaskNum",
Version: "2.2.0",
DefaultValue: "1024",
}
p.MaxTaskNum.Init(base.mgr)
p.GinLogging = ParamItem{
Key: "proxy.ginLogging",
Version: "2.2.0",
DefaultValue: "true",
}
p.GinLogging.Init(base.mgr)
p.MaxUserNum = ParamItem{
Key: "proxy.maxUserNum",
DefaultValue: "100",
Version: "2.0.0",
PanicIfEmpty: true,
}
p.MaxUserNum.Init(base.mgr)
p.MaxRoleNum = ParamItem{
Key: "proxy.maxRoleNum",
DefaultValue: "10",
Version: "2.0.0",
PanicIfEmpty: true,
}
p.MaxRoleNum.Init(base.mgr)
p.SoPath = ParamItem{
Key: "proxy.soPath",
Version: "2.2.0",
DefaultValue: "",
}
p.SoPath.Init(base.mgr)
p.AccessLog.Enable = ParamItem{
Key: "proxy.accessLog.enable",
Version: "2.2.0",
DefaultValue: "true",
}
p.AccessLog.Enable.Init(base.mgr)
p.AccessLog.MinioEnable = ParamItem{
Key: "proxy.accessLog.minioEnable",
Version: "2.2.0",
DefaultValue: "false",
}
p.AccessLog.MinioEnable.Init(base.mgr)
p.AccessLog.LocalPath = ParamItem{
Key: "proxy.accessLog.localPath",
Version: "2.2.0",
}
p.AccessLog.LocalPath.Init(base.mgr)
p.AccessLog.Filename = ParamItem{
Key: "proxy.accessLog.filename",
Version: "2.2.0",
DefaultValue: "milvus_access_log.log",
}
p.AccessLog.Filename.Init(base.mgr)
p.AccessLog.MaxSize = ParamItem{
Key: "proxy.accessLog.maxSize",
Version: "2.2.0",
DefaultValue: "64",
}
p.AccessLog.MaxSize.Init(base.mgr)
p.AccessLog.MaxBackups = ParamItem{
Key: "proxy.accessLog.maxBackups",
Version: "2.2.0",
DefaultValue: "8",
}
p.AccessLog.MaxBackups.Init(base.mgr)
p.AccessLog.RotatedTime = ParamItem{
Key: "proxy.accessLog.rotatedTime",
Version: "2.2.0",
DefaultValue: "3600",
}
p.AccessLog.RotatedTime.Init(base.mgr)
p.AccessLog.RemotePath = ParamItem{
Key: "proxy.accessLog.remotePath",
Version: "2.2.0",
DefaultValue: "access_log/",
}
p.AccessLog.RemotePath.Init(base.mgr)
}
// /////////////////////////////////////////////////////////////////////////////
// --- querycoord ---
type queryCoordConfig struct {
//---- Task ---
RetryNum ParamItem
RetryInterval ParamItem
TaskMergeCap ParamItem
TaskExecutionCap ParamItem
//---- Handoff ---
AutoHandoff ParamItem
//---- Balance ---
AutoBalance ParamItem
OverloadedMemoryThresholdPercentage ParamItem
BalanceIntervalSeconds ParamItem
MemoryUsageMaxDifferencePercentage ParamItem
CheckInterval ParamItem
ChannelTaskTimeout ParamItem
SegmentTaskTimeout ParamItem
DistPullInterval ParamItem
HeartbeatAvailableInterval ParamItem
LoadTimeoutSeconds ParamItem
CheckHandoffInterval ParamItem
EnableActiveStandby ParamItem
NextTargetSurviveTime ParamItem
UpdateNextTargetInterval ParamItem
}
func (p *queryCoordConfig) init(base *BaseTable) {
//---- Task ---
p.RetryNum = ParamItem{
Key: "queryCoord.task.retrynum",
Version: "2.2.0",
DefaultValue: "5",
}
p.RetryNum.Init(base.mgr)
p.RetryInterval = ParamItem{
Key: "queryCoord.task.retryinterval",
Version: "2.2.0",
DefaultValue: strconv.FormatInt(int64(10*time.Second), 10),
}
p.RetryInterval.Init(base.mgr)
p.TaskMergeCap = ParamItem{
Key: "queryCoord.taskMergeCap",
Version: "2.2.0",
DefaultValue: "16",
}
p.TaskMergeCap.Init(base.mgr)
p.TaskExecutionCap = ParamItem{
Key: "queryCoord.taskExecutionCap",
Version: "2.2.0",
DefaultValue: "256",
}
p.TaskExecutionCap.Init(base.mgr)
p.AutoHandoff = ParamItem{
Key: "queryCoord.autoHandoff",
Version: "2.0.0",
DefaultValue: "true",
PanicIfEmpty: true,
}
p.AutoHandoff.Init(base.mgr)
p.AutoBalance = ParamItem{
Key: "queryCoord.autoBalance",
Version: "2.0.0",
DefaultValue: "false",
PanicIfEmpty: true,
}
p.AutoBalance.Init(base.mgr)
p.OverloadedMemoryThresholdPercentage = ParamItem{
Key: "queryCoord.overloadedMemoryThresholdPercentage",
Version: "2.0.0",
DefaultValue: "90",
PanicIfEmpty: true,
}
p.OverloadedMemoryThresholdPercentage.Init(base.mgr)
p.BalanceIntervalSeconds = ParamItem{
Key: "queryCoord.balanceIntervalSeconds",
Version: "2.0.0",
DefaultValue: "60",
PanicIfEmpty: true,
}
p.BalanceIntervalSeconds.Init(base.mgr)
p.MemoryUsageMaxDifferencePercentage = ParamItem{
Key: "queryCoord.memoryUsageMaxDifferencePercentage",
Version: "2.0.0",
DefaultValue: "30",
PanicIfEmpty: true,
}
p.MemoryUsageMaxDifferencePercentage.Init(base.mgr)
p.CheckInterval = ParamItem{
Key: "queryCoord.checkInterval",
Version: "2.0.0",
DefaultValue: "1000",
PanicIfEmpty: true,
}
p.CheckInterval.Init(base.mgr)
p.ChannelTaskTimeout = ParamItem{
Key: "queryCoord.channelTaskTimeout",
Version: "2.0.0",
DefaultValue: "60000",
PanicIfEmpty: true,
}
p.ChannelTaskTimeout.Init(base.mgr)
p.SegmentTaskTimeout = ParamItem{
Key: "queryCoord.segmentTaskTimeout",
Version: "2.0.0",
DefaultValue: "120000",
PanicIfEmpty: true,
}
p.SegmentTaskTimeout.Init(base.mgr)
p.DistPullInterval = ParamItem{
Key: "queryCoord.distPullInterval",
Version: "2.0.0",
DefaultValue: "500",
PanicIfEmpty: true,
}
p.DistPullInterval.Init(base.mgr)
p.LoadTimeoutSeconds = ParamItem{
Key: "queryCoord.loadTimeoutSeconds",
Version: "2.0.0",
DefaultValue: "600",
PanicIfEmpty: true,
}
p.LoadTimeoutSeconds.Init(base.mgr)
p.HeartbeatAvailableInterval = ParamItem{
Key: "queryCoord.heartbeatAvailableInterval",
Version: "2.2.1",
DefaultValue: "10000",
PanicIfEmpty: true,
}
p.HeartbeatAvailableInterval.Init(base.mgr)
p.EnableActiveStandby = ParamItem{
Key: "queryCoord.enableActiveStandby",
Version: "2.2.0",
DefaultValue: "false",
}
p.EnableActiveStandby.Init(base.mgr)
p.NextTargetSurviveTime = ParamItem{
Key: "queryCoord.NextTargetSurviveTime",
Version: "2.0.0",
DefaultValue: "300",
PanicIfEmpty: true,
}
p.NextTargetSurviveTime.Init(base.mgr)
p.UpdateNextTargetInterval = ParamItem{
Key: "queryCoord.UpdateNextTargetInterval",
Version: "2.0.0",
DefaultValue: "10",
PanicIfEmpty: true,
}
p.UpdateNextTargetInterval.Init(base.mgr)
}
// /////////////////////////////////////////////////////////////////////////////
// --- querynode ---
type queryNodeConfig struct {
FlowGraphMaxQueueLength ParamItem
FlowGraphMaxParallelism ParamItem
// stats
StatsPublishInterval ParamItem
SliceIndex ParamItem
// segcore
ChunkRows ParamItem
SmallIndexNlist ParamItem
SmallIndexNProbe ParamItem
CreatedTime ParamItem
UpdatedTime ParamItem
// memory limit
LoadMemoryUsageFactor ParamItem
OverloadedMemoryThresholdPercentage ParamItem
// enable disk
EnableDisk ParamItem
DiskCapacityLimit ParamItem
MaxDiskUsagePercentage ParamItem
// cache limit
CacheEnabled ParamItem
CacheMemoryLimit ParamItem
GroupEnabled ParamItem
MaxReceiveChanSize ParamItem
MaxUnsolvedQueueSize ParamItem
MaxReadConcurrency ParamItem
MaxGroupNQ ParamItem
TopKMergeRatio ParamItem
CPURatio ParamItem
GCHelperEnabled ParamItem
MinimumGOGCConfig ParamItem
MaximumGOGCConfig ParamItem
GracefulStopTimeout ParamItem
}
func (p *queryNodeConfig) init(base *BaseTable) {
p.FlowGraphMaxQueueLength = ParamItem{
Key: "queryNode.dataSync.flowGraph.maxQueueLength",
Version: "2.0.0",
DefaultValue: "1024",
}
p.FlowGraphMaxQueueLength.Init(base.mgr)
p.FlowGraphMaxParallelism = ParamItem{
Key: "queryNode.dataSync.flowGraph.maxParallelism",
Version: "2.0.0",
DefaultValue: "1024",
}
p.FlowGraphMaxParallelism.Init(base.mgr)
p.StatsPublishInterval = ParamItem{
Key: "queryNode.stats.publishInterval",
Version: "2.0.0",
DefaultValue: "1000",
}
p.StatsPublishInterval.Init(base.mgr)
p.ChunkRows = ParamItem{
Key: "queryNode.segcore.chunkRows",
Version: "2.0.0",
DefaultValue: "1024",
Formatter: func(v string) string {
if getAsInt(v) < 1024 {
return "1024"
}
return v
},
}
p.ChunkRows.Init(base.mgr)
p.SmallIndexNlist = ParamItem{
Key: "queryNode.segcore.smallIndex.nlist",
Version: "2.0.0",
Formatter: func(v string) string {
rows := p.ChunkRows.GetAsInt64()
var defaultNList int64
for i := int64(0); i < rows; i++ {
if math.Pow(2.0, float64(i)) > math.Sqrt(float64(rows)) {
defaultNList = int64(math.Pow(2, float64(i)))
break
}
}
nlist := getAsInt64(v)
if nlist == 0 {
nlist = defaultNList
}
if nlist > rows/8 {
return strconv.FormatInt(rows/8, 10)
}
return strconv.FormatInt(nlist, 10)
},
}
p.SmallIndexNlist.Init(base.mgr)
p.SmallIndexNProbe = ParamItem{
Key: "queryNode.segcore.smallIndex.nprobe",
Version: "2.0.0",
Formatter: func(v string) string {
defaultNprobe := p.SmallIndexNlist.GetAsInt64() / 16
nprobe := getAsInt64(v)
if nprobe == 0 {
nprobe = defaultNprobe
}
if nprobe > p.SmallIndexNlist.GetAsInt64() {
return p.SmallIndexNlist.GetValue()
}
return strconv.FormatInt(nprobe, 10)
},
}
p.SmallIndexNProbe.Init(base.mgr)
p.LoadMemoryUsageFactor = ParamItem{
Key: "queryNode.loadMemoryUsageFactor",
Version: "2.0.0",
DefaultValue: "3",
PanicIfEmpty: true,
}
p.LoadMemoryUsageFactor.Init(base.mgr)
p.OverloadedMemoryThresholdPercentage = ParamItem{
Key: "queryCoord.overloadedMemoryThresholdPercentage",
Version: "2.0.0",
DefaultValue: "90",
PanicIfEmpty: true,
Formatter: func(v string) string {
return fmt.Sprintf("%f", getAsFloat(v)/100)
},
}
p.OverloadedMemoryThresholdPercentage.Init(base.mgr)
p.CacheMemoryLimit = ParamItem{
Key: "queryNode.cache.memoryLimit",
Version: "2.0.0",
DefaultValue: "2147483648",
PanicIfEmpty: true,
}
p.CacheMemoryLimit.Init(base.mgr)
p.CacheEnabled = ParamItem{
Key: "queryNode.cache.enabled",
Version: "2.0.0",
DefaultValue: "",
}
p.CacheEnabled.Init(base.mgr)
p.GroupEnabled = ParamItem{
Key: "queryNode.grouping.enabled",
Version: "2.0.0",
DefaultValue: "true",
}
p.GroupEnabled.Init(base.mgr)
p.MaxReceiveChanSize = ParamItem{
Key: "queryNode.scheduler.receiveChanSize",
Version: "2.0.0",
DefaultValue: "10240",
}
p.MaxReceiveChanSize.Init(base.mgr)
p.MaxReadConcurrency = ParamItem{
Key: "queryNode.scheduler.maxReadConcurrentRatio",
Version: "2.0.0",
DefaultValue: "2.0",
Formatter: func(v string) string {
ratio := getAsFloat(v)
cpuNum := int64(runtime.GOMAXPROCS(0))
concurrency := int64(float64(cpuNum) * ratio)
if concurrency < 1 {
return "1" // MaxReadConcurrency must >= 1
} else if concurrency > cpuNum*100 {
return strconv.FormatInt(cpuNum*100, 10) // MaxReadConcurrency must <= 100*cpuNum
}
return strconv.FormatInt(concurrency, 10)
},
}
p.MaxReadConcurrency.Init(base.mgr)
p.MaxUnsolvedQueueSize = ParamItem{
Key: "queryNode.scheduler.unsolvedQueueSize",
Version: "2.0.0",
DefaultValue: "10240",
}
p.MaxUnsolvedQueueSize.Init(base.mgr)
p.MaxGroupNQ = ParamItem{
Key: "queryNode.grouping.maxNQ",
Version: "2.0.0",
DefaultValue: "1000",
}
p.MaxGroupNQ.Init(base.mgr)
p.TopKMergeRatio = ParamItem{
Key: "queryNode.grouping.topKMergeRatio",
Version: "2.0.0",
DefaultValue: "10.0",
}
p.TopKMergeRatio.Init(base.mgr)
p.CPURatio = ParamItem{
Key: "queryNode.scheduler.cpuRatio",
Version: "2.0.0",
DefaultValue: "10",
}
p.CPURatio.Init(base.mgr)
p.EnableDisk = ParamItem{
Key: "queryNode.enableDisk",
Version: "2.2.0",
DefaultValue: "false",
}
p.EnableDisk.Init(base.mgr)
p.DiskCapacityLimit = ParamItem{
Key: "LOCAL_STORAGE_SIZE",
Version: "2.2.0",
Formatter: func(v string) string {
if len(v) == 0 {
diskUsage, err := disk.Usage("/")
if err != nil {
panic(err)
}
return strconv.FormatUint(diskUsage.Total, 10)
}
diskSize := getAsInt64(v)
return strconv.FormatInt(diskSize*1024*1024*1024, 10)
},
}
p.DiskCapacityLimit.Init(base.mgr)
p.MaxDiskUsagePercentage = ParamItem{
Key: "queryNode.maxDiskUsagePercentage",
Version: "2.2.0",
DefaultValue: "95",
PanicIfEmpty: true,
Formatter: func(v string) string {
return fmt.Sprintf("%f", getAsFloat(v)/100)
},
}
p.MaxDiskUsagePercentage.Init(base.mgr)
p.GCHelperEnabled = ParamItem{
Key: "queryNode.gchelper.enabled",
Version: "2.0.0",
DefaultValue: "true",
}
p.GCHelperEnabled.Init(base.mgr)
p.MaximumGOGCConfig = ParamItem{
Key: "queryNode.gchelper.maximumGoGC",
Version: "2.0.0",
DefaultValue: "200",
}
p.MaximumGOGCConfig.Init(base.mgr)
p.MinimumGOGCConfig = ParamItem{
Key: "queryNode.gchelper.minimumGoGC",
Version: "2.0.0",
DefaultValue: "30",
}
p.MinimumGOGCConfig.Init(base.mgr)
p.GracefulStopTimeout = ParamItem{
Key: "queryNode.gracefulStopTimeout",
Version: "2.2.1",
FallbackKeys: []string{"common.gracefulStopTimeout"},
}
p.GracefulStopTimeout.Init(base.mgr)
}
// /////////////////////////////////////////////////////////////////////////////
// --- datacoord ---
type dataCoordConfig struct {
// --- CHANNEL ---
MaxWatchDuration ParamItem
// --- SEGMENTS ---
SegmentMaxSize ParamItem
DiskSegmentMaxSize ParamItem
SegmentSealProportion ParamItem
SegAssignmentExpiration ParamItem
SegmentMaxLifetime ParamItem
SegmentMaxIdleTime ParamItem
SegmentMinSizeFromIdleToSealed ParamItem
// compaction
EnableCompaction ParamItem
EnableAutoCompaction ParamItem
MinSegmentToMerge ParamItem
MaxSegmentToMerge ParamItem
SegmentSmallProportion ParamItem
SegmentCompactableProportion ParamItem
CompactionTimeoutInSeconds ParamItem
CompactionCheckIntervalInSeconds ParamItem
SingleCompactionRatioThreshold ParamItem
SingleCompactionDeltaLogMaxSize ParamItem
SingleCompactionExpiredLogMaxSize ParamItem
SingleCompactionBinlogMaxNum ParamItem
GlobalCompactionInterval ParamItem
// Garbage Collection
EnableGarbageCollection ParamItem
GCInterval ParamItem
GCMissingTolerance ParamItem
GCDropTolerance ParamItem
EnableActiveStandby ParamItem
}
func (p *dataCoordConfig) init(base *BaseTable) {
p.MaxWatchDuration = ParamItem{
Key: "dataCoord.channel.maxWatchDuration",
Version: "2.2.1",
DefaultValue: "60",
}
p.MaxWatchDuration.Init(base.mgr)
p.SegmentMaxSize = ParamItem{
Key: "dataCoord.segment.maxSize",
Version: "2.0.0",
DefaultValue: "512",
}
p.SegmentMaxSize.Init(base.mgr)
p.DiskSegmentMaxSize = ParamItem{
Key: "dataCoord.segment.diskSegmentMaxSize",
Version: "2.0.0",
DefaultValue: "512",
}
p.DiskSegmentMaxSize.Init(base.mgr)
p.SegmentSealProportion = ParamItem{
Key: "dataCoord.segment.sealProportion",
Version: "2.0.0",
DefaultValue: "0",
}
p.SegmentSealProportion.Init(base.mgr)
p.SegAssignmentExpiration = ParamItem{
Key: "dataCoord.segment.assignmentExpiration",
Version: "2.0.0",
DefaultValue: "2000",
}
p.SegAssignmentExpiration.Init(base.mgr)
p.SegmentMaxLifetime = ParamItem{
Key: "dataCoord.segment.maxLife",
Version: "2.0.0",
DefaultValue: "24",
}
p.SegmentMaxLifetime.Init(base.mgr)
p.SegmentMaxIdleTime = ParamItem{
Key: "dataCoord.segment.maxIdleTime",
Version: "2.0.0",
DefaultValue: "3600",
}
p.SegmentMaxIdleTime.Init(base.mgr)
p.SegmentMinSizeFromIdleToSealed = ParamItem{
Key: "dataCoord.segment.minSizeFromIdleToSealed",
Version: "2.0.0",
DefaultValue: "16.0",
}
p.SegmentMinSizeFromIdleToSealed.Init(base.mgr)
p.EnableCompaction = ParamItem{
Key: "dataCoord.enableCompaction",
Version: "2.0.0",
DefaultValue: "false",
}
p.EnableCompaction.Init(base.mgr)
p.EnableAutoCompaction = ParamItem{
Key: "dataCoord.compaction.enableAutoCompaction",
Version: "2.0.0",
DefaultValue: "false",
}
p.EnableAutoCompaction.Init(base.mgr)
p.MinSegmentToMerge = ParamItem{
Key: "dataCoord.compaction.min.segment",
Version: "2.0.0",
DefaultValue: "4",
}
p.MinSegmentToMerge.Init(base.mgr)
p.MaxSegmentToMerge = ParamItem{
Key: "dataCoord.compaction.max.segment",
Version: "2.0.0",
DefaultValue: "30",
}
p.MaxSegmentToMerge.Init(base.mgr)
p.SegmentSmallProportion = ParamItem{
Key: "dataCoord.segment.smallProportion",
Version: "2.0.0",
DefaultValue: "0.5",
}
p.SegmentSmallProportion.Init(base.mgr)
p.SegmentCompactableProportion = ParamItem{
Key: "dataCoord.segment.compactableProportion",
Version: "2.2.1",
DefaultValue: "0.5",
}
p.SegmentCompactableProportion.Init(base.mgr)
p.CompactionTimeoutInSeconds = ParamItem{
Key: "dataCoord.compaction.timeout",
Version: "2.0.0",
DefaultValue: "180",
}
p.CompactionTimeoutInSeconds.Init(base.mgr)
p.CompactionCheckIntervalInSeconds = ParamItem{
Key: "dataCoord.compaction.check.interval",
Version: "2.0.0",
DefaultValue: "10",
}
p.CompactionCheckIntervalInSeconds.Init(base.mgr)
p.SingleCompactionRatioThreshold = ParamItem{
Key: "dataCoord.compaction.single.ratio.threshold",
Version: "2.0.0",
DefaultValue: "0.2",
}
p.SingleCompactionRatioThreshold.Init(base.mgr)
p.SingleCompactionDeltaLogMaxSize = ParamItem{
Key: "dataCoord.compaction.single.deltalog.maxsize",
Version: "2.0.0",
DefaultValue: strconv.Itoa(2 * 1024 * 1024),
}
p.SingleCompactionDeltaLogMaxSize.Init(base.mgr)
p.SingleCompactionExpiredLogMaxSize = ParamItem{
Key: "dataCoord.compaction.single.expiredlog.maxsize",
Version: "2.0.0",
DefaultValue: "10485760",
}
p.SingleCompactionExpiredLogMaxSize.Init(base.mgr)
p.SingleCompactionBinlogMaxNum = ParamItem{
Key: "dataCoord.compaction.single.binlog.maxnum",
Version: "2.0.0",
DefaultValue: "1000",
}
p.SingleCompactionBinlogMaxNum.Init(base.mgr)
p.GlobalCompactionInterval = ParamItem{
Key: "dataCoord.compaction.global.interval",
Version: "2.0.0",
DefaultValue: "60",
}
p.GlobalCompactionInterval.Init(base.mgr)
p.EnableGarbageCollection = ParamItem{
Key: "dataCoord.enableGarbageCollection",
Version: "2.0.0",
DefaultValue: "true",
}
p.EnableGarbageCollection.Init(base.mgr)
p.GCInterval = ParamItem{
Key: "dataCoord.gc.interval",
Version: "2.0.0",
DefaultValue: "3600",
}
p.GCInterval.Init(base.mgr)
p.GCMissingTolerance = ParamItem{
Key: "dataCoord.gc.missingTolerance",
Version: "2.0.0",
DefaultValue: "86400",
}
p.GCMissingTolerance.Init(base.mgr)
p.GCDropTolerance = ParamItem{
Key: "dataCoord.gc.dropTolerance",
Version: "2.0.0",
DefaultValue: "86400",
}
p.GCDropTolerance.Init(base.mgr)
p.EnableActiveStandby = ParamItem{
Key: "dataCoord.enableActiveStandby",
Version: "2.0.0",
DefaultValue: "false",
}
p.EnableActiveStandby.Init(base.mgr)
}
// /////////////////////////////////////////////////////////////////////////////
// --- datanode ---
type dataNodeConfig struct {
FlowGraphMaxQueueLength ParamItem
FlowGraphMaxParallelism ParamItem
// segment
FlushInsertBufferSize ParamItem
FlushDeleteBufferBytes ParamItem
SyncPeriod ParamItem
// io concurrency to fetch stats logs
IOConcurrency ParamItem
}
func (p *dataNodeConfig) init(base *BaseTable) {
p.FlowGraphMaxQueueLength = ParamItem{
Key: "dataNode.dataSync.flowGraph.maxQueueLength",
Version: "2.0.0",
DefaultValue: "1024",
}
p.FlowGraphMaxQueueLength.Init(base.mgr)
p.FlowGraphMaxParallelism = ParamItem{
Key: "dataNode.dataSync.flowGraph.maxParallelism",
Version: "2.0.0",
DefaultValue: "1024",
}
p.FlowGraphMaxParallelism.Init(base.mgr)
p.FlushInsertBufferSize = ParamItem{
Key: "DATA_NODE_IBUFSIZE",
Version: "2.0.0",
FallbackKeys: []string{"datanode.segment.insertBufSize"},
DefaultValue: "16777216",
PanicIfEmpty: true,
}
p.FlushInsertBufferSize.Init(base.mgr)
p.FlushDeleteBufferBytes = ParamItem{
Key: "datanode.segment.deleteBufBytes",
Version: "2.0.0",
DefaultValue: "67108864",
}
p.FlushDeleteBufferBytes.Init(base.mgr)
p.SyncPeriod = ParamItem{
Key: "datanode.segment.syncPeriod",
Version: "2.0.0",
DefaultValue: "600",
}
p.SyncPeriod.Init(base.mgr)
p.IOConcurrency = ParamItem{
Key: "dataNode.dataSync.ioConcurrency",
Version: "2.0.0",
DefaultValue: "10",
}
p.IOConcurrency.Init(base.mgr)
}
// /////////////////////////////////////////////////////////////////////////////
// --- indexcoord ---
type indexCoordConfig struct {
BindIndexNodeMode ParamItem
IndexNodeAddress ParamItem
WithCredential ParamItem
IndexNodeID ParamItem
MinSegmentNumRowsToEnableIndex ParamItem
GCInterval ParamItem
EnableActiveStandby ParamItem
}
func (p *indexCoordConfig) init(base *BaseTable) {
p.GCInterval = ParamItem{
Key: "indexCoord.gc.interval",
Version: "2.0.0",
DefaultValue: "600",
}
p.GCInterval.Init(base.mgr)
p.MinSegmentNumRowsToEnableIndex = ParamItem{
Key: "indexCoord.minSegmentNumRowsToEnableIndex",
Version: "2.0.0",
DefaultValue: "1024",
}
p.MinSegmentNumRowsToEnableIndex.Init(base.mgr)
p.BindIndexNodeMode = ParamItem{
Key: "indexCoord.bindIndexNodeMode.enable",
Version: "2.0.0",
DefaultValue: "false",
}
p.BindIndexNodeMode.Init(base.mgr)
p.IndexNodeAddress = ParamItem{
Key: "indexCoord.bindIndexNodeMode.address",
Version: "2.0.0",
DefaultValue: "localhost:22930",
}
p.IndexNodeAddress.Init(base.mgr)
p.WithCredential = ParamItem{
Key: "indexCoord.bindIndexNodeMode.withCred",
Version: "2.0.0",
DefaultValue: "false",
}
p.WithCredential.Init(base.mgr)
p.IndexNodeID = ParamItem{
Key: "indexCoord.bindIndexNodeMode.nodeID",
Version: "2.0.0",
DefaultValue: "0",
}
p.IndexNodeID.Init(base.mgr)
p.EnableActiveStandby = ParamItem{
Key: "indexCoord.enableActiveStandby",
Version: "2.0.0",
DefaultValue: "false",
}
p.EnableActiveStandby.Init(base.mgr)
}
// /////////////////////////////////////////////////////////////////////////////
// --- indexnode ---
type indexNodeConfig struct {
BuildParallel ParamItem
// enable disk
EnableDisk ParamItem
DiskCapacityLimit ParamItem
MaxDiskUsagePercentage ParamItem
}
func (p *indexNodeConfig) init(base *BaseTable) {
p.BuildParallel = ParamItem{
Key: "indexNode.scheduler.buildParallel",
Version: "2.0.0",
DefaultValue: "1",
}
p.BuildParallel.Init(base.mgr)
p.EnableDisk = ParamItem{
Key: "indexNode.enableDisk",
Version: "2.2.0",
DefaultValue: "false",
PanicIfEmpty: true,
}
p.EnableDisk.Init(base.mgr)
p.DiskCapacityLimit = ParamItem{
Key: "LOCAL_STORAGE_SIZE",
Version: "2.2.0",
Formatter: func(v string) string {
if len(v) == 0 {
diskUsage, err := disk.Usage("/")
if err != nil {
panic(err)
}
return strconv.FormatUint(diskUsage.Total, 10)
}
diskSize := getAsInt64(v)
return strconv.FormatInt(diskSize*1024*1024*1024, 10)
},
}
p.DiskCapacityLimit.Init(base.mgr)
p.MaxDiskUsagePercentage = ParamItem{
Key: "indexNode.maxDiskUsagePercentage",
Version: "2.2.0",
DefaultValue: "95",
PanicIfEmpty: true,
Formatter: func(v string) string {
return fmt.Sprintf("%f", getAsFloat(v)/100)
},
}
p.MaxDiskUsagePercentage.Init(base.mgr)
}