mirror of
https://github.com/cloudflare/pingora.git
synced 2024-09-20 02:31:35 +02:00
Fix TinyUFO ahash in nightly Rust
I think ahash has this bug where the hash of &u64 and u64 are different under nightly build. This works around that.
This commit is contained in:
parent
8797329225
commit
dd54b59d38
2 changed files with 4 additions and 3 deletions
1
.bleep
Normal file
1
.bleep
Normal file
|
@ -0,0 +1 @@
|
|||
bc15229a4afa44364f388138e04cc05334937b5a
|
|
@ -403,7 +403,7 @@ impl<K: Hash, T: Clone + Send + Sync> TinyUfo<K, T> {
|
|||
///
|
||||
/// Return a list of [KV] of key and `T` that are evicted
|
||||
pub fn put(&self, key: K, data: T, weight: Weight) -> Vec<KV<T>> {
|
||||
let key = self.random_status.hash_one(key);
|
||||
let key = self.random_status.hash_one(&key);
|
||||
self.queues.admit(key, data, weight, false, &self.buckets)
|
||||
}
|
||||
|
||||
|
@ -422,13 +422,13 @@ impl<K: Hash, T: Clone + Send + Sync> TinyUfo<K, T> {
|
|||
/// Compared to [Self::put], the hit ratio when using this function is reduced by about 0.5pp or less in
|
||||
/// under zipf workloads.
|
||||
pub fn force_put(&self, key: K, data: T, weight: Weight) -> Vec<KV<T>> {
|
||||
let key = self.random_status.hash_one(key);
|
||||
let key = self.random_status.hash_one(&key);
|
||||
self.queues.admit(key, data, weight, true, &self.buckets)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
fn peek_queue(&self, key: K) -> Option<bool> {
|
||||
let key = self.random_status.hash_one(key);
|
||||
let key = self.random_status.hash_one(&key);
|
||||
self.buckets.pin().get(&key).map(|p| p.queue.value())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue