component_param.go 81.3 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
// 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 (
15
	"fmt"
16
	"os"
17
	"runtime"
18
	"strconv"
19
	"strings"
20
	"sync"
21
	"time"
22

23
	"github.com/shirou/gopsutil/v3/disk"
24
	"go.uber.org/zap"
25

J
jaime 已提交
26
	"github.com/milvus-io/milvus/pkg/config"
27 28
	"github.com/milvus-io/milvus/pkg/log"
	"github.com/milvus-io/milvus/pkg/util/metricsinfo"
29 30 31
)

const (
X
XuanYang-cn 已提交
32
	// DefaultRetentionDuration defines the default duration for retention which is 1 days in seconds.
33
	DefaultRetentionDuration = 0
34 35

	// DefaultIndexSliceSize defines the default slice size of index file when serializing.
36 37 38 39 40 41
	DefaultIndexSliceSize                      = 16
	DefaultGracefulTime                        = 5000 // ms
	DefaultGracefulStopTimeout                 = 30   // s
	DefaultHighPriorityThreadCoreCoefficient   = 100
	DefaultMiddlePriorityThreadCoreCoefficient = 50
	DefaultLowPriorityThreadCoreCoefficient    = 10
42

43
	DefaultSessionTTL        = 20 // s
44
	DefaultSessionRetryTimes = 30
45 46 47

	DefaultMaxDegree                = 56
	DefaultSearchListSize           = 100
X
xige-16 已提交
48
	DefaultPQCodeBudgetGBRatio      = 0.125
49
	DefaultBuildNumThreadsRatio     = 1.0
50
	DefaultSearchCacheBudgetGBRatio = 0.10
51 52
	DefaultLoadNumThreadRatio       = 8.0
	DefaultBeamWidthRatio           = 4.0
53 54
)

55
// ComponentParam is used to quickly and easily access all components' configurations.
56 57
type ComponentParam struct {
	ServiceParam
58
	once sync.Once
59

Z
zhenshan.cao 已提交
60 61 62
	CommonCfg       commonConfig
	QuotaConfig     quotaConfig
	AutoIndexConfig autoIndexConfig
E
Enwei Jiao 已提交
63
	TraceCfg        traceConfig
64 65 66 67 68 69 70 71

	RootCoordCfg  rootCoordConfig
	ProxyCfg      proxyConfig
	QueryCoordCfg queryCoordConfig
	QueryNodeCfg  queryNodeConfig
	DataCoordCfg  dataCoordConfig
	DataNodeCfg   dataNodeConfig
	IndexNodeCfg  indexNodeConfig
E
Enwei Jiao 已提交
72
	HTTPCfg       httpConfig
73
	LogCfg        logConfig
74
	HookCfg       hookConfig
E
Enwei Jiao 已提交
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90

	RootCoordGrpcServerCfg  GrpcServerConfig
	ProxyGrpcServerCfg      GrpcServerConfig
	QueryCoordGrpcServerCfg GrpcServerConfig
	QueryNodeGrpcServerCfg  GrpcServerConfig
	DataCoordGrpcServerCfg  GrpcServerConfig
	DataNodeGrpcServerCfg   GrpcServerConfig
	IndexNodeGrpcServerCfg  GrpcServerConfig

	RootCoordGrpcClientCfg  GrpcClientConfig
	ProxyGrpcClientCfg      GrpcClientConfig
	QueryCoordGrpcClientCfg GrpcClientConfig
	QueryNodeGrpcClientCfg  GrpcClientConfig
	DataCoordGrpcClientCfg  GrpcClientConfig
	DataNodeGrpcClientCfg   GrpcClientConfig
	IndexNodeGrpcClientCfg  GrpcClientConfig
W
wayblink 已提交
91 92

	IntegrationTestCfg integrationTestConfig
93 94
}

95 96
// Init initialize once
func (p *ComponentParam) Init() {
97
	p.once.Do(func() {
98
		p.init()
99 100 101
	})
}

102 103 104 105
// init initialize the global param table

func (p *ComponentParam) init() {
	p.ServiceParam.init()
106

107
	p.CommonCfg.init(&p.BaseTable)
108
	p.QuotaConfig.init(&p.BaseTable)
Z
zhenshan.cao 已提交
109
	p.AutoIndexConfig.init(&p.BaseTable)
E
Enwei Jiao 已提交
110
	p.TraceCfg.init(&p.BaseTable)
111

112 113 114 115 116 117 118
	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.IndexNodeCfg.init(&p.BaseTable)
E
Enwei Jiao 已提交
119
	p.HTTPCfg.init(&p.BaseTable)
120
	p.LogCfg.init(&p.BaseTable)
G
Gao 已提交
121
	p.HookCfg.init(&p.BaseTable)
E
Enwei Jiao 已提交
122

123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
	p.RootCoordGrpcServerCfg.Init("rootCoord", &p.BaseTable)
	p.ProxyGrpcServerCfg.Init("proxy", &p.BaseTable)
	p.ProxyGrpcServerCfg.InternalPort.Export = true
	p.QueryCoordGrpcServerCfg.Init("queryCoord", &p.BaseTable)
	p.QueryNodeGrpcServerCfg.Init("queryNode", &p.BaseTable)
	p.DataCoordGrpcServerCfg.Init("dataCoord", &p.BaseTable)
	p.DataNodeGrpcServerCfg.Init("dataNode", &p.BaseTable)
	p.IndexNodeGrpcServerCfg.Init("indexNode", &p.BaseTable)

	p.RootCoordGrpcClientCfg.Init("rootCoord", &p.BaseTable)
	p.ProxyGrpcClientCfg.Init("proxy", &p.BaseTable)
	p.QueryCoordGrpcClientCfg.Init("queryCoord", &p.BaseTable)
	p.QueryNodeGrpcClientCfg.Init("queryNode", &p.BaseTable)
	p.DataCoordGrpcClientCfg.Init("dataCoord", &p.BaseTable)
	p.DataNodeGrpcClientCfg.Init("dataNode", &p.BaseTable)
	p.IndexNodeGrpcClientCfg.Init("indexNode", &p.BaseTable)
W
wayblink 已提交
139 140

	p.IntegrationTestCfg.init(&p.BaseTable)
141 142
}

E
Enwei Jiao 已提交
143 144 145
func (p *ComponentParam) GetComponentConfigurations(componentName string, sub string) map[string]string {
	allownPrefixs := append(globalConfigPrefixs(), componentName+".")
	return p.mgr.GetBy(config.WithSubstr(sub), config.WithOneOfPrefixs(allownPrefixs...))
146 147
}

E
Enwei Jiao 已提交
148 149
func (p *ComponentParam) GetAll() map[string]string {
	return p.mgr.GetConfigs()
J
jaime 已提交
150 151
}

152 153 154 155
func (p *ComponentParam) Watch(key string, watcher config.EventHandler) {
	p.mgr.Dispatcher.Register(key, watcher)
}

G
Gao 已提交
156 157 158 159
func (p *ComponentParam) WatchKeyPrefix(keyPrefix string, watcher config.EventHandler) {
	p.mgr.Dispatcher.RegisterForKeyPrefix(keyPrefix, watcher)
}

S
smellthemoon 已提交
160
// /////////////////////////////////////////////////////////////////////////////
161
// --- common ---
162
type commonConfig struct {
E
Enwei Jiao 已提交
163
	ClusterPrefix ParamItem `refreshable:"false"`
E
Enwei Jiao 已提交
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182

	// Deprecated: do not use it anymore
	ProxySubName ParamItem `refreshable:"true"`

	RootCoordTimeTick   ParamItem `refreshable:"true"`
	RootCoordStatistics ParamItem `refreshable:"true"`
	RootCoordDml        ParamItem `refreshable:"false"`
	RootCoordDelta      ParamItem `refreshable:"false"`
	// Deprecated: do not use it anymore
	RootCoordSubName ParamItem `refreshable:"true"`

	// Deprecated: only used in metrics as ID
	QueryCoordSearch ParamItem `refreshable:"true"`
	// Deprecated: only used in metrics as ID
	QueryCoordSearchResult ParamItem `refreshable:"true"`
	QueryCoordTimeTick     ParamItem `refreshable:"true"`
	QueryNodeSubName       ParamItem `refreshable:"false"`

	// Deprecated: do not use it anymore
183 184
	DataCoordStatistic ParamItem `refreshable:"true"`
	// Deprecated
E
Enwei Jiao 已提交
185 186 187 188
	DataCoordTimeTick     ParamItem `refreshable:"false"`
	DataCoordSegmentInfo  ParamItem `refreshable:"true"`
	DataCoordSubName      ParamItem `refreshable:"false"`
	DataCoordWatchSubPath ParamItem `refreshable:"false"`
189
	DataCoordTicklePath   ParamItem `refreshable:"false"`
E
Enwei Jiao 已提交
190 191
	DataNodeSubName       ParamItem `refreshable:"false"`

192
	DefaultPartitionName ParamItem `refreshable:"false"`
E
Enwei Jiao 已提交
193
	DefaultIndexName     ParamItem `refreshable:"true"`
E
Enwei Jiao 已提交
194 195 196
	RetentionDuration    ParamItem `refreshable:"true"`
	EntityExpirationTTL  ParamItem `refreshable:"true"`

197 198 199 200 201 202 203 204 205 206 207 208 209
	IndexSliceSize                      ParamItem `refreshable:"false"`
	HighPriorityThreadCoreCoefficient   ParamItem `refreshable:"false"`
	MiddlePriorityThreadCoreCoefficient ParamItem `refreshable:"false"`
	LowPriorityThreadCoreCoefficient    ParamItem `refreshable:"false"`
	MaxDegree                           ParamItem `refreshable:"true"`
	SearchListSize                      ParamItem `refreshable:"true"`
	PQCodeBudgetGBRatio                 ParamItem `refreshable:"true"`
	BuildNumThreadsRatio                ParamItem `refreshable:"true"`
	SearchCacheBudgetGBRatio            ParamItem `refreshable:"true"`
	LoadNumThreadRatio                  ParamItem `refreshable:"true"`
	BeamWidthRatio                      ParamItem `refreshable:"true"`
	GracefulTime                        ParamItem `refreshable:"true"`
	GracefulStopTimeout                 ParamItem `refreshable:"true"`
210

E
Enwei Jiao 已提交
211 212
	StorageType ParamItem `refreshable:"false"`
	SimdType    ParamItem `refreshable:"false"`
213

E
Enwei Jiao 已提交
214 215
	AuthorizationEnabled ParamItem `refreshable:"false"`
	SuperUsers           ParamItem `refreshable:"true"`
216

E
Enwei Jiao 已提交
217
	ClusterName ParamItem `refreshable:"false"`
218

E
Enwei Jiao 已提交
219 220
	SessionTTL        ParamItem `refreshable:"false"`
	SessionRetryTimes ParamItem `refreshable:"false"`
S
smellthemoon 已提交
221 222 223 224

	PreCreatedTopicEnabled ParamItem `refreshable:"true"`
	TopicNames             ParamItem `refreshable:"true"`
	TimeTicker             ParamItem `refreshable:"true"`
Y
yah01 已提交
225 226

	JSONMaxLength ParamItem `refreshable:"false"`
227 228

	ImportMaxFileSize ParamItem `refreshable:"true"`
229 230

	MetricsPort ParamItem `refreshable:"false"`
231 232 233 234 235

	//lock related params
	EnableLockMetrics        ParamItem `refreshable:"false"`
	LockSlowLogInfoThreshold ParamItem `refreshable:"true"`
	LockSlowLogWarnThreshold ParamItem `refreshable:"true"`
236 237
}

