]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/newstore: make collection_list tolerate sloppy start position
authorSage Weil <sage@redhat.com>
Tue, 24 Nov 2015 19:12:05 +0000 (14:12 -0500)
committerSage Weil <sage@redhat.com>
Fri, 1 Jan 2016 18:05:18 +0000 (13:05 -0500)
Because of this change (#6076), the hobject_t will contain pool id, hence
the ghobject_t having this hobject_t will be not equal to ghobject_t().

In newstore, this will cause assertion failure:
FAILED assert(k >= start_key && k < end_key)

The fix is to make compatible with previous change to create a
ghobject_t object with pool id and shard id in newstore.

Fixes: #13801
Reported-by: Zhi Zhang <zhangz.david@outlook.com>
Signed-off-by: Sage Weil <sage@redhat.com>
src/os/newstore/NewStore.cc
src/osd/osd_types.h

index 59d60b3007d67e510860a873ba1ed2df7fd69c50..0f797a3477807d3fe9be38c52cd13066be5678bf 100644 (file)
@@ -1734,7 +1734,7 @@ int NewStore::collection_list(
           << " to " << pretty_binary_string(end_key)
           << " start " << start << dendl;
   it = db->get_iterator(PREFIX_OBJ);
-  if (start == ghobject_t()) {
+  if (start == ghobject_t() || start == cid.get_min_hobj()) {
     it->upper_bound(temp_start_key);
     temp = true;
   } else {
index a440dee6f56cce44e5a52b6079a4a89499a20694..b58f7d1230cbe30787a1ab9796cee2c889eaf364 100644 (file)
@@ -623,6 +623,22 @@ public:
     return coll_t(TYPE_PG_TEMP, pgid, 0);
   }
 
+  ghobject_t get_min_hobj() const {
+    ghobject_t o;
+    switch (type) {
+    case TYPE_PG:
+      o.hobj.pool = pgid.pool();
+      o.set_shard(pgid.shard);
+      break;
+    case TYPE_META:
+      o.hobj.pool = -1;
+      break;
+    default:
+      break;
+    }
+    return o;
+  }
+
   void dump(Formatter *f) const;
   static void generate_test_instances(list<coll_t*>& o);
 };