Merge remote-tracking branch 'origin/topic/matthias/bloomfilter-fix'

* origin/topic/matthias/bloomfilter-fix:
  Switch to double hashing.
  Use full digest length instead of just one byte.

BIT-1140 #merged
This commit is contained in:
Robin Sommer 2014-06-05 14:42:26 -07:00
commit 0f372c99df
2 changed files with 3 additions and 3 deletions

View file

@ -108,7 +108,7 @@ Hasher::digest UHF::hash(const void* x, size_t n) const
MD5(d, 16, d);
return d[0];
return *reinterpret_cast<const Hasher::digest*>(d);
}
DefaultHasher::DefaultHasher(size_t k, size_t seed)

View file

@ -44,7 +44,7 @@ function bloomfilter_basic_init%(fp: double, capacity: count,
size_t optimal_k = BasicBloomFilter::K(cells, capacity);
size_t seed = Hasher::MakeSeed(name->Len() > 0 ? name->Bytes() : 0,
name->Len());
const Hasher* h = new DefaultHasher(optimal_k, seed);
const Hasher* h = new DoubleHasher(optimal_k, seed);
return new BloomFilterVal(new BasicBloomFilter(h, cells));
%}
@ -84,7 +84,7 @@ function bloomfilter_basic_init2%(k: count, cells: count,
size_t seed = Hasher::MakeSeed(name->Len() > 0 ? name->Bytes() : 0,
name->Len());
const Hasher* h = new DefaultHasher(k, seed);
const Hasher* h = new DoubleHasher(k, seed);
return new BloomFilterVal(new BasicBloomFilter(h, cells));
%}