]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/PGBackend: set correct shard in objects_list_partial
authorSage Weil <sage@redhat.com>
Thu, 11 Jun 2015 20:30:16 +0000 (13:30 -0700)
committerSage Weil <sage@redhat.com>
Fri, 19 Jun 2015 00:02:49 +0000 (17:02 -0700)
We need to list objects within the current shard only.  We could get away
with being sloppy about shard previously when the ghobject_t sort order
was broken, but not in the new world.  Here, it is only necessary that we
capture all generations of the object to get the marker.

Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/PGBackend.cc
src/test/osd/types.cc

index 4ea47583d1061ef8834000b33fe7fa13b449958e..2acce7e07ab443a9e4a5a67737ae105dd870cd08 100644 (file)
@@ -105,11 +105,10 @@ int PGBackend::objects_list_partial(
   hobject_t *next)
 {
   assert(ls);
-  // Starts with the smallest shard id and generation to
-  // make sure the result list has the marker object (
-  // it might have multiple generations though, which would
-  // be filtered).
-  ghobject_t _next(begin, 0, shard_id_t::NO_SHARD);
+  // Starts with the smallest generation to make sure the result list
+  // has the marker object (it might have multiple generations
+  // though, which would be filtered).
+  ghobject_t _next(begin, 0, get_parent()->whoami_shard().shard);
   ls->reserve(max);
   int r = 0;
   while (!_next.is_max() && ls->size() < (unsigned)min) {
index a4ba72094d48d939e195fb03868b37846e1642a7..fae8607af67a79915d4046e89b0f1633ff865662 100644 (file)
@@ -1365,6 +1365,13 @@ TEST(ghobject_t, cmp) {
   sep.hobj.pool = -1;
   cout << min << " < " << sep << std::endl;
   ASSERT_LT(min, sep);
+
+  sep.set_shard(shard_id_t::NO_SHARD);
+  cout << "sep shard " << sep.shard_id << std::endl;
+  ghobject_t o(hobject_t(object_t(), string(), CEPH_NOSNAP, 0x42,
+                        1, string()));
+  cout << "o " << o << std::endl;
+  ASSERT_GT(o, sep);
 }
 
 /*