]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/rgw_rados: do not omap_getvals with (u64)-1 max
authorSage Weil <sage@redhat.com>
Mon, 21 Nov 2016 23:37:39 +0000 (18:37 -0500)
committerYehuda Sadeh <yehuda@redhat.com>
Tue, 29 Nov 2016 18:56:47 +0000 (10:56 -0800)
Fixes: http://tracker.ceph.com/issues/17985
This will make the OSD fall over if the object is big
and the OSD doesn't impose it's own fail-safe limit.

Signed-off-by: Sage Weil <sage@redhat.com>
src/rgw/rgw_rados.cc

index 8683b53b65f6f41c04508c8fb0440fe12d790191..b87c12ecaabd2d3cc312f0ed7208581c0461e56c 100644 (file)
@@ -11286,11 +11286,32 @@ int RGWRados::omap_get_vals(rgw_obj& obj, bufferlist& header, const string& mark
  
 }
 
-int RGWRados::omap_get_all(rgw_obj& obj, bufferlist& header, std::map<string, bufferlist>& m)
+int RGWRados::omap_get_all(rgw_obj& obj, bufferlist& header,
+                          std::map<string, bufferlist>& m)
 {
+  rgw_rados_ref ref;
+  rgw_bucket bucket;
+  int r = get_obj_ref(obj, &ref, &bucket);
+  if (r < 0) {
+    return r;
+  }
+
+  const int count = 1024;  // ?
   string start_after;
 
-  return omap_get_vals(obj, header, start_after, (uint64_t)-1, m);
+  while (true) {
+    std::map<string, bufferlist> t;
+    r = ref.ioctx.omap_get_vals(ref.oid, start_after, count, &m);
+    if (r < 0) {
+      return r;
+    }
+    if (t.empty()) {
+      break;
+    }
+    start_after = t.rbegin()->first;
+    m.insert(t.begin(), t.end());
+  }
+  return 0;
 }
 
 int RGWRados::omap_set(rgw_obj& obj, std::string& key, bufferlist& bl)