238 239 240
func (p *commonConfig) init(base *BaseTable) {
	// must init cluster prefix first
	p.ClusterPrefix = ParamItem{
241
		Key:          "msgChannel.chanNamePrefix.cluster",
242
		Version:      "2.1.0",
243
		FallbackKeys: []string{"common.chanNamePrefix.cluster"},
244
		DefaultValue: "by-dev",
245
		PanicIfEmpty: true,
246
		Forbidden:    true,
247
		Export:       true,
248 249 250 251 252 253 254
	}
	p.ClusterPrefix.Init(base.mgr)

	chanNamePrefix := func(prefix string) string {
		return strings.Join([]string{p.ClusterPrefix.GetValue(), prefix}, "-")
	}
	p.ProxySubName = ParamItem{
255
		Key:          "msgChannel.subNamePrefix.proxySubNamePrefix",
256
		Version:      "2.1.0",
257
		FallbackKeys: []string{"common.subNamePrefix.proxySubNamePrefix"},
258 259
		PanicIfEmpty: true,
		Formatter:    chanNamePrefix,
260
		Export:       true,
261 262 263 264 265
	}
	p.ProxySubName.Init(base.mgr)

	// --- rootcoord ---
	p.RootCoordTimeTick = ParamItem{
266
		Key:          "msgChannel.chanNamePrefix.rootCoordTimeTick",
267
		Version:      "2.1.0",
268
		FallbackKeys: []string{"common.chanNamePrefix.rootCoordTimeTick"},
269 270
		PanicIfEmpty: true,
		Formatter:    chanNamePrefix,
271
		Export:       true,
272 273 274 275
	}
	p.RootCoordTimeTick.Init(base.mgr)

	p.RootCoordStatistics = ParamItem{
276
		Key:          "msgChannel.chanNamePrefix.rootCoordStatistics",
277
		Version:      "2.1.0",
278
		FallbackKeys: []string{"common.chanNamePrefix.rootCoordStatistics"},
279 280
		PanicIfEmpty: true,
		Formatter:    chanNamePrefix,
281
		Export:       true,
282 283 284 285
	}
	p.RootCoordStatistics.Init(base.mgr)

	p.RootCoordDml = ParamItem{
286
		Key:          "msgChannel.chanNamePrefix.rootCoordDml",
287
		Version:      "2.1.0",
288
		FallbackKeys: []string{"common.chanNamePrefix.rootCoordDml"},
289 290
		PanicIfEmpty: true,
		Formatter:    chanNamePrefix,
291
		Export:       true,
292 293 294 295
	}
	p.RootCoordDml.Init(base.mgr)

	p.RootCoordDelta = ParamItem{
296
		Key:          "msgChannel.chanNamePrefix.rootCoordDelta",
297
		Version:      "2.1.0",
298
		FallbackKeys: []string{"common.chanNamePrefix.rootCoordDelta"},
299 300
		PanicIfEmpty: true,
		Formatter:    chanNamePrefix,
301
		Export:       true,
302 303 304 305
	}
	p.RootCoordDelta.Init(base.mgr)

	p.RootCoordSubName = ParamItem{
306
		Key:          "msgChannel.subNamePrefix.rootCoordSubNamePrefix",
307
		Version:      "2.1.0",
308
		FallbackKeys: []string{"common.subNamePrefix.rootCoordSubNamePrefix"},
309 310
		PanicIfEmpty: true,
		Formatter:    chanNamePrefix,
311
		Export:       true,
312 313 314 315
	}
	p.RootCoordSubName.Init(base.mgr)

	p.QueryCoordSearch = ParamItem{
316
		Key:          "msgChannel.chanNamePrefix.search",
317
		Version:      "2.1.0",
318
		FallbackKeys: []string{"common.chanNamePrefix.search"},
319 320
		PanicIfEmpty: true,
		Formatter:    chanNamePrefix,
321
		Export:       true,
322 323 324 325
	}
	p.QueryCoordSearch.Init(base.mgr)

	p.QueryCoordSearchResult = ParamItem{
326
		Key:          "msgChannel.chanNamePrefix.searchResult",
327
		Version:      "2.1.0",
328
		FallbackKeys: []string{"common.chanNamePrefix.searchResult"},
329 330
		PanicIfEmpty: true,
		Formatter:    chanNamePrefix,
331
		Export:       true,
332 333 334 335
	}
	p.QueryCoordSearchResult.Init(base.mgr)

	p.QueryCoordTimeTick = ParamItem{
336
		Key:          "msgChannel.chanNamePrefix.queryTimeTick",
337
		Version:      "2.1.0",
338
		FallbackKeys: []string{"common.chanNamePrefix.queryTimeTick"},
339 340
		PanicIfEmpty: true,
		Formatter:    chanNamePrefix,
341
		Export:       true,
342 343 344 345
	}
	p.QueryCoordTimeTick.Init(base.mgr)

	p.QueryNodeSubName = ParamItem{
346
		Key:          "msgChannel.subNamePrefix.queryNodeSubNamePrefix",
347
		Version:      "2.1.0",
348
		FallbackKeys: []string{"common.subNamePrefix.queryNodeSubNamePrefix"},
349 350
		PanicIfEmpty: true,
		Formatter:    chanNamePrefix,
351
		Export:       true,
352 353 354 355
	}
	p.QueryNodeSubName.Init(base.mgr)

	p.DataCoordStatistic = ParamItem{
356
		Key:          "msgChannel.chanNamePrefix.dataCoordStatistic",
357
		Version:      "2.1.0",
358
		FallbackKeys: []string{"common.chanNamePrefix.dataCoordStatistic"},
359 360
		PanicIfEmpty: true,
		Formatter:    chanNamePrefix,
361
		Export:       true,
362 363 364 365
	}
	p.DataCoordStatistic.Init(base.mgr)

	p.DataCoordTimeTick = ParamItem{
366
		Key:          "msgChannel.chanNamePrefix.dataCoordTimeTick",
367
		Version:      "2.1.0",
368
		FallbackKeys: []string{"common.chanNamePrefix.dataCoordTimeTick"},
369 370
		PanicIfEmpty: true,
		Formatter:    chanNamePrefix,
371
		Export:       true,
372 373 374 375
	}
	p.DataCoordTimeTick.Init(base.mgr)

	p.DataCoordSegmentInfo = ParamItem{
376
		Key:          "msgChannel.chanNamePrefix.dataCoordSegmentInfo",
377
		Version:      "2.1.0",
378
		FallbackKeys: []string{"common.chanNamePrefix.dataCoordSegmentInfo"},
379 380
		PanicIfEmpty: true,
		Formatter:    chanNamePrefix,
381
		Export:       true,
382 383 384 385
	}
	p.DataCoordSegmentInfo.Init(base.mgr)

	p.DataCoordSubName = ParamItem{
386
		Key:          "msgChannel.subNamePrefix.dataCoordSubNamePrefix",
387
		Version:      "2.1.0",
388
		FallbackKeys: []string{"common.subNamePrefix.dataCoordSubNamePrefix"},
389 390
		PanicIfEmpty: true,
		Formatter:    chanNamePrefix,
391
		Export:       true,
392 393 394 395
	}
	p.DataCoordSubName.Init(base.mgr)

	p.DataCoordWatchSubPath = ParamItem{
396
		Key:          "msgChannel.subNamePrefix.dataCoordWatchSubPath",
397 398 399 400 401 402
		Version:      "2.1.0",
		DefaultValue: "channelwatch",
		PanicIfEmpty: true,
	}
	p.DataCoordWatchSubPath.Init(base.mgr)

403 404 405 406 407 408 409 410
	p.DataCoordTicklePath = ParamItem{
		Key:          "msgChannel.subNamePrefix.dataCoordWatchSubPath",
		Version:      "2.2.3",
		DefaultValue: "tickle",
		PanicIfEmpty: true,
	}
	p.DataCoordTicklePath.Init(base.mgr)

411
	p.DataNodeSubName = ParamItem{
412
		Key:          "msgChannel.subNamePrefix.dataNodeSubNamePrefix",
413
		Version:      "2.1.0",
414
		FallbackKeys: []string{"common.subNamePrefix.dataNodeSubNamePrefix"},
415 416
		PanicIfEmpty: true,
		Formatter:    chanNamePrefix,
417
		Export:       true,
418 419 420 421 422 423 424
	}
	p.DataNodeSubName.Init(base.mgr)

	p.DefaultPartitionName = ParamItem{
		Key:          "common.defaultPartitionName",
		Version:      "2.0.0",
		DefaultValue: "_default",
425
		Forbidden:    true,
426 427
		Doc:          "default partition name for a collection",
		Export:       true,
428 429 430 431 432 433 434
	}
	p.DefaultPartitionName.Init(base.mgr)

	p.DefaultIndexName = ParamItem{
		Key:          "common.defaultIndexName",
		Version:      "2.0.0",
		DefaultValue: "_default_idx",
435 436
		Doc:          "default index name",
		Export:       true,
437 438 439 440 441 442 443
	}
	p.DefaultIndexName.Init(base.mgr)

	p.RetentionDuration = ParamItem{
		Key:          "common.retentionDuration",
		Version:      "2.0.0",
		DefaultValue: strconv.Itoa(DefaultRetentionDuration),
444 445
		Doc:          "time travel reserved time, insert/delete will not be cleaned in this period. disable it by default",
		Export:       true,
446
	}
447 448 449 450 451 452 453 454 455 456 457
	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"
			}
458

459 460 461 462 463 464
			// 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()
		},
465 466
		Doc:    "Entity expiration in seconds, CAUTION make sure entityExpiration >= retentionDuration and -1 means never expire",
		Export: true,
467
	}
468
	p.EntityExpirationTTL.Init(base.mgr)
469

470 471 472 473 474
	p.SimdType = ParamItem{
		Key:          "common.simdType",
		Version:      "2.1.0",
		DefaultValue: "auto",
		FallbackKeys: []string{"knowhere.simdType"},
475 476 477 478
		Doc: `Default value: auto
Valid values: [auto, avx512, avx2, avx, sse4_2]
This configuration is only used by querynode and indexnode, it selects CPU instruction set for Searching and Index-building.`,
		Export: true,
479
	}
480
	p.SimdType.Init(base.mgr)
481

482 483 484 485
	p.IndexSliceSize = ParamItem{
		Key:          "common.indexSliceSize",
		Version:      "2.0.0",
		DefaultValue: strconv.Itoa(DefaultIndexSliceSize),
486 487
		Doc:          "MB",
		Export:       true,
488
	}
489
	p.IndexSliceSize.Init(base.mgr)
490

491 492 493 494
	p.MaxDegree = ParamItem{
		Key:          "common.DiskIndex.MaxDegree",
		Version:      "2.0.0",
		DefaultValue: strconv.Itoa(DefaultMaxDegree),
495
		Export:       true,
496
	}
497
	p.MaxDegree.Init(base.mgr)
498

499 500 501 502
	p.SearchListSize = ParamItem{
		Key:          "common.DiskIndex.SearchListSize",
		Version:      "2.0.0",
		DefaultValue: strconv.Itoa(DefaultSearchListSize),
503
		Export:       true,
504
	}
505
	p.SearchListSize.Init(base.mgr)
506

507 508 509 510
	p.PQCodeBudgetGBRatio = ParamItem{
		Key:          "common.DiskIndex.PQCodeBudgetGBRatio",
		Version:      "2.0.0",
		DefaultValue: fmt.Sprintf("%f", DefaultPQCodeBudgetGBRatio),
511
		Export:       true,
512
	}
513
	p.PQCodeBudgetGBRatio.Init(base.mgr)
514

515 516 517 518
	p.BuildNumThreadsRatio = ParamItem{
		Key:          "common.DiskIndex.BuildNumThreadsRatio",
		Version:      "2.0.0",
		DefaultValue: strconv.Itoa(DefaultBuildNumThreadsRatio),
519
		Export:       true,
520
	}
521
	p.BuildNumThreadsRatio.Init(base.mgr)
522

523 524 525 526
	p.SearchCacheBudgetGBRatio = ParamItem{
		Key:          "common.DiskIndex.SearchCacheBudgetGBRatio",
		Version:      "2.0.0",
		DefaultValue: fmt.Sprintf("%f", DefaultSearchCacheBudgetGBRatio),
527
		Export:       true,
528
	}
529
	p.SearchCacheBudgetGBRatio.Init(base.mgr)
530

531 532 533 534
	p.LoadNumThreadRatio = ParamItem{
		Key:          "common.DiskIndex.LoadNumThreadRatio",
		Version:      "2.0.0",
		DefaultValue: strconv.Itoa(DefaultLoadNumThreadRatio),
535
		Export:       true,
X
Xiaofan 已提交
536
	}
537
	p.LoadNumThreadRatio.Init(base.mgr)
X
Xiaofan 已提交
538

539 540 541 542
	p.BeamWidthRatio = ParamItem{
		Key:          "common.DiskIndex.BeamWidthRatio",
		Version:      "2.0.0",
		DefaultValue: strconv.Itoa(DefaultBeamWidthRatio),
543 544
		Doc:          "",
		Export:       true,
545
	}
546
	p.BeamWidthRatio.Init(base.mgr)
547

548 549 550 551
	p.GracefulTime = ParamItem{
		Key:          "common.gracefulTime",
		Version:      "2.0.0",
		DefaultValue: strconv.Itoa(DefaultGracefulTime),
552 553
		Doc:          "milliseconds. it represents the interval (in ms) by which the request arrival time needs to be subtracted in the case of Bounded Consistency.",
		Export:       true,
554 555
	}
	p.GracefulTime.Init(base.mgr)
556

557 558 559 560 561 562 563 564 565
	p.GracefulStopTimeout = ParamItem{
		Key:          "common.gracefulStopTimeout",
		Version:      "2.2.1",
		DefaultValue: "30",
		Doc:          "seconds. it will force quit the server if the graceful stop process is not completed during this time.",
		Export:       true,
	}
	p.GracefulStopTimeout.Init(base.mgr)

566 567 568 569
	p.StorageType = ParamItem{
		Key:          "common.storageType",
		Version:      "2.0.0",
		DefaultValue: "minio",
570 571
		Doc:          "please adjust in embedded Milvus: local",
		Export:       true,
572 573
	}
	p.StorageType.Init(base.mgr)
574

575 576
	p.HighPriorityThreadCoreCoefficient = ParamItem{
		Key:          "common.threadCoreCoefficient.highPriority",
577
		Version:      "2.0.0",
578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601
		DefaultValue: strconv.Itoa(DefaultHighPriorityThreadCoreCoefficient),
		Doc: "This parameter specify how many times the number of threads " +
			"is the number of cores in high priority pool",
		Export: true,
	}
	p.HighPriorityThreadCoreCoefficient.Init(base.mgr)

	p.MiddlePriorityThreadCoreCoefficient = ParamItem{
		Key:          "common.threadCoreCoefficient.middlePriority",
		Version:      "2.0.0",
		DefaultValue: strconv.Itoa(DefaultMiddlePriorityThreadCoreCoefficient),
		Doc: "This parameter specify how many times the number of threads " +
			"is the number of cores in middle priority pool",
		Export: true,
	}
	p.MiddlePriorityThreadCoreCoefficient.Init(base.mgr)

	p.LowPriorityThreadCoreCoefficient = ParamItem{
		Key:          "common.threadCoreCoefficient.lowPriority",
		Version:      "2.0.0",
		DefaultValue: strconv.Itoa(DefaultLowPriorityThreadCoreCoefficient),
		Doc: "This parameter specify how many times the number of threads " +
			"is the number of cores in low priority pool",
		Export: true,
602
	}
603
	p.LowPriorityThreadCoreCoefficient.Init(base.mgr)
604

605 606 607 608
	p.AuthorizationEnabled = ParamItem{
		Key:          "common.security.authorizationEnabled",
		Version:      "2.0.0",
		DefaultValue: "false",
609
		Export:       true,
610 611
	}
	p.AuthorizationEnabled.Init(base.mgr)
612

S
SimFG 已提交
613 614 615
	p.SuperUsers = ParamItem{
		Key:     "common.security.superUsers",
		Version: "2.2.1",
616 617
		Doc: `The superusers will ignore some system check processes,
like the old password verification when updating the credential`,
618 619
		DefaultValue: "",
		Export:       true,
S
SimFG 已提交
620 621 622
	}
	p.SuperUsers.Init(base.mgr)

623 624 625 626 627 628
	p.ClusterName = ParamItem{
		Key:          "common.cluster.name",
		Version:      "2.0.0",
		DefaultValue: "",
	}
	p.ClusterName.Init(base.mgr)
629

630 631 632
	p.SessionTTL = ParamItem{
		Key:          "common.session.ttl",
		Version:      "2.0.0",
633
		DefaultValue: "20",
634 635
		Doc:          "ttl value when session granting a lease to register service",
		Export:       true,
636 637
	}
	p.SessionTTL.Init(base.mgr)
638

639 640 641 642
	p.SessionRetryTimes = ParamItem{
		Key:          "common.session.retryTimes",
		Version:      "2.0.0",
		DefaultValue: "30",
643 644
		Doc:          "retry times when session sending etcd requests",
		Export:       true,
645 646
	}
	p.SessionRetryTimes.Init(base.mgr)
J
jaime 已提交
647

