From 35232de80d19e3692b4ae375d2b20a8ecb3a8216 Mon Sep 17 00:00:00 2001 From: kisfenyo Date: Sun, 25 Oct 2026 16:43:57 +0100 Subject: [PATCH] Fix A: the stable-start sampler says at DEBUG why a sample is not ok (a live run on 9202 judged a healthy app unstable; the reason was not logged). Commit only. --- controller/internal/backup/restore_verdict.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/controller/internal/backup/restore_verdict.go b/controller/internal/backup/restore_verdict.go index 6486b7a0..88b52af6 100644 --- a/controller/internal/backup/restore_verdict.go +++ b/controller/internal/backup/restore_verdict.go @@ -144,6 +144,7 @@ const ( // stableSample is one look: ok, and the fingerprint (container id → restart count) a stable window must keep. func (m *Manager) stableSample(stack string) (bool, map[string]int) { if m.stackProvider == nil || !m.stackProvider.RefreshAndIsRunning(stack) { + m.debugStable(stack, "the stack does not read running") return false, nil } cs, ok := m.stackProvider.(containerSampler) @@ -152,11 +153,13 @@ func (m *Manager) stableSample(stack string) (bool, map[string]int) { } samples, err := cs.ContainerSamples(stack) if err != nil || len(samples) == 0 { + m.debugStable(stack, fmt.Sprintf("no container sample (%d, err %v)", len(samples), err)) return false, nil } fp := make(map[string]int, len(samples)) for _, c := range samples { if !c.Running || (c.Health != "" && c.Health != "healthy") { + m.debugStable(stack, fmt.Sprintf("container %.12s running=%v health=%q", c.ID, c.Running, c.Health)) return false, nil } fp[c.ID] = c.RestartCount @@ -164,6 +167,12 @@ func (m *Manager) stableSample(stack string) (bool, map[string]int) { return true, fp } +func (m *Manager) debugStable(stack, why string) { + if m.logger != nil && m.isDebug() { + m.logger.Printf("[DEBUG] [backup] stable-start sample %s: not ok — %s", stack, why) + } +} + func sameRestartFingerprint(a, b map[string]int) bool { if len(a) != len(b) { return false