-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rework CommitHashRing
consensus message into CommitRead
/CommitWrite
/Finish
#4417
Conversation
I've got somewhat stuck with an alternative idea (to filter incoming updates), and I had this PR half-implemented already, so I've decided to push this to a working prototype. In my simple tests - it works:
I suggest we take a look at the PR and consider, once again, which of the two approaches to implement. |
7b5bc6d
to
2cfc12a
Compare
let Some(ring) = self.rings.get(&state.shard_key) else { | ||
return None; // TODO(resharding)!? | ||
}; | ||
|
||
let HashRing::Resharding { new, .. } = ring else { | ||
return None; // TODO(resharding)!? | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say, error, as we don't expect this.
lib/segment/src/index/query_optimization/condition_converter.rs
Outdated
Show resolved
Hide resolved
60533e1
to
8739505
Compare
lib/api/src/grpc/conversions.rs
Outdated
conditions | ||
.into_iter() | ||
.filter(|c| !matches!(c, segment::types::Condition::Resharding(_))) // TODO(resharding)!? | ||
.map(|c| c.into()) | ||
.collect() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit hacky, but this was much easier, than refactoring all read operations, so that we only propagate Condition::Resharding
to local read operations, but not to remote read operations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would a condition.is_local_only()
make sense here?
fn eq(&self, other: &dyn ReshardingCondition) -> bool { | ||
match other.as_any().downcast_ref::<Self>() { | ||
Some(other) => self == other, | ||
None => false, | ||
} | ||
} | ||
|
||
fn as_any(&self) -> &dyn any::Any { | ||
self | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be a bit of an overkill, but this is required to implement PartialEq
on Condition
.
(Self::HasId(this), Self::HasId(other)) => this == other, | ||
(Self::Nested(this), Self::Nested(other)) => this == other, | ||
(Self::Filter(this), Self::Filter(other)) => this == other, | ||
(Self::Resharding(this), Self::Resharding(other)) => this.eq(other.deref()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without ReshardingCondition::eq
and ReshardingCondition::as_any
, we can always return false
here, but this will kinda break equality for Condition
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though I don't see any pressing issues, I do see a lot of TODO's. What do we do about those?
If we merge all of the we get a growing number of TODOs which we'll never resolve. I'd suggest as many as possible right away, or remove them if it's something not strictly necessary.
All marked with |
813f124
to
3494359
Compare
…ish` `cargo clippy --fix`
…trieve request results Add `Condition::is_local_only` method
…trieve request results Clarified a few `TODO`s
3494359
to
4ef0c7d
Compare
…ite`/`Finish` (#4417) * Refactor `CommitHashRing` into `CommitRead`/`CommitWrite`/`Finish` * Add `Resharding` filter condition * Filter "resharded" points from search, scroll by, count and retrieve request results * fixup! Refactor `CommitHashRing` into `CommitRead`/`CommitWrite`/`Finish` `cargo clippy --fix` * Apply suggestions from code review * fixup! Filter "resharded" points from search, scroll by, count and retrieve request results Add `Condition::is_local_only` method * fixup! Add `Resharding` filter condition * fixup! Filter "resharded" points from search, scroll by, count and retrieve request results Clarified a few `TODO`s * Fix clippy suggestions --------- Co-authored-by: Tim Visée <tim+github@visee.me> Co-authored-by: timvisee <tim@visee.me>
Tracked in #4213.
This PR reworks
CommitHashRing
into three separate operations:CommitRead
,CommitWrite
andFinish
.We need all three to make resharding process seem "transparent" to the user.
We don't (yet) properly track resharding state, so this PR adds some "stubs" and
TODO
s in places where we will introduce state later.All Submissions:
dev
branch. Did you create your branch fromdev
?New Feature Submissions:
cargo +nightly fmt --all
command prior to submission?cargo clippy --all --all-features
command?Changes to Core Features: