From 95a09cd077438e259c249d7b73605916b1a5decf Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 22 Feb 2024 11:50:03 +0000 Subject: [PATCH] fix(deps): update github.com/longhorn/backupstore digest to 3a87ee0 --- go.mod | 2 +- go.sum | 2 ++ .../github.com/longhorn/backupstore/config.go | 22 +++++++++++++++++++ .../longhorn/backupstore/deltablock.go | 11 ++++++++++ .../longhorn/backupstore/renovate.json | 3 +++ vendor/modules.txt | 2 +- 6 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 vendor/github.com/longhorn/backupstore/renovate.json diff --git a/go.mod b/go.mod index b8512ca11..6d6326b91 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/0xPolygon/polygon-edge v1.3.2 github.com/RoaringBitmap/roaring v1.2.3 github.com/google/uuid v1.4.0 - github.com/longhorn/backupstore v0.0.0-20240110081942-bd231cfb0c7b + github.com/longhorn/backupstore v0.0.0-20240219094812-3a87ee02df77 github.com/longhorn/go-common-libs v0.0.0-20240219094750-e7176c332156 github.com/longhorn/go-spdk-helper v0.0.0-20240219160403-5fe20e7f7542 github.com/pkg/errors v0.9.1 diff --git a/go.sum b/go.sum index 8c71a9fbf..5175e2627 100644 --- a/go.sum +++ b/go.sum @@ -44,6 +44,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/longhorn/backupstore v0.0.0-20240110081942-bd231cfb0c7b h1:euBbfDb6bnp8KQ5qmbvWWEG7KP6nxhUotLCPGU/x3v0= github.com/longhorn/backupstore v0.0.0-20240110081942-bd231cfb0c7b/go.mod h1:4cbJWtlrD2cGTQxQLtdlPTYopiJiusXH7CpOBrn/s3k= +github.com/longhorn/backupstore v0.0.0-20240219094812-3a87ee02df77 h1:iJRq59kA22f9HIjFtY/lz5rKCorZJrrYXju70XoWdmE= +github.com/longhorn/backupstore v0.0.0-20240219094812-3a87ee02df77/go.mod h1:4cbJWtlrD2cGTQxQLtdlPTYopiJiusXH7CpOBrn/s3k= github.com/longhorn/go-common-libs v0.0.0-20240219094750-e7176c332156 h1:Jv1+UlfrzSodyIobaioQn8Vh4RQ+23FpN2Q60iFdqCU= github.com/longhorn/go-common-libs v0.0.0-20240219094750-e7176c332156/go.mod h1:nIECQARppamt2zwFSdzADRTVKo/7izFwWIS3VWi7D/s= github.com/longhorn/go-spdk-helper v0.0.0-20240219160403-5fe20e7f7542 h1:IrYKv4aIz7ncNOzzU4wadvmMGLUZjRVu34IZd8EmcBw= diff --git a/vendor/github.com/longhorn/backupstore/config.go b/vendor/github.com/longhorn/backupstore/config.go index 35cd5a525..a996ba0db 100644 --- a/vendor/github.com/longhorn/backupstore/config.go +++ b/vendor/github.com/longhorn/backupstore/config.go @@ -6,6 +6,7 @@ import ( "encoding/json" "fmt" "path/filepath" + "runtime" "strings" "time" @@ -139,6 +140,27 @@ func volumeExists(driver BackupStoreDriver, volumeName string) bool { return driver.FileExists(getVolumeFilePath(volumeName)) } +// volumeFolderExists checks if volume folder exists on backupstore +// by listing all the backup volume name based on the folders on the backupstore +// since s3 does not support checking folder exist. +func volumeFolderExists(driver BackupStoreDriver, volumeName string) (bool, error) { + jobQueues := workerpool.New(runtime.NumCPU() * 16) + defer jobQueues.StopWait() + + volumeNames, err := getVolumeNames(jobQueues, driver) + if err != nil { + return false, err + } + + for _, name := range volumeNames { + if volumeName == name { + return true, nil + } + } + + return false, nil +} + func getVolumePath(volumeName string) string { checksum := util.GetChecksum([]byte(volumeName)) volumeLayer1 := checksum[0:VOLUME_SEPARATE_LAYER1] diff --git a/vendor/github.com/longhorn/backupstore/deltablock.go b/vendor/github.com/longhorn/backupstore/deltablock.go index d011b3a2a..73851e53b 100644 --- a/vendor/github.com/longhorn/backupstore/deltablock.go +++ b/vendor/github.com/longhorn/backupstore/deltablock.go @@ -1051,6 +1051,17 @@ func DeleteBackupVolume(volumeName string, destURL string) error { if err != nil { return err } + + backupVolumeFolderExists, err := volumeFolderExists(bsDriver, volumeName) + if err != nil { + return err + } + + // No need to lock and remove volume if it does not exist. + if !backupVolumeFolderExists { + return nil + } + lock, err := New(bsDriver, volumeName, DELETION_LOCK) if err != nil { return err diff --git a/vendor/github.com/longhorn/backupstore/renovate.json b/vendor/github.com/longhorn/backupstore/renovate.json new file mode 100644 index 000000000..c297cdcff --- /dev/null +++ b/vendor/github.com/longhorn/backupstore/renovate.json @@ -0,0 +1,3 @@ +{ + "extends": ["github>longhorn/release:renovate-default"] +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 334ed3b00..6b29ae123 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -47,7 +47,7 @@ github.com/kr/pretty # github.com/kr/text v0.2.0 ## explicit github.com/kr/text -# github.com/longhorn/backupstore v0.0.0-20240110081942-bd231cfb0c7b +# github.com/longhorn/backupstore v0.0.0-20240219094812-3a87ee02df77 ## explicit; go 1.21 github.com/longhorn/backupstore github.com/longhorn/backupstore/logging