]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: remove placement_rule from cls_user_bucket_entry 18767/head
authorCasey Bodley <cbodley@redhat.com>
Tue, 31 Oct 2017 20:56:01 +0000 (16:56 -0400)
committerNathan Cutler <ncutler@suse.com>
Mon, 6 Nov 2017 12:35:44 +0000 (13:35 +0100)
placement_rule is no longer needed in cls_user_bucket_entry, because the
only time that it's needed, we can read it from the bucket instance in
RGWRados::update_containers_stats()

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 8e62e3526643da67f5af7daa687120feed469785)

src/cls/user/cls_user.cc
src/cls/user/cls_user_types.cc
src/cls/user/cls_user_types.h
src/rgw/rgw_common.h

index b4d6001fae18908f60517e0bbf5852f257f9b1ff..840470e9f4d9b665a6b0d647046759a39f2099bb 100644 (file)
@@ -157,12 +157,6 @@ static int cls_user_set_buckets_info(cls_method_context_t hctx, bufferlist *in,
     CLS_LOG(20, "storing entry for key=%s size=%lld count=%lld",
             key.c_str(), (long long)update_entry.size, (long long)update_entry.count);
 
-    // Update bucket's placement rule info only when linking bucket, not on
-    // usage stats change. */
-    if (op.add) {
-      entry.placement_rule = update_entry.placement_rule;
-    }
-
     // sync entry stats when not an op.add, as when the case is op.add if its a
     // new entry we already have copied update_entry earlier, OTOH, for an existing entry
     // we end up clobbering the existing stats for the bucket
index eea32d7b799a595c81bee3eecd4a364f62bb14af..be3280ca2bd9116bb877d90bb7b041e91b3ce3fb 100644 (file)
@@ -39,7 +39,6 @@ void cls_user_bucket_entry::dump(Formatter *f) const
   encode_json("creation_time", utime_t(creation_time), f);
   encode_json("count", count, f);
   encode_json("user_stats_sync", user_stats_sync, f);
-  encode_json("placement_rule", placement_rule, f);
 }
 
 void cls_user_gen_test_bucket_entry(cls_user_bucket_entry *entry, int i)
index 41c85d2cd83134d6b9e8a8d7244d5cb1c312d2e7..6ffd933231606e188ed420cf2d4d11ea978c99bf 100644 (file)
@@ -105,15 +105,10 @@ struct cls_user_bucket_entry {
   uint64_t count;
   bool user_stats_sync;
 
-  /* The placement_rule is necessary to calculate per-storage-policy statics
-   * of the Swift API. Although the info available in RGWBucketInfo, we need
-   * to duplicate it here to not affect the performance of buckets listing. */
-  std::string placement_rule;
-
   cls_user_bucket_entry() : size(0), size_rounded(0), count(0), user_stats_sync(false) {}
 
   void encode(bufferlist& bl) const {
-    ENCODE_START(8, 5, bl);
+    ENCODE_START(9, 5, bl);
     uint64_t s = size;
     __u32 mt = ceph::real_clock::to_time_t(creation_time);
     string empty_str;  // originally had the bucket name here, but we encode bucket later
@@ -126,11 +121,11 @@ struct cls_user_bucket_entry {
     ::encode(s, bl);
     ::encode(user_stats_sync, bl);
     ::encode(creation_time, bl);
-    ::encode(placement_rule, bl);
+    //::encode(placement_rule, bl); removed in v9
     ENCODE_FINISH(bl);
   }
   void decode(bufferlist::iterator& bl) {
-    DECODE_START_LEGACY_COMPAT_LEN(6, 5, 5, bl);
+    DECODE_START_LEGACY_COMPAT_LEN(9, 5, 5, bl);
     __u32 mt;
     uint64_t s;
     string empty_str;  // backward compatibility
@@ -152,8 +147,10 @@ struct cls_user_bucket_entry {
       ::decode(user_stats_sync, bl);
     if (struct_v >= 7)
       ::decode(creation_time, bl);
-    if (struct_v >= 8)
+    if (struct_v == 8) { // added in v8, removed in v9
+      std::string placement_rule;
       ::decode(placement_rule, bl);
+    }
     DECODE_FINISH(bl);
   }
   void dump(Formatter *f) const;
index 54f96d30f50d2682b9d30fd10b86f73d5c715f82..6146d1cb33cc720d5a7cde51f6d0e069355c30ad 100644 (file)
@@ -1899,8 +1899,7 @@ struct RGWBucketEnt {
       size(e.size),
       size_rounded(e.size_rounded),
       creation_time(e.creation_time),
-      count(e.count),
-      placement_rule(std::move(e.placement_rule)) {
+      count(e.count) {
   }
 
   RGWBucketEnt& operator=(const RGWBucketEnt&) = default;