binary search: fix token comparator

compare_unsigned cannot be used directly on a token. We need to use the
dht-provided token comparators.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
This commit is contained in:
Glauber Costa
2015-04-29 21:30:41 -04:00
parent 9e8f6c4e50
commit 1bd12ec2ff

View File

@@ -42,9 +42,10 @@ int sstable::binary_search(const T& entries, const key& sk) {
auto mid_key = key_view(mid_bytes);
auto mid_token = partitioner.get_token(mid_key);
result = compare_unsigned(bytes_view(token._data), bytes_view(mid_token._data));
if (result == 0) {
if (token == mid_token) {
result = compare_unsigned(sk_bytes, mid_bytes);
} else {
result = token < mid_token ? -1 : 1;
}
if (result > 0) {