From 228760ce3a7109f50fc0f8e3c4a5697a423cb08f Mon Sep 17 00:00:00 2001 From: Guang Yang Date: Wed, 9 Jul 2014 11:20:36 +0000 Subject: [PATCH] Fix the PG listing issue which could miss objects for EC pool (where there is object shard and generation). Backport: firefly Signed-off-by: Guang Yang (yguang@yahoo-inc.com) --- src/os/ObjectStore.cc | 6 +++++- src/osd/PGBackend.cc | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/os/ObjectStore.cc b/src/os/ObjectStore.cc index 4e77af93e261..dfd5a33de075 100644 --- a/src/os/ObjectStore.cc +++ b/src/os/ObjectStore.cc @@ -610,7 +610,11 @@ int ObjectStore::collection_list_range(coll_t c, hobject_t start, hobject_t end, snapid_t seq, vector *ls) { vector go; - ghobject_t gstart(start), gend(end); + // Starts with the smallest shard id and generation to + // make sure the result list has the marker object + ghobject_t gstart(start, 0, shard_id_t(0)); + // Exclusive end, choose the smallest end ghobject + ghobject_t gend(end, 0, shard_id_t(0)); int ret = collection_list_range(c, gstart, gend, seq, &go); if (ret == 0) { ls->reserve(go.size()); diff --git a/src/osd/PGBackend.cc b/src/osd/PGBackend.cc index 09cbe8daa501..39e4b7809eb8 100644 --- a/src/osd/PGBackend.cc +++ b/src/osd/PGBackend.cc @@ -116,7 +116,11 @@ int PGBackend::objects_list_partial( hobject_t *next) { assert(ls); - ghobject_t _next(begin); + // 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(0)); ls->reserve(max); int r = 0; while (!_next.is_max() && ls->size() < (unsigned)min) { -- 2.47.3