unaligned_cast violates strict aliasing, and causes code misgeneration on
gcc 6. Replace it with read_be/write_be, which are nicer anyway.
Message-Id: <1469122850-7511-1-git-send-email-avi@scylladb.com>
HyperLogLog constructor promises that it only throws instances of
std::invalid_argument. That's a lie since it also adds elements to a
vector (and doesn't catch potential bad_allocs).
Signed-off-by: Paweł Dziepak <pdziepak@scylladb.com>
This fixes a mysterious compilation problem which popped up after
changing header order. It could be that the name "VERSION" picks up
some macro, but I haven't really figured that exactly.
Assert should be completely avoided. Instead, we should trigger an
exception, allowing the db to proceed with a "smooth" shutdown.
Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
The first change was to add the function get_bytes, which will create
a temporary buffer with the format expected by compaction metadata's
cardinality. For creating the format, I had to import write_unsigned_
var_int from stream-lib.
write_unsigned_var_int is about using fewer bytes to encode smaller
integer values, but will use slighly more bytes to larger values.
The last change was to add the function offer_hashed, which receives
a 64-bit hashed value instead. Hash algorithm used by c* is murmur
hash - hash2_64.
Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>