Compare commits

...

1 Commits

Author SHA1 Message Date
7711a206ab Fix panic in TUI backup manager verify when logger is nil
All checks were successful
CI/CD / Test (push) Successful in 1m17s
CI/CD / Lint (push) Successful in 1m25s
CI/CD / Build & Release (push) Successful in 3m15s
- Add nil checks before logger calls in diagnose.go (8 places)
- Add nil checks before logger calls in safety.go (2 places)
- Fixes crash when pressing 'v' to verify backup in interactive menu
2026-01-14 17:18:37 +01:00
3 changed files with 35 additions and 19 deletions

View File

@@ -4,8 +4,8 @@ This directory contains pre-compiled binaries for the DB Backup Tool across mult
## Build Information ## Build Information
- **Version**: 3.42.34 - **Version**: 3.42.34
- **Build Time**: 2026-01-14_15:59:44_UTC - **Build Time**: 2026-01-14_16:06:08_UTC
- **Git Commit**: ec5e89e - **Git Commit**: ba6e8a2
## Recent Updates (v1.1.0) ## Recent Updates (v1.1.0)
- ✅ Fixed TUI progress display with line-by-line output - ✅ Fixed TUI progress display with line-by-line output

View File

@@ -368,7 +368,7 @@ func (d *Diagnoser) diagnoseSQLScript(filePath string, compressed bool, result *
} }
// Store last line for termination check // Store last line for termination check
if lineNumber > 0 && (lineNumber%100000 == 0) && d.verbose { if lineNumber > 0 && (lineNumber%100000 == 0) && d.verbose && d.log != nil {
d.log.Debug("Scanning SQL file", "lines_processed", lineNumber) d.log.Debug("Scanning SQL file", "lines_processed", lineNumber)
} }
} }
@@ -430,9 +430,11 @@ func (d *Diagnoser) diagnoseClusterArchive(filePath string, result *DiagnoseResu
} }
} }
d.log.Info("Verifying cluster archive integrity", if d.log != nil {
"size", fmt.Sprintf("%.1f GB", float64(result.FileSize)/(1024*1024*1024)), d.log.Info("Verifying cluster archive integrity",
"timeout", fmt.Sprintf("%d min", timeoutMinutes)) "size", fmt.Sprintf("%.1f GB", float64(result.FileSize)/(1024*1024*1024)),
"timeout", fmt.Sprintf("%d min", timeoutMinutes))
}
ctx, cancel := context.WithTimeout(context.Background(), time.Duration(timeoutMinutes)*time.Minute) ctx, cancel := context.WithTimeout(context.Background(), time.Duration(timeoutMinutes)*time.Minute)
defer cancel() defer cancel()
@@ -561,7 +563,7 @@ func (d *Diagnoser) diagnoseClusterArchive(filePath string, result *DiagnoseResu
} }
// For verbose mode, diagnose individual dumps inside the archive // For verbose mode, diagnose individual dumps inside the archive
if d.verbose && len(dumpFiles) > 0 { if d.verbose && len(dumpFiles) > 0 && d.log != nil {
d.log.Info("Cluster archive contains databases", "count", len(dumpFiles)) d.log.Info("Cluster archive contains databases", "count", len(dumpFiles))
for _, df := range dumpFiles { for _, df := range dumpFiles {
d.log.Info(" - " + df) d.log.Info(" - " + df)
@@ -684,9 +686,11 @@ func (d *Diagnoser) DiagnoseClusterDumps(archivePath, tempDir string) ([]*Diagno
} }
} }
d.log.Info("Listing cluster archive contents", if d.log != nil {
"size", fmt.Sprintf("%.1f GB", float64(archiveInfo.Size())/(1024*1024*1024)), d.log.Info("Listing cluster archive contents",
"timeout", fmt.Sprintf("%d min", timeoutMinutes)) "size", fmt.Sprintf("%.1f GB", float64(archiveInfo.Size())/(1024*1024*1024)),
"timeout", fmt.Sprintf("%d min", timeoutMinutes))
}
listCtx, listCancel := context.WithTimeout(context.Background(), time.Duration(timeoutMinutes)*time.Minute) listCtx, listCancel := context.WithTimeout(context.Background(), time.Duration(timeoutMinutes)*time.Minute)
defer listCancel() defer listCancel()
@@ -766,7 +770,9 @@ func (d *Diagnoser) DiagnoseClusterDumps(archivePath, tempDir string) ([]*Diagno
return []*DiagnoseResult{errResult}, nil return []*DiagnoseResult{errResult}, nil
} }
d.log.Debug("Archive listing streamed successfully", "total_files", fileCount, "relevant_files", len(files)) if d.log != nil {
d.log.Debug("Archive listing streamed successfully", "total_files", fileCount, "relevant_files", len(files))
}
// Check if we have enough disk space (estimate 4x archive size needed) // Check if we have enough disk space (estimate 4x archive size needed)
// archiveInfo already obtained at function start // archiveInfo already obtained at function start
@@ -781,7 +787,9 @@ func (d *Diagnoser) DiagnoseClusterDumps(archivePath, tempDir string) ([]*Diagno
testCancel() testCancel()
} }
d.log.Info("Archive listing successful", "files", len(files)) if d.log != nil {
d.log.Info("Archive listing successful", "files", len(files))
}
// Try full extraction - NO TIMEOUT here as large archives can take a long time // Try full extraction - NO TIMEOUT here as large archives can take a long time
// Use a generous timeout (30 minutes) for very large archives // Use a generous timeout (30 minutes) for very large archives
@@ -870,11 +878,15 @@ func (d *Diagnoser) DiagnoseClusterDumps(archivePath, tempDir string) ([]*Diagno
} }
dumpPath := filepath.Join(dumpsDir, name) dumpPath := filepath.Join(dumpsDir, name)
d.log.Info("Diagnosing dump file", "file", name) if d.log != nil {
d.log.Info("Diagnosing dump file", "file", name)
}
result, err := d.DiagnoseFile(dumpPath) result, err := d.DiagnoseFile(dumpPath)
if err != nil { if err != nil {
d.log.Warn("Failed to diagnose file", "file", name, "error", err) if d.log != nil {
d.log.Warn("Failed to diagnose file", "file", name, "error", err)
}
continue continue
} }
results = append(results, result) results = append(results, result)

View File

@@ -255,7 +255,9 @@ func (s *Safety) CheckDiskSpaceAt(archivePath string, checkDir string, multiplie
// Get available disk space // Get available disk space
availableSpace, err := getDiskSpace(checkDir) availableSpace, err := getDiskSpace(checkDir)
if err != nil { if err != nil {
s.log.Warn("Cannot check disk space", "error", err) if s.log != nil {
s.log.Warn("Cannot check disk space", "error", err)
}
return nil // Don't fail if we can't check return nil // Don't fail if we can't check
} }
@@ -278,10 +280,12 @@ func (s *Safety) CheckDiskSpaceAt(archivePath string, checkDir string, multiplie
checkDir) checkDir)
} }
s.log.Info("Disk space check passed", if s.log != nil {
"location", checkDir, s.log.Info("Disk space check passed",
"required", FormatBytes(requiredSpace), "location", checkDir,
"available", FormatBytes(availableSpace)) "required", FormatBytes(requiredSpace),
"available", FormatBytes(availableSpace))
}
return nil return nil
} }