diff --git a/go.mod b/go.mod index 3e8306f7c..b6848ede3 100644 --- a/go.mod +++ b/go.mod @@ -8,10 +8,10 @@ require ( github.com/google/uuid v1.6.0 github.com/gorilla/handlers v1.5.2 github.com/gorilla/mux v1.8.1 - github.com/longhorn/backupstore v0.0.0-20240427164602-c8721e8ea31a - github.com/longhorn/go-common-libs v0.0.0-20240427164621-70d1933bfa90 + github.com/longhorn/backupstore v0.0.0-20240501152902-3fa6a4a2e3e3 + github.com/longhorn/go-common-libs v0.0.0-20240501153456-f7a5b1a1edb0 github.com/longhorn/go-iscsi-helper v0.0.0-20240427164656-e9439c0018ce - 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/moby/moby v24.0.9+incompatible github.com/pkg/errors v0.9.1 diff --git a/go.sum b/go.sum index 2f11004a2..7d2685e61 100644 --- a/go.sum +++ b/go.sum @@ -66,14 +66,14 @@ 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/go-common-libs v0.0.0-20240427164621-70d1933bfa90 h1:uBVee6AulPsgSvsvaxdj4xIdgkIvjIqA0j7ZD+Hg/Mc= -github.com/longhorn/go-common-libs v0.0.0-20240427164621-70d1933bfa90/go.mod h1:qppGSy9WsxH1C9T6yhSMvG53ynpasyKOH/n9e1jr8mw= +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/go-common-libs v0.0.0-20240501153456-f7a5b1a1edb0 h1:pYPo3iOQefnxrYBAj8vVTjqVnpTNBeTVvile3EAJR1A= +github.com/longhorn/go-common-libs v0.0.0-20240501153456-f7a5b1a1edb0/go.mod h1:qppGSy9WsxH1C9T6yhSMvG53ynpasyKOH/n9e1jr8mw= github.com/longhorn/go-iscsi-helper v0.0.0-20240427164656-e9439c0018ce h1:PxKniE9F6IZ2DMKfmxDsbqeAxQI1TZhnw7/HOBMs1Is= github.com/longhorn/go-iscsi-helper v0.0.0-20240427164656-e9439c0018ce/go.mod h1:d9t3gtE+UPjescbCFluXd4xBc8OQT/JrC2cdkk2IXWQ= -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/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= diff --git a/vendor/github.com/longhorn/backupstore/.drone.yml b/vendor/github.com/longhorn/backupstore/.drone.yml deleted file mode 100644 index 25656205f..000000000 --- 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 a29967914..ede8e76ff 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 de6a364bf..1d9acc3b3 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 5622aa6ab..187f13a4d 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 87fc13fa8..c1e5dafe9 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 9d6fc9068..3921f2523 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 e161b271d..ad9c2396e 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 85962d475..d1d39cb0b 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 73d4f17b2..091d65abb 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/github.com/longhorn/sparse-tools/stats/stats.go b/vendor/github.com/longhorn/sparse-tools/stats/stats.go index 510fc0980..6d59ad6b8 100644 --- a/vendor/github.com/longhorn/sparse-tools/stats/stats.go +++ b/vendor/github.com/longhorn/sparse-tools/stats/stats.go @@ -15,7 +15,7 @@ const ( defaultBufferSize = 4 * 1000 // sample buffer size (cyclic) ) -//SampleOp operation +// SampleOp operation type SampleOp int const ( @@ -202,7 +202,7 @@ func resetStats(size int) { initStats(size) } -//OpID pending operation id +// OpID pending operation id type OpID int var ( @@ -211,7 +211,7 @@ var ( mutexPendingOps sync.Mutex ) -//InsertPendingOp starts tracking of a pending operation +// InsertPendingOp starts tracking of a pending operation func InsertPendingOp(timestamp time.Time, targetID string, op SampleOp, size int) OpID { mutexPendingOps.Lock() defer mutexPendingOps.Unlock() @@ -229,7 +229,7 @@ func InsertPendingOp(timestamp time.Time, targetID string, op SampleOp, size int return OpID(id) } -//RemovePendingOp removes tracking of a completed operation +// RemovePendingOp removes tracking of a completed operation func RemovePendingOp(id OpID, status bool) error { log.Debug("RemovePendingOp id=", id) mutexPendingOps.Lock() @@ -248,7 +248,7 @@ func RemovePendingOp(id OpID, status bool) error { } // Update the duration and store in the recent stats - pendingOps[i].duration = time.Now().Sub(pendingOps[i].timestamp) + pendingOps[i].duration = time.Since(pendingOps[i].timestamp) pendingOps[i].status = status storeSample(pendingOps[i]) diff --git a/vendor/modules.txt b/vendor/modules.txt index 2335e7073..ef005e490 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -127,7 +127,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 @@ -144,7 +144,7 @@ github.com/longhorn/backupstore/systembackup github.com/longhorn/backupstore/types github.com/longhorn/backupstore/util github.com/longhorn/backupstore/vfs -# github.com/longhorn/go-common-libs v0.0.0-20240427164621-70d1933bfa90 +# github.com/longhorn/go-common-libs v0.0.0-20240501153456-f7a5b1a1edb0 ## explicit; go 1.22 github.com/longhorn/go-common-libs/exec github.com/longhorn/go-common-libs/generated/profilerpb @@ -163,8 +163,8 @@ github.com/longhorn/go-iscsi-helper/iscsidev github.com/longhorn/go-iscsi-helper/longhorndev github.com/longhorn/go-iscsi-helper/types github.com/longhorn/go-iscsi-helper/util -# 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/cli/ssync github.com/longhorn/sparse-tools/sparse github.com/longhorn/sparse-tools/sparse/rest