From ae8097bf8fb42bbf428059dc3fc3267defe80540 Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Fri, 26 Feb 2021 16:42:19 +0000 Subject: [PATCH 1/3] Fix object prefix not being stripped for Dell ECS This commit ensure that the same object prefix string is used to query and strip an object when listing all the objects in a bucket. Some S3 implementations (in this case Dell ECS) cannot be relied upon to return the correct `res.Prefix`. Dell ECS will return it URLencoded, e.g. "traceID%2F" instead of "traceID/". --- tempodb/backend/s3/s3.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tempodb/backend/s3/s3.go b/tempodb/backend/s3/s3.go index 14d814ae437..bfb22e72d17 100644 --- a/tempodb/backend/s3/s3.go +++ b/tempodb/backend/s3/s3.go @@ -271,8 +271,9 @@ func (rw *readerWriter) Tenants(ctx context.Context) ([]string, error) { // Blocks implements backend.Reader func (rw *readerWriter) Blocks(ctx context.Context, tenantID string) ([]uuid.UUID, error) { + prefix := tenantID + "/" // ListObjects(bucket, prefix, marker, delimiter string, maxKeys int) - res, err := rw.core.ListObjects(rw.cfg.Bucket, tenantID+"/", "", "/", 0) + res, err := rw.core.ListObjects(rw.cfg.Bucket, prefix, "", "/", 0) if err != nil { return nil, errors.Wrapf(err, "error listing blocks in s3 bucket, bucket: %s", rw.cfg.Bucket) } @@ -280,7 +281,7 @@ func (rw *readerWriter) Blocks(ctx context.Context, tenantID string) ([]uuid.UUI level.Debug(rw.logger).Log("msg", "listing blocks", "tenantID", tenantID, "found", len(res.CommonPrefixes)) var blockIDs []uuid.UUID for _, cp := range res.CommonPrefixes { - blockID, err := uuid.Parse(strings.Split(strings.TrimPrefix(cp.Prefix, res.Prefix), "/")[0]) + blockID, err := uuid.Parse(strings.Split(strings.TrimPrefix(cp.Prefix, prefix), "/")[0]) if err != nil { return nil, errors.Wrapf(err, "error parsing uuid of obj, objectName: %s", cp.Prefix) } From fbd64aa1b7011ae4405726723ff0858b1b819b22 Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Fri, 26 Feb 2021 16:54:19 +0000 Subject: [PATCH 2/3] Add changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd2a23e6079..d58dd62036b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ * [ENHANCEMENT] Add a Shutdown handler to flush data to backend, at "/shutdown". [#526](https://github.com/grafana/tempo/pull/526) * [BUGFIX] Fixes permissions errors on startup in GCS. [#554](https://github.com/grafana/tempo/pull/554) +* [BUGFIX] Fixes error were Dell ECS cannot list objects. [#561](https://github.com/grafana/tempo/pull/561) + ## v0.6.0 From ec6acc8211e82d7efcc732f2266aef5659e5f3b5 Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Mon, 1 Mar 2021 11:16:31 +0000 Subject: [PATCH 3/3] Update CHANGELOG.md Co-authored-by: Graham Reed --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d58dd62036b..644005f41f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ * [ENHANCEMENT] Add a Shutdown handler to flush data to backend, at "/shutdown". [#526](https://github.com/grafana/tempo/pull/526) * [BUGFIX] Fixes permissions errors on startup in GCS. [#554](https://github.com/grafana/tempo/pull/554) -* [BUGFIX] Fixes error were Dell ECS cannot list objects. [#561](https://github.com/grafana/tempo/pull/561) +* [BUGFIX] Fixes error where Dell ECS cannot list objects. [#561](https://github.com/grafana/tempo/pull/561) ## v0.6.0