]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: add a function to add a bucket to the resharding queue
authorOrit Wasserman <owasserm@redhat.com>
Thu, 18 May 2017 19:47:12 +0000 (22:47 +0300)
committerYehuda Sadeh <yehuda@redhat.com>
Mon, 5 Jun 2017 20:17:50 +0000 (13:17 -0700)
Signed-off-by: Orit Wasserman <owasserm@redhat.com>
src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h

index bb3e34a26eaf0103f8c4c267a79c7ceee5f09f90..10e2cc49d3ee8260f6f64088400598d0048b1c31 100644 (file)
@@ -13091,6 +13091,22 @@ int RGWRados::check_bucket_shards(const rgw_user& bucket_owner, rgw_bucket& buck
                                            bucket_owner, bucket, bucket_quota, 1, need_resharding);
 }
 
+int RGWRados::add_bucket_to_reshard(const RGWBucketInfo& bucket_info)
+{
+  RGWReshard reshard(this);
+
+  int num_source_shards = (bucket_info.num_shards > 0 ? bucket_info.num_shards : 1);
+
+  cls_rgw_reshard_entry entry;
+  entry.time = real_clock::now();
+  entry.tenant = bucket_info.owner.tenant;
+  entry.bucket_name = bucket_info.bucket.name;
+  entry.bucket_id = bucket_info.bucket.bucket_id;
+  entry.old_num_shards = num_source_shards;
+  entry.new_num_shards = num_source_shards >> 1;
+
+  return reshard.add(entry);
+}
 
 int RGWRados::check_quota(const rgw_user& bucket_owner, rgw_bucket& bucket,
                           RGWQuotaInfo& user_quota, RGWQuotaInfo& bucket_quota, uint64_t obj_size)
index d9d670657551f02020472851f4cfe017290dd76d..7a856b42f5a46e2b1a736f8707abea18146ed73e 100644 (file)
@@ -3483,6 +3483,8 @@ public:
                          RGWQuotaInfo& bucket_quota, uint64_t num_shards,
                          bool& need_resharding);
 
+  int add_bucket_to_reshard(const RGWBucketInfo& bucket_info);
+
   uint64_t instance_id();
   const string& zone_id() {
     return get_zone_params().get_id();