-
Notifications
You must be signed in to change notification settings - Fork 139
Shard aware batching - add Session::shard_for_statement & Batch::enforce_target_node #738
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
Open
Ten0
wants to merge
17
commits into
scylladb:main
Choose a base branch
from
Ten0:easier_access_to_shard_awareness_api
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
738b1e1
Add Session::first_shard_for_statement
Ten0 7ac1759
silence type-complexity lint on first_shard_for_statement
Ten0 20c32b8
routing_info -> routing_info_from_prepared_statement
Ten0 146655e
add enforce_target_node on batch
Ten0 6406e70
Filter that node is alive
Ten0 bab56d3
Merge remote-tracking branch 'upstream/main' into easier_access_to_sh…
Ten0 84ee6aa
less qualifying more use
Ten0 a651fed
fix doc being missing for ExecutionProfileHandle::load_balancing_policy
Ten0 128f741
Merge remote-tracking branch 'upstream/main' into easier_access_to_sh…
Ten0 59ced8f
wip example test
Ten0 a5b8b87
Merge remote-tracking branch 'upstream/main' into easier_access_to_sh…
Ten0 f81d87f
adapt after master merge
Ten0 fe8af81
test shard-awareness following pattern usage
Ten0 515417e
fix doclink
Ten0 f062b4d
Fix Cargo.lock.msrv
Ten0 10a8a86
test fixes
Ten0 d5f71a9
make test deterministic
Ten0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| use super::{FallbackPlan, LoadBalancingPolicy, NodeRef, RoutingInfo}; | ||
| use crate::transport::{cluster::ClusterData, Node}; | ||
| use std::sync::Arc; | ||
|
|
||
| #[derive(Debug)] | ||
| pub struct EnforceTargetNodePolicy { | ||
| target_node: uuid::Uuid, | ||
| fallback: Arc<dyn LoadBalancingPolicy>, | ||
Ten0 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| impl EnforceTargetNodePolicy { | ||
| pub fn new(target_node: &Arc<Node>, fallback: Arc<dyn LoadBalancingPolicy>) -> Self { | ||
| Self { | ||
| target_node: target_node.host_id, | ||
| fallback, | ||
| } | ||
| } | ||
| } | ||
| impl LoadBalancingPolicy for EnforceTargetNodePolicy { | ||
| fn pick<'a>(&'a self, query: &'a RoutingInfo, cluster: &'a ClusterData) -> Option<NodeRef<'a>> { | ||
| cluster | ||
| .known_peers | ||
| .get(&self.target_node) | ||
| .or_else(|| self.fallback.pick(query, cluster)) | ||
| } | ||
|
|
||
| fn fallback<'a>( | ||
| &'a self, | ||
| query: &'a RoutingInfo, | ||
| cluster: &'a ClusterData, | ||
| ) -> FallbackPlan<'a> { | ||
| self.fallback.fallback(query, cluster) | ||
| } | ||
|
|
||
| fn name(&self) -> String { | ||
| format!( | ||
| "Enforce target node Load balancing policy - Node: {} - fallback: {}", | ||
| self.target_node, | ||
| self.fallback.name() | ||
| ) | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.