Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,11 @@ type Cluster struct {
SessionManager *tty.SessionManager `json:"-"`
SysBenchTpcMResults []SysBenchTpcResultPerMinute
OpenSVCStats atomic.Value `json:"-"`
// Per-cluster preserved variables (replaces ProvDBConfigPreserveVars mechanism)
preservedVars map[string]string `json:"-"`
preservedVarsExcludeServers map[string]map[string]bool `json:"-"` // varName -> {serverID -> true}
preservedVarsLoaded bool `json:"-"`
preservedVarsMutex sync.RWMutex `json:"-"`
}

type SlavesOldestMasterFile struct {
Expand Down Expand Up @@ -551,6 +556,17 @@ func (cluster *Cluster) InitFromConf() {

cluster.LoadAppConfigs()

// Configurator generates base configuration from tags, which is overridden by:
// 1. Cluster-wide preserved variables
// 2. Server-specific preserved variables

// Initialize preserved variables before server initialization
// This replaces the old ProvDBConfigPreserveVars mechanism
if err := cluster.initPreservedVars(); err != nil {
cluster.LogModulePrintf(cluster.Conf.Verbose, config.ConstLogModGeneral, config.LvlWarn,
"Failed to pre-initialize preserved variables: %v (will retry on demand)", err)
}

err = cluster.newServerList()
if err != nil {
cluster.LogModulePrintf(cluster.Conf.Verbose, config.ConstLogModGeneral, config.LvlErr, "Could not set server list %s", err)
Expand Down
12 changes: 12 additions & 0 deletions cluster/cluster_acl.go
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,18 @@ func (cluster *Cluster) IsURLPassACL(strUser string, URL string, errorPrint bool
}
}
if cluster.APIUsers[strUser].Grants[config.GrantClusterSettings] {
if strings.Contains(URL, "/api/clusters/"+cluster.Name+"/settings/mysql-defaults-cnf") {
return true
}
if strings.Contains(URL, "/api/clusters/"+cluster.Name+"/settings/actions/save-mysql-defaults-cnf") {
return true
}
if strings.Contains(URL, "/api/clusters/"+cluster.Name+"/settings/preserved-variables-cnf") {
return true
}
if strings.Contains(URL, "/api/clusters/"+cluster.Name+"/settings/actions/save-preserved-variables-cnf") {
return true
}
if strings.Contains(URL, "/api/clusters/"+cluster.Name+"/settings/actions/reload") {
return true
}
Expand Down
Loading