From: jiahuizeng Date: Tue, 17 Dec 2019 09:39:34 +0000 (+0000) Subject: rgw: do not specify all placement targets when sync module never writes X-Git-Tag: v15.1.0~96^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2df7a1c06fc5bbff209998a2447cc5a7239a9e11;p=ceph.git rgw: do not specify all placement targets when sync module never writes Fixes: https://tracker.ceph.com/issues/43350 Signed-off-by: jiahuizeng --- diff --git a/src/rgw/rgw_bucket.cc b/src/rgw/rgw_bucket.cc index f702d8d5e12a..e001caacb918 100644 --- a/src/rgw/rgw_bucket.cc +++ b/src/rgw/rgw_bucket.cc @@ -2995,10 +2995,13 @@ int RGWMetadataHandlerPut_BucketInstance::put_check() bci.info.bucket.name = bucket_name; bci.info.bucket.bucket_id = bucket_instance; bci.info.bucket.tenant = tenant_name; - ret = bihandler->svc.zone->select_bucket_location_by_rule(bci.info.placement_rule, &rule_info); - if (ret < 0) { - ldout(cct, 0) << "ERROR: select_bucket_placement() returned " << ret << dendl; - return ret; + // if the sync module never writes data, don't require the zone to specify all placement targets + if (bihandler->svc.zone->sync_module_supports_writes()) { + ret = bihandler->svc.zone->select_bucket_location_by_rule(bci.info.placement_rule, &rule_info); + if (ret < 0) { + ldout(cct, 0) << "ERROR: select_bucket_placement() returned " << ret << dendl; + return ret; + } } bci.info.index_type = rule_info.index_type; } else { diff --git a/src/rgw/services/svc_zone.cc b/src/rgw/services/svc_zone.cc index 261e02678ccf..b80bd6df3f0a 100644 --- a/src/rgw/services/svc_zone.cc +++ b/src/rgw/services/svc_zone.cc @@ -841,6 +841,11 @@ bool RGWSI_Zone::zone_is_writeable() return writeable_zone && !get_zone().is_read_only(); } +bool RGWSI_Zone::sync_module_supports_writes() const +{ + return writeable_zone; +} + uint32_t RGWSI_Zone::get_zone_short_id() const { return zone_short_id; diff --git a/src/rgw/services/svc_zone.h b/src/rgw/services/svc_zone.h index 3c69c97ca37d..c321e1d12a5e 100644 --- a/src/rgw/services/svc_zone.h +++ b/src/rgw/services/svc_zone.h @@ -77,6 +77,7 @@ public: bool zone_is_writeable(); bool zone_syncs_from(const RGWZone& target_zone, const RGWZone& source_zone) const; bool get_redirect_zone_endpoint(string *endpoint); + bool sync_module_supports_writes() const; RGWRESTConn *get_master_conn() { return rest_master_conn;