Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rgw: set object accounted size correctly #14950

Merged
merged 1 commit into from
Jun 8, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/rgw/rgw_rados.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8710,13 +8710,14 @@ int RGWRados::get_obj_state_impl(RGWObjectCtx *rctx, const RGWBucketInfo& bucket
s->accounted_size = s->size;

auto iter = s->attrset.find(RGW_ATTR_COMPRESSION);
if (iter != s->attrset.end()) {
const bool compressed = (iter != s->attrset.end());
if (compressed) {
// use uncompressed size for accounted_size
try {
RGWCompressionInfo info;
auto p = iter->second.begin();
::decode(info, p);
s->accounted_size = info.orig_size;
s->accounted_size = info.orig_size;
} catch (buffer::error&) {
dout(0) << "ERROR: could not decode compression info for object: " << obj << dendl;
return -EIO;
Expand All @@ -8741,6 +8742,8 @@ int RGWRados::get_obj_state_impl(RGWObjectCtx *rctx, const RGWBucketInfo& bucket
s->manifest.set_head(bucket_info.placement_rule, obj, s->size); /* patch manifest to reflect the head we just read, some manifests might be
broken due to old bugs */
s->size = s->manifest.get_obj_size();
if (!compressed)
s->accounted_size = s->size;
} catch (buffer::error& err) {
ldout(cct, 0) << "ERROR: couldn't decode manifest" << dendl;
return -EIO;
Expand Down