diff --git a/bin/README.md b/bin/README.md index 1869d8d..744ffd1 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-16_15:09:21_UTC -- **Git Commit**: dd7c4da +- **Build Time**: 2026-01-16_17:31:38_UTC +- **Git Commit**: 698b8a7 ## Recent Updates (v1.1.0) - ✅ Fixed TUI progress display with line-by-line output diff --git a/internal/restore/engine.go b/internal/restore/engine.go index e956010..45442d2 100755 --- a/internal/restore/engine.go +++ b/internal/restore/engine.go @@ -910,6 +910,16 @@ func (e *Engine) RestoreCluster(ctx context.Context, archivePath string) error { return fmt.Errorf("failed to extract archive: %w", err) } + // Check context validity after extraction (debugging context cancellation issues) + if ctx.Err() != nil { + e.log.Error("Context cancelled after extraction - this should not happen", + "context_error", ctx.Err(), + "extraction_completed", true) + operation.Fail("Context cancelled unexpectedly") + return fmt.Errorf("context cancelled after extraction completed: %w", ctx.Err()) + } + e.log.Info("Extraction completed, context still valid") + // Check if user has superuser privileges (required for ownership restoration) e.progress.Update("Checking privileges...") isSuperuser, err := e.checkSuperuser(ctx) @@ -1108,6 +1118,18 @@ func (e *Engine) RestoreCluster(ctx context.Context, archivePath string) error { var successCount, failCount int32 var mu sync.Mutex // Protect shared resources (progress, logger) + // CRITICAL: Check context before starting database restore loop + // This helps debug issues where context gets cancelled between extraction and restore + if ctx.Err() != nil { + e.log.Error("Context cancelled before database restore loop started", + "context_error", ctx.Err(), + "total_databases", totalDBs, + "parallelism", parallelism) + operation.Fail("Context cancelled before database restores could start") + return fmt.Errorf("context cancelled before database restore: %w", ctx.Err()) + } + e.log.Info("Starting database restore loop", "databases", totalDBs, "parallelism", parallelism) + // Timing tracking for restore phase progress restorePhaseStart := time.Now() var completedDBTimes []time.Duration // Track duration for each completed DB restore