Skip to content

Commit 00cc9e3

Browse files
committed
fix swift: CR minor fixes
Signed-off-by: Martin Chodur <m.chodur@seznam.cz>
1 parent d0c15fe commit 00cc9e3

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ We use *breaking* word for marking changes that are not backward compatible (rel
2424
- [#2667](https://github.com/thanos-io/thanos/pull/2667) Store: removed support to the legacy `index.cache.json`. The hidden flag `--store.disable-index-header` was removed.
2525
- [#2667](https://github.com/thanos-io/thanos/pull/2667) Compact: the deprecated flag `--index.generate-missing-cache-file` and the metric `thanos_compact_generated_index_total` were removed.
2626
- [2603](https://github.com/thanos-io/thanos/pull/2603) Store/Querier: Significantly optimize cases where StoreAPIs or blocks returns exact overlapping chunks (e.g Store GW and sidecar or brute force Store Gateway HA).
27-
- [#TBA](https://github.com/thanos-io/thanos/pull/TBA) Swift: Switched to a new library [ncw/swift]() providing large objects support.
27+
- [#2732](https://github.com/thanos-io/thanos/pull/2732) Swift: Switched to a new library [ncw/swift]() providing large objects support.
2828
By default, segments will be uploaded to the same container directory `segments/` if the file is bigger than `1GB`.
2929
To change the defaults see [the docs](./docs/storage.md#openstack-swift).
3030

pkg/objstore/swift/swift.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -182,18 +182,18 @@ func NewContainerFromConfig(logger log.Logger, sc *Config, createContainer bool)
182182
if sc.SegmentContainerName == "" {
183183
sc.SegmentContainerName = sc.ContainerName
184184
} else if _, err := ensureContainer(connection, sc.SegmentContainerName, createContainer); err != nil {
185-
return nil, err
186-
}
185+
return nil, err
187186
}
187+
}
188188

189-
container := Container{
190-
logger: logger,
191-
name: sc.ContainerName,
192-
connection: connection,
193-
chunkSize: sc.ChunkSize,
194-
segmentsContainer: sc.SegmentContainerName,
195-
}
196-
return &container, nil
189+
container := Container{
190+
logger: logger,
191+
name: sc.ContainerName,
192+
connection: connection,
193+
chunkSize: sc.ChunkSize,
194+
segmentsContainer: sc.SegmentContainerName,
195+
}
196+
return &container, nil
197197
}
198198

199199
// Name returns the container name for swift.
@@ -264,10 +264,10 @@ func (c *Container) Attributes(ctx context.Context, name string) (objstore.Objec
264264
// Exists checks if the given object exists.
265265
func (c *Container) Exists(ctx context.Context, name string) (bool, error) {
266266
_, _, err := c.connection.Object(c.name, name)
267+
if c.IsObjNotFoundErr(err) {
268+
err = nil
269+
}
267270
if err != nil {
268-
if c.IsObjNotFoundErr(err) {
269-
err = nil
270-
}
271271
return false, errors.Wrap(err, "swift check if file exists")
272272
}
273273
return true, nil

0 commit comments

Comments
 (0)