From 3d99cdc2fd06f95f6b3141719761705fc4b11d9e Mon Sep 17 00:00:00 2001 From: jeremyhi Date: Thu, 8 Aug 2024 11:33:16 +0800 Subject: [PATCH 1/3] feat: change the default selector to rr --- src/meta-srv/src/selector.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/meta-srv/src/selector.rs b/src/meta-srv/src/selector.rs index d69f0ca5ead2..473d88fcd80c 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 (leased) 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, } From dee8c34879e1060851f9fe48ab8eb3c990cfa139 Mon Sep 17 00:00:00 2001 From: Jeremyhi Date: Thu, 8 Aug 2024 11:53:19 +0800 Subject: [PATCH 2/3] Update src/meta-srv/src/selector.rs --- src/meta-srv/src/selector.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/meta-srv/src/selector.rs b/src/meta-srv/src/selector.rs index 473d88fcd80c..0aa86695174d 100644 --- a/src/meta-srv/src/selector.rs +++ b/src/meta-srv/src/selector.rs @@ -65,7 +65,7 @@ pub enum SelectorType { /// 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 (leased) nodes. Its characteristic + /// 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. From 0f8ceb8079e29f6dabd6f4c875a895f357915dd4 Mon Sep 17 00:00:00 2001 From: jeremyhi Date: Thu, 8 Aug 2024 12:37:40 +0800 Subject: [PATCH 3/3] fix: unit test --- src/meta-srv/src/selector.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/meta-srv/src/selector.rs b/src/meta-srv/src/selector.rs index 0aa86695174d..0795bccd9b82 100644 --- a/src/meta-srv/src/selector.rs +++ b/src/meta-srv/src/selector.rs @@ -106,7 +106,7 @@ mod tests { #[test] fn test_default_selector_type() { - assert_eq!(SelectorType::LoadBased, SelectorType::default()); + assert_eq!(SelectorType::RoundRobin, SelectorType::default()); } #[test]