From 248bd94dab4359dfea34bfa0cbdd16d9a9b76a02 Mon Sep 17 00:00:00 2001 From: Orit Wasserman Date: Mon, 9 Oct 2017 13:25:36 +0300 Subject: [PATCH] rgw: disable dynamic resharding in multisite environment Fixes:http://tracker.ceph.com/issues/21725 Signed-off-by: Orit Wasserman (cherry picked from commit f1ec7a49bde054a19a0a8fd80f37866e1e40379f) --- src/rgw/rgw_rados.h | 7 ++++++- src/rgw/rgw_reshard.cc | 12 +++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index 6984192f0f497..8a0cd14b48ee1 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -1860,7 +1860,7 @@ public: int get_zonegroup(RGWZoneGroup& zonegroup, const string& zonegroup_id); - bool is_single_zonegroup() + bool is_single_zonegroup() const { return (period_map.zonegroups.size() == 1); } @@ -3593,6 +3593,11 @@ public: (get_zonegroup().zones.size() > 1 || current_period.is_multi_zonegroups_with_zones()); } + bool can_reshard() const { + return current_period.get_id().empty() || + (zonegroup.zones.size() == 1 && current_period.is_single_zonegroup()); + } + librados::Rados* get_rados_handle(); int delete_raw_obj_aio(const rgw_raw_obj& obj, list& handles); diff --git a/src/rgw/rgw_reshard.cc b/src/rgw/rgw_reshard.cc index 0389ca33dce29..a3a712c767234 100644 --- a/src/rgw/rgw_reshard.cc +++ b/src/rgw/rgw_reshard.cc @@ -595,6 +595,11 @@ void RGWReshard::get_bucket_logshard_oid(const string& tenant, const string& buc int RGWReshard::add(cls_rgw_reshard_entry& entry) { + if (!store->can_reshard()) { + ldout(store->ctx(), 20) << __func__ << " Resharding is disabled" << dendl; + return 0; + } + string logshard_oid; get_bucket_logshard_oid(entry.tenant, entry.bucket_name, &logshard_oid); @@ -856,6 +861,10 @@ void RGWReshard::get_logshard_oid(int shard_num, string *logshard) int RGWReshard::process_all_logshards() { + if (!store->can_reshard()) { + ldout(store->ctx(), 20) << __func__ << " Resharding is disabled" << dendl; + return 0; + } int ret = 0; for (int i = 0; i < num_logshards; i++) { @@ -899,14 +908,11 @@ void *RGWReshard::ReshardWorker::entry() { utime_t last_run; do { utime_t start = ceph_clock_now(); - ldout(cct, 2) << "object expiration: start" << dendl; if (reshard->process_all_logshards()) { /* All shards have been processed properly. Next time we can start * from this moment. */ last_run = start; } - ldout(cct, 2) << "object expiration: stop" << dendl; - if (reshard->going_down()) break; -- 2.39.5