mirror of
https://github.com/ceph/ceph
synced 2025-02-19 17:08:05 +00:00
ReplicatedBackend: update the collection_list mechanisms to skip stashed objects
Signed-off-by: Samuel Just <sam.just@inktank.com>
This commit is contained in:
parent
4d56e3c831
commit
d3c8e85a44
@ -268,6 +268,14 @@ public:
|
||||
return generation == NO_GEN && shard_id == NO_SHARD;
|
||||
}
|
||||
|
||||
bool is_no_gen() const {
|
||||
return generation == NO_GEN;
|
||||
}
|
||||
|
||||
bool is_no_shard() const {
|
||||
return shard_id == NO_SHARD;
|
||||
}
|
||||
|
||||
// maximum sorted value.
|
||||
static ghobject_t get_max() {
|
||||
ghobject_t h(hobject_t::get_max());
|
||||
|
@ -227,25 +227,33 @@ int ReplicatedBackend::objects_list_partial(
|
||||
vector<hobject_t> *ls,
|
||||
hobject_t *next)
|
||||
{
|
||||
vector<ghobject_t> objects;
|
||||
ghobject_t _next;
|
||||
int r = osd->store->collection_list_partial(
|
||||
coll,
|
||||
begin,
|
||||
min,
|
||||
max,
|
||||
seq,
|
||||
&objects,
|
||||
&_next);
|
||||
ls->reserve(objects.size());
|
||||
for (vector<ghobject_t>::iterator i = objects.begin();
|
||||
i != objects.end();
|
||||
++i) {
|
||||
assert(i->is_degenerate());
|
||||
ls->push_back(i->hobj);
|
||||
assert(ls);
|
||||
ghobject_t _next(begin);
|
||||
ls->reserve(max);
|
||||
int r = 0;
|
||||
while (!_next.is_max() && ls->size() < (unsigned)min) {
|
||||
vector<ghobject_t> objects;
|
||||
int r = osd->store->collection_list_partial(
|
||||
coll,
|
||||
_next,
|
||||
min - ls->size(),
|
||||
max - ls->size(),
|
||||
seq,
|
||||
&objects,
|
||||
&_next);
|
||||
if (r != 0)
|
||||
break;
|
||||
for (vector<ghobject_t>::iterator i = objects.begin();
|
||||
i != objects.end();
|
||||
++i) {
|
||||
assert(i->is_no_shard());
|
||||
if (i->is_no_gen()) {
|
||||
ls->push_back(i->hobj);
|
||||
}
|
||||
}
|
||||
}
|
||||
assert(_next.is_degenerate());
|
||||
*next = _next.hobj;
|
||||
if (r == 0)
|
||||
*next = _next.hobj;
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -255,6 +263,7 @@ int ReplicatedBackend::objects_list_range(
|
||||
snapid_t seq,
|
||||
vector<hobject_t> *ls)
|
||||
{
|
||||
assert(ls);
|
||||
vector<ghobject_t> objects;
|
||||
int r = osd->store->collection_list_range(
|
||||
coll,
|
||||
@ -266,8 +275,10 @@ int ReplicatedBackend::objects_list_range(
|
||||
for (vector<ghobject_t>::iterator i = objects.begin();
|
||||
i != objects.end();
|
||||
++i) {
|
||||
assert(i->is_degenerate());
|
||||
ls->push_back(i->hobj);
|
||||
assert(i->is_no_shard());
|
||||
if (i->is_no_gen()) {
|
||||
ls->push_back(i->hobj);
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user