From cc4c6087d035d423fabb3fb253e08936aadd29c9 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 11 Jun 2015 13:30:16 -0700 Subject: [PATCH] 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 --- src/osd/PGBackend.cc | 9 ++++----- src/test/osd/types.cc | 7 +++++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/osd/PGBackend.cc b/src/osd/PGBackend.cc index 4ea47583d10..2acce7e07ab 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 a4ba72094d4..fae8607af67 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); } /* -- 2.47.3