From ea4337e298278f12f74dd790a7c9fec68717ef93 Mon Sep 17 00:00:00 2001 From: Alexander Renz Date: Sun, 18 Jan 2026 12:04:11 +0100 Subject: [PATCH] fix(config): use resource profile defaults for Jobs, DumpJobs, ClusterParallelism - ClusterParallelism now defaults to recommended profile (1 for small VMs) - Jobs and DumpJobs now use profile values instead of raw CPU counts - Small VMs (4 cores, 32GB) will now get 'conservative' or 'balanced' profile with lower parallelism to avoid 'out of shared memory' errors This fixes the issue where small VMs defaulted to ClusterParallelism=2 regardless of detected resources, causing restore failures on large DBs. --- bin/README.md | 4 ++-- internal/config/config.go | 10 +++++----- internal/tui/restore_exec.go | 4 ++-- internal/tui/settings.go | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/bin/README.md b/bin/README.md index 095563f..e9ca1cf 100644 --- a/bin/README.md +++ b/bin/README.md @@ -4,8 +4,8 @@ This directory contains pre-compiled binaries for the DB Backup Tool across mult ## Build Information - **Version**: 3.42.50 -- **Build Time**: 2026-01-18_10:38:39_UTC -- **Git Commit**: 670c9af +- **Build Time**: 2026-01-18_10:48:22_UTC +- **Git Commit**: f6f8b04 ## Recent Updates (v1.1.0) - ✅ Fixed TUI progress display with line-by-line output diff --git a/internal/config/config.go b/internal/config/config.go index b533fb4..b8e4bf8 100755 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -200,11 +200,11 @@ func New() *Config { SSLMode: sslMode, Insecure: getEnvBool("INSECURE", false), - // Backup defaults + // Backup defaults - use recommended profile's settings for small VMs BackupDir: backupDir, CompressionLevel: getEnvInt("COMPRESS_LEVEL", 6), - Jobs: getEnvInt("JOBS", getDefaultJobs(cpuInfo)), - DumpJobs: getEnvInt("DUMP_JOBS", getDefaultDumpJobs(cpuInfo)), + Jobs: getEnvInt("JOBS", recommendedProfile.Jobs), + DumpJobs: getEnvInt("DUMP_JOBS", recommendedProfile.DumpJobs), MaxCores: getEnvInt("MAX_CORES", getDefaultMaxCores(cpuInfo)), AutoDetectCores: getEnvBool("AUTO_DETECT_CORES", true), CPUWorkloadType: getEnvString("CPU_WORKLOAD_TYPE", "balanced"), @@ -233,8 +233,8 @@ func New() *Config { // Timeouts - default 24 hours (1440 min) to handle very large databases with large objects ClusterTimeoutMinutes: getEnvInt("CLUSTER_TIMEOUT_MIN", 1440), - // Cluster parallelism (default: 2 concurrent operations for faster cluster backup/restore) - ClusterParallelism: getEnvInt("CLUSTER_PARALLELISM", 2), + // Cluster parallelism - use recommended profile's setting for small VMs + ClusterParallelism: getEnvInt("CLUSTER_PARALLELISM", recommendedProfile.ClusterParallelism), // Working directory for large operations (default: system temp) WorkDir: getEnvString("WORK_DIR", ""), diff --git a/internal/tui/restore_exec.go b/internal/tui/restore_exec.go index e8b6402..c87d939 100755 --- a/internal/tui/restore_exec.go +++ b/internal/tui/restore_exec.go @@ -662,7 +662,7 @@ func (m RestoreExecutionModel) View() string { // Parse and display error in a clean, structured format errStr := m.err.Error() - + // Extract key parts from the error message errDisplay := formatRestoreError(errStr) s.WriteString(errDisplay) @@ -1030,7 +1030,7 @@ func formatRestoreError(errStr string) string { // First, try to extract a clean error summary errLines := strings.Split(errStr, "\n") - + // Find the main error message (first line or first ERROR:) mainError := "" hint := "" diff --git a/internal/tui/settings.go b/internal/tui/settings.go index 9b1ed3d..c44b905 100755 --- a/internal/tui/settings.go +++ b/internal/tui/settings.go @@ -870,7 +870,7 @@ func (m SettingsModel) View() string { fmt.Sprintf("Database: %s@%s:%d", m.config.User, m.config.Host, m.config.Port), fmt.Sprintf("Backup Dir: %s", m.config.BackupDir), fmt.Sprintf("Compression: Level %d", m.config.CompressionLevel), - fmt.Sprintf("Profile: %s | Cluster: %d parallel | Jobs: %d", + fmt.Sprintf("Profile: %s | Cluster: %d parallel | Jobs: %d", m.config.ResourceProfile, m.config.ClusterParallelism, m.config.Jobs), }