From: Sage Weil Date: Thu, 11 Jun 2015 20:30:16 +0000 (-0700) Subject: osd/PGBackend: set correct shard in objects_list_partial X-Git-Tag: v9.0.3~52^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=cc4c6087d035d423fabb3fb253e08936aadd29c9;p=ceph.git osd/PGBackend: set correct shard in objects_list_partial 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 --- diff --git a/src/osd/PGBackend.cc b/src/osd/PGBackend.cc index 4ea47583d106..2acce7e07ab4 100644 --- a/src/osd/PGBackend.cc +++ b/src/osd/PGBackend.cc @@ -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) { diff --git a/src/test/osd/types.cc b/src/test/osd/types.cc index a4ba72094d48..fae8607af67a 100644 --- a/src/test/osd/types.cc +++ b/src/test/osd/types.cc @@ -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); } /*