PLT-6079 Adding leader election (#7105)
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
0ab490845a
Коммит
29a7e182a6
@@ -49,7 +49,7 @@ const (
|
|||||||
var client *analytics.Client
|
var client *analytics.Client
|
||||||
|
|
||||||
func SendDailyDiagnostics() {
|
func SendDailyDiagnostics() {
|
||||||
if *utils.Cfg.LogSettings.EnableDiagnostics {
|
if *utils.Cfg.LogSettings.EnableDiagnostics && utils.IsLeader() {
|
||||||
initDiagnostics("")
|
initDiagnostics("")
|
||||||
trackActivity()
|
trackActivity()
|
||||||
trackConfig()
|
trackConfig()
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ type ClusterInterface interface {
|
|||||||
StopInterNodeCommunication()
|
StopInterNodeCommunication()
|
||||||
RegisterClusterMessageHandler(event string, crm ClusterMessageHandler)
|
RegisterClusterMessageHandler(event string, crm ClusterMessageHandler)
|
||||||
GetClusterId() string
|
GetClusterId() string
|
||||||
|
IsLeader() bool
|
||||||
GetClusterInfos() []*model.ClusterInfo
|
GetClusterInfos() []*model.ClusterInfo
|
||||||
SendClusterMessage(cluster *model.ClusterMessage)
|
SendClusterMessage(cluster *model.ClusterMessage)
|
||||||
NotifyMsg(buf []byte)
|
NotifyMsg(buf []byte)
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type ClusterInfo struct {
|
type ClusterInfo struct {
|
||||||
|
Id string `json:"id"`
|
||||||
Version string `json:"version"`
|
Version string `json:"version"`
|
||||||
ConfigHash string `json:"config_hash"`
|
ConfigHash string `json:"config_hash"`
|
||||||
IpAddress string `json:"ipaddress"`
|
IpAddress string `json:"ipaddress"`
|
||||||
|
|||||||
@@ -653,3 +653,11 @@ func Desanitize(cfg *model.Config) {
|
|||||||
cfg.SqlSettings.DataSourceSearchReplicas[i] = Cfg.SqlSettings.DataSourceSearchReplicas[i]
|
cfg.SqlSettings.DataSourceSearchReplicas[i] = Cfg.SqlSettings.DataSourceSearchReplicas[i]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func IsLeader() bool {
|
||||||
|
if IsLicensed && *Cfg.ClusterSettings.Enable && einterfaces.GetClusterInterface() != nil {
|
||||||
|
return einterfaces.GetClusterInterface().IsLeader()
|
||||||
|
} else {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user