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());
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;
}
snapid_t seq,
vector<hobject_t> *ls)
{
+ assert(ls);
vector<ghobject_t> objects;
int r = osd->store->collection_list_range(
coll,
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;
}