S
smellthemoon 已提交
648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665
	p.PreCreatedTopicEnabled = ParamItem{
		Key:          "common.preCreatedTopic.enabled",
		Version:      "2.3.0",
		DefaultValue: "false",
	}
	p.PreCreatedTopicEnabled.Init(base.mgr)

	p.TopicNames = ParamItem{
		Key:     "common.preCreatedTopic.names",
		Version: "2.3.0",
	}
	p.TopicNames.Init(base.mgr)

	p.TimeTicker = ParamItem{
		Key:     "common.preCreatedTopic.timeticker",
		Version: "2.3.0",
	}
	p.TimeTicker.Init(base.mgr)
Y
yah01 已提交
666 667 668 669 670 671 672

	p.JSONMaxLength = ParamItem{
		Key:          "common.JSONMaxLength",
		Version:      "2.2.9",
		DefaultValue: fmt.Sprint(64 << 10),
	}
	p.JSONMaxLength.Init(base.mgr)
673 674 675 676 677 678 679

	p.ImportMaxFileSize = ParamItem{
		Key:          "common.ImportMaxFileSize",
		Version:      "2.2.9",
		DefaultValue: fmt.Sprint(16 << 30),
	}
	p.ImportMaxFileSize.Init(base.mgr)
680 681 682 683 684 685 686

	p.MetricsPort = ParamItem{
		Key:          "common.MetricsPort",
		Version:      "2.3.0",
		DefaultValue: "9091",
	}
	p.MetricsPort.Init(base.mgr)
687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713

	p.EnableLockMetrics = ParamItem{
		Key:          "common.locks.metrics.enable",
		Version:      "2.0.0",
		DefaultValue: "false",
		Doc:          "whether gather statistics for metrics locks",
		Export:       true,
	}
	p.EnableLockMetrics.Init(base.mgr)

	p.LockSlowLogInfoThreshold = ParamItem{
		Key:          "common.locks.threshold.info",
		Version:      "2.0.0",
		DefaultValue: "500",
		Doc:          "minimum milliseconds for printing durations in info level",
		Export:       true,
	}
	p.LockSlowLogInfoThreshold.Init(base.mgr)

	p.LockSlowLogWarnThreshold = ParamItem{
		Key:          "common.locks.threshold.warn",
		Version:      "2.0.0",
		DefaultValue: "1000",
		Doc:          "minimum milliseconds for printing durations in warn level",
		Export:       true,
	}
	p.LockSlowLogWarnThreshold.Init(base.mgr)
C
codeman 已提交
714 715
}

E
Enwei Jiao 已提交
716 717 718 719
type traceConfig struct {
	Exporter       ParamItem `refreshable:"false"`
	SampleFraction ParamItem `refreshable:"false"`
	JaegerURL      ParamItem `refreshable:"false"`
E
Enwei Jiao 已提交
720
	OtlpEndpoint   ParamItem `refreshable:"false"`
E
Enwei Jiao 已提交
721 722 723 724 725 726
}

func (t *traceConfig) init(base *BaseTable) {
	t.Exporter = ParamItem{
		Key:     "trace.exporter",
		Version: "2.3.0",
727 728 729
		Doc: `trace exporter type, default is stdout,
optional values: ['stdout', 'jaeger']`,
		Export: true,
E
Enwei Jiao 已提交
730 731 732 733 734 735
	}
	t.Exporter.Init(base.mgr)

	t.SampleFraction = ParamItem{
		Key:          "trace.sampleFraction",
		Version:      "2.3.0",
736 737 738 739 740
		DefaultValue: "0",
		Doc: `fraction of traceID based sampler,
optional values: [0, 1]
Fractions >= 1 will always sample. Fractions < 0 are treated as zero.`,
		Export: true,
E
Enwei Jiao 已提交
741 742 743 744 745 746
	}
	t.SampleFraction.Init(base.mgr)

	t.JaegerURL = ParamItem{
		Key:     "trace.jaeger.url",
		Version: "2.3.0",
747 748
		Doc:     "when exporter is jaeger should set the jaeger's URL",
		Export:  true,
E
Enwei Jiao 已提交
749 750
	}
	t.JaegerURL.Init(base.mgr)
E
Enwei Jiao 已提交
751 752 753 754 755 756

	t.OtlpEndpoint = ParamItem{
		Key:     "trace.otlp.endpoint",
		Version: "2.3.0",
	}
	t.OtlpEndpoint.Init(base.mgr)
E
Enwei Jiao 已提交
757 758
}

759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840
type logConfig struct {
	Level        ParamItem `refreshable:"false"`
	RootPath     ParamItem `refreshable:"false"`
	MaxSize      ParamItem `refreshable:"false"`
	MaxAge       ParamItem `refreshable:"false"`
	MaxBackups   ParamItem `refreshable:"false"`
	Format       ParamItem `refreshable:"false"`
	Stdout       ParamItem `refreshable:"false"`
	GrpcLogLevel ParamItem `refreshable:"false"`
}

func (l *logConfig) init(base *BaseTable) {
	l.Level = ParamItem{
		Key:          "log.level",
		DefaultValue: "info",
		Version:      "2.0.0",
		Doc:          "Only supports debug, info, warn, error, panic, or fatal. Default 'info'.",
		Export:       true,
	}
	l.Level.Init(base.mgr)

	l.RootPath = ParamItem{
		Key:     "log.file.rootPath",
		Version: "2.0.0",
		Doc:     "root dir path to put logs, default \"\" means no log file will print. please adjust in embedded Milvus: /tmp/milvus/logs",
		Export:  true,
	}
	l.RootPath.Init(base.mgr)

	l.MaxSize = ParamItem{
		Key:          "log.file.maxSize",
		DefaultValue: "300",
		Version:      "2.0.0",
		Doc:          "MB",
		Export:       true,
	}
	l.MaxSize.Init(base.mgr)

	l.MaxAge = ParamItem{
		Key:          "log.file.maxAge",
		DefaultValue: "10",
		Version:      "2.0.0",
		Doc:          "Maximum time for log retention in day.",
		Export:       true,
	}
	l.MaxAge.Init(base.mgr)

	l.MaxBackups = ParamItem{
		Key:          "log.file.maxBackups",
		DefaultValue: "20",
		Version:      "2.0.0",
		Export:       true,
	}
	l.MaxBackups.Init(base.mgr)

	l.Format = ParamItem{
		Key:          "log.format",
		DefaultValue: "text",
		Version:      "2.0.0",
		Doc:          "text or json",
		Export:       true,
	}
	l.Format.Init(base.mgr)

	l.Stdout = ParamItem{
		Key:          "log.stdout",
		DefaultValue: "true",
		Version:      "2.3.0",
		Doc:          "Stdout enable or not",
		Export:       true,
	}
	l.Stdout.Init(base.mgr)

	l.GrpcLogLevel = ParamItem{
		Key:          "grpc.log.level",
		DefaultValue: "WARNING",
		Version:      "2.0.0",
		Export:       true,
	}
	l.GrpcLogLevel.Init(base.mgr)
}

841 842 843
// /////////////////////////////////////////////////////////////////////////////
// --- rootcoord ---
type rootCoordConfig struct {
E
Enwei Jiao 已提交
844 845 846 847 848
	DmlChannelNum               ParamItem `refreshable:"false"`
	MaxPartitionNum             ParamItem `refreshable:"true"`
	MinSegmentSizeToEnableIndex ParamItem `refreshable:"true"`
	ImportTaskExpiration        ParamItem `refreshable:"true"`
	ImportTaskRetention         ParamItem `refreshable:"true"`
849
	ImportMaxPendingTaskCount   ParamItem `refreshable:"true"`
E
Enwei Jiao 已提交
850 851
	ImportTaskSubPath           ParamItem `refreshable:"true"`
	EnableActiveStandby         ParamItem `refreshable:"false"`
J
jaime 已提交
852
	MaxDatabaseNum              ParamItem `refreshable:"false"`
853 854
}

855 856 857 858
func (p *rootCoordConfig) init(base *BaseTable) {
	p.DmlChannelNum = ParamItem{
		Key:          "rootCoord.dmlChannelNum",
		Version:      "2.0.0",
859
		DefaultValue: "16",
860
		Forbidden:    true,
861 862
		Doc:          "The number of dml channels created at system startup",
		Export:       true,
863 864
	}
	p.DmlChannelNum.Init(base.mgr)
865

866 867 868 869
	p.MaxPartitionNum = ParamItem{
		Key:          "rootCoord.maxPartitionNum",
		Version:      "2.0.0",
		DefaultValue: "4096",
870 871
		Doc:          "Maximum number of partitions in a collection",
		Export:       true,
872 873
	}
	p.MaxPartitionNum.Init(base.mgr)
874

875 876 877 878
	p.MinSegmentSizeToEnableIndex = ParamItem{
		Key:          "rootCoord.minSegmentSizeToEnableIndex",
		Version:      "2.0.0",
		DefaultValue: "1024",
879 880
		Doc:          "It's a threshold. When the segment size is less than this value, the segment will not be indexed",
		Export:       true,
881 882
	}
	p.MinSegmentSizeToEnableIndex.Init(base.mgr)
883

884 885 886
	p.ImportTaskExpiration = ParamItem{
		Key:          "rootCoord.importTaskExpiration",
		Version:      "2.2.0",
887
		DefaultValue: "900", // 15 * 60 seconds
888 889
		Doc:          "(in seconds) Duration after which an import task will expire (be killed). Default 900 seconds (15 minutes).",
		Export:       true,
890 891
	}
	p.ImportTaskExpiration.Init(base.mgr)
892

893 894 895 896
	p.ImportTaskRetention = ParamItem{
		Key:          "rootCoord.importTaskRetention",
		Version:      "2.2.0",
		DefaultValue: strconv.Itoa(24 * 60 * 60),
897 898
		Doc:          "(in seconds) Milvus will keep the record of import tasks for at least `importTaskRetention` seconds. Default 86400, seconds (24 hours).",
		Export:       true,
899 900
	}
	p.ImportTaskRetention.Init(base.mgr)
901

902 903 904 905 906 907
	p.ImportTaskSubPath = ParamItem{
		Key:          "rootCoord.ImportTaskSubPath",
		Version:      "2.2.0",
		DefaultValue: "importtask",
	}
	p.ImportTaskSubPath.Init(base.mgr)
908

909 910 911 912 913 914 915
	p.ImportMaxPendingTaskCount = ParamItem{
		Key:          "rootCoord.importMaxPendingTaskCount",
		Version:      "2.2.2",
		DefaultValue: strconv.Itoa(65535),
	}
	p.ImportMaxPendingTaskCount.Init(base.mgr)

916 917 918 919
	p.EnableActiveStandby = ParamItem{
		Key:          "rootCoord.enableActiveStandby",
		Version:      "2.2.0",
		DefaultValue: "false",
920
		Export:       true,
921 922
	}
	p.EnableActiveStandby.Init(base.mgr)
J
jaime 已提交
923 924 925 926 927 928 929 930 931

	p.MaxDatabaseNum = ParamItem{
		Key:          "rootCoord.maxDatabaseNum",
		Version:      "2.3.0",
		DefaultValue: "64",
		Doc:          "Maximum number of database",
		Export:       true,
	}
	p.MaxDatabaseNum.Init(base.mgr)
932 933
}

S
smellthemoon 已提交
934
// /////////////////////////////////////////////////////////////////////////////
935
// --- proxy ---
A
aoiasd 已提交
936
type AccessLogConfig struct {
937 938 939 940 941 942 943 944
	Enable        ParamItem `refreshable:"false"`
	MinioEnable   ParamItem `refreshable:"false"`
	LocalPath     ParamItem `refreshable:"false"`
	Filename      ParamItem `refreshable:"false"`
	MaxSize       ParamItem `refreshable:"false"`
	RotatedTime   ParamItem `refreshable:"false"`
	MaxBackups    ParamItem `refreshable:"false"`
	RemotePath    ParamItem `refreshable:"false"`
E
Enwei Jiao 已提交
945
	RemoteMaxTime ParamItem `refreshable:"false"`
A
aoiasd 已提交
946 947
}

948
type proxyConfig struct {
949
	// Alias  string
E
Enwei Jiao 已提交
950 951
	SoPath ParamItem `refreshable:"false"`

952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970
	TimeTickInterval             ParamItem `refreshable:"false"`
	HealthCheckTimetout          ParamItem `refreshable:"true"`
	MsgStreamTimeTickBufSize     ParamItem `refreshable:"true"`
	MaxNameLength                ParamItem `refreshable:"true"`
	MaxUsernameLength            ParamItem `refreshable:"true"`
	MinPasswordLength            ParamItem `refreshable:"true"`
	MaxPasswordLength            ParamItem `refreshable:"true"`
	MaxFieldNum                  ParamItem `refreshable:"true"`
	MaxShardNum                  ParamItem `refreshable:"true"`
	MaxDimension                 ParamItem `refreshable:"true"`
	GinLogging                   ParamItem `refreshable:"false"`
	MaxUserNum                   ParamItem `refreshable:"true"`
	MaxRoleNum                   ParamItem `refreshable:"true"`
	MaxTaskNum                   ParamItem `refreshable:"false"`
	AccessLog                    AccessLogConfig
	ShardLeaderCacheInterval     ParamItem `refreshable:"false"`
	ReplicaSelectionPolicy       ParamItem `refreshable:"false"`
	CheckQueryNodeHealthInterval ParamItem `refreshable:"false"`
	CostMetricsExpireTime        ParamItem `refreshable:"true"`
W
wei liu 已提交
971 972
	RetryTimesOnReplica          ParamItem `refreshable:"true"`
	RetryTimesOnHealthCheck      ParamItem `refreshable:"true"`
973 974
}

