]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: merge manifests correctly when there's prefix override 4697/head
authorYehuda Sadeh <yehuda@redhat.com>
Thu, 14 May 2015 00:05:22 +0000 (17:05 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 15 May 2015 18:11:09 +0000 (11:11 -0700)
Fixes: #11622
Backport: hammer, firefly

Prefix override happens in a manifest when a rados object does not
conform to the generic prefix set on the manifest. When merging
manifests (specifically being used in multipart objects upload), we need
to check if the rule that we try to merge has a prefix that is the same
as the previous rule. Beforehand we checked if both had the same
override_prefix setting, but that might not apply as both manifests
might have different prefixes.

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
(cherry picked from commit 389ae6739ddc6239a4dd7c5f7f9bfc9b645b8577)

src/rgw/rgw_rados.cc

index ff0c3d275a5ec4dc82c9a0227f651d4eb159786e..25923e1534610d14beddcf6d6f8d317a8422bf7d 100644 (file)
@@ -758,15 +758,24 @@ int RGWObjManifest::append(RGWObjManifest& m)
       next_rule.part_size = m.obj_size - next_rule.start_ofs;
     }
 
-    if (override_prefix != rule.override_prefix) {
-      append_rules(m, miter, &override_prefix);
-      break;
+    string rule_prefix = prefix;
+    if (!rule.override_prefix.empty()) {
+      rule_prefix = rule.override_prefix;
+    }
+
+    string next_rule_prefix = m.prefix;
+    if (!next_rule.override_prefix.empty()) {
+      next_rule_prefix = next_rule.override_prefix;
     }
 
     if (rule.part_size != next_rule.part_size ||
         rule.stripe_max_size != next_rule.stripe_max_size ||
-        rule.override_prefix != next_rule.override_prefix) {
-      append_rules(m, miter, NULL);
+        rule_prefix != next_rule_prefix) {
+      if (next_rule_prefix != prefix) {
+        append_rules(m, miter, &next_rule_prefix);
+      } else {
+        append_rules(m, miter, NULL);
+      }
       break;
     }