From 25673b61e4d9514f3f5d244fc755b5ff224a488f Mon Sep 17 00:00:00 2001 From: Andy Asp Date: Tue, 12 Sep 2023 13:38:16 -0400 Subject: [PATCH 1/2] GCS: use Query.SetAttrSelection when listing Signed-off-by: Andy Asp --- providers/gcs/gcs.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/providers/gcs/gcs.go b/providers/gcs/gcs.go index 5ea45c7e..ad305d6e 100644 --- a/providers/gcs/gcs.go +++ b/providers/gcs/gcs.go @@ -108,10 +108,16 @@ func (b *Bucket) Iter(ctx context.Context, dir string, f func(string) error, opt delimiter = "" } - it := b.bkt.Objects(ctx, &storage.Query{ + query := &storage.Query{ Prefix: dir, Delimiter: delimiter, - }) + } + err := query.SetAttrSelection([]string{"Name"}) + if err != nil { + return err + } + + it := b.bkt.Objects(ctx, query) for { select { case <-ctx.Done(): From 02d54dc163e2e0bddcc35b52c5e69bb1e33cbd85 Mon Sep 17 00:00:00 2001 From: Andy Asp Date: Tue, 12 Sep 2023 16:09:45 -0400 Subject: [PATCH 2/2] Add changelog entry Signed-off-by: Andy Asp --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b9387df..72f8f180 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re - [#64](https://github.com/thanos-io/objstore/pull/64) OCI: OKE Workload Identity support. - [#73](https://github.com/thanos-io/objstore/pull/73) Аdded file path to erros from DownloadFile - [#51](https://github.com/thanos-io/objstore/pull/51) Azure: Support using connection string authentication. +- [#76](https://github.com/thanos-io/objstore/pull/76) GCS: Query for object names only in `Iter` to possibly improve performance when listing objects. ### Changed - [#38](https://github.com/thanos-io/objstore/pull/38) *: Upgrade minio-go version to `v7.0.45`.