mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-30 20:00:36 +00:00
fix: the latest number of regions (#1546)
* fix: the latest number of regions * fix: unit test
This commit is contained in:
@@ -251,9 +251,9 @@ pub struct StatValue {
|
||||
}
|
||||
|
||||
impl StatValue {
|
||||
/// Get the region number from stat value.
|
||||
/// Get the latest number of regions.
|
||||
pub fn region_num(&self) -> Option<u64> {
|
||||
for stat in self.stats.iter() {
|
||||
for stat in self.stats.iter().rev() {
|
||||
match stat.region_num {
|
||||
Some(region_num) => return Some(region_num),
|
||||
None => continue,
|
||||
@@ -402,7 +402,7 @@ mod tests {
|
||||
],
|
||||
};
|
||||
let region_num = stat_val.region_num().unwrap();
|
||||
assert_eq!(1, region_num);
|
||||
assert_eq!(2, region_num);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user