Skip to content

Commit

Permalink
feat: change the default selector to RoundRobin (#4528)
Browse files Browse the repository at this point in the history
* feat: change the default selector to rr

* Update src/meta-srv/src/selector.rs

* fix: unit test
  • Loading branch information
fengjiachun authored Aug 8, 2024
1 parent a75cfaa commit 0d70961
Showing 1 changed file with 11 additions and 2 deletions.
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

0 comments on commit 0d70961

Please sign in to comment.