Commit Graph

3 Commits

Author SHA1 Message Date
Raphael S. Carvalho
74febd97f2 sstables: avoid assert when generating cardinality metadata
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>
2015-06-24 18:58:17 +03:00
Raphael S. Carvalho
954688b327 hyperloglog: modify it according to our needs
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>
2015-06-23 12:13:25 -03:00
Raphael S. Carvalho
2c95fdd7b6 sstables: import hyperloglog implementation
Imported from: https://github.com/hideo55/cpp-HyperLogLog
HEAD: 3ff431b5af84aa28a6390430bbc60c4678bec763

hyperloglog is a cardinality estimator that will used by sstable
compaction metadata stored by Statistics file.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-06-23 11:59:45 -03:00