You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cache: tinylfu policy tests use degenerate [b; 32] keys #1854
crates/cache/src/policy/sketch.rs documents an explicit key() helper whose docstring explains that [b; 32] keys make the shard-routing slice and the four row slices perfectly correlated and put every row on one column, so a test built on them cannot observe a routing bug at all.
crates/cache/src/policy/tinylfu.rs still uses h(b) = [b; 32] for all five of its tests, including tinylfu_evicts_least_frequent_first_not_least_recent — which tests the cross-shard ranking property, exactly the thing degenerate keys cannot exercise.
Those tests were equally degenerate before sharding so this is not a regression, but the sketch module now establishes the convention and the sister module violates it.
Fix: switch tinylfu.rs's test keys to full-entropy hashes (Hash::new(i.to_le_bytes()), as sketch.rs's key() does).
Activity
test(cache): use full-entropy keys in tinylfu policy tests (#1854) (#…