]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: do not specify all placement targets when sync module never writes 32290/head
authorjiahuizeng <jhzeng93@foxmail.com>
Tue, 17 Dec 2019 09:39:34 +0000 (09:39 +0000)
committerjiahuizeng <jhzeng93@foxmail.com>
Wed, 18 Dec 2019 03:03:18 +0000 (03:03 +0000)
Fixes: https://tracker.ceph.com/issues/43350
Signed-off-by: jiahuizeng <jhzeng93@foxmail.com>
src/rgw/rgw_bucket.cc
src/rgw/services/svc_zone.cc
src/rgw/services/svc_zone.h

index f702d8d5e12a1644a1b2a5d47b7f23b8437ba139..e001caacb9185a5b0a15d70d6b28fb562418debe 100644 (file)
@@ -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 {
index 261e02678ccf9e65ee3d26ef8b80fa849d138a2d..b80bd6df3f0a41c2e00ea2c25f465c99fc475d4a 100644 (file)
@@ -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;
index 3c69c97ca37dec8f2bc0cba22cb515c51a39ca4e..c321e1d12a5ef86ddbcc085e4c58b99ff7118d63 100644 (file)
@@ -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;