From 7df4b11cdef6bb1104fe6e632313282f795ff721 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Tue, 12 Oct 2021 12:22:04 -0700 Subject: [PATCH] support warp list benchmark to optionally choose metadata (#193) --- .github/workflows/go.yml | 4 ++-- .github/workflows/release.yml | 2 +- .goreleaser.yml | 3 +++ cli/list.go | 5 +++++ pkg/bench/benchmark.go | 2 ++ pkg/bench/list.go | 7 ++++++- 6 files changed, 19 insertions(+), 4 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index a04fc88c..00008433 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -14,7 +14,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - go-version: [1.15.x, 1.16.x] + go-version: [1.16.x, 1.17.x] os: [ubuntu-latest] steps: - name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }} @@ -30,6 +30,6 @@ jobs: env: GO111MODULE: on run: | - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.27.0 + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.40.1 $(go env GOPATH)/bin/golangci-lint run --timeout=5m --config ./.golangci.yml go test -v -race ./... diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1157b9f7..cba972e7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,7 +18,7 @@ jobs: name: Set up Go uses: actions/setup-go@v1 with: - go-version: 1.14.x + go-version: 1.17.x - name: Run GoReleaser uses: goreleaser/goreleaser-action@53acad1befee355d46f71cccf6ab4d885eb4f77f diff --git a/.goreleaser.yml b/.goreleaser.yml index 3ed4a0e9..7d1b678e 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -16,6 +16,9 @@ builds: goarch: - amd64 - arm64 + ignore: + - goos: windows + goarch: arm64 env: - CGO_ENABLED=0 flags: diff --git a/cli/list.go b/cli/list.go index 24a4696c..08acaabd 100644 --- a/cli/list.go +++ b/cli/list.go @@ -35,6 +35,10 @@ var ( Value: "1KB", Usage: "Size of each generated object. Can be a number or 10KB/MB/GB. All sizes are base 2 binary.", }, + cli.BoolFlag{ + Name: "metadata", + Usage: "Enable extended MinIO ListObjects with metadata, by default this benchmarking uses ListObjectsV2 API.", + }, } ) @@ -70,6 +74,7 @@ func mainList(ctx *cli.Context) error { Location: "", PutOpts: putOpts(ctx), }, + Metadata: ctx.Bool("metadata"), CreateObjects: ctx.Int("objects"), NoPrefix: ctx.Bool("noprefix"), } diff --git a/pkg/bench/benchmark.go b/pkg/bench/benchmark.go index afa73731..a7df7383 100644 --- a/pkg/bench/benchmark.go +++ b/pkg/bench/benchmark.go @@ -80,10 +80,12 @@ const ( autoTermCheck = 7 ) +// GetCommon implements interface compatible implementation func (c *Common) GetCommon() *Common { return c } +// ErrorF formatted error printer func (c *Common) ErrorF(format string, data ...interface{}) { c.Error(fmt.Sprintf(format, data...)) } diff --git a/pkg/bench/list.go b/pkg/bench/list.go index 37994673..b0b2a388 100644 --- a/pkg/bench/list.go +++ b/pkg/bench/list.go @@ -36,6 +36,7 @@ type List struct { CreateObjects int NoPrefix bool Collector *Collector + Metadata bool objects []generator.Objects Common @@ -185,7 +186,11 @@ func (d *List) Start(ctx context.Context, wait chan struct{}) (Operations, error op.Start = time.Now() // List all objects with prefix - listCh := client.ListObjects(nonTerm, d.Bucket, minio.ListObjectsOptions{WithMetadata: true, Prefix: objs[0].Prefix, Recursive: true}) + listCh := client.ListObjects(nonTerm, d.Bucket, minio.ListObjectsOptions{ + WithMetadata: d.Metadata, + Prefix: objs[0].Prefix, + Recursive: true, + }) // Wait for errCh to close. for {