enhance: Change const magic number in querycoord to param (#28819)

See also #28817

---------

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
pull/28703/head
congqixia 2023-11-30 09:06:28 +08:00 committed by GitHub
parent 1dc086496f
commit f9bb8e9648
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 13 deletions

View File

@ -33,11 +33,6 @@ import (
"github.com/milvus-io/milvus/pkg/util/paramtable"
)
const (
interval = 1 * time.Second
RPCTimeout = 3 * time.Second
)
// LeaderObserver is to sync the distribution with leader
type LeaderObserver struct {
wg sync.WaitGroup
@ -79,7 +74,7 @@ func (o *LeaderObserver) Stop() {
}
func (o *LeaderObserver) schedule(ctx context.Context) {
ticker := time.NewTicker(interval)
ticker := time.NewTicker(paramtable.Get().QueryCoordCfg.LeaderViewUpdateInterval.GetAsDuration(time.Second))
defer ticker.Stop()
for {
select {

View File

@ -32,12 +32,7 @@ import (
"github.com/milvus-io/milvus/internal/proto/querypb"
"github.com/milvus-io/milvus/internal/types"
"github.com/milvus-io/milvus/pkg/log"
)
const (
updateTickerDuration = 1 * time.Minute
segmentBufferSize = 16
bufferFlushPeriod = 500 * time.Millisecond
"github.com/milvus-io/milvus/pkg/util/paramtable"
)
var ErrNodeNotFound = errors.New("NodeNotFound")
@ -100,7 +95,7 @@ func (c *QueryCluster) Stop() {
func (c *QueryCluster) updateLoop() {
defer c.wg.Done()
ticker := time.NewTicker(updateTickerDuration)
ticker := time.NewTicker(paramtable.Get().QueryCoordCfg.CheckNodeSessionInterval.GetAsDuration(time.Second))
defer ticker.Stop()
for {
select {

View File

@ -1247,6 +1247,7 @@ type queryCoordConfig struct {
UpdateNextTargetInterval ParamItem `refreshable:"false"`
CheckNodeInReplicaInterval ParamItem `refreshable:"false"`
CheckResourceGroupInterval ParamItem `refreshable:"false"`
LeaderViewUpdateInterval ParamItem `refreshable:"false"`
EnableRGAutoRecover ParamItem `refreshable:"true"`
CheckHealthInterval ParamItem `refreshable:"false"`
CheckHealthRPCTimeout ParamItem `refreshable:"true"`
@ -1254,6 +1255,7 @@ type queryCoordConfig struct {
CollectionRecoverTimesLimit ParamItem `refreshable:"true"`
ObserverTaskParallel ParamItem `refreshable:"false"`
CheckAutoBalanceConfigInterval ParamItem `refreshable:"false"`
CheckNodeSessionInterval ParamItem `refreshable:"false"`
}
func (p *queryCoordConfig) init(base *BaseTable) {
@ -1518,6 +1520,15 @@ func (p *queryCoordConfig) init(base *BaseTable) {
}
p.CheckResourceGroupInterval.Init(base.mgr)
p.LeaderViewUpdateInterval = ParamItem{
Key: "queryCoord.leaderViewUpdateInterval",
Doc: "the interval duration(in seconds) for LeaderObserver to fetch LeaderView from querynodes",
Version: "2.3.4",
DefaultValue: "1",
PanicIfEmpty: true,
}
p.LeaderViewUpdateInterval.Init(base.mgr)
p.EnableRGAutoRecover = ParamItem{
Key: "queryCoord.enableRGAutoRecover",
Version: "2.2.3",
@ -1585,6 +1596,16 @@ func (p *queryCoordConfig) init(base *BaseTable) {
Export: true,
}
p.CheckAutoBalanceConfigInterval.Init(base.mgr)
p.CheckNodeSessionInterval = ParamItem{
Key: "queryCoord.checkNodeSessionInterval",
Version: "2.3.4",
DefaultValue: "60",
PanicIfEmpty: true,
Doc: "the interval(in seconds) of check querynode cluster session",
Export: true,
}
p.CheckNodeSessionInterval.Init(base.mgr)
}
// /////////////////////////////////////////////////////////////////////////////