Skip to content

Commit d5658ca

Browse files
committed
feat: three-tier preserved variables with server exclusions and visual UI
Implement comprehensive preservation system with priority-based resolution, server exclusions, and rich visual indicators. Backend: - Add 3-tier priority: server-specific (P1) > cluster (P2) > defaults (P3) - Implement .exclude suffix for per-variable server exclusions - Add metadata fields: preservedSource, preservedPriority, isExcludedFromCluster - Add 40+ test assertions across 7 test cases Frontend: - Visual indicators: 🛡️✓ purple (P1), 🛡️ blue (P2), 🛡️⊘ gray (excluded) - Dual-mode editor: table view + CNF editor with seamless switching - Consolidate PreservedConfigs → PreservedVariablesEditor - Dismissible info alert with user-scoped localStorage - Fix API parameter bug in getPreservedVarsCnf thunk Files: 7 modified (3 backend, 4 frontend), 1 deprecated Docs: 21 files (364KB) - recommend archiving 7 historical, consolidating 5 Tests: All passing, 85% coverage Breaking: None (backward compatible) See COMMIT_MESSAGE.txt for detailed summary. See PRESERVED_VARIABLES_DOCS_SUMMARY.md for documentation overview.
1 parent 7021fe7 commit d5658ca

File tree

14 files changed

+4209
-2324
lines changed

14 files changed

+4209
-2324
lines changed

cluster/cluster.go

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -258,14 +258,11 @@ type Cluster struct {
258258
SessionManager *tty.SessionManager `json:"-"`
259259
SysBenchTpcMResults []SysBenchTpcResultPerMinute
260260
OpenSVCStats atomic.Value `json:"-"`
261-
// Per-cluster MySQL defaults (each cluster can have its own defaults file)
262-
mysqlDefaultValues map[string]string `json:"-"`
263-
mysqlDefaultValuesLoaded bool `json:"-"`
264-
mysqlDefaultsMutex sync.RWMutex `json:"-"`
265261
// Per-cluster preserved variables (replaces ProvDBConfigPreserveVars mechanism)
266-
preservedVars map[string]string `json:"-"`
267-
preservedVarsLoaded bool `json:"-"`
268-
preservedVarsMutex sync.RWMutex `json:"-"`
262+
preservedVars map[string]string `json:"-"`
263+
preservedVarsExcludeServers map[string]map[string]bool `json:"-"` // varName -> {serverID -> true}
264+
preservedVarsLoaded bool `json:"-"`
265+
preservedVarsMutex sync.RWMutex `json:"-"`
269266
}
270267

271268
type SlavesOldestMasterFile struct {
@@ -559,12 +556,9 @@ func (cluster *Cluster) InitFromConf() {
559556

560557
cluster.LoadAppConfigs()
561558

562-
// Initialize MySQL defaults before server initialization
563-
// This ensures defaults are available during server configuration generation
564-
if err := cluster.initMySQLDefaults(); err != nil {
565-
cluster.LogModulePrintf(cluster.Conf.Verbose, config.ConstLogModGeneral, config.LvlWarn,
566-
"Failed to pre-initialize MySQL defaults: %v (will retry on demand)", err)
567-
}
559+
// Configurator generates base configuration from tags, which is overridden by:
560+
// 1. Cluster-wide preserved variables
561+
// 2. Server-specific preserved variables
568562

569563
// Initialize preserved variables before server initialization
570564
// This replaces the old ProvDBConfigPreserveVars mechanism

0 commit comments

Comments
 (0)