diff options
author | Samuel Just <sam.just@inktank.com> | 2012-12-06 22:57:01 +0100 |
---|---|---|
committer | Samuel Just <sam.just@inktank.com> | 2012-12-07 01:56:25 +0100 |
commit | f2914af52ebb3005d23ddd4fbf1dd882c53a03c5 (patch) | |
tree | ca65ad204c52670c9bec08b3c7c6a1c35683825b /src/os | |
parent | rbd: remove block-by-block messages when exporting (diff) | |
download | ceph-f2914af52ebb3005d23ddd4fbf1dd882c53a03c5.tar.xz ceph-f2914af52ebb3005d23ddd4fbf1dd882c53a03c5.zip |
HashIndex: fix list_by_hash handling of next->is_max()
get_path_str() should not handle hobject_t::get_max(). get_path_str()
now asserts that the passed object is not max and the callers now check
for is_max(). This caused HashIndex.cc to incorrectly scan an entire
collection before returning no objects rather than scanning the top
level and returning no objects. It did not actually list_by_hash to
return an incorrect answer, however.
Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'src/os')
-rw-r--r-- | src/os/HashIndex.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/os/HashIndex.cc b/src/os/HashIndex.cc index 34a7074bce0..8948c506411 100644 --- a/src/os/HashIndex.cc +++ b/src/os/HashIndex.cc @@ -371,6 +371,7 @@ string HashIndex::get_hash_str(uint32_t hash) { } string HashIndex::get_path_str(const hobject_t &hoid) { + assert(!hoid.is_max()); return get_hash_str(hoid.hash); } @@ -428,7 +429,8 @@ int HashIndex::get_path_contents_by_hash(const vector<string> &path, if (lower_bound && candidate < lower_bound->substr(0, candidate.size())) continue; if (next_object && - candidate < get_path_str(*next_object).substr(0, candidate.size())) + (next_object->is_max() || + candidate < get_path_str(*next_object).substr(0, candidate.size()))) continue; hash_prefixes->insert(cur_prefix + *i); } |