From: Orit Wasserman Date: Thu, 18 May 2017 19:47:12 +0000 (+0300) Subject: rgw: add a function to add a bucket to the resharding queue X-Git-Tag: v12.1.0~276^2~38 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=9a084497fdac22b7b757c096c4114319adec228a;p=ceph-ci.git rgw: add a function to add a bucket to the resharding queue Signed-off-by: Orit Wasserman --- diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index bb3e34a26ea..10e2cc49d3e 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -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) diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index d9d67065755..7a856b42f5a 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -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();