From 0d709614486b055fe2eddf58af315972351e3696 Mon Sep 17 00:00:00 2001 From: Jeremyhi Date: Thu, 8 Aug 2024 12:58:20 +0800 Subject: [PATCH] feat: change the default selector to RoundRobin (#4528) * feat: change the default selector to rr * Update src/meta-srv/src/selector.rs * fix: unit test --- src/meta-srv/src/selector.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/meta-srv/src/selector.rs b/src/meta-srv/src/selector.rs index d69f0ca5ead2..0795bccd9b82 100644 --- a/src/meta-srv/src/selector.rs +++ b/src/meta-srv/src/selector.rs @@ -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, } @@ -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]