975
func (p *proxyConfig) init(base *BaseTable) {
976 977 978 979 980
	p.TimeTickInterval = ParamItem{
		Key:          "proxy.timeTickInterval",
		Version:      "2.2.0",
		DefaultValue: "200",
		PanicIfEmpty: true,
981 982
		Doc:          "ms, the interval that proxy synchronize the time tick",
		Export:       true,
983 984
	}
	p.TimeTickInterval.Init(base.mgr)
985

986 987 988
	p.HealthCheckTimetout = ParamItem{
		Key:          "proxy.healthCheckTimetout",
		Version:      "2.3.0",
W
wei liu 已提交
989
		DefaultValue: "1000",
990 991 992 993 994 995
		PanicIfEmpty: true,
		Doc:          "ms, the interval that to do component healthy check",
		Export:       true,
	}
	p.HealthCheckTimetout.Init(base.mgr)

996 997 998 999 1000
	p.MsgStreamTimeTickBufSize = ParamItem{
		Key:          "proxy.msgStream.timeTick.bufSize",
		Version:      "2.2.0",
		DefaultValue: "512",
		PanicIfEmpty: true,
1001
		Export:       true,
1002 1003
	}
	p.MsgStreamTimeTickBufSize.Init(base.mgr)
1004

1005 1006 1007 1008 1009
	p.MaxNameLength = ParamItem{
		Key:          "proxy.maxNameLength",
		DefaultValue: "255",
		Version:      "2.0.0",
		PanicIfEmpty: true,
1010 1011
		Doc:          "Maximum length of name for a collection or alias",
		Export:       true,
1012 1013
	}
	p.MaxNameLength.Init(base.mgr)
1014

1015 1016 1017 1018 1019 1020 1021
	p.MinPasswordLength = ParamItem{
		Key:          "proxy.minPasswordLength",
		DefaultValue: "6",
		Version:      "2.0.0",
		PanicIfEmpty: true,
	}
	p.MinPasswordLength.Init(base.mgr)
1022

1023 1024 1025 1026 1027 1028 1029
	p.MaxUsernameLength = ParamItem{
		Key:          "proxy.maxUsernameLength",
		DefaultValue: "32",
		Version:      "2.0.0",
		PanicIfEmpty: true,
	}
	p.MaxUsernameLength.Init(base.mgr)
1030

1031 1032 1033 1034 1035
	p.MaxPasswordLength = ParamItem{
		Key:          "proxy.maxPasswordLength",
		DefaultValue: "256",
		Version:      "2.0.0",
		PanicIfEmpty: true,
1036
	}
1037
	p.MaxPasswordLength.Init(base.mgr)
1038

1039 1040 1041 1042 1043
	p.MaxFieldNum = ParamItem{
		Key:          "proxy.maxFieldNum",
		DefaultValue: "64",
		Version:      "2.0.0",
		PanicIfEmpty: true,
1044 1045 1046 1047
		Doc: `Maximum number of fields in a collection.
As of today (2.2.0 and after) it is strongly DISCOURAGED to set maxFieldNum >= 64.
So adjust at your risk!`,
		Export: true,
1048
	}
1049
	p.MaxFieldNum.Init(base.mgr)
1050

1051 1052
	p.MaxShardNum = ParamItem{
		Key:          "proxy.maxShardNum",
1053
		DefaultValue: "16",
1054 1055
		Version:      "2.0.0",
		PanicIfEmpty: true,
1056 1057
		Doc:          "Maximum number of shards in a collection",
		Export:       true,
1058
	}
1059
	p.MaxShardNum.Init(base.mgr)
1060

1061 1062 1063 1064 1065
	p.MaxDimension = ParamItem{
		Key:          "proxy.maxDimension",
		DefaultValue: "32768",
		Version:      "2.0.0",
		PanicIfEmpty: true,
1066 1067
		Doc:          "Maximum dimension of a vector",
		Export:       true,
1068
	}
1069
	p.MaxDimension.Init(base.mgr)
1070

1071 1072 1073 1074
	p.MaxTaskNum = ParamItem{
		Key:          "proxy.maxTaskNum",
		Version:      "2.2.0",
		DefaultValue: "1024",
1075 1076
		Doc:          "max task number of proxy task queue",
		Export:       true,
1077
	}
1078
	p.MaxTaskNum.Init(base.mgr)
1079

1080 1081 1082 1083
	p.GinLogging = ParamItem{
		Key:          "proxy.ginLogging",
		Version:      "2.2.0",
		DefaultValue: "true",
1084 1085 1086
		Doc: `Whether to produce gin logs.\n
please adjust in embedded Milvus: false`,
		Export: true,
1087
	}
1088
	p.GinLogging.Init(base.mgr)
1089

1090 1091 1092 1093 1094
	p.MaxUserNum = ParamItem{
		Key:          "proxy.maxUserNum",
		DefaultValue: "100",
		Version:      "2.0.0",
		PanicIfEmpty: true,
1095
	}
1096
	p.MaxUserNum.Init(base.mgr)
1097

1098 1099 1100 1101 1102 1103 1104
	p.MaxRoleNum = ParamItem{
		Key:          "proxy.maxRoleNum",
		DefaultValue: "10",
		Version:      "2.0.0",
		PanicIfEmpty: true,
	}
	p.MaxRoleNum.Init(base.mgr)
1105

1106 1107 1108 1109 1110 1111
	p.SoPath = ParamItem{
		Key:          "proxy.soPath",
		Version:      "2.2.0",
		DefaultValue: "",
	}
	p.SoPath.Init(base.mgr)
1112

1113 1114 1115 1116
	p.AccessLog.Enable = ParamItem{
		Key:          "proxy.accessLog.enable",
		Version:      "2.2.0",
		DefaultValue: "true",
1117
		Doc:          "if use access log",
1118
	}
1119
	p.AccessLog.Enable.Init(base.mgr)
1120

1121 1122 1123 1124
	p.AccessLog.MinioEnable = ParamItem{
		Key:          "proxy.accessLog.minioEnable",
		Version:      "2.2.0",
		DefaultValue: "false",
1125
		Doc:          "if upload sealed access log file to minio",
1126
	}
1127
	p.AccessLog.MinioEnable.Init(base.mgr)
1128

1129 1130 1131
	p.AccessLog.LocalPath = ParamItem{
		Key:     "proxy.accessLog.localPath",
		Version: "2.2.0",
1132
		Export:  true,
1133 1134
	}
	p.AccessLog.LocalPath.Init(base.mgr)
A
aoiasd 已提交
1135

1136 1137 1138 1139
	p.AccessLog.Filename = ParamItem{
		Key:          "proxy.accessLog.filename",
		Version:      "2.2.0",
		DefaultValue: "milvus_access_log.log",
1140 1141
		Doc:          "Log filename, leave empty to disable file log.",
		Export:       true,
A
aoiasd 已提交
1142
	}
1143
	p.AccessLog.Filename.Init(base.mgr)
A
aoiasd 已提交
1144

1145 1146 1147 1148
	p.AccessLog.MaxSize = ParamItem{
		Key:          "proxy.accessLog.maxSize",
		Version:      "2.2.0",
		DefaultValue: "64",
1149
		Doc:          "Max size for a single file, in MB.",
A
aoiasd 已提交
1150
	}
1151
	p.AccessLog.MaxSize.Init(base.mgr)
A
aoiasd 已提交
1152

1153 1154 1155 1156
	p.AccessLog.MaxBackups = ParamItem{
		Key:          "proxy.accessLog.maxBackups",
		Version:      "2.2.0",
		DefaultValue: "8",
1157
		Doc:          "Maximum number of old log files to retain.",
A
aoiasd 已提交
1158
	}
1159
	p.AccessLog.MaxBackups.Init(base.mgr)
A
aoiasd 已提交
1160

1161 1162 1163 1164
	p.AccessLog.RotatedTime = ParamItem{
		Key:          "proxy.accessLog.rotatedTime",
		Version:      "2.2.0",
		DefaultValue: "3600",
1165
		Doc:          "Max time for single access log file in seconds",
1166 1167
	}
	p.AccessLog.RotatedTime.Init(base.mgr)
A
aoiasd 已提交
1168

1169 1170 1171 1172
	p.AccessLog.RemotePath = ParamItem{
		Key:          "proxy.accessLog.remotePath",
		Version:      "2.2.0",
		DefaultValue: "access_log/",
1173
		Doc:          "File path in minIO",
1174 1175
	}
	p.AccessLog.RemotePath.Init(base.mgr)
1176 1177 1178 1179 1180

	p.AccessLog.RemoteMaxTime = ParamItem{
		Key:          "proxy.accessLog.remoteMaxTime",
		Version:      "2.2.0",
		DefaultValue: "168",
1181
		Doc:          "Max time for log file in minIO, in hours",
1182 1183
	}
	p.AccessLog.RemoteMaxTime.Init(base.mgr)
1184 1185 1186 1187

	p.ShardLeaderCacheInterval = ParamItem{
		Key:          "proxy.shardLeaderCacheInterval",
		Version:      "2.2.4",
1188
		DefaultValue: "10",
1189 1190 1191
		Doc:          "time interval to update shard leader cache, in seconds",
	}
	p.ShardLeaderCacheInterval.Init(base.mgr)
1192 1193 1194 1195 1196 1197 1198 1199

	p.ReplicaSelectionPolicy = ParamItem{
		Key:          "proxy.replicaSelectionPolicy",
		Version:      "2.3.0",
		DefaultValue: "look_aside",
		Doc:          "replica selection policy in multiple replicas load balancing, support round_robin and look_aside",
	}
	p.ReplicaSelectionPolicy.Init(base.mgr)
1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216

	p.CheckQueryNodeHealthInterval = ParamItem{
		Key:          "proxy.checkQueryNodeHealthInterval",
		Version:      "2.3.0",
		DefaultValue: "1000",
		Doc:          "time interval to check health for query node, in ms",
	}
	p.CheckQueryNodeHealthInterval.Init(base.mgr)

	p.CostMetricsExpireTime = ParamItem{
		Key:          "proxy.costMetricsExpireTime",
		Version:      "2.3.0",
		DefaultValue: "1000",
		Doc:          "expire time for query node cost metrics, in ms",
	}
	p.CostMetricsExpireTime.Init(base.mgr)

W
wei liu 已提交
1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231
	p.RetryTimesOnReplica = ParamItem{
		Key:          "proxy.retryTimesOnReplica",
		Version:      "2.3.0",
		DefaultValue: "2",
		Doc:          "retry times on each replica",
	}
	p.RetryTimesOnReplica.Init(base.mgr)

	p.RetryTimesOnHealthCheck = ParamItem{
		Key:          "proxy.retryTimesOnHealthCheck",
		Version:      "2.3.0",
		DefaultValue: "3",
		Doc:          "set query node unavailable on proxy when heartbeat failures reach this limit",
	}
	p.RetryTimesOnHealthCheck.Init(base.mgr)
A
aoiasd 已提交
1232 1233
}

1234
// /////////////////////////////////////////////////////////////////////////////
1235 1236
// --- querycoord ---
type queryCoordConfig struct {
1237
	// Deprecated: Since 2.2.0
E
Enwei Jiao 已提交
1238
	RetryNum ParamItem `refreshable:"true"`
1239
	// Deprecated: Since 2.2.0
E
Enwei Jiao 已提交
1240 1241 1242
	RetryInterval    ParamItem `refreshable:"true"`
	TaskMergeCap     ParamItem `refreshable:"false"`
	TaskExecutionCap ParamItem `refreshable:"true"`
1243

1244
	//---- Handoff ---
E
Enwei Jiao 已提交
1245 1246
	//Deprecated: Since 2.2.2
	AutoHandoff ParamItem `refreshable:"true"`
1247 1248

	//---- Balance ---
E
Enwei Jiao 已提交
1249
	AutoBalance                         ParamItem `refreshable:"true"`
1250 1251 1252
	Balancer                            ParamItem `refreshable:"true"`
	GlobalRowCountFactor                ParamItem `refreshable:"true"`
	ScoreUnbalanceTolerationFactor      ParamItem `refreshable:"true"`
1253
	ReverseUnbalanceTolerationFactor    ParamItem `refreshable:"true"`
E
Enwei Jiao 已提交
1254 1255 1256
	OverloadedMemoryThresholdPercentage ParamItem `refreshable:"true"`
	BalanceIntervalSeconds              ParamItem `refreshable:"true"`
	MemoryUsageMaxDifferencePercentage  ParamItem `refreshable:"true"`
1257 1258 1259 1260

	SegmentCheckInterval       ParamItem `refreshable:"true"`
	ChannelCheckInterval       ParamItem `refreshable:"true"`
	BalanceCheckInterval       ParamItem `refreshable:"true"`
1261
	IndexCheckInterval         ParamItem `refreshable:"true"`
1262 1263 1264 1265 1266 1267
	ChannelTaskTimeout         ParamItem `refreshable:"true"`
	SegmentTaskTimeout         ParamItem `refreshable:"true"`
	DistPullInterval           ParamItem `refreshable:"false"`
	HeartbeatAvailableInterval ParamItem `refreshable:"true"`
	LoadTimeoutSeconds         ParamItem `refreshable:"true"`

1268
	// Deprecated: Since 2.2.2, QueryCoord do not use HandOff logic anymore
E
Enwei Jiao 已提交
1269 1270 1271
	CheckHandoffInterval ParamItem `refreshable:"true"`
	EnableActiveStandby  ParamItem `refreshable:"false"`

1272 1273 1274
	// Deprecated: Since 2.2.2, use different interval for different checker
	CheckInterval ParamItem `refreshable:"true"`

W
wei liu 已提交
1275 1276 1277 1278 1279
	NextTargetSurviveTime      ParamItem `refreshable:"true"`
	UpdateNextTargetInterval   ParamItem `refreshable:"false"`
	CheckNodeInReplicaInterval ParamItem `refreshable:"false"`
	CheckResourceGroupInterval ParamItem `refreshable:"false"`
	EnableRGAutoRecover        ParamItem `refreshable:"true"`
W
wei liu 已提交
1280 1281
	CheckHealthInterval        ParamItem `refreshable:"false"`
	CheckHealthRPCTimeout      ParamItem `refreshable:"true"`
1282
	BrokerTimeout              ParamItem `refreshable:"false"`
1283 1284
}

