]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: remove compression attribute from bucket instance
authorCasey Bodley <cbodley@redhat.com>
Thu, 29 Sep 2016 16:42:57 +0000 (12:42 -0400)
committerAdam Kupczyk <akupczyk@mirantis.com>
Wed, 2 Nov 2016 11:13:06 +0000 (12:13 +0100)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_op.cc
src/rgw/rgw_op.h
src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h

index bd5b772150edaaf2648c2bd4a29b9f656d2f8ddb..6796f6eb1fa354cee6c8d71f88cbfaa0d42e1cae 100644 (file)
@@ -775,16 +775,6 @@ bool RGWOp::generate_cors_headers(string& origin, string& method, string& header
   return true;
 }
 
-int RGWOp::update_compressed_bucket_size(uint64_t obj_size, RGWBucketCompressionInfo& bucket_size)
-{
-  bucket_size.orig_size += obj_size;
-  bufferlist bs;
-  ::encode(bucket_size, bs);
-  s->bucket_attrs[RGW_ATTR_COMPRESSION] = bs;
-  return store->put_bucket_instance_info(s->bucket_info, false, real_time(),
-                                         &s->bucket_attrs);
-}
-
 int RGWGetObj::read_user_manifest_part(rgw_bucket& bucket,
                                        const RGWObjEnt& ent,
                                        RGWAccessControlPolicy * const bucket_policy,
@@ -1891,12 +1881,6 @@ void RGWStatBucket::execute()
       op_ret = -EINVAL;
     }
   }
-  RGWBucketCompressionInfo bcs;
-  int res = rgw_bucket_compression_info_from_attrset(s->bucket_attrs, bcs);
-  if (!res)
-    bucket.size = bcs.orig_size;
-  if (res < 0)
-      lderr(s->cct) << "Failed to read decompressed bucket size" << dendl;
 }
 
 int RGWListBucket::verify_permission()
@@ -3068,15 +3052,6 @@ void RGWPutObj::execute()
     attrs[RGW_ATTR_COMPRESSION] = tmp;
   }
 
-  // add attr to bucket to know original  size of data
-  res = rgw_bucket_compression_info_from_attrset(s->bucket_attrs, bucket_size);
-  if (res < 0)
-    lderr(s->cct) << "ERROR: failed to read decompressed bucket size, cannot update stat" << dendl;
-  op_ret = update_compressed_bucket_size(s->obj_size, bucket_size);
-  if (op_ret < 0)
-    ldout(s->cct, 0) << "NOTICE: put_bucket_info on bucket=" << s->bucket.name
-         << " returned err=" << op_ret << dendl;
-
   buf_to_hex(m, CEPH_CRYPTO_MD5_DIGESTSIZE, calc_md5);
 
   etag = calc_md5;
@@ -3697,27 +3672,6 @@ void RGWDeleteObj::execute()
       if (op_ret >= 0) {
         delete_marker = del_op.result.delete_marker;
         version_id = del_op.result.version_id;
-        RGWBucketCompressionInfo bucket_size;
-        int res = rgw_bucket_compression_info_from_attrset(s->bucket_attrs, bucket_size);
-        if (res < 0)
-          lderr(s->cct) << "ERROR: failed to read decompressed bucket size, cannot update stat" << dendl;
-        if (!res) {
-          uint64_t deleted_size;
-          bool tmp;
-          RGWCompressionInfo cs_info;
-          res = rgw_compression_info_from_attrset(attrs, tmp, cs_info);
-          if (res < 0) {
-            lderr(s->cct) << "ERROR: failed to decode compression info, cannot update stat" << dendl;
-            deleted_size = s->obj_size;
-          } else {
-            if (tmp) 
-              deleted_size = cs_info.orig_size;
-            else
-              deleted_size = s->obj_size;
-          }
-          if (update_compressed_bucket_size(-deleted_size, bucket_size) < 0)
-            lderr(s->cct) << "ERROR: failed to update bucket stat" << dendl;
-        }
       }
 
       /* Check whether the object has expired. Swift API documentation
@@ -5075,18 +5029,6 @@ void RGWAbortMultipart::execute()
   if (op_ret == -ENOENT) {
     op_ret = -ERR_NO_SUCH_BUCKET;
   }
-
-  if (!op_ret) {
-    RGWBucketCompressionInfo bucket_size;
-    int res = rgw_bucket_compression_info_from_attrset(s->bucket_attrs, bucket_size);
-    if (res < 0)
-      lderr(s->cct) << "ERROR: failed to read decompressed bucket size, cannot update stat" << dendl;
-    if (!res) {
-      if (update_compressed_bucket_size(-deleted_size, bucket_size) < 0)
-            lderr(s->cct) << "ERROR: failed to update bucket stat" << dendl;
-    }
-  }
-
 }
 
 int RGWListMultipart::verify_permission()
index 60295e7739edadb91fbcca3855c605adba72c965..31f6b774658065ec405cd89d0419ce0503e7daf5 100644 (file)
@@ -87,8 +87,6 @@ RGWOp() : s(nullptr), dialect_handler(nullptr), store(nullptr),
   }
   int read_bucket_cors();
   bool generate_cors_headers(string& origin, string& method, string& headers, string& exp_headers, unsigned *max_age);
-  // obj_size can be positive or negative
-  int update_compressed_bucket_size(uint64_t obj_size, RGWBucketCompressionInfo& bucket_size);
 
   virtual int verify_params() { return 0; }
   virtual bool prefetch_data() { return false; }
index d74d5d19e8c3a6010d9b073abe4556e44d62128d..59186d3e6057fe428d8705a2191672dd53eff21b 100644 (file)
@@ -12941,18 +12941,3 @@ int rgw_compression_info_from_attrset(map<string, bufferlist>& attrs, bool& need
     return 0;
   }
 }
-
-int rgw_bucket_compression_info_from_attrset(map<string, bufferlist>& attrs, RGWBucketCompressionInfo& cs_info)
-{
-  map<string, bufferlist>::iterator cmp = attrs.find(RGW_ATTR_COMPRESSION);
-  if (cmp != attrs.end()) {
-    try {
-      ::decode(cs_info, cmp->second);
-    } catch (buffer::error& err) {
-      return -EIO;
-    }
-  } else {
-    return 1;
-  }
-  return 0;
-}
index 12ac56917697b0913f32e024cf4789a10cc866d9..9f5f7bb953422b6ac990b8a72e4419822dd960cd 100644 (file)
@@ -127,28 +127,7 @@ struct RGWCompressionInfo {
 };
 WRITE_CLASS_ENCODER(RGWCompressionInfo)
 
-struct RGWBucketCompressionInfo {
-  uint64_t orig_size;
-
-  RGWBucketCompressionInfo() : orig_size(0) {}
-
-  void encode(bufferlist& bl) const {
-    ENCODE_START(1, 1, bl);
-    ::encode(orig_size, bl);
-    ENCODE_FINISH(bl);
-  }
-
-  void decode(bufferlist::iterator& bl) {
-     DECODE_START(1, bl);
-     ::decode(orig_size, bl);
-     DECODE_FINISH(bl);
-  }
-};
-WRITE_CLASS_ENCODER(RGWBucketCompressionInfo)
-
 int rgw_compression_info_from_attrset(map<string, bufferlist>& attrs, bool& need_decompress, RGWCompressionInfo& cs_info);
-// return 0, if find and read; -EIO, if find and not read; 1 if not find
-int rgw_bucket_compression_info_from_attrset(map<string, bufferlist>& attrs, RGWBucketCompressionInfo& cs_info);
 
 struct RGWOLHInfo {
   rgw_obj target;