From 60dfd766a7c5100da4af0713458c20963d08a341 Mon Sep 17 00:00:00 2001 From: Jack Lin Date: Thu, 5 Sep 2024 16:14:03 +0800 Subject: [PATCH] fix: skip updating backup status when it is completed or failed ref: longhorn/longhonr 9168 Signed-off-by: Jack Lin --- go.mod | 2 +- go.sum | 4 ++-- .../longhorn/longhorn-engine/pkg/replica/backup.go | 5 +++++ vendor/modules.txt | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 604c07aa4..4f3b8d0b1 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/longhorn/backupstore v0.0.0-20240827054225-fe89e488b75f github.com/longhorn/go-common-libs v0.0.0-20240821134112-907f57efd48f github.com/longhorn/go-spdk-helper v0.0.0-20240902084253-ba8761258885 - github.com/longhorn/longhorn-engine v1.8.0-dev-20240825.0.20240831055950-b629ebaafa55 + github.com/longhorn/longhorn-engine v1.8.0-dev-20240825.0.20240905075622-ecfa3c2bc26f github.com/longhorn/longhorn-spdk-engine v0.0.0-20240903022243-ca0b8f4dae1f github.com/longhorn/types v0.0.0-20240827042720-af8f10eb57cd github.com/pkg/errors v0.9.1 diff --git a/go.sum b/go.sum index 607187c6a..393ed75b7 100644 --- a/go.sum +++ b/go.sum @@ -113,8 +113,8 @@ github.com/longhorn/go-iscsi-helper v0.0.0-20240811043302-df8de353dd58 h1:fzLAnC github.com/longhorn/go-iscsi-helper v0.0.0-20240811043302-df8de353dd58/go.mod h1:TobRDCXmF0Ni+jz6+nLJamw3uVu+gNDZoZre1JczGwc= github.com/longhorn/go-spdk-helper v0.0.0-20240902084253-ba8761258885 h1:T0IQ9TIVDBm3IYy7ufvxBclxVa4q4c69HgjP0/OlnhY= github.com/longhorn/go-spdk-helper v0.0.0-20240902084253-ba8761258885/go.mod h1:hoJmEzRBENFMEPqdX7jiEyjWMYMXNDxEXrHfAE99qVg= -github.com/longhorn/longhorn-engine v1.8.0-dev-20240825.0.20240831055950-b629ebaafa55 h1:BJb3yRM/iCkwaHF8MrIqMCgXkEkiprshivAXBN36NlI= -github.com/longhorn/longhorn-engine v1.8.0-dev-20240825.0.20240831055950-b629ebaafa55/go.mod h1:WxnRZefYEMqrTn4H189DTqIPeKEAknNlmQjoAOk9K38= +github.com/longhorn/longhorn-engine v1.8.0-dev-20240825.0.20240905075622-ecfa3c2bc26f h1:d6UjaruyQFXMoCPYmcf9SfP1svCokONAHblpjJ6XXcc= +github.com/longhorn/longhorn-engine v1.8.0-dev-20240825.0.20240905075622-ecfa3c2bc26f/go.mod h1:WxnRZefYEMqrTn4H189DTqIPeKEAknNlmQjoAOk9K38= github.com/longhorn/longhorn-spdk-engine v0.0.0-20240903022243-ca0b8f4dae1f h1:nLZMHdwzwkWeLVXPEw8/JfAaC4ytkgCphnPHNWd/byo= github.com/longhorn/longhorn-spdk-engine v0.0.0-20240903022243-ca0b8f4dae1f/go.mod h1:ZJSMYDAwnL2YXDbc9waUi7TY1iAWOy4b8m0edjQM+U0= github.com/longhorn/sparse-tools v0.0.0-20240729132735-18b207e459ff h1:gmdQDbnaGJ/zmrK+QJzSys8mH679os6i7vW/pOpRn1U= diff --git a/vendor/github.com/longhorn/longhorn-engine/pkg/replica/backup.go b/vendor/github.com/longhorn/longhorn-engine/pkg/replica/backup.go index 520d92681..df39c548a 100644 --- a/vendor/github.com/longhorn/longhorn-engine/pkg/replica/backup.go +++ b/vendor/github.com/longhorn/longhorn-engine/pkg/replica/backup.go @@ -57,6 +57,11 @@ func (rb *BackupStatus) UpdateBackupStatus(snapID, volumeID string, state string return fmt.Errorf("invalid volume [%s] and snapshot [%s], not volume [%s], snapshot [%s]", rb.volumeID, rb.SnapshotID, volumeID, id) } + if rb.State == ProgressStateComplete || rb.State == ProgressStateError { + logrus.Warnf("backup of volume [%s] and snapshot [%s] already completed or failed, skip the status update", rb.volumeID, rb.SnapshotID) + return nil + } + rb.State = ProgressState(state) rb.Progress = progress rb.BackupURL = url diff --git a/vendor/modules.txt b/vendor/modules.txt index 91e0fbd41..89a5e8f29 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -254,7 +254,7 @@ github.com/longhorn/go-spdk-helper/pkg/spdk/setup github.com/longhorn/go-spdk-helper/pkg/spdk/types github.com/longhorn/go-spdk-helper/pkg/types github.com/longhorn/go-spdk-helper/pkg/util -# github.com/longhorn/longhorn-engine v1.8.0-dev-20240825.0.20240831055950-b629ebaafa55 +# github.com/longhorn/longhorn-engine v1.8.0-dev-20240825.0.20240905075622-ecfa3c2bc26f ## explicit; go 1.22.2 github.com/longhorn/longhorn-engine/pkg/backingfile github.com/longhorn/longhorn-engine/pkg/controller/client