1285
func (p *queryCoordConfig) init(base *BaseTable) {
1286
	//---- Task ---
1287 1288 1289 1290 1291 1292
	p.RetryNum = ParamItem{
		Key:          "queryCoord.task.retrynum",
		Version:      "2.2.0",
		DefaultValue: "5",
	}
	p.RetryNum.Init(base.mgr)
1293

1294 1295 1296 1297 1298 1299
	p.RetryInterval = ParamItem{
		Key:          "queryCoord.task.retryinterval",
		Version:      "2.2.0",
		DefaultValue: strconv.FormatInt(int64(10*time.Second), 10),
	}
	p.RetryInterval.Init(base.mgr)
1300

1301 1302 1303 1304
	p.TaskMergeCap = ParamItem{
		Key:          "queryCoord.taskMergeCap",
		Version:      "2.2.0",
		DefaultValue: "16",
1305
		Export:       true,
1306 1307
	}
	p.TaskMergeCap.Init(base.mgr)
1308

1309 1310 1311 1312
	p.TaskExecutionCap = ParamItem{
		Key:          "queryCoord.taskExecutionCap",
		Version:      "2.2.0",
		DefaultValue: "256",
1313
		Export:       true,
1314
	}
1315 1316 1317 1318 1319 1320 1321
	p.TaskExecutionCap.Init(base.mgr)

	p.AutoHandoff = ParamItem{
		Key:          "queryCoord.autoHandoff",
		Version:      "2.0.0",
		DefaultValue: "true",
		PanicIfEmpty: true,
1322 1323
		Doc:          "Enable auto handoff",
		Export:       true,
1324
	}
1325
	p.AutoHandoff.Init(base.mgr)
1326

1327 1328 1329
	p.AutoBalance = ParamItem{
		Key:          "queryCoord.autoBalance",
		Version:      "2.0.0",
1330
		DefaultValue: "true",
1331
		PanicIfEmpty: true,
1332 1333
		Doc:          "Enable auto balance",
		Export:       true,
1334
	}
1335
	p.AutoBalance.Init(base.mgr)
1336

1337 1338 1339
	p.Balancer = ParamItem{
		Key:          "queryCoord.balancer",
		Version:      "2.0.0",
1340 1341
		DefaultValue: "ScoreBasedBalancer",
		PanicIfEmpty: false,
1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359
		Doc:          "auto balancer used for segments on queryNodes",
		Export:       true,
	}
	p.Balancer.Init(base.mgr)

	p.GlobalRowCountFactor = ParamItem{
		Key:          "queryCoord.globalRowCountFactor",
		Version:      "2.0.0",
		DefaultValue: "0.1",
		PanicIfEmpty: true,
		Doc:          "the weight used when balancing segments among queryNodes",
		Export:       true,
	}
	p.GlobalRowCountFactor.Init(base.mgr)

	p.ScoreUnbalanceTolerationFactor = ParamItem{
		Key:          "queryCoord.scoreUnbalanceTolerationFactor",
		Version:      "2.0.0",
1360
		DefaultValue: "0.05",
1361
		PanicIfEmpty: true,
1362
		Doc:          "the least value for unbalanced extent between from and to nodes when doing balance",
1363 1364 1365 1366
		Export:       true,
	}
	p.ScoreUnbalanceTolerationFactor.Init(base.mgr)

1367 1368 1369 1370 1371 1372 1373 1374 1375 1376
	p.ReverseUnbalanceTolerationFactor = ParamItem{
		Key:          "queryCoord.reverseUnBalanceTolerationFactor",
		Version:      "2.0.0",
		DefaultValue: "1.3",
		PanicIfEmpty: true,
		Doc:          "the largest value for unbalanced extent between from and to nodes after doing balance",
		Export:       true,
	}
	p.ReverseUnbalanceTolerationFactor.Init(base.mgr)

1377 1378 1379 1380 1381
	p.OverloadedMemoryThresholdPercentage = ParamItem{
		Key:          "queryCoord.overloadedMemoryThresholdPercentage",
		Version:      "2.0.0",
		DefaultValue: "90",
		PanicIfEmpty: true,
1382 1383
		Doc:          "The threshold percentage that memory overload",
		Export:       true,
1384
	}
1385
	p.OverloadedMemoryThresholdPercentage.Init(base.mgr)
1386

1387 1388 1389 1390 1391
	p.BalanceIntervalSeconds = ParamItem{
		Key:          "queryCoord.balanceIntervalSeconds",
		Version:      "2.0.0",
		DefaultValue: "60",
		PanicIfEmpty: true,
1392
		Export:       true,
1393
	}
1394
	p.BalanceIntervalSeconds.Init(base.mgr)
1395

1396 1397 1398 1399 1400
	p.MemoryUsageMaxDifferencePercentage = ParamItem{
		Key:          "queryCoord.memoryUsageMaxDifferencePercentage",
		Version:      "2.0.0",
		DefaultValue: "30",
		PanicIfEmpty: true,
1401
		Export:       true,
1402
	}
1403
	p.MemoryUsageMaxDifferencePercentage.Init(base.mgr)
1404

1405 1406 1407
	p.CheckInterval = ParamItem{
		Key:          "queryCoord.checkInterval",
		Version:      "2.0.0",
1408
		DefaultValue: "10000",
1409
		PanicIfEmpty: true,
1410
		Export:       true,
1411 1412
	}
	p.CheckInterval.Init(base.mgr)
1413

1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440
	p.SegmentCheckInterval = ParamItem{
		Key:          "queryCoord.checkSegmentInterval",
		Version:      "2.3.0",
		DefaultValue: "1000",
		PanicIfEmpty: true,
		Export:       true,
	}
	p.SegmentCheckInterval.Init(base.mgr)

	p.ChannelCheckInterval = ParamItem{
		Key:          "queryCoord.checkChannelInterval",
		Version:      "2.3.0",
		DefaultValue: "1000",
		PanicIfEmpty: true,
		Export:       true,
	}
	p.ChannelCheckInterval.Init(base.mgr)

	p.BalanceCheckInterval = ParamItem{
		Key:          "queryCoord.checkChannelInterval",
		Version:      "2.3.0",
		DefaultValue: "10000",
		PanicIfEmpty: true,
		Export:       true,
	}
	p.BalanceCheckInterval.Init(base.mgr)

1441 1442 1443 1444 1445 1446 1447 1448 1449
	p.IndexCheckInterval = ParamItem{
		Key:          "queryCoord.checkIndexInterval",
		Version:      "2.3.0",
		DefaultValue: "10000",
		PanicIfEmpty: true,
		Export:       true,
	}
	p.IndexCheckInterval.Init(base.mgr)

1450 1451 1452 1453 1454
	p.ChannelTaskTimeout = ParamItem{
		Key:          "queryCoord.channelTaskTimeout",
		Version:      "2.0.0",
		DefaultValue: "60000",
		PanicIfEmpty: true,
1455 1456
		Doc:          "1 minute",
		Export:       true,
B
Bingyi Sun 已提交
1457
	}
1458
	p.ChannelTaskTimeout.Init(base.mgr)
B
Bingyi Sun 已提交
1459

1460 1461 1462 1463 1464
	p.SegmentTaskTimeout = ParamItem{
		Key:          "queryCoord.segmentTaskTimeout",
		Version:      "2.0.0",
		DefaultValue: "120000",
		PanicIfEmpty: true,
1465 1466
		Doc:          "2 minute",
		Export:       true,
B
Bingyi Sun 已提交
1467
	}
1468
	p.SegmentTaskTimeout.Init(base.mgr)
B
Bingyi Sun 已提交
1469

1470 1471 1472 1473 1474
	p.DistPullInterval = ParamItem{
		Key:          "queryCoord.distPullInterval",
		Version:      "2.0.0",
		DefaultValue: "500",
		PanicIfEmpty: true,
1475
		Export:       true,
B
Bingyi Sun 已提交
1476
	}
1477
	p.DistPullInterval.Init(base.mgr)
B
Bingyi Sun 已提交
1478

1479 1480 1481 1482 1483
	p.LoadTimeoutSeconds = ParamItem{
		Key:          "queryCoord.loadTimeoutSeconds",
		Version:      "2.0.0",
		DefaultValue: "600",
		PanicIfEmpty: true,
1484
		Export:       true,
B
Bingyi Sun 已提交
1485
	}
1486
	p.LoadTimeoutSeconds.Init(base.mgr)
1487

1488 1489 1490
	p.HeartbeatAvailableInterval = ParamItem{
		Key:          "queryCoord.heartbeatAvailableInterval",
		Version:      "2.2.1",
Y
yah01 已提交
1491
		DefaultValue: "10000",
1492
		PanicIfEmpty: true,
1493 1494
		Doc:          "10s, Only QueryNodes which fetched heartbeats within the duration are available",
		Export:       true,
1495 1496
	}
	p.HeartbeatAvailableInterval.Init(base.mgr)
B
Bingyi Sun 已提交
1497

E
Enwei Jiao 已提交
1498 1499 1500 1501 1502
	p.CheckHandoffInterval = ParamItem{
		Key:          "queryCoord.checkHandoffInterval",
		DefaultValue: "5000",
		Version:      "2.2.0",
		PanicIfEmpty: true,
1503
		Export:       true,
E
Enwei Jiao 已提交
1504 1505 1506
	}
	p.CheckHandoffInterval.Init(base.mgr)

1507 1508 1509 1510
	p.EnableActiveStandby = ParamItem{
		Key:          "queryCoord.enableActiveStandby",
		Version:      "2.2.0",
		DefaultValue: "false",
1511
		Export:       true,
B
Bingyi Sun 已提交
1512
	}
1513
	p.EnableActiveStandby.Init(base.mgr)
B
Bingyi Sun 已提交
1514

1515 1516 1517 1518 1519
	p.NextTargetSurviveTime = ParamItem{
		Key:          "queryCoord.NextTargetSurviveTime",
		Version:      "2.0.0",
		DefaultValue: "300",
		PanicIfEmpty: true,
W
wei liu 已提交
1520
	}
1521
	p.NextTargetSurviveTime.Init(base.mgr)
W
wei liu 已提交
1522

1523 1524 1525 1526 1527
	p.UpdateNextTargetInterval = ParamItem{
		Key:          "queryCoord.UpdateNextTargetInterval",
		Version:      "2.0.0",
		DefaultValue: "10",
		PanicIfEmpty: true,
W
wei liu 已提交
1528
	}
1529
	p.UpdateNextTargetInterval.Init(base.mgr)
W
wei liu 已提交
1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541

	p.CheckNodeInReplicaInterval = ParamItem{
		Key:          "queryCoord.checkNodeInReplicaInterval",
		Version:      "2.2.3",
		DefaultValue: "60",
		PanicIfEmpty: true,
	}
	p.CheckNodeInReplicaInterval.Init(base.mgr)

	p.CheckResourceGroupInterval = ParamItem{
		Key:          "queryCoord.checkResourceGroupInterval",
		Version:      "2.2.3",
W
wei liu 已提交
1542
		DefaultValue: "10",
W
wei liu 已提交
1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553
		PanicIfEmpty: true,
	}
	p.CheckResourceGroupInterval.Init(base.mgr)

	p.EnableRGAutoRecover = ParamItem{
		Key:          "queryCoord.enableRGAutoRecover",
		Version:      "2.2.3",
		DefaultValue: "true",
		PanicIfEmpty: true,
	}
	p.EnableRGAutoRecover.Init(base.mgr)
W
wei liu 已提交
1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573

	p.CheckHealthInterval = ParamItem{
		Key:          "queryCoord.checkHealthInterval",
		Version:      "2.2.7",
		DefaultValue: "3000",
		PanicIfEmpty: true,
		Doc:          "3s, the interval when query coord try to check health of query node",
		Export:       true,
	}
	p.CheckHealthInterval.Init(base.mgr)

	p.CheckHealthRPCTimeout = ParamItem{
		Key:          "queryCoord.checkHealthRPCTimeout",
		Version:      "2.2.7",
		DefaultValue: "100",
		PanicIfEmpty: true,
		Doc:          "100ms, the timeout of check health rpc to query node",
		Export:       true,
	}
	p.CheckHealthRPCTimeout.Init(base.mgr)
1574 1575 1576 1577 1578 1579 1580 1581 1582 1583

	p.BrokerTimeout = ParamItem{
		Key:          "queryCoord.brokerTimeout",
		Version:      "2.3.0",
		DefaultValue: "5000",
		PanicIfEmpty: true,
		Doc:          "5000ms, querycoord broker rpc timeout",
		Export:       true,
	}
	p.BrokerTimeout.Init(base.mgr)
W
wei liu 已提交
1584 1585
}

S
smellthemoon 已提交
1586
// /////////////////////////////////////////////////////////////////////////////
1587 1588
// --- querynode ---
type queryNodeConfig struct {
G
Gao 已提交
1589 1590
	SoPath ParamItem `refreshable:"false"`

E
Enwei Jiao 已提交
1591 1592
	FlowGraphMaxQueueLength ParamItem `refreshable:"false"`
	FlowGraphMaxParallelism ParamItem `refreshable:"false"`
1593 1594

	// stats
1595
	// Deprecated: Never used
E
Enwei Jiao 已提交
1596
	StatsPublishInterval ParamItem `refreshable:"true"`
1597 1598

	// segcore
F
foxspy 已提交
1599 1600 1601 1602 1603
	KnowhereThreadPoolSize    ParamItem `refreshable:"false"`
	ChunkRows                 ParamItem `refreshable:"false"`
	EnableGrowingSegmentIndex ParamItem `refreshable:"false"`
	GrowingIndexNlist         ParamItem `refreshable:"false"`
	GrowingIndexNProbe        ParamItem `refreshable:"false"`
1604 1605

	// memory limit
E
Enwei Jiao 已提交
1606 1607
	LoadMemoryUsageFactor               ParamItem `refreshable:"true"`
	OverloadedMemoryThresholdPercentage ParamItem `refreshable:"false"`
G
godchen 已提交
1608

1609
	// enable disk
E
Enwei Jiao 已提交
1610 1611 1612
	EnableDisk             ParamItem `refreshable:"true"`
	DiskCapacityLimit      ParamItem `refreshable:"true"`
	MaxDiskUsagePercentage ParamItem `refreshable:"true"`
1613

G
godchen 已提交
1614
	// cache limit
E
Enwei Jiao 已提交
1615 1616
	CacheEnabled     ParamItem `refreshable:"false"`
	CacheMemoryLimit ParamItem `refreshable:"false"`
Y
yah01 已提交
1617
	MmapDirPath      ParamItem `refreshable:"false"`
E
Enwei Jiao 已提交
1618 1619 1620 1621 1622 1623 1624 1625

	GroupEnabled         ParamItem `refreshable:"true"`
	MaxReceiveChanSize   ParamItem `refreshable:"false"`
	MaxUnsolvedQueueSize ParamItem `refreshable:"true"`
	MaxReadConcurrency   ParamItem `refreshable:"true"`
	MaxGroupNQ           ParamItem `refreshable:"true"`
	TopKMergeRatio       ParamItem `refreshable:"true"`
	CPURatio             ParamItem `refreshable:"true"`
1626
	MaxTimestampLag      ParamItem `refreshable:"true"`
Y
yah01 已提交
1627
	GCEnabled            ParamItem `refreshable:"true"`
E
Enwei Jiao 已提交
1628 1629 1630 1631 1632

	GCHelperEnabled     ParamItem `refreshable:"false"`
	MinimumGOGCConfig   ParamItem `refreshable:"false"`
	MaximumGOGCConfig   ParamItem `refreshable:"false"`
	GracefulStopTimeout ParamItem `refreshable:"false"`
Y
yah01 已提交
1633 1634 1635

	// delete buffer
	MaxSegmentDeleteBuffer ParamItem `refreshable:"false"`
Y
yah01 已提交
1636 1637 1638

	// loader
	IoPoolSize ParamItem `refreshable:"false"`
1639 1640 1641 1642 1643 1644

	// schedule task policy.
	SchedulePolicyName                    ParamItem `refreshable:"false"`
	SchedulePolicyTaskQueueExpire         ParamItem `refreshable:"true"`
	SchedulePolicyEnableCrossUserGrouping ParamItem `refreshable:"true"`
	SchedulePolicyMaxPendingTaskPerUser   ParamItem `refreshable:"true"`
1645 1646 1647

	// CGOPoolSize ratio to MaxReadConcurrency
	CGOPoolSizeRatio ParamItem `refreshable:"false"`
1648
}
1649

