Skip to content
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

feat: change the default selector to RoundRobin #4528

Merged
merged 3 commits into from
Aug 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/meta-srv/src/selector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,21 @@ impl Default for SelectorOptions {
}
}

/// [`SelectorType`] refers to the load balancer used when creating tables.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, Default)]
#[serde(try_from = "String")]
pub enum SelectorType {
#[default]
/// The current load balancing is based on the number of regions on each datanode node;
/// the more regions, the higher the load (it may be changed to Capacity Units(CU)
/// calculation in the future).
LoadBased,
/// This one randomly selects from all available (in lease) nodes. Its characteristic
/// is simplicity and fast.
LeaseBased,
/// This one selects the node in a round-robin way.
/// In most cases, it's recommended and is the default option. If you're unsure which
/// to choose, using it is usually correct.
#[default]
RoundRobin,
}

Expand Down Expand Up @@ -97,7 +106,7 @@ mod tests {

#[test]
fn test_default_selector_type() {
assert_eq!(SelectorType::LoadBased, SelectorType::default());
assert_eq!(SelectorType::RoundRobin, SelectorType::default());
}

#[test]
Expand Down