From 2f90bfdb854750990881f2f53492687a07b19546 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) (cherry picked from commit 228760ce3a7109f50fc0f8e3c4a5697a423cb08f) --- 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 e4e22572d59e5..afa90b16e495f 100644 --- a/src/os/ObjectStore.cc +++ b/src/os/ObjectStore.cc @@ -144,7 +144,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 e1aceef4ac9b0..e93f05d268528 100644 --- a/src/osd/PGBackend.cc +++ b/src/osd/PGBackend.cc @@ -115,7 +115,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.39.5