From 998b3ae44b3dccafc62636678c332e7681dfdbb7 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 7 Sep 2024 04:47:25 +0000 Subject: [PATCH] fix(deps): update github.com/longhorn/backupstore digest to 326b984 --- go.mod | 2 +- go.sum | 4 ++-- .../github.com/longhorn/backupstore/lock.go | 22 +++++++++++++++---- vendor/modules.txt | 2 +- 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index 0a88f299..9689a3f7 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/RoaringBitmap/roaring v1.9.4 github.com/golang/protobuf v1.5.4 github.com/gorilla/mux v1.8.1 - github.com/longhorn/backupstore v0.0.0-20240827054225-fe89e488b75f + github.com/longhorn/backupstore v0.0.0-20240905092550-326b9844e10b github.com/longhorn/longhorn-engine v1.6.3-dev-20240825 github.com/longhorn/sparse-tools v0.0.0-20240729132735-18b207e459ff github.com/pkg/errors v0.9.1 diff --git a/go.sum b/go.sum index 843063af..aedfe714 100644 --- a/go.sum +++ b/go.sum @@ -69,8 +69,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/longhorn/backupstore v0.0.0-20240827054225-fe89e488b75f h1:/Wo/leT2yrMmiDieCGhzqyzXb9FNsWoGeYWNfuf29KA= -github.com/longhorn/backupstore v0.0.0-20240827054225-fe89e488b75f/go.mod h1:N4cqNhSs4VUw9aGbO2OfyiIvJL7/L53hUrNiT73UN+U= +github.com/longhorn/backupstore v0.0.0-20240905092550-326b9844e10b h1:S+VuYPFMq235z7A/GaGTlv7P1GaUMBjWFeXE+ihn/CM= +github.com/longhorn/backupstore v0.0.0-20240905092550-326b9844e10b/go.mod h1:N4cqNhSs4VUw9aGbO2OfyiIvJL7/L53hUrNiT73UN+U= github.com/longhorn/go-common-libs v0.0.0-20240821134112-907f57efd48f h1:hjqUs3WVodkzrWwlUMVsnKAlom3uohoNlhZBGLsRvQY= github.com/longhorn/go-common-libs v0.0.0-20240821134112-907f57efd48f/go.mod h1:Qv34svr/msf6XoUwnrltNBTwMhQljbHEhb5ZKWiRdxo= github.com/longhorn/longhorn-engine v1.6.3-dev-20240825 h1:9z7BXsIVxCEs8lh/upXKtP/QQA/InjPiBl5WnNoNtbI= diff --git a/vendor/github.com/longhorn/backupstore/lock.go b/vendor/github.com/longhorn/backupstore/lock.go index ee321b62..32e7fc04 100644 --- a/vendor/github.com/longhorn/backupstore/lock.go +++ b/vendor/github.com/longhorn/backupstore/lock.go @@ -29,6 +29,12 @@ const BACKUP_LOCK LockType = 1 const RESTORE_LOCK LockType = 1 const DELETION_LOCK LockType = 2 +type Operation string + +const BackupOperationCreateRestore Operation = "create/restore" +const BackupOperationDelete Operation = "delete" +const BackupOperationUndefined Operation = "undefined" + type FileLock struct { Name string Type LockType @@ -80,6 +86,14 @@ func (lock *FileLock) canAcquire() bool { func (lock *FileLock) Lock() error { lock.mutex.Lock() defer lock.mutex.Unlock() + + operation := BackupOperationUndefined + if lock.Type == BACKUP_LOCK || lock.Type == RESTORE_LOCK { + operation = BackupOperationCreateRestore + } else if lock.Type == DELETION_LOCK { + operation = BackupOperationDelete + } + if lock.Acquired { atomic.AddInt32(&lock.count, 1) _ = saveLock(lock) @@ -107,16 +121,16 @@ func (lock *FileLock) Lock() error { if !lock.canAcquire() { file := getLockFilePath(lock.volume, lock.Name) _ = removeLock(lock) - return fmt.Errorf("failed lock %v type %v acquisition", file, lock.Type) + return fmt.Errorf("failed to acquire lock %v when performing backup %v, please try again later.", file, operation) } file := getLockFilePath(lock.volume, lock.Name) - log.Infof("Acquired lock %v type %v on backupstore", file, lock.Type) + log.Infof("Acquired lock %v for backup %v on backupstore", file, operation) lock.Acquired = true atomic.AddInt32(&lock.count, 1) if err := saveLock(lock); err != nil { _ = removeLock(lock) - return errors.Wrapf(err, "failed to store updated lock %v type %v after acquisition", file, lock.Type) + return errors.Wrapf(err, "failed to store updated lock %v when performing backup %v, please try again later", file, operation) } // enable lock refresh @@ -133,7 +147,7 @@ func (lock *FileLock) Lock() error { if lock.Acquired { if err := saveLock(lock); err != nil { // nothing we can do here, that's why the lock acquisition time is 2x lock refresh interval - log.WithError(err).Warnf("Failed to refresh acquired lock %v type %v", file, lock.Type) + log.WithError(err).Warnf("Failed to refresh acquired lock %v when performing backup %v, please try again later", file, operation) } } lock.mutex.Unlock() diff --git a/vendor/modules.txt b/vendor/modules.txt index 83a6e3c8..a42c2107 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -150,7 +150,7 @@ github.com/kr/pretty # github.com/kr/text v0.2.0 ## explicit github.com/kr/text -# github.com/longhorn/backupstore v0.0.0-20240827054225-fe89e488b75f +# github.com/longhorn/backupstore v0.0.0-20240905092550-326b9844e10b ## explicit; go 1.22.0 github.com/longhorn/backupstore github.com/longhorn/backupstore/azblob