1650
func (p *queryNodeConfig) init(base *BaseTable) {
G
Gao 已提交
1651 1652 1653 1654 1655 1656 1657
	p.SoPath = ParamItem{
		Key:          "queryNode.soPath",
		Version:      "2.3.0",
		DefaultValue: "",
	}
	p.SoPath.Init(base.mgr)

1658 1659 1660 1661
	p.FlowGraphMaxQueueLength = ParamItem{
		Key:          "queryNode.dataSync.flowGraph.maxQueueLength",
		Version:      "2.0.0",
		DefaultValue: "1024",
1662 1663
		Doc:          "Maximum length of task queue in flowgraph",
		Export:       true,
1664 1665 1666 1667 1668 1669 1670
	}
	p.FlowGraphMaxQueueLength.Init(base.mgr)

	p.FlowGraphMaxParallelism = ParamItem{
		Key:          "queryNode.dataSync.flowGraph.maxParallelism",
		Version:      "2.0.0",
		DefaultValue: "1024",
1671 1672
		Doc:          "Maximum number of tasks executed in parallel in the flowgraph",
		Export:       true,
1673 1674 1675 1676 1677 1678 1679
	}
	p.FlowGraphMaxParallelism.Init(base.mgr)

	p.StatsPublishInterval = ParamItem{
		Key:          "queryNode.stats.publishInterval",
		Version:      "2.0.0",
		DefaultValue: "1000",
1680 1681
		Doc:          "Interval for querynode to report node information (milliseconds)",
		Export:       true,
1682 1683 1684
	}
	p.StatsPublishInterval.Init(base.mgr)

1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703
	p.KnowhereThreadPoolSize = ParamItem{
		Key:          "queryNode.segcore.knowhereThreadPoolNumRatio",
		Version:      "2.0.0",
		DefaultValue: "4",
		Formatter: func(v string) string {
			factor := getAsInt64(v)
			if factor <= 0 || !p.EnableDisk.GetAsBool() {
				factor = 1
			} else if factor > 32 {
				factor = 32
			}
			knowhereThreadPoolSize := uint32(runtime.GOMAXPROCS(0)) * uint32(factor)
			return strconv.FormatUint(uint64(knowhereThreadPoolSize), 10)
		},
		Doc:    "The number of threads in knowhere's thread pool. If disk is enabled, the pool size will multiply with knowhereThreadPoolNumRatio([1, 32]).",
		Export: true,
	}
	p.KnowhereThreadPoolSize.Init(base.mgr)

1704 1705 1706 1707 1708 1709 1710 1711 1712 1713
	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
		},
1714 1715
		Doc:    "The number of vectors in a chunk.",
		Export: true,
1716 1717 1718
	}
	p.ChunkRows.Init(base.mgr)

F
foxspy 已提交
1719 1720 1721 1722 1723 1724 1725 1726
	p.EnableGrowingSegmentIndex = ParamItem{
		Key:          "queryNode.segcore.growing.enableIndex",
		Version:      "2.0.0",
		DefaultValue: "false",
		Doc:          "Enable segment growing with index to accelerate vector search.",
		Export:       true,
	}
	p.EnableGrowingSegmentIndex.Init(base.mgr)
1727

F
foxspy 已提交
1728 1729 1730 1731 1732 1733
	p.GrowingIndexNlist = ParamItem{
		Key:          "queryNode.segcore.growing.nlist",
		Version:      "2.0.0",
		DefaultValue: "128",
		Doc:          "growing index nlist, recommend to set sqrt(chunkRows), must smaller than chunkRows/8",
		Export:       true,
1734
	}
F
foxspy 已提交
1735
	p.GrowingIndexNlist.Init(base.mgr)
1736

F
foxspy 已提交
1737 1738
	p.GrowingIndexNProbe = ParamItem{
		Key:     "queryNode.segcore.growing.nprobe",
1739 1740
		Version: "2.0.0",
		Formatter: func(v string) string {
F
foxspy 已提交
1741
			defaultNprobe := p.GrowingIndexNlist.GetAsInt64() / 8
1742 1743 1744 1745
			nprobe := getAsInt64(v)
			if nprobe == 0 {
				nprobe = defaultNprobe
			}
F
foxspy 已提交
1746 1747
			if nprobe > p.GrowingIndexNlist.GetAsInt64() {
				return p.GrowingIndexNlist.GetValue()
1748 1749 1750
			}
			return strconv.FormatInt(nprobe, 10)
		},
1751 1752
		Doc:    "nprobe to search small index, based on your accuracy requirement, must smaller than nlist",
		Export: true,
1753
	}
F
foxspy 已提交
1754
	p.GrowingIndexNProbe.Init(base.mgr)
1755 1756 1757 1758

	p.LoadMemoryUsageFactor = ParamItem{
		Key:          "queryNode.loadMemoryUsageFactor",
		Version:      "2.0.0",
1759
		DefaultValue: "2",
1760
		PanicIfEmpty: true,
1761 1762
		Doc:          "The multiply factor of calculating the memory usage while loading segments",
		Export:       true,
1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781
	}
	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,
1782 1783
		Doc:          "2 GB, 2 * 1024 *1024 *1024",
		Export:       true,
1784 1785 1786 1787 1788 1789 1790
	}
	p.CacheMemoryLimit.Init(base.mgr)

	p.CacheEnabled = ParamItem{
		Key:          "queryNode.cache.enabled",
		Version:      "2.0.0",
		DefaultValue: "",
1791
		Export:       true,
1792 1793 1794
	}
	p.CacheEnabled.Init(base.mgr)

Y
yah01 已提交
1795 1796 1797 1798 1799 1800 1801 1802
	p.MmapDirPath = ParamItem{
		Key:          "queryNode.mmapDirPath",
		Version:      "2.3.0",
		DefaultValue: "",
		Doc:          "The folder that storing data files for mmap, setting to a path will enable Milvus to load data with mmap",
	}
	p.MmapDirPath.Init(base.mgr)

1803 1804 1805 1806
	p.GroupEnabled = ParamItem{
		Key:          "queryNode.grouping.enabled",
		Version:      "2.0.0",
		DefaultValue: "true",
1807
		Export:       true,
1808 1809 1810 1811 1812 1813 1814
	}
	p.GroupEnabled.Init(base.mgr)

	p.MaxReceiveChanSize = ParamItem{
		Key:          "queryNode.scheduler.receiveChanSize",
		Version:      "2.0.0",
		DefaultValue: "10240",
1815
		Export:       true,
1816 1817 1818 1819 1820 1821
	}
	p.MaxReceiveChanSize.Init(base.mgr)

	p.MaxReadConcurrency = ParamItem{
		Key:          "queryNode.scheduler.maxReadConcurrentRatio",
		Version:      "2.0.0",
Y
yah01 已提交
1822
		DefaultValue: "1.0",
1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833
		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)
		},
1834 1835 1836 1837 1838 1839
		Doc: `maxReadConcurrentRatio is the concurrency ratio of read task (search task and query task).
Max read concurrency would be the value of ` + "runtime.NumCPU * maxReadConcurrentRatio" + `.
It defaults to 2.0, which means max read concurrency would be the value of runtime.NumCPU * 2.
Max read concurrency must greater than or equal to 1, and less than or equal to runtime.NumCPU * 100.
(0, 100]`,
		Export: true,
1840 1841 1842 1843 1844 1845 1846
	}
	p.MaxReadConcurrency.Init(base.mgr)

	p.MaxUnsolvedQueueSize = ParamItem{
		Key:          "queryNode.scheduler.unsolvedQueueSize",
		Version:      "2.0.0",
		DefaultValue: "10240",
1847
		Export:       true,
1848 1849 1850 1851 1852 1853
	}
	p.MaxUnsolvedQueueSize.Init(base.mgr)

	p.MaxGroupNQ = ParamItem{
		Key:          "queryNode.grouping.maxNQ",
		Version:      "2.0.0",
1854
		DefaultValue: "1000",
1855
		Export:       true,
1856 1857 1858 1859 1860 1861
	}
	p.MaxGroupNQ.Init(base.mgr)

	p.TopKMergeRatio = ParamItem{
		Key:          "queryNode.grouping.topKMergeRatio",
		Version:      "2.0.0",
Y
yah01 已提交
1862
		DefaultValue: "20.0",
1863
		Export:       true,
1864 1865 1866 1867 1868 1869 1870
	}
	p.TopKMergeRatio.Init(base.mgr)

	p.CPURatio = ParamItem{
		Key:          "queryNode.scheduler.cpuRatio",
		Version:      "2.0.0",
		DefaultValue: "10",
1871 1872
		Doc:          "ratio used to estimate read task cpu usage.",
		Export:       true,
1873 1874 1875 1876 1877 1878 1879
	}
	p.CPURatio.Init(base.mgr)

	p.EnableDisk = ParamItem{
		Key:          "queryNode.enableDisk",
		Version:      "2.2.0",
		DefaultValue: "false",
1880 1881
		Doc:          "enable querynode load disk index, and search on disk index",
		Export:       true,
1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909
	}
	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)
		},
1910
		Export: true,
1911 1912 1913
	}
	p.MaxDiskUsagePercentage.Init(base.mgr)

1914 1915 1916 1917
	p.MaxTimestampLag = ParamItem{
		Key:          "queryNode.scheduler.maxTimestampLag",
		Version:      "2.2.3",
		DefaultValue: "86400",
1918
		Export:       true,
1919 1920 1921
	}
	p.MaxTimestampLag.Init(base.mgr)

Y
yah01 已提交
1922 1923 1924 1925 1926 1927 1928
	p.GCEnabled = ParamItem{
		Key:          "queryNode.gcenabled",
		Version:      "2.3.0",
		DefaultValue: "true",
	}
	p.GCEnabled.Init(base.mgr)

1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953
	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"},
1954
		Export:       true,
1955 1956
	}
	p.GracefulStopTimeout.Init(base.mgr)
Y
yah01 已提交
1957 1958 1959 1960 1961 1962 1963

	p.MaxSegmentDeleteBuffer = ParamItem{
		Key:          "queryNode.maxSegmentDeleteBuffer",
		Version:      "2.3.0",
		DefaultValue: "10000000",
	}
	p.MaxSegmentDeleteBuffer.Init(base.mgr)
Y
yah01 已提交
1964 1965 1966 1967 1968 1969 1970 1971

	p.IoPoolSize = ParamItem{
		Key:          "queryNode.ioPoolSize",
		Version:      "2.3.0",
		DefaultValue: "0",
		Doc:          "Control how many goroutines will the loader use to pull files, if the given value is non-positive, the value will be set to CpuNum * 8, at least 32, and at most 256",
	}
	p.IoPoolSize.Init(base.mgr)
1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001

	// schedule read task policy.
	p.SchedulePolicyName = ParamItem{
		Key:          "queryNode.scheduler.scheduleReadPolicy.name",
		Version:      "2.3.0",
		DefaultValue: "fifo",
		Doc:          "Control how to schedule query/search read task in query node",
	}
	p.SchedulePolicyName.Init(base.mgr)
	p.SchedulePolicyTaskQueueExpire = ParamItem{
		Key:          "queryNode.scheduler.scheduleReadPolicy.taskQueueExpire",
		Version:      "2.3.0",
		DefaultValue: "60",
		Doc:          "Control how long (many seconds) that queue retains since queue is empty",
	}
	p.SchedulePolicyTaskQueueExpire.Init(base.mgr)
	p.SchedulePolicyEnableCrossUserGrouping = ParamItem{
		Key:          "queryNode.scheduler.scheduleReadPolicy.enableCrossUserGrouping",
		Version:      "2.3.0",
		DefaultValue: "false",
		Doc:          "Enable Cross user grouping when using user-task-polling policy. (Disable it if user's task can not merge each other)",
	}
	p.SchedulePolicyEnableCrossUserGrouping.Init(base.mgr)
	p.SchedulePolicyMaxPendingTaskPerUser = ParamItem{
		Key:          "queryNode.scheduler.scheduleReadPolicy.maxPendingTaskPerUser",
		Version:      "2.3.0",
		DefaultValue: "1024",
		Doc:          "Max pending task per user in scheduler",
	}
	p.SchedulePolicyMaxPendingTaskPerUser.Init(base.mgr)
2002 2003 2004 2005 2006 2007 2008 2009

	p.CGOPoolSizeRatio = ParamItem{
		Key:          "queryNode.segcore.cgoPoolSizeRatio",
		Version:      "2.3.0",
		DefaultValue: "2.0",
		Doc:          "cgo pool size ratio to max read concurrency",
	}
	p.CGOPoolSizeRatio.Init(base.mgr)
2010
}
X
Xiaofan 已提交
2011

