mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-12 19:02:12 +00:00
types: fix uuid_type_impl::less
timeuuid_type_impl::compare_bytes is a "trichotomic" comparator (-1, 0, 1) while less() is a "less" comparator (false, true). The code incorrectly returns c1 instead of c1 < 0 which breaks the ordering. Fixes #1196. Message-Id: <1473956716-5209-1-git-send-email-tgrabiec@scylladb.com>
This commit is contained in:
committed by
Paweł Dziepak
parent
bc3cbb7009
commit
804fe50b7f
8
types.cc
8
types.cc
@@ -773,11 +773,9 @@ struct uuid_type_impl : concrete_type<utils::UUID> {
|
||||
}
|
||||
|
||||
if (v1 == 1) {
|
||||
auto c1 = timeuuid_type_impl::compare_bytes(b1, b2);
|
||||
auto c2 = timeuuid_type_impl::compare_bytes(b2, b1);
|
||||
// Require strict ordering
|
||||
if (c1 != c2) {
|
||||
return c1;
|
||||
auto c = timeuuid_type_impl::compare_bytes(b1, b2);
|
||||
if (c) {
|
||||
return c < 0;
|
||||
}
|
||||
}
|
||||
return less_unsigned(b1, b2);
|
||||
|
||||
Reference in New Issue
Block a user