]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/ReplicatedPG: fix copy-get iteration of omap keys 989/head
authorSage Weil <sage@inktank.com>
Mon, 23 Dec 2013 20:52:34 +0000 (12:52 -0800)
committerSage Weil <sage@inktank.com>
Mon, 23 Dec 2013 20:54:00 +0000 (12:54 -0800)
We need to call upper_bound() before checking if the iterator is valid!

Signed-off-by: Sage Weil <sage@inktank.com>
src/osd/ReplicatedPG.cc

index 0eb16ba2131541ef9ec728a7b813c3bf20e8d570..93258209df05cca7a7d81f4a00e72cda5fc5f05c 100644 (file)
@@ -4682,8 +4682,8 @@ int ReplicatedPG::fill_in_copy_get(bufferlist::iterator& bp, OSDOp& osd_op,
     ObjectMap::ObjectMapIterator iter =
       osd->store->get_omap_iterator(coll, oi.soid);
     assert(iter);
+    iter->upper_bound(cursor.omap_offset);
     if (iter->valid()) {
-      iter->upper_bound(cursor.omap_offset);
       for (; left > 0 && iter->valid(); iter->next()) {
        out_omap.insert(make_pair(iter->key(), iter->value()));
        left -= iter->key().length() + 4 + iter->value().length() + 4;
@@ -4698,10 +4698,11 @@ int ReplicatedPG::fill_in_copy_get(bufferlist::iterator& bp, OSDOp& osd_op,
   }
 
   dout(20) << " cursor.is_complete=" << cursor.is_complete()
-                    << " " << out_attrs.size() << " attrs"
-                    << " " << bl.length() << " bytes"
-                    << " " << out_omap.size() << " keys"
-                    << dendl;
+          << " " << out_attrs.size() << " attrs"
+          << " " << bl.length() << " bytes"
+          << " " << reply_obj.omap_header.length() << " omap header bytes"
+          << " " << out_omap.size() << " keys"
+          << dendl;
   reply_obj.cursor = cursor;
   if (classic) {
     if (reply_obj.omap_header.length() > 0) {