2012 2013 2014 2015
// /////////////////////////////////////////////////////////////////////////////
// --- datacoord ---
type dataCoordConfig struct {
	// --- CHANNEL ---
2016 2017 2018
	WatchTimeoutInterval         ParamItem `refreshable:"false"`
	ChannelBalanceSilentDuration ParamItem `refreshable:"true"`
	ChannelBalanceInterval       ParamItem `refreshable:"true"`
2019

2020
	// --- SEGMENTS ---
E
Enwei Jiao 已提交
2021 2022 2023
	SegmentMaxSize                 ParamItem `refreshable:"false"`
	DiskSegmentMaxSize             ParamItem `refreshable:"true"`
	SegmentSealProportion          ParamItem `refreshable:"false"`
2024 2025
	SegAssignmentExpiration        ParamItem `refreshable:"false"`
	AllocLatestExpireAttempt       ParamItem `refreshable:"true"`
E
Enwei Jiao 已提交
2026 2027 2028
	SegmentMaxLifetime             ParamItem `refreshable:"false"`
	SegmentMaxIdleTime             ParamItem `refreshable:"false"`
	SegmentMinSizeFromIdleToSealed ParamItem `refreshable:"false"`
2029
	SegmentMaxBinlogFileNumber     ParamItem `refreshable:"false"`
2030

2031
	// compaction
E
Enwei Jiao 已提交
2032 2033
	EnableCompaction     ParamItem `refreshable:"false"`
	EnableAutoCompaction ParamItem `refreshable:"true"`
2034
	IndexBasedCompaction ParamItem `refreshable:"true"`
E
Enwei Jiao 已提交
2035

2036 2037
	CompactionRPCTimeout              ParamItem `refreshable:"true"`
	CompactionMaxParallelTasks        ParamItem `refreshable:"true"`
2038
	CompactionWorkerParalleTasks      ParamItem `refreshable:"true"`
E
Enwei Jiao 已提交
2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050
	MinSegmentToMerge                 ParamItem `refreshable:"true"`
	MaxSegmentToMerge                 ParamItem `refreshable:"true"`
	SegmentSmallProportion            ParamItem `refreshable:"true"`
	SegmentCompactableProportion      ParamItem `refreshable:"true"`
	SegmentExpansionRate              ParamItem `refreshable:"true"`
	CompactionTimeoutInSeconds        ParamItem `refreshable:"true"`
	CompactionCheckIntervalInSeconds  ParamItem `refreshable:"false"`
	SingleCompactionRatioThreshold    ParamItem `refreshable:"true"`
	SingleCompactionDeltaLogMaxSize   ParamItem `refreshable:"true"`
	SingleCompactionExpiredLogMaxSize ParamItem `refreshable:"true"`
	SingleCompactionDeltalogMaxNum    ParamItem `refreshable:"true"`
	GlobalCompactionInterval          ParamItem `refreshable:"false"`
2051

2052
	// Garbage Collection
E
Enwei Jiao 已提交
2053 2054 2055 2056 2057
	EnableGarbageCollection ParamItem `refreshable:"false"`
	GCInterval              ParamItem `refreshable:"false"`
	GCMissingTolerance      ParamItem `refreshable:"false"`
	GCDropTolerance         ParamItem `refreshable:"false"`
	EnableActiveStandby     ParamItem `refreshable:"false"`
2058

2059 2060 2061 2062 2063
	BindIndexNodeMode          ParamItem `refreshable:"false"`
	IndexNodeAddress           ParamItem `refreshable:"false"`
	WithCredential             ParamItem `refreshable:"false"`
	IndexNodeID                ParamItem `refreshable:"false"`
	IndexTaskSchedulerInterval ParamItem `refreshable:"false"`
2064 2065

	MinSegmentNumRowsToEnableIndex ParamItem `refreshable:"true"`
2066 2067
}

2068
func (p *dataCoordConfig) init(base *BaseTable) {
2069 2070 2071
	p.WatchTimeoutInterval = ParamItem{
		Key:          "dataCoord.channel.watchTimeoutInterval",
		Version:      "2.2.3",
2072
		DefaultValue: "120",
2073 2074
		Doc:          "Timeout on watching channels (in seconds). Datanode tickler update watch progress will reset timeout timer.",
		Export:       true,
2075
	}
2076
	p.WatchTimeoutInterval.Init(base.mgr)
2077

2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095
	p.ChannelBalanceSilentDuration = ParamItem{
		Key:          "dataCoord.channel.balanceSilentDuration",
		Version:      "2.2.3",
		DefaultValue: "300",
		Doc:          "The duration after which the channel manager start background channel balancing",
		Export:       true,
	}
	p.ChannelBalanceSilentDuration.Init(base.mgr)

	p.ChannelBalanceInterval = ParamItem{
		Key:          "dataCoord.channel.balanceInterval",
		Version:      "2.2.3",
		DefaultValue: "360",
		Doc:          "The interval with which the channel manager check dml channel balance status",
		Export:       true,
	}
	p.ChannelBalanceInterval.Init(base.mgr)

2096 2097 2098 2099
	p.SegmentMaxSize = ParamItem{
		Key:          "dataCoord.segment.maxSize",
		Version:      "2.0.0",
		DefaultValue: "512",
2100 2101
		Doc:          "Maximum size of a segment in MB",
		Export:       true,
2102
	}
2103
	p.SegmentMaxSize.Init(base.mgr)
2104

2105 2106 2107 2108
	p.DiskSegmentMaxSize = ParamItem{
		Key:          "dataCoord.segment.diskSegmentMaxSize",
		Version:      "2.0.0",
		DefaultValue: "512",
2109 2110
		Doc:          "Maximun size of a segment in MB for collection which has Disk index",
		Export:       true,
2111
	}
2112
	p.DiskSegmentMaxSize.Init(base.mgr)
2113

2114 2115 2116
	p.SegmentSealProportion = ParamItem{
		Key:          "dataCoord.segment.sealProportion",
		Version:      "2.0.0",
2117
		DefaultValue: "0.25",
2118
		Export:       true,
2119
	}
2120
	p.SegmentSealProportion.Init(base.mgr)
2121

2122 2123 2124 2125
	p.SegAssignmentExpiration = ParamItem{
		Key:          "dataCoord.segment.assignmentExpiration",
		Version:      "2.0.0",
		DefaultValue: "2000",
2126 2127
		Doc:          "The time of the assignment expiration in ms",
		Export:       true,
2128
	}
2129
	p.SegAssignmentExpiration.Init(base.mgr)
2130

2131 2132 2133 2134 2135 2136 2137 2138 2139
	p.AllocLatestExpireAttempt = ParamItem{
		Key:          "dataCoord.segment.allocLatestExpireAttempt",
		Version:      "2.2.0",
		DefaultValue: "200",
		Doc:          "The time attempting to alloc latest lastExpire from rootCoord after restart",
		Export:       true,
	}
	p.AllocLatestExpireAttempt.Init(base.mgr)

2140 2141 2142
	p.SegmentMaxLifetime = ParamItem{
		Key:          "dataCoord.segment.maxLife",
		Version:      "2.0.0",
2143
		DefaultValue: "86400",
2144 2145
		Doc:          "The max lifetime of segment in seconds, 24*60*60",
		Export:       true,
2146
	}
2147
	p.SegmentMaxLifetime.Init(base.mgr)
2148

2149 2150 2151 2152
	p.SegmentMaxIdleTime = ParamItem{
		Key:          "dataCoord.segment.maxIdleTime",
		Version:      "2.0.0",
		DefaultValue: "3600",
2153 2154 2155 2156
		Doc: `If a segment didn't accept dml records in ` + "maxIdleTime" + ` and the size of segment is greater than
` + "minSizeFromIdleToSealed" + `, Milvus will automatically seal it.
The max idle time of segment in seconds, 10*60.`,
		Export: true,
G
godchen 已提交
2157
	}
2158
	p.SegmentMaxIdleTime.Init(base.mgr)
X
Xiaofan 已提交
2159

2160 2161 2162 2163
	p.SegmentMinSizeFromIdleToSealed = ParamItem{
		Key:          "dataCoord.segment.minSizeFromIdleToSealed",
		Version:      "2.0.0",
		DefaultValue: "16.0",
2164 2165
		Doc:          "The min size in MB of segment which can be idle from sealed.",
		Export:       true,
G
godchen 已提交
2166
	}
2167
	p.SegmentMinSizeFromIdleToSealed.Init(base.mgr)
G
godchen 已提交
2168

2169 2170
	p.SegmentMaxBinlogFileNumber = ParamItem{
		Key:          "dataCoord.segment.maxBinlogFileNumber",
2171
		Version:      "2.2.0",
2172
		DefaultValue: "32",
2173 2174 2175
		Doc: `The max number of binlog file for one segment, the segment will be sealed if
the number of binlog file reaches to max value.`,
		Export: true,
2176 2177 2178
	}
	p.SegmentMaxBinlogFileNumber.Init(base.mgr)

2179 2180 2181
	p.EnableCompaction = ParamItem{
		Key:          "dataCoord.enableCompaction",
		Version:      "2.0.0",
2182
		DefaultValue: "true",
2183 2184
		Doc:          "Enable data segment compaction",
		Export:       true,
2185
	}
2186
	p.EnableCompaction.Init(base.mgr)
2187

2188 2189 2190
	p.EnableAutoCompaction = ParamItem{
		Key:          "dataCoord.compaction.enableAutoCompaction",
		Version:      "2.0.0",
2191
		DefaultValue: "true",
2192
		Export:       true,
2193
	}
2194
	p.EnableAutoCompaction.Init(base.mgr)
2195

2196 2197 2198 2199 2200 2201 2202 2203
	p.IndexBasedCompaction = ParamItem{
		Key:          "dataCoord.compaction.indexBasedCompaction",
		Version:      "2.0.0",
		DefaultValue: "true",
		Export:       true,
	}
	p.IndexBasedCompaction.Init(base.mgr)

2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219
	p.CompactionRPCTimeout = ParamItem{
		Key:          "dataCoord.compaction.rpcTimeout",
		Version:      "2.2.12",
		DefaultValue: "10",
		Export:       true,
	}
	p.CompactionRPCTimeout.Init(base.mgr)

	p.CompactionMaxParallelTasks = ParamItem{
		Key:          "dataCoord.compaction.maxParallelTaskNum",
		Version:      "2.2.12",
		DefaultValue: "100",
		Export:       true,
	}
	p.CompactionMaxParallelTasks.Init(base.mgr)

2220 2221 2222 2223 2224 2225 2226 2227
	p.CompactionWorkerParalleTasks = ParamItem{
		Key:          "dataCoord.compaction.workerMaxParallelTaskNum",
		Version:      "2.3.0",
		DefaultValue: "2",
		Export:       true,
	}
	p.CompactionWorkerParalleTasks.Init(base.mgr)

2228 2229 2230
	p.MinSegmentToMerge = ParamItem{
		Key:          "dataCoord.compaction.min.segment",
		Version:      "2.0.0",
2231
		DefaultValue: "3",
2232
	}
2233
	p.MinSegmentToMerge.Init(base.mgr)
2234

2235 2236 2237 2238
	p.MaxSegmentToMerge = ParamItem{
		Key:          "dataCoord.compaction.max.segment",
		Version:      "2.0.0",
		DefaultValue: "30",
2239
	}
2240
	p.MaxSegmentToMerge.Init(base.mgr)
2241

2242 2243 2244 2245
	p.SegmentSmallProportion = ParamItem{
		Key:          "dataCoord.segment.smallProportion",
		Version:      "2.0.0",
		DefaultValue: "0.5",
2246 2247
		Doc:          "The segment is considered as \"small segment\" when its # of rows is smaller than",
		Export:       true,
2248
	}
2249
	p.SegmentSmallProportion.Init(base.mgr)
2250

2251 2252 2253
	p.SegmentCompactableProportion = ParamItem{
		Key:          "dataCoord.segment.compactableProportion",
		Version:      "2.2.1",
X
xige-16 已提交
2254
		DefaultValue: "0.85",
2255 2256 2257
		Doc: `(smallProportion * segment max # of rows).
A compaction will happen on small segments if the segment after compaction will have`,
		Export: true,
2258 2259
	}
	p.SegmentCompactableProportion.Init(base.mgr)
2260

2261 2262 2263 2264
	p.SegmentExpansionRate = ParamItem{
		Key:          "dataCoord.segment.expansionRate",
		Version:      "2.2.1",
		DefaultValue: "1.25",
2265 2266 2267 2268
		Doc: `over (compactableProportion * segment max # of rows) rows.
MUST BE GREATER THAN OR EQUAL TO <smallProportion>!!!
During compaction, the size of segment # of rows is able to exceed segment max # of rows by (expansionRate-1) * 100%. `,
		Export: true,
2269 2270 2271
	}
	p.SegmentExpansionRate.Init(base.mgr)

2272 2273 2274
	p.CompactionTimeoutInSeconds = ParamItem{
		Key:          "dataCoord.compaction.timeout",
		Version:      "2.0.0",
2275
		DefaultValue: "300",
2276 2277
	}
	p.CompactionTimeoutInSeconds.Init(base.mgr)
2278

2279 2280 2281 2282 2283 2284
	p.CompactionCheckIntervalInSeconds = ParamItem{
		Key:          "dataCoord.compaction.check.interval",
		Version:      "2.0.0",
		DefaultValue: "10",
	}
	p.CompactionCheckIntervalInSeconds.Init(base.mgr)
2285

2286 2287 2288 2289 2290 2291
	p.SingleCompactionRatioThreshold = ParamItem{
		Key:          "dataCoord.compaction.single.ratio.threshold",
		Version:      "2.0.0",
		DefaultValue: "0.2",
	}
	p.SingleCompactionRatioThreshold.Init(base.mgr)
2292

2293 2294 2295 2296 2297 2298
	p.SingleCompactionDeltaLogMaxSize = ParamItem{
		Key:          "dataCoord.compaction.single.deltalog.maxsize",
		Version:      "2.0.0",
		DefaultValue: strconv.Itoa(2 * 1024 * 1024),
	}
	p.SingleCompactionDeltaLogMaxSize.Init(base.mgr)
2299

2300 2301 2302 2303 2304 2305
	p.SingleCompactionExpiredLogMaxSize = ParamItem{
		Key:          "dataCoord.compaction.single.expiredlog.maxsize",
		Version:      "2.0.0",
		DefaultValue: "10485760",
	}
	p.SingleCompactionExpiredLogMaxSize.Init(base.mgr)
2306

2307 2308
	p.SingleCompactionDeltalogMaxNum = ParamItem{
		Key:          "dataCoord.compaction.single.deltalog.maxnum",
2309
		Version:      "2.0.0",
2310
		DefaultValue: "200",
2311
	}
2312
	p.SingleCompactionDeltalogMaxNum.Init(base.mgr)
2313

2314 2315 2316 2317 2318 2319
	p.GlobalCompactionInterval = ParamItem{
		Key:          "dataCoord.compaction.global.interval",
		Version:      "2.0.0",
		DefaultValue: "60",
	}
	p.GlobalCompactionInterval.Init(base.mgr)
2320

2321 2322 2323 2324
	p.EnableGarbageCollection = ParamItem{
		Key:          "dataCoord.enableGarbageCollection",
		Version:      "2.0.0",
		DefaultValue: "true",
2325 2326
		Doc:          "",
		Export:       true,
2327 2328
	}
	p.EnableGarbageCollection.Init(base.mgr)
2329

2330 2331 2332 2333
	p.GCInterval = ParamItem{
		Key:          "dataCoord.gc.interval",
		Version:      "2.0.0",
		DefaultValue: "3600",
2334 2335
		Doc:          "gc interval in seconds",
		Export:       true,
2336 2337
	}
	p.GCInterval.Init(base.mgr)
2338

2339
	// Do you set this to incredible small value, make sure this to be more than 10 minutes at least
2340 2341 2342
	p.GCMissingTolerance = ParamItem{
		Key:          "dataCoord.gc.missingTolerance",
		Version:      "2.0.0",
2343
		DefaultValue: "3600",
2344
		Doc:          "file meta missing tolerance duration in seconds, 60*60*3",
2345
		Export:       true,
2346 2347
	}
	p.GCMissingTolerance.Init(base.mgr)
2348

2349 2350 2351
	p.GCDropTolerance = ParamItem{
		Key:          "dataCoord.gc.dropTolerance",
		Version:      "2.0.0",
2352
		DefaultValue: "10800",
2353 2354
		Doc:          "file belongs to dropped entity tolerance duration in seconds. 3600",
		Export:       true,
2355
	}
2356
	p.GCDropTolerance.Init(base.mgr)
2357

2358 2359 2360 2361
	p.EnableActiveStandby = ParamItem{
		Key:          "dataCoord.enableActiveStandby",
		Version:      "2.0.0",
		DefaultValue: "false",
2362
		Export:       true,
2363 2364
	}
	p.EnableActiveStandby.Init(base.mgr)
2365 2366

	p.MinSegmentNumRowsToEnableIndex = ParamItem{
2367
		Key:          "indexCoord.segment.minSegmentNumRowsToEnableIndex",
2368 2369
		Version:      "2.0.0",
		DefaultValue: "1024",
2370 2371
		Doc:          "It's a threshold. When the segment num rows is less than this value, the segment will not be indexed",
		Export:       true,
2372 2373 2374 2375
	}
	p.MinSegmentNumRowsToEnableIndex.Init(base.mgr)

	p.BindIndexNodeMode = ParamItem{
2376
		Key:          "indexCoord.bindIndexNodeMode.enable",
2377 2378
		Version:      "2.0.0",
		DefaultValue: "false",
2379
		Export:       true,
2380 2381 2382 2383
	}
	p.BindIndexNodeMode.Init(base.mgr)

	p.IndexNodeAddress = ParamItem{
2384
		Key:          "indexCoord.bindIndexNodeMode.address",
2385 2386
		Version:      "2.0.0",
		DefaultValue: "localhost:22930",
2387
		Export:       true,
2388 2389 2390 2391
	}
	p.IndexNodeAddress.Init(base.mgr)

	p.WithCredential = ParamItem{
2392
		Key:          "indexCoord.bindIndexNodeMode.withCred",
2393 2394
		Version:      "2.0.0",
		DefaultValue: "false",
2395
		Export:       true,
2396 2397 2398 2399
	}
	p.WithCredential.Init(base.mgr)

	p.IndexNodeID = ParamItem{
2400
		Key:          "indexCoord.bindIndexNodeMode.nodeID",
2401 2402
		Version:      "2.0.0",
		DefaultValue: "0",
2403
		Export:       true,
2404 2405
	}
	p.IndexNodeID.Init(base.mgr)
2406 2407 2408 2409 2410 2411
	p.IndexTaskSchedulerInterval = ParamItem{
		Key:          "indexCoord.scheduler.interval",
		Version:      "2.0.0",
		DefaultValue: "1000",
	}
	p.IndexTaskSchedulerInterval.Init(base.mgr)
2412 2413
}

