PLT-6079 Adding leader election (#7105)
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
0ab490845a
Коммит
29a7e182a6
@@ -49,7 +49,7 @@ const (
|
||||
var client *analytics.Client
|
||||
|
||||
func SendDailyDiagnostics() {
|
||||
if *utils.Cfg.LogSettings.EnableDiagnostics {
|
||||
if *utils.Cfg.LogSettings.EnableDiagnostics && utils.IsLeader() {
|
||||
initDiagnostics("")
|
||||
trackActivity()
|
||||
trackConfig()
|
||||
|
||||
@@ -14,6 +14,7 @@ type ClusterInterface interface {
|
||||
StopInterNodeCommunication()
|
||||
RegisterClusterMessageHandler(event string, crm ClusterMessageHandler)
|
||||
GetClusterId() string
|
||||
IsLeader() bool
|
||||
GetClusterInfos() []*model.ClusterInfo
|
||||
SendClusterMessage(cluster *model.ClusterMessage)
|
||||
NotifyMsg(buf []byte)
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
)
|
||||
|
||||
type ClusterInfo struct {
|
||||
Id string `json:"id"`
|
||||
Version string `json:"version"`
|
||||
ConfigHash string `json:"config_hash"`
|
||||
IpAddress string `json:"ipaddress"`
|
||||
|
||||
@@ -653,3 +653,11 @@ func Desanitize(cfg *model.Config) {
|
||||
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