mirror of
https://github.com/ceph/ceph
synced 2025-03-22 10:17:23 +00:00
Merge pull request #37999 from trociny/wip-48153
os/bluestore: fix "end reached" check in collection_list_legacy Reviewed-by: Josh Durgin <jdurgin@redhat.com> Reviewed-by: Igor Fedotov <ifedotov@suse.com> Reviewed-by: Neha Ojha <nojha@redhat.com>
This commit is contained in:
commit
d121f4b31e
@ -646,6 +646,16 @@ public:
|
||||
virtual void upper_bound(const ghobject_t &oid) = 0;
|
||||
virtual void next() = 0;
|
||||
|
||||
virtual int cmp(const ghobject_t &oid) const = 0;
|
||||
|
||||
bool is_ge(const ghobject_t &oid) const {
|
||||
return cmp(oid) >= 0;
|
||||
}
|
||||
|
||||
bool is_lt(const ghobject_t &oid) const {
|
||||
return cmp(oid) < 0;
|
||||
}
|
||||
|
||||
protected:
|
||||
KeyValueDB::Iterator m_it;
|
||||
};
|
||||
@ -689,6 +699,15 @@ public:
|
||||
get_oid();
|
||||
}
|
||||
|
||||
int cmp(const ghobject_t &oid) const override {
|
||||
ceph_assert(valid());
|
||||
|
||||
string key;
|
||||
get_object_key(m_cct, oid, &key);
|
||||
|
||||
return m_it->key().compare(key);
|
||||
}
|
||||
|
||||
private:
|
||||
CephContext *m_cct;
|
||||
ghobject_t m_oid;
|
||||
@ -762,6 +781,18 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
int cmp(const ghobject_t &oid) const override {
|
||||
ceph_assert(valid());
|
||||
|
||||
if (this->oid() < oid) {
|
||||
return -1;
|
||||
}
|
||||
if (this->oid() > oid) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private:
|
||||
std::map<ghobject_t, std::string> m_chunk;
|
||||
std::map<ghobject_t, std::string>::iterator m_chunk_iter;
|
||||
@ -10256,14 +10287,14 @@ int BlueStore::_collection_list(
|
||||
}
|
||||
dout(20) << __func__ << " pend " << pend << dendl;
|
||||
while (true) {
|
||||
if (!it->valid() || it->oid() >= pend) {
|
||||
if (!it->valid() || it->is_ge(pend)) {
|
||||
if (!it->valid())
|
||||
dout(20) << __func__ << " iterator not valid (end of db?)" << dendl;
|
||||
else
|
||||
dout(20) << __func__ << " oid " << it->oid() << " >= " << pend << dendl;
|
||||
if (temp) {
|
||||
if (end.hobj.is_temp()) {
|
||||
if (it->valid() && it->oid() < coll_range_temp_end) {
|
||||
if (it->valid() && it->is_lt(coll_range_temp_end)) {
|
||||
*pnext = it->oid();
|
||||
set_next = true;
|
||||
}
|
||||
@ -10279,7 +10310,7 @@ int BlueStore::_collection_list(
|
||||
dout(30) << __func__ << " pend " << pend << dendl;
|
||||
continue;
|
||||
}
|
||||
if (it->valid() && it->oid() < coll_range_end) {
|
||||
if (it->valid() && it->is_lt(coll_range_end)) {
|
||||
*pnext = it->oid();
|
||||
set_next = true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user