S
smellthemoon 已提交
2414
// /////////////////////////////////////////////////////////////////////////////
2415 2416
// --- datanode ---
type dataNodeConfig struct {
E
Enwei Jiao 已提交
2417 2418
	FlowGraphMaxQueueLength ParamItem `refreshable:"false"`
	FlowGraphMaxParallelism ParamItem `refreshable:"false"`
2419
	MaxParallelSyncTaskNum  ParamItem `refreshable:"false"`
2420 2421

	// segment
E
Enwei Jiao 已提交
2422 2423 2424 2425
	FlushInsertBufferSize  ParamItem `refreshable:"true"`
	FlushDeleteBufferBytes ParamItem `refreshable:"true"`
	BinLogMaxSize          ParamItem `refreshable:"true"`
	SyncPeriod             ParamItem `refreshable:"true"`
2426
	CpLagPeriod            ParamItem `refreshable:"true"`
2427
	CpLagSyncLimit         ParamItem `refreshable:"true"`
2428

2429 2430 2431
	// watchEvent
	WatchEventTicklerInterval ParamItem `refreshable:"false"`

2432
	// io concurrency to fetch stats logs
E
Enwei Jiao 已提交
2433
	IOConcurrency ParamItem `refreshable:"false"`
2434 2435

	// memory management
2436 2437 2438
	MemoryForceSyncEnable     ParamItem `refreshable:"true"`
	MemoryForceSyncSegmentNum ParamItem `refreshable:"true"`
	MemoryWatermark           ParamItem `refreshable:"true"`
2439

2440
	DataNodeTimeTickByRPC ParamItem `refreshable:"false"`
2441 2442
	// DataNode send timetick interval per collection
	DataNodeTimeTickInterval ParamItem `refreshable:"false"`
2443

2444 2445 2446
	// timeout for bulkinsert
	BulkInsertTimeoutSeconds ParamItem `refreshable:"true"`

2447 2448
	// Skip BF
	SkipBFStatsLoad ParamItem `refreshable:"true"`
2449 2450
}

2451
func (p *dataNodeConfig) init(base *BaseTable) {
2452 2453 2454 2455
	p.FlowGraphMaxQueueLength = ParamItem{
		Key:          "dataNode.dataSync.flowGraph.maxQueueLength",
		Version:      "2.0.0",
		DefaultValue: "1024",
2456 2457
		Doc:          "Maximum length of task queue in flowgraph",
		Export:       true,
2458 2459
	}
	p.FlowGraphMaxQueueLength.Init(base.mgr)
2460

2461 2462 2463 2464
	p.FlowGraphMaxParallelism = ParamItem{
		Key:          "dataNode.dataSync.flowGraph.maxParallelism",
		Version:      "2.0.0",
		DefaultValue: "1024",
2465 2466
		Doc:          "Maximum number of tasks executed in parallel in the flowgraph",
		Export:       true,
2467 2468
	}
	p.FlowGraphMaxParallelism.Init(base.mgr)
2469

2470 2471 2472 2473 2474 2475 2476 2477 2478
	p.MaxParallelSyncTaskNum = ParamItem{
		Key:          "dataNode.dataSync.maxParallelSyncTaskNum",
		Version:      "2.3.0",
		DefaultValue: "2",
		Doc:          "Maximum number of sync tasks executed in parallel in each flush manager",
		Export:       true,
	}
	p.MaxParallelSyncTaskNum.Init(base.mgr)

2479
	p.FlushInsertBufferSize = ParamItem{
2480
		Key:          "dataNode.segment.insertBufSize",
2481
		Version:      "2.0.0",
2482
		FallbackKeys: []string{"DATA_NODE_IBUFSIZE"},
2483 2484
		DefaultValue: "16777216",
		PanicIfEmpty: true,
2485 2486
		Doc:          "Max buffer size to flush for a single segment.",
		Export:       true,
E
Enwei Jiao 已提交
2487
	}
2488
	p.FlushInsertBufferSize.Init(base.mgr)
2489

2490 2491 2492 2493 2494 2495 2496
	p.MemoryForceSyncEnable = ParamItem{
		Key:          "datanode.memory.forceSyncEnable",
		Version:      "2.2.4",
		DefaultValue: "true",
	}
	p.MemoryForceSyncEnable.Init(base.mgr)

2497 2498
	p.MemoryForceSyncSegmentNum = ParamItem{
		Key:          "datanode.memory.forceSyncSegmentNum",
2499
		Version:      "2.2.4",
2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524
		DefaultValue: "1",
	}
	p.MemoryForceSyncSegmentNum.Init(base.mgr)

	if os.Getenv(metricsinfo.DeployModeEnvKey) == metricsinfo.StandaloneDeployMode {
		p.MemoryWatermark = ParamItem{
			Key:          "datanode.memory.watermarkStandalone",
			Version:      "2.2.4",
			DefaultValue: "0.2",
		}
	} else if os.Getenv(metricsinfo.DeployModeEnvKey) == metricsinfo.ClusterDeployMode {
		p.MemoryWatermark = ParamItem{
			Key:          "datanode.memory.watermarkCluster",
			Version:      "2.2.4",
			DefaultValue: "0.5",
		}
	} else {
		log.Warn("DeployModeEnv is not set, use default", zap.Float64("default", 0.5))
		p.MemoryWatermark = ParamItem{
			Key:          "datanode.memory.watermarkCluster",
			Version:      "2.2.4",
			DefaultValue: "0.5",
		}
	}
	p.MemoryWatermark.Init(base.mgr)
2525

2526
	p.FlushDeleteBufferBytes = ParamItem{
2527
		Key:          "dataNode.segment.deleteBufBytes",
2528 2529
		Version:      "2.0.0",
		DefaultValue: "67108864",
2530 2531
		Doc:          "Max buffer size to flush del for a single channel",
		Export:       true,
2532 2533
	}
	p.FlushDeleteBufferBytes.Init(base.mgr)
2534

2535
	p.BinLogMaxSize = ParamItem{
2536
		Key:          "dataNode.segment.binlog.maxsize",
2537 2538 2539 2540 2541
		Version:      "2.0.0",
		DefaultValue: "67108864",
	}
	p.BinLogMaxSize.Init(base.mgr)

2542
	p.SyncPeriod = ParamItem{
2543
		Key:          "dataNode.segment.syncPeriod",
2544 2545
		Version:      "2.0.0",
		DefaultValue: "600",
2546 2547
		Doc:          "The period to sync segments if buffer is not empty.",
		Export:       true,
2548 2549
	}
	p.SyncPeriod.Init(base.mgr)
2550

2551 2552 2553 2554
	p.CpLagPeriod = ParamItem{
		Key:          "datanode.segment.cpLagPeriod",
		Version:      "2.2.0",
		DefaultValue: "600",
2555
		Doc:          "The period to sync segments for cp lag period policy",
2556 2557 2558 2559
		Export:       true,
	}
	p.CpLagPeriod.Init(base.mgr)

2560 2561 2562 2563 2564 2565 2566 2567 2568
	p.CpLagSyncLimit = ParamItem{
		Key:          "datanode.segment.cpLagSyncLimit",
		Version:      "2.2.0",
		DefaultValue: "10",
		Doc:          "The limit to sync segments for cp lag period policy",
		Export:       true,
	}
	p.CpLagSyncLimit.Init(base.mgr)

2569 2570 2571 2572 2573 2574 2575
	p.WatchEventTicklerInterval = ParamItem{
		Key:          "datanode.segment.watchEventTicklerInterval",
		Version:      "2.2.3",
		DefaultValue: "15",
	}
	p.WatchEventTicklerInterval.Init(base.mgr)

2576 2577 2578 2579 2580 2581
	p.IOConcurrency = ParamItem{
		Key:          "dataNode.dataSync.ioConcurrency",
		Version:      "2.0.0",
		DefaultValue: "10",
	}
	p.IOConcurrency.Init(base.mgr)
2582

2583 2584 2585 2586 2587 2588 2589 2590
	p.DataNodeTimeTickByRPC = ParamItem{
		Key:          "datanode.timetick.byRPC",
		Version:      "2.2.9",
		PanicIfEmpty: false,
		DefaultValue: "true",
	}
	p.DataNodeTimeTickByRPC.Init(base.mgr)

2591 2592 2593 2594 2595 2596 2597
	p.DataNodeTimeTickInterval = ParamItem{
		Key:          "datanode.timetick.interval",
		Version:      "2.2.5",
		PanicIfEmpty: false,
		DefaultValue: "500",
	}
	p.DataNodeTimeTickInterval.Init(base.mgr)
2598 2599 2600 2601 2602 2603 2604 2605

	p.SkipBFStatsLoad = ParamItem{
		Key:          "dataNode.skip.BFStats.Load",
		Version:      "2.2.5",
		PanicIfEmpty: false,
		DefaultValue: "false",
	}
	p.SkipBFStatsLoad.Init(base.mgr)
2606 2607 2608 2609 2610 2611 2612 2613

	p.BulkInsertTimeoutSeconds = ParamItem{
		Key:          "datanode.bulkinsert.timeout.seconds",
		Version:      "2.3.0",
		PanicIfEmpty: false,
		DefaultValue: "18000",
	}
	p.BulkInsertTimeoutSeconds.Init(base.mgr)
2614 2615
}

S
smellthemoon 已提交
2616
// /////////////////////////////////////////////////////////////////////////////
2617 2618
// --- indexnode ---
type indexNodeConfig struct {
E
Enwei Jiao 已提交
2619
	BuildParallel ParamItem `refreshable:"false"`
2620
	// enable disk
E
Enwei Jiao 已提交
2621 2622 2623
	EnableDisk             ParamItem `refreshable:"false"`
	DiskCapacityLimit      ParamItem `refreshable:"true"`
	MaxDiskUsagePercentage ParamItem `refreshable:"true"`
2624

E
Enwei Jiao 已提交
2625
	GracefulStopTimeout ParamItem `refreshable:"false"`
2626 2627
}

2628
func (p *indexNodeConfig) init(base *BaseTable) {
2629 2630 2631 2632
	p.BuildParallel = ParamItem{
		Key:          "indexNode.scheduler.buildParallel",
		Version:      "2.0.0",
		DefaultValue: "1",
2633
		Export:       true,
2634 2635 2636 2637 2638 2639 2640 2641
	}
	p.BuildParallel.Init(base.mgr)

	p.EnableDisk = ParamItem{
		Key:          "indexNode.enableDisk",
		Version:      "2.2.0",
		DefaultValue: "false",
		PanicIfEmpty: true,
2642 2643
		Doc:          "enable index node build disk vector index",
		Export:       true,
2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671
	}
	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)
		},
2672
		Export: true,
2673 2674
	}
	p.MaxDiskUsagePercentage.Init(base.mgr)
2675 2676 2677 2678 2679

	p.GracefulStopTimeout = ParamItem{
		Key:          "indexNode.gracefulStopTimeout",
		Version:      "2.2.1",
		FallbackKeys: []string{"common.gracefulStopTimeout"},
2680
		Export:       true,
2681 2682
	}
	p.GracefulStopTimeout.Init(base.mgr)
2683
}
W
wayblink 已提交
2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697

type integrationTestConfig struct {
	IntegrationMode ParamItem `refreshable:"false"`
}

func (p *integrationTestConfig) init(base *BaseTable) {
	p.IntegrationMode = ParamItem{
		Key:          "integration.test.mode",
		Version:      "2.2.0",
		DefaultValue: "false",
		PanicIfEmpty: true,
	}
	p.IntegrationMode.Init(base.mgr)
}