Skip to content

Commit

Permalink
support warp list benchmark to optionally choose metadata (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
harshavardhana authored Oct 12, 2021
1 parent e9a39fc commit 7df4b11
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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 ./...
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ builds:
goarch:
- amd64
- arm64
ignore:
- goos: windows
goarch: arm64
env:
- CGO_ENABLED=0
flags:
Expand Down
5 changes: 5 additions & 0 deletions cli/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
},
}
)

Expand Down Expand Up @@ -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"),
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/bench/benchmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -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...))
}
Expand Down
7 changes: 6 additions & 1 deletion pkg/bench/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type List struct {
CreateObjects int
NoPrefix bool
Collector *Collector
Metadata bool
objects []generator.Objects

Common
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 7df4b11

Please sign in to comment.