From 6a9303147c020925bc4be84b043fd652e15cab54 Mon Sep 17 00:00:00 2001 From: "Eduardo J. Ortega U." <5791035+ejortegau@users.noreply.github.com> Date: Mon, 2 Dec 2024 10:20:32 +0100 Subject: [PATCH] Fix SIGSEV in test Signed-off-by: Eduardo J. Ortega U. <5791035+ejortegau@users.noreply.github.com> --- go/vt/vtctl/reparentutil/replication.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/go/vt/vtctl/reparentutil/replication.go b/go/vt/vtctl/reparentutil/replication.go index ea6dcd24808..17dbaeae015 100644 --- a/go/vt/vtctl/reparentutil/replication.go +++ b/go/vt/vtctl/reparentutil/replication.go @@ -239,8 +239,18 @@ func stopReplicationAndBuildStatusMaps( err = vterrors.Wrapf(err, "error when getting replication status for alias %v: %v", alias, err) } } else { + isTakingBackup := false + + // Prefer the most up-to-date information regarding whether the tablet is taking a backup from the After + // replication status, but fall back to the Before status if After is nil. + if stopReplicationStatus.After != nil { + isTakingBackup = stopReplicationStatus.After.BackupRunning + } else if stopReplicationStatus.Before != nil { + isTakingBackup = stopReplicationStatus.Before.BackupRunning + } + m.Lock() - res.tabletsBackupState[alias] = stopReplicationStatus.After.BackupRunning + res.tabletsBackupState[alias] = isTakingBackup m.Unlock() var sqlThreadRunning bool