2021-01-16 10:12:14 +08:00
|
|
|
package querynode
|
2020-11-26 16:01:31 +08:00
|
|
|
|
|
|
|
import (
|
2021-03-05 09:21:35 +08:00
|
|
|
"fmt"
|
2020-12-08 14:41:04 +08:00
|
|
|
"os"
|
2021-03-05 09:21:35 +08:00
|
|
|
"path"
|
2020-11-26 16:01:31 +08:00
|
|
|
"strconv"
|
2021-02-06 13:39:15 +08:00
|
|
|
"sync"
|
2020-11-26 16:01:31 +08:00
|
|
|
|
2021-03-05 09:21:35 +08:00
|
|
|
"github.com/zilliztech/milvus-distributed/internal/log"
|
2020-11-26 16:01:31 +08:00
|
|
|
"github.com/zilliztech/milvus-distributed/internal/util/paramtable"
|
|
|
|
)
|
|
|
|
|
|
|
|
type ParamTable struct {
|
|
|
|
paramtable.BaseTable
|
2020-12-10 16:31:09 +08:00
|
|
|
|
2021-04-13 10:04:39 +08:00
|
|
|
PulsarAddress string
|
|
|
|
ETCDAddress string
|
|
|
|
MetaRootPath string
|
2020-12-10 16:31:09 +08:00
|
|
|
|
2021-01-21 10:01:29 +08:00
|
|
|
QueryNodeIP string
|
|
|
|
QueryNodePort int64
|
|
|
|
QueryNodeID UniqueID
|
|
|
|
QueryNodeNum int
|
|
|
|
QueryTimeTickChannelName string
|
|
|
|
QueryTimeTickReceiveBufSize int64
|
2020-12-10 16:31:09 +08:00
|
|
|
|
|
|
|
FlowGraphMaxQueueLength int32
|
|
|
|
FlowGraphMaxParallelism int32
|
|
|
|
|
2020-12-24 20:55:40 +08:00
|
|
|
// minio
|
|
|
|
MinioEndPoint string
|
|
|
|
MinioAccessKeyID string
|
|
|
|
MinioSecretAccessKey string
|
|
|
|
MinioUseSSLStr bool
|
2021-01-05 15:58:13 +08:00
|
|
|
MinioBucketName string
|
2020-12-24 20:55:40 +08:00
|
|
|
|
2020-12-10 16:31:09 +08:00
|
|
|
// dm
|
|
|
|
InsertChannelNames []string
|
|
|
|
InsertChannelRange []int
|
|
|
|
InsertReceiveBufSize int64
|
|
|
|
InsertPulsarBufSize int64
|
|
|
|
|
|
|
|
// dd
|
|
|
|
DDChannelNames []string
|
|
|
|
DDReceiveBufSize int64
|
|
|
|
DDPulsarBufSize int64
|
|
|
|
|
|
|
|
// search
|
|
|
|
SearchChannelNames []string
|
|
|
|
SearchResultChannelNames []string
|
|
|
|
SearchReceiveBufSize int64
|
|
|
|
SearchPulsarBufSize int64
|
|
|
|
SearchResultReceiveBufSize int64
|
|
|
|
|
|
|
|
// stats
|
|
|
|
StatsPublishInterval int
|
|
|
|
StatsChannelName string
|
|
|
|
StatsReceiveBufSize int64
|
|
|
|
|
2021-02-03 18:12:48 +08:00
|
|
|
GracefulTime int64
|
|
|
|
MsgChannelSubName string
|
|
|
|
SliceIndex int
|
2021-03-05 09:21:35 +08:00
|
|
|
|
|
|
|
Log log.Config
|
2020-11-26 16:01:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
var Params ParamTable
|
2021-02-06 13:39:15 +08:00
|
|
|
var once sync.Once
|
2020-11-26 16:01:31 +08:00
|
|
|
|
|
|
|
func (p *ParamTable) Init() {
|
2021-02-06 13:39:15 +08:00
|
|
|
once.Do(func() {
|
|
|
|
p.BaseTable.Init()
|
|
|
|
err := p.LoadYaml("advanced/query_node.yaml")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2020-11-26 16:01:31 +08:00
|
|
|
|
2021-02-06 13:39:15 +08:00
|
|
|
queryNodeIDStr := os.Getenv("QUERY_NODE_ID")
|
|
|
|
if queryNodeIDStr == "" {
|
|
|
|
queryNodeIDList := p.QueryNodeIDList()
|
|
|
|
if len(queryNodeIDList) <= 0 {
|
|
|
|
queryNodeIDStr = "0"
|
|
|
|
} else {
|
|
|
|
queryNodeIDStr = strconv.Itoa(int(queryNodeIDList[0]))
|
|
|
|
}
|
2020-12-08 14:41:04 +08:00
|
|
|
}
|
2020-12-10 16:31:09 +08:00
|
|
|
|
2021-02-06 13:39:15 +08:00
|
|
|
err = p.Save("_queryNodeID", queryNodeIDStr)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2020-12-10 16:31:09 +08:00
|
|
|
|
2021-02-06 13:39:15 +08:00
|
|
|
p.initQueryNodeID()
|
|
|
|
p.initQueryNodeNum()
|
2021-02-18 16:26:02 +08:00
|
|
|
//p.initQueryTimeTickChannelName()
|
2021-02-06 13:39:15 +08:00
|
|
|
p.initQueryTimeTickReceiveBufSize()
|
|
|
|
|
|
|
|
p.initMinioEndPoint()
|
|
|
|
p.initMinioAccessKeyID()
|
|
|
|
p.initMinioSecretAccessKey()
|
|
|
|
p.initMinioUseSSLStr()
|
|
|
|
p.initMinioBucketName()
|
|
|
|
|
|
|
|
p.initPulsarAddress()
|
|
|
|
p.initETCDAddress()
|
|
|
|
p.initMetaRootPath()
|
|
|
|
|
|
|
|
p.initGracefulTime()
|
|
|
|
p.initMsgChannelSubName()
|
|
|
|
p.initSliceIndex()
|
|
|
|
|
|
|
|
p.initFlowGraphMaxQueueLength()
|
|
|
|
p.initFlowGraphMaxParallelism()
|
|
|
|
|
|
|
|
p.initInsertChannelNames()
|
|
|
|
p.initInsertChannelRange()
|
|
|
|
p.initInsertReceiveBufSize()
|
|
|
|
p.initInsertPulsarBufSize()
|
|
|
|
|
|
|
|
p.initDDChannelNames()
|
|
|
|
p.initDDReceiveBufSize()
|
|
|
|
p.initDDPulsarBufSize()
|
|
|
|
|
2021-02-18 16:26:02 +08:00
|
|
|
//p.initSearchChannelNames()
|
|
|
|
//p.initSearchResultChannelNames()
|
2021-02-06 13:39:15 +08:00
|
|
|
p.initSearchReceiveBufSize()
|
|
|
|
p.initSearchPulsarBufSize()
|
|
|
|
p.initSearchResultReceiveBufSize()
|
|
|
|
|
|
|
|
p.initStatsPublishInterval()
|
2021-02-18 16:26:02 +08:00
|
|
|
//p.initStatsChannelName()
|
2021-02-06 13:39:15 +08:00
|
|
|
p.initStatsReceiveBufSize()
|
2021-03-05 09:21:35 +08:00
|
|
|
|
|
|
|
p.initLogCfg()
|
2021-02-06 13:39:15 +08:00
|
|
|
})
|
2020-12-24 20:55:40 +08:00
|
|
|
}
|
|
|
|
|
2021-01-21 15:20:23 +08:00
|
|
|
// ---------------------------------------------------------- query node
|
|
|
|
func (p *ParamTable) initQueryNodeID() {
|
|
|
|
queryNodeID, err := p.Load("_queryNodeID")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
id, err := strconv.Atoi(queryNodeID)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.QueryNodeID = UniqueID(id)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *ParamTable) initQueryNodeNum() {
|
|
|
|
p.QueryNodeNum = len(p.QueryNodeIDList())
|
|
|
|
}
|
|
|
|
|
2021-01-21 10:01:29 +08:00
|
|
|
func (p *ParamTable) initQueryTimeTickChannelName() {
|
|
|
|
ch, err := p.Load("msgChannel.chanNamePrefix.queryTimeTick")
|
2021-01-21 15:20:23 +08:00
|
|
|
if err != nil {
|
2021-03-05 09:21:35 +08:00
|
|
|
log.Error(err.Error())
|
2021-01-21 15:20:23 +08:00
|
|
|
}
|
2021-01-21 10:01:29 +08:00
|
|
|
p.QueryTimeTickChannelName = ch
|
2021-01-21 15:20:23 +08:00
|
|
|
}
|
|
|
|
|
2021-01-21 10:01:29 +08:00
|
|
|
func (p *ParamTable) initQueryTimeTickReceiveBufSize() {
|
|
|
|
p.QueryTimeTickReceiveBufSize = p.ParseInt64("queryNode.msgStream.timeTick.recvBufSize")
|
2021-01-21 15:20:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------- minio
|
2020-12-24 20:55:40 +08:00
|
|
|
func (p *ParamTable) initMinioEndPoint() {
|
|
|
|
url, err := p.Load("_MinioAddress")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.MinioEndPoint = url
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *ParamTable) initMinioAccessKeyID() {
|
|
|
|
id, err := p.Load("minio.accessKeyID")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.MinioAccessKeyID = id
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *ParamTable) initMinioSecretAccessKey() {
|
|
|
|
key, err := p.Load("minio.secretAccessKey")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.MinioSecretAccessKey = key
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *ParamTable) initMinioUseSSLStr() {
|
|
|
|
ssl, err := p.Load("minio.useSSL")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
sslBoolean, err := strconv.ParseBool(ssl)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.MinioUseSSLStr = sslBoolean
|
2020-12-04 14:18:17 +08:00
|
|
|
}
|
|
|
|
|
2021-01-05 15:58:13 +08:00
|
|
|
func (p *ParamTable) initMinioBucketName() {
|
|
|
|
bucketName, err := p.Load("minio.bucketName")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.MinioBucketName = bucketName
|
|
|
|
}
|
|
|
|
|
2020-12-10 16:31:09 +08:00
|
|
|
func (p *ParamTable) initPulsarAddress() {
|
2020-12-07 15:22:20 +08:00
|
|
|
url, err := p.Load("_PulsarAddress")
|
2020-11-26 16:01:31 +08:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2020-12-10 16:31:09 +08:00
|
|
|
p.PulsarAddress = url
|
2020-12-05 16:12:45 +08:00
|
|
|
}
|
|
|
|
|
2020-12-10 16:31:09 +08:00
|
|
|
func (p *ParamTable) initInsertChannelRange() {
|
2020-12-07 14:37:42 +08:00
|
|
|
insertChannelRange, err := p.Load("msgChannel.channelRange.insert")
|
2020-12-05 17:39:58 +08:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2020-12-10 16:31:09 +08:00
|
|
|
p.InsertChannelRange = paramtable.ConvertRangeToIntRange(insertChannelRange, ",")
|
2020-11-26 16:01:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// advanced params
|
|
|
|
// stats
|
2020-12-10 16:31:09 +08:00
|
|
|
func (p *ParamTable) initStatsPublishInterval() {
|
|
|
|
p.StatsPublishInterval = p.ParseInt("queryNode.stats.publishInterval")
|
2020-11-26 16:01:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// dataSync:
|
2020-12-10 16:31:09 +08:00
|
|
|
func (p *ParamTable) initFlowGraphMaxQueueLength() {
|
|
|
|
p.FlowGraphMaxQueueLength = p.ParseInt32("queryNode.dataSync.flowGraph.maxQueueLength")
|
2020-11-26 16:01:31 +08:00
|
|
|
}
|
|
|
|
|
2020-12-10 16:31:09 +08:00
|
|
|
func (p *ParamTable) initFlowGraphMaxParallelism() {
|
|
|
|
p.FlowGraphMaxParallelism = p.ParseInt32("queryNode.dataSync.flowGraph.maxParallelism")
|
2020-11-26 16:01:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// msgStream
|
2020-12-10 16:31:09 +08:00
|
|
|
func (p *ParamTable) initInsertReceiveBufSize() {
|
|
|
|
p.InsertReceiveBufSize = p.ParseInt64("queryNode.msgStream.insert.recvBufSize")
|
2020-11-26 16:01:31 +08:00
|
|
|
}
|
|
|
|
|
2020-12-10 16:31:09 +08:00
|
|
|
func (p *ParamTable) initInsertPulsarBufSize() {
|
|
|
|
p.InsertPulsarBufSize = p.ParseInt64("queryNode.msgStream.insert.pulsarBufSize")
|
2020-11-26 16:01:31 +08:00
|
|
|
}
|
|
|
|
|
2020-12-10 16:31:09 +08:00
|
|
|
func (p *ParamTable) initDDReceiveBufSize() {
|
|
|
|
revBufSize, err := p.Load("queryNode.msgStream.dataDefinition.recvBufSize")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
bufSize, err := strconv.Atoi(revBufSize)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.DDReceiveBufSize = int64(bufSize)
|
2020-11-26 16:01:31 +08:00
|
|
|
}
|
|
|
|
|
2020-12-10 16:31:09 +08:00
|
|
|
func (p *ParamTable) initDDPulsarBufSize() {
|
|
|
|
pulsarBufSize, err := p.Load("queryNode.msgStream.dataDefinition.pulsarBufSize")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
bufSize, err := strconv.Atoi(pulsarBufSize)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.DDPulsarBufSize = int64(bufSize)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *ParamTable) initSearchReceiveBufSize() {
|
|
|
|
p.SearchReceiveBufSize = p.ParseInt64("queryNode.msgStream.search.recvBufSize")
|
2020-11-26 16:01:31 +08:00
|
|
|
}
|
|
|
|
|
2020-12-10 16:31:09 +08:00
|
|
|
func (p *ParamTable) initSearchPulsarBufSize() {
|
|
|
|
p.SearchPulsarBufSize = p.ParseInt64("queryNode.msgStream.search.pulsarBufSize")
|
2020-11-26 16:01:31 +08:00
|
|
|
}
|
|
|
|
|
2020-12-10 16:31:09 +08:00
|
|
|
func (p *ParamTable) initSearchResultReceiveBufSize() {
|
|
|
|
p.SearchResultReceiveBufSize = p.ParseInt64("queryNode.msgStream.searchResult.recvBufSize")
|
2020-11-26 16:01:31 +08:00
|
|
|
}
|
|
|
|
|
2020-12-10 16:31:09 +08:00
|
|
|
func (p *ParamTable) initStatsReceiveBufSize() {
|
|
|
|
p.StatsReceiveBufSize = p.ParseInt64("queryNode.msgStream.stats.recvBufSize")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *ParamTable) initETCDAddress() {
|
|
|
|
ETCDAddress, err := p.Load("_EtcdAddress")
|
2020-11-26 16:01:31 +08:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2020-12-10 16:31:09 +08:00
|
|
|
p.ETCDAddress = ETCDAddress
|
2020-11-26 16:01:31 +08:00
|
|
|
}
|
|
|
|
|
2020-12-10 16:31:09 +08:00
|
|
|
func (p *ParamTable) initMetaRootPath() {
|
2020-11-28 19:06:48 +08:00
|
|
|
rootPath, err := p.Load("etcd.rootPath")
|
2020-11-26 16:01:31 +08:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2020-11-28 19:06:48 +08:00
|
|
|
subPath, err := p.Load("etcd.metaSubPath")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2020-12-10 16:31:09 +08:00
|
|
|
p.MetaRootPath = rootPath + "/" + subPath
|
2020-11-26 16:01:31 +08:00
|
|
|
}
|
|
|
|
|
2020-12-10 16:31:09 +08:00
|
|
|
func (p *ParamTable) initGracefulTime() {
|
|
|
|
p.GracefulTime = p.ParseInt64("queryNode.gracefulTime")
|
2020-11-26 16:01:31 +08:00
|
|
|
}
|
|
|
|
|
2020-12-10 16:31:09 +08:00
|
|
|
func (p *ParamTable) initInsertChannelNames() {
|
2020-12-08 14:41:04 +08:00
|
|
|
|
|
|
|
prefix, err := p.Load("msgChannel.chanNamePrefix.insert")
|
2020-11-26 16:01:31 +08:00
|
|
|
if err != nil {
|
2021-03-05 09:21:35 +08:00
|
|
|
log.Error(err.Error())
|
2020-11-26 16:01:31 +08:00
|
|
|
}
|
2020-12-08 14:41:04 +08:00
|
|
|
prefix += "-"
|
2020-11-26 16:01:31 +08:00
|
|
|
channelRange, err := p.Load("msgChannel.channelRange.insert")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2020-12-08 14:41:04 +08:00
|
|
|
channelIDs := paramtable.ConvertRangeToIntSlice(channelRange, ",")
|
2020-11-26 16:01:31 +08:00
|
|
|
|
2020-12-08 14:41:04 +08:00
|
|
|
var ret []string
|
|
|
|
for _, ID := range channelIDs {
|
|
|
|
ret = append(ret, prefix+strconv.Itoa(ID))
|
2020-12-07 15:22:20 +08:00
|
|
|
}
|
2020-12-10 16:31:09 +08:00
|
|
|
sep := len(channelIDs) / p.QueryNodeNum
|
|
|
|
index := p.SliceIndex
|
2020-12-08 14:41:04 +08:00
|
|
|
if index == -1 {
|
|
|
|
panic("queryNodeID not Match with Config")
|
2020-12-07 15:22:20 +08:00
|
|
|
}
|
2020-12-08 14:41:04 +08:00
|
|
|
start := index * sep
|
2020-12-10 16:31:09 +08:00
|
|
|
p.InsertChannelNames = ret[start : start+sep]
|
2020-11-26 16:01:31 +08:00
|
|
|
}
|
|
|
|
|
2020-12-10 16:31:09 +08:00
|
|
|
func (p *ParamTable) initSearchChannelNames() {
|
2020-12-08 14:41:04 +08:00
|
|
|
prefix, err := p.Load("msgChannel.chanNamePrefix.search")
|
2020-11-26 16:01:31 +08:00
|
|
|
if err != nil {
|
2021-03-05 09:21:35 +08:00
|
|
|
log.Error(err.Error())
|
2020-11-26 16:01:31 +08:00
|
|
|
}
|
2020-12-08 14:41:04 +08:00
|
|
|
prefix += "-"
|
2020-11-26 16:01:31 +08:00
|
|
|
channelRange, err := p.Load("msgChannel.channelRange.search")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
2020-12-08 14:41:04 +08:00
|
|
|
channelIDs := paramtable.ConvertRangeToIntSlice(channelRange, ",")
|
2020-11-26 16:01:31 +08:00
|
|
|
|
2020-12-08 14:41:04 +08:00
|
|
|
var ret []string
|
|
|
|
for _, ID := range channelIDs {
|
|
|
|
ret = append(ret, prefix+strconv.Itoa(ID))
|
2020-11-26 16:01:31 +08:00
|
|
|
}
|
2020-12-10 16:31:09 +08:00
|
|
|
p.SearchChannelNames = ret
|
2020-11-26 16:01:31 +08:00
|
|
|
}
|
|
|
|
|
2020-12-10 16:31:09 +08:00
|
|
|
func (p *ParamTable) initSearchResultChannelNames() {
|
2020-12-08 14:41:04 +08:00
|
|
|
prefix, err := p.Load("msgChannel.chanNamePrefix.searchResult")
|
2020-11-26 16:01:31 +08:00
|
|
|
if err != nil {
|
2021-03-05 09:21:35 +08:00
|
|
|
log.Error(err.Error())
|
2020-11-26 16:01:31 +08:00
|
|
|
}
|
2020-12-08 14:41:04 +08:00
|
|
|
prefix += "-"
|
2020-11-26 16:01:31 +08:00
|
|
|
channelRange, err := p.Load("msgChannel.channelRange.searchResult")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
2020-12-08 14:41:04 +08:00
|
|
|
channelIDs := paramtable.ConvertRangeToIntSlice(channelRange, ",")
|
2020-11-26 16:01:31 +08:00
|
|
|
|
2020-12-08 14:41:04 +08:00
|
|
|
var ret []string
|
|
|
|
for _, ID := range channelIDs {
|
|
|
|
ret = append(ret, prefix+strconv.Itoa(ID))
|
2020-11-26 16:01:31 +08:00
|
|
|
}
|
2020-12-10 16:31:09 +08:00
|
|
|
p.SearchResultChannelNames = ret
|
2020-11-26 16:01:31 +08:00
|
|
|
}
|
|
|
|
|
2020-12-10 16:31:09 +08:00
|
|
|
func (p *ParamTable) initMsgChannelSubName() {
|
2020-11-26 16:01:31 +08:00
|
|
|
// TODO: subName = namePrefix + "-" + queryNodeID, queryNodeID is assigned by master
|
|
|
|
name, err := p.Load("msgChannel.subNamePrefix.queryNodeSubNamePrefix")
|
|
|
|
if err != nil {
|
2021-03-05 09:21:35 +08:00
|
|
|
log.Error(err.Error())
|
2020-11-26 16:01:31 +08:00
|
|
|
}
|
2020-12-08 14:41:04 +08:00
|
|
|
queryNodeIDStr, err := p.Load("_QueryNodeID")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2020-12-10 16:31:09 +08:00
|
|
|
p.MsgChannelSubName = name + "-" + queryNodeIDStr
|
2020-11-26 16:01:31 +08:00
|
|
|
}
|
|
|
|
|
2020-12-10 16:31:09 +08:00
|
|
|
func (p *ParamTable) initStatsChannelName() {
|
2020-11-26 16:01:31 +08:00
|
|
|
channels, err := p.Load("msgChannel.chanNamePrefix.queryNodeStats")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2020-12-10 16:31:09 +08:00
|
|
|
p.StatsChannelName = channels
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *ParamTable) initDDChannelNames() {
|
|
|
|
prefix, err := p.Load("msgChannel.chanNamePrefix.dataDefinition")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2021-02-06 15:16:10 +08:00
|
|
|
//prefix += "-"
|
|
|
|
//iRangeStr, err := p.Load("msgChannel.channelRange.dataDefinition")
|
|
|
|
//if err != nil {
|
|
|
|
// panic(err)
|
|
|
|
//}
|
|
|
|
//channelIDs := paramtable.ConvertRangeToIntSlice(iRangeStr, ",")
|
|
|
|
//var ret []string
|
|
|
|
//for _, ID := range channelIDs {
|
|
|
|
// ret = append(ret, prefix+strconv.Itoa(ID))
|
|
|
|
//}
|
|
|
|
p.DDChannelNames = []string{prefix}
|
2020-12-10 16:31:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (p *ParamTable) initSliceIndex() {
|
|
|
|
queryNodeID := p.QueryNodeID
|
2020-12-08 14:41:04 +08:00
|
|
|
queryNodeIDList := p.QueryNodeIDList()
|
|
|
|
for i := 0; i < len(queryNodeIDList); i++ {
|
|
|
|
if queryNodeID == queryNodeIDList[i] {
|
2020-12-10 16:31:09 +08:00
|
|
|
p.SliceIndex = i
|
|
|
|
return
|
2020-12-08 14:41:04 +08:00
|
|
|
}
|
|
|
|
}
|
2020-12-10 16:31:09 +08:00
|
|
|
p.SliceIndex = -1
|
2020-12-08 14:41:04 +08:00
|
|
|
}
|
2021-03-05 09:21:35 +08:00
|
|
|
|
|
|
|
func (p *ParamTable) initLogCfg() {
|
|
|
|
p.Log = log.Config{}
|
|
|
|
format, err := p.Load("log.format")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.Log.Format = format
|
|
|
|
level, err := p.Load("log.level")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.Log.Level = level
|
|
|
|
devStr, err := p.Load("log.dev")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
dev, err := strconv.ParseBool(devStr)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
p.Log.Development = dev
|
|
|
|
p.Log.File.MaxSize = p.ParseInt("log.file.maxSize")
|
|
|
|
p.Log.File.MaxBackups = p.ParseInt("log.file.maxBackups")
|
|
|
|
p.Log.File.MaxDays = p.ParseInt("log.file.maxAge")
|
|
|
|
rootPath, err := p.Load("log.file.rootPath")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2021-03-08 16:24:55 +08:00
|
|
|
if len(rootPath) != 0 {
|
|
|
|
p.Log.File.Filename = path.Join(rootPath, fmt.Sprintf("querynode-%d.log", p.QueryNodeID))
|
|
|
|
} else {
|
|
|
|
p.Log.File.Filename = ""
|
|
|
|
}
|
2021-03-05 09:21:35 +08:00
|
|
|
}
|