diff --git a/go.mod b/go.mod index 8197a731..bb63c218 100644 --- a/go.mod +++ b/go.mod @@ -1,14 +1,16 @@ module github.com/longhorn/backing-image-manager -go 1.21 +go 1.22 + +toolchain go1.22.2 require ( github.com/RoaringBitmap/roaring v1.9.3 github.com/golang/protobuf v1.5.4 github.com/gorilla/mux v1.8.1 - github.com/longhorn/backupstore v0.0.0-20240427164602-c8721e8ea31a + github.com/longhorn/backupstore v0.0.0-20240501152902-3fa6a4a2e3e3 github.com/longhorn/longhorn-engine v1.6.0-dev-20231217.0.20240418025706-519598108463 - github.com/longhorn/sparse-tools v0.0.0-20240427164751-a7b9f1b2c8a8 + github.com/longhorn/sparse-tools v0.0.0-20240429031723-813ac9e807f8 github.com/longhorn/types v0.0.0-20240427164854-38dbed8528d3 github.com/pkg/errors v0.9.1 github.com/rancher/go-fibmap v0.0.0-20160418233256-5fc9f8c1ed47 diff --git a/go.sum b/go.sum index b167e06c..1fade485 100644 --- a/go.sum +++ b/go.sum @@ -55,12 +55,12 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= 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-20240427164602-c8721e8ea31a h1:cwHDzWi0zkgg/SHtvEhWIYLvZHJvCp5twS8qBOUt/Nc= -github.com/longhorn/backupstore v0.0.0-20240427164602-c8721e8ea31a/go.mod h1:NlOHCyQiGjn9TS1HUfQlBESttDPzi9x1Vs38geRV9SU= +github.com/longhorn/backupstore v0.0.0-20240501152902-3fa6a4a2e3e3 h1:2LC/Euk1O1FCYJzBBJfYKPpYE/wSe8Rzn6AhaBmdIGE= +github.com/longhorn/backupstore v0.0.0-20240501152902-3fa6a4a2e3e3/go.mod h1:NlOHCyQiGjn9TS1HUfQlBESttDPzi9x1Vs38geRV9SU= github.com/longhorn/longhorn-engine v1.6.0-dev-20231217.0.20240418025706-519598108463 h1:KxddgUYC9InOhe8MxfbxzOL5v9q7f5DyThxQGGKvqVw= github.com/longhorn/longhorn-engine v1.6.0-dev-20231217.0.20240418025706-519598108463/go.mod h1:WNiZl2l51I36/c8dewxkyWd0yBA5Anznzki0knKO88U= -github.com/longhorn/sparse-tools v0.0.0-20240427164751-a7b9f1b2c8a8 h1:lwtmZEomiv8uchwo9JIyoo+lK8J3cLCm7/qzpn6wmzo= -github.com/longhorn/sparse-tools v0.0.0-20240427164751-a7b9f1b2c8a8/go.mod h1:pvlUkVwRGojXhcTkkzksOe4i7GVk59P2PbJjHIB2Yj0= +github.com/longhorn/sparse-tools v0.0.0-20240429031723-813ac9e807f8 h1:mPKL3fPcOZmFn/j5TlCGG221McBSz31XyCoMEu7gUSs= +github.com/longhorn/sparse-tools v0.0.0-20240429031723-813ac9e807f8/go.mod h1:S2gaK6EE4dcleD6Qy4NVBWvULVwz98Jz8zSkRmyuBvk= github.com/longhorn/types v0.0.0-20240427164854-38dbed8528d3 h1:7YDGJTwro/kCcMmnCWM1UIL4JgervR6MT++71PvcbGY= github.com/longhorn/types v0.0.0-20240427164854-38dbed8528d3/go.mod h1:pqT+7B8T+nkyUZYe8tL3CwPDCHjkbe3mHUDY5ntJFyQ= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= diff --git a/vendor/github.com/longhorn/backupstore/.drone.yml b/vendor/github.com/longhorn/backupstore/.drone.yml deleted file mode 100644 index 25656205..00000000 --- a/vendor/github.com/longhorn/backupstore/.drone.yml +++ /dev/null @@ -1,28 +0,0 @@ ---- -kind: pipeline -name: default - -platform: - os: linux - arch: amd64 - -steps: -- name: fetch - image: alpine/git - commands: - - git fetch --tags - -- name: build - pull: default - image: rancher/dapper:1.11.2 - commands: - - dapper ci - privileged: true - volumes: - - name: socket - path: /var/run/docker.sock - -volumes: -- name: socket - host: - path: /var/run/docker.sock diff --git a/vendor/github.com/longhorn/backupstore/Dockerfile.dapper b/vendor/github.com/longhorn/backupstore/Dockerfile.dapper index a2996791..ede8e76f 100644 --- a/vendor/github.com/longhorn/backupstore/Dockerfile.dapper +++ b/vendor/github.com/longhorn/backupstore/Dockerfile.dapper @@ -22,7 +22,7 @@ RUN wget -O - https://storage.googleapis.com/golang/go1.21.3.linux-${!GOLANG_ARC RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.55.2 ENV DAPPER_SOURCE /go/src/github.com/longhorn/backupstore -ENV DAPPER_OUTPUT ./bin +ENV DAPPER_OUTPUT ./bin coverage.out ENV DAPPER_DOCKER_SOCKET true ENV DAPPER_ENV IMAGE REPO VERSION TAG DRONE_REPO DRONE_PULL_REQUEST DRONE_COMMIT_REF ENV DAPPER_RUN_ARGS --privileged --tmpfs /go/src/github.com/longhorn/longhorn/integration/.venv:exec --tmpfs /go/src/github.com/longhorn/longhorn/integration/.tox:exec -v /dev:/host/dev diff --git a/vendor/github.com/longhorn/sparse-tools/sparse/client.go b/vendor/github.com/longhorn/sparse-tools/sparse/client.go index de6a364b..1d9acc3b 100644 --- a/vendor/github.com/longhorn/sparse-tools/sparse/client.go +++ b/vendor/github.com/longhorn/sparse-tools/sparse/client.go @@ -198,6 +198,7 @@ func (client *syncClient) syncContent() error { select { case err = <-mergedErrc: break + default: } return err } diff --git a/vendor/github.com/longhorn/sparse-tools/sparse/file.go b/vendor/github.com/longhorn/sparse-tools/sparse/file.go index 5622aa6a..187f13a4 100644 --- a/vendor/github.com/longhorn/sparse-tools/sparse/file.go +++ b/vendor/github.com/longhorn/sparse-tools/sparse/file.go @@ -77,7 +77,9 @@ func (file *BufferedFileIoProcessor) Size() (int64, error) { } func (file *BufferedFileIoProcessor) Close() error { - file.File.Sync() + if err := file.File.Sync(); err != nil { + return err + } return file.File.Close() } diff --git a/vendor/github.com/longhorn/sparse-tools/sparse/rest/handlers.go b/vendor/github.com/longhorn/sparse-tools/sparse/rest/handlers.go index 87fc13fa..c1e5dafe 100644 --- a/vendor/github.com/longhorn/sparse-tools/sparse/rest/handlers.go +++ b/vendor/github.com/longhorn/sparse-tools/sparse/rest/handlers.go @@ -158,7 +158,7 @@ func (server *SyncServer) close(writer http.ResponseWriter, request *http.Reques } if err != nil { - log.WithError(err).Warnf("Failed ot set snapshot hash info to checksum file %v", server.filePath) + log.WithError(err).Warnf("Failed to set snapshot hash info to checksum file %v", server.filePath) } } @@ -207,6 +207,9 @@ func (server *SyncServer) doGetChecksum(writer http.ResponseWriter, request *htt // For the region to have valid data, it can only has one extent covering the whole region exts, err := sparse.GetFiemapRegionExts(server.fileIo, remoteDataInterval, 2) + if err != nil { + return errors.Wrapf(err, "failed to get fiemap region exts %+v", remoteDataInterval) + } if len(exts) == 1 && int64(exts[0].Logical) <= remoteDataInterval.Begin && int64(exts[0].Logical+exts[0].Length) >= remoteDataInterval.End { diff --git a/vendor/github.com/longhorn/sparse-tools/sparse/rest/router.go b/vendor/github.com/longhorn/sparse-tools/sparse/rest/router.go index 9d6fc906..3921f252 100644 --- a/vendor/github.com/longhorn/sparse-tools/sparse/rest/router.go +++ b/vendor/github.com/longhorn/sparse-tools/sparse/rest/router.go @@ -2,7 +2,7 @@ package rest import "github.com/gorilla/mux" -//NewRouter creates and configures a mux router +// NewRouter creates and configures a mux router func NewRouter(server *SyncServer) *mux.Router { // API framework routes diff --git a/vendor/github.com/longhorn/sparse-tools/sparse/rest/server.go b/vendor/github.com/longhorn/sparse-tools/sparse/rest/server.go index e161b271..ad9c2396 100644 --- a/vendor/github.com/longhorn/sparse-tools/sparse/rest/server.go +++ b/vendor/github.com/longhorn/sparse-tools/sparse/rest/server.go @@ -117,6 +117,6 @@ func Server(ctx context.Context, port string, filePath string, syncFileOps SyncF } // TestServer daemon serves only one connection for each test then exits -func TestServer(ctx context.Context, port string, filePath string, timeout int) { - Server(ctx, port, filePath, &SyncFileStub{}) +func TestServer(ctx context.Context, port string, filePath string, timeout int) error { + return Server(ctx, port, filePath, &SyncFileStub{}) } diff --git a/vendor/github.com/longhorn/sparse-tools/sparse/sfold.go b/vendor/github.com/longhorn/sparse-tools/sparse/sfold.go index 85962d47..d1d39cb0 100644 --- a/vendor/github.com/longhorn/sparse-tools/sparse/sfold.go +++ b/vendor/github.com/longhorn/sparse-tools/sparse/sfold.go @@ -98,7 +98,7 @@ func coalesce(parentFileIo, childFileIo FileIoProcessor, fileSize int64, ops Fil size = int(segment.End - offset) } // read a batch from child - n, err := childFileIo.ReadAt(buffer[:size], offset) + _, err := childFileIo.ReadAt(buffer[:size], offset) if err != nil { return errors.Wrapf(err, "failed to read childFile filename: %v, size: %v, at: %v", childFileIo.Name(), size, offset) @@ -130,6 +130,7 @@ func coalesce(parentFileIo, childFileIo FileIoProcessor, fileSize int64, ops Fil select { case err = <-mergedErrc: break + default: } log.Debugf("Finished fold for parent %v, child %v, size %v, elapsed %.2fs", diff --git a/vendor/github.com/longhorn/sparse-tools/sparse/sprune.go b/vendor/github.com/longhorn/sparse-tools/sparse/sprune.go index 73d4f17b..091d65ab 100644 --- a/vendor/github.com/longhorn/sparse-tools/sparse/sprune.go +++ b/vendor/github.com/longhorn/sparse-tools/sparse/sprune.go @@ -104,6 +104,7 @@ func prune(parentFileIo, childFileIo FileIoProcessor, fileSize int64, ops FileHa select { case err = <-mergedErrc: break + default: } log.Debugf("Finished pruning for parent %v, child %v, size %v, elapsed %.2fs", diff --git a/vendor/modules.txt b/vendor/modules.txt index 608cd646..1f5fd54f 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -117,7 +117,7 @@ github.com/kr/pretty # github.com/kr/text v0.2.0 ## explicit github.com/kr/text -# github.com/longhorn/backupstore v0.0.0-20240427164602-c8721e8ea31a +# github.com/longhorn/backupstore v0.0.0-20240501152902-3fa6a4a2e3e3 ## explicit; go 1.21 github.com/longhorn/backupstore github.com/longhorn/backupstore/azblob @@ -139,8 +139,8 @@ github.com/longhorn/longhorn-engine/pkg/replica/client github.com/longhorn/longhorn-engine/pkg/types github.com/longhorn/longhorn-engine/pkg/util github.com/longhorn/longhorn-engine/pkg/util/disk -# github.com/longhorn/sparse-tools v0.0.0-20240427164751-a7b9f1b2c8a8 -## explicit; go 1.17 +# github.com/longhorn/sparse-tools v0.0.0-20240429031723-813ac9e807f8 +## explicit; go 1.22 github.com/longhorn/sparse-tools/sparse github.com/longhorn/sparse-tools/sparse/rest github.com/longhorn/sparse-tools/types