Skip to content

Commit

Permalink
dataflow-state: Add some missing cases in eviction path
Browse files Browse the repository at this point in the history
While scanning the eviction code, I noticed a missing case in a
match statement.  Since that might not have been the only mistake,
an audit was conducted of the entire file, which revealed two
additional accidental omissions.  Clearly the code could use some
refactoring via macros to make it more dense and to make these
errors easier to see, but in light of possible near-term renovation,
I'm just going to make things more correct for now.

Change-Id: Ib999845211ca077aa66c49d89ca499376d060644
Reviewed-on: https://gerrit.readyset.name/c/readyset/+/7746
Tested-by: Buildkite CI
Reviewed-by: Jason Brown <[email protected]>
  • Loading branch information
rs-sac committed Jul 24, 2024
1 parent 3bd9e50 commit 413ccdf
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions dataflow-state/src/keyed_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ impl KeyedState {
(KeyedState::DoubleBTree(m), RangeKey::Double(range)) => range!(m, range),
(KeyedState::TriBTree(m), RangeKey::Tri(range)) => range!(m, range),
(KeyedState::QuadBTree(m), RangeKey::Quad(range)) => range!(m, range),
(KeyedState::QuinBTree(m), RangeKey::Quin(range)) => range!(m, range),
(KeyedState::SexBTree(m), RangeKey::Sex(range)) => range!(m, range),
(KeyedState::MultiBTree(m, _), RangeKey::Multi(range)) => m
.range::<_, [DfValue]>(&(
Expand All @@ -453,6 +454,7 @@ impl KeyedState {
| KeyedState::DoubleHash(_)
| KeyedState::TriHash(_)
| KeyedState::QuadHash(_)
| KeyedState::QuinHash(_)
| KeyedState::SexHash(_)
| KeyedState::MultiHash(..),
_,
Expand Down Expand Up @@ -489,6 +491,11 @@ impl KeyedState {
m.swap_remove_index(index)
.map(|(k, rs)| (rs, k.into_elements().collect()))
}
KeyedState::QuinHash(ref mut m) if !m.is_empty() => {
let index = seed % m.len();
m.swap_remove_index(index)
.map(|(k, rs)| (rs, k.into_elements().collect()))
}
KeyedState::SexHash(ref mut m) if !m.is_empty() => {
let index = seed % m.len();
m.swap_remove_index(index)
Expand Down

0 comments on commit 413ccdf

Please sign in to comment.