From ee15f5d1b5dd51cf43b08f7f1fe43c147b0554ac Mon Sep 17 00:00:00 2001 From: Shanicky Chen <> Date: Fri, 17 May 2024 14:35:29 +0800 Subject: [PATCH] Update vnode placement tests and unique counts --- src/common/src/vnode_mapping/vnode_placement.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/common/src/vnode_mapping/vnode_placement.rs b/src/common/src/vnode_mapping/vnode_placement.rs index 63446d76f177..8c1d33765d52 100644 --- a/src/common/src/vnode_mapping/vnode_placement.rs +++ b/src/common/src/vnode_mapping/vnode_placement.rs @@ -284,7 +284,7 @@ mod tests { ) .unwrap(); - assert_eq!(re_worker_mapping.iter_unique().count(), 2); + assert_eq!(re_worker_mapping.iter_unique().count(), 51); // 1 * 256 + 0 -> 51 * 5 + 1 let score = count_same_vnode_mapping(&re_worker_mapping_2, &re_worker_mapping); assert!(score >= 5); @@ -303,7 +303,7 @@ mod tests { .unwrap(); // limited by total pu number - assert_eq!(re_pu_mapping_2.iter_unique().count(), 3); + assert_eq!(re_pu_mapping_2.iter_unique().count(), 111); // 51 * 5 + 1 -> 111 * 2 + 34 let score = count_same_vnode_mapping(&re_pu_mapping_2, &re_worker_mapping); assert!(score >= (2 + 50 * 2)); @@ -314,7 +314,7 @@ mod tests { ) .unwrap(); // limited by max_parallelism - assert_eq!(re_pu_mapping.iter_unique().count(), 3); + assert_eq!(re_pu_mapping.iter_unique().count(), 50); // 111 * 2 + 34 -> 50 * 5 + 6 let score = count_same_vnode_mapping(&re_pu_mapping, &re_pu_mapping_2); assert!(score >= 50 * 2); @@ -324,20 +324,20 @@ mod tests { None, ) .unwrap(); - assert_eq!(re_pu_mapping_2.iter_unique().count(), 3); + assert_eq!(re_pu_mapping_2.iter_unique().count(), 111); // 50 * 5 + 6 -> 111 * 2 + 34 let score = count_same_vnode_mapping(&re_pu_mapping_2, &re_pu_mapping); assert!(score >= 50 * 2); let re_pu_mapping = place_vnode(Some(&re_pu_mapping_2), &[worker_1, worker_3.clone()], None).unwrap(); // limited by total pu number - assert_eq!(re_pu_mapping.iter_unique().count(), 2); + assert_eq!(re_pu_mapping.iter_unique().count(), 61); // 111 * 2 + 34 -> 61 * 4 + 12 let score = count_same_vnode_mapping(&re_pu_mapping, &re_pu_mapping_2); assert!(score >= 61 * 2); assert!(place_vnode(Some(&re_pu_mapping), &[], None).is_none()); let re_pu_mapping = place_vnode(Some(&re_pu_mapping), &[worker_3], None).unwrap(); - assert_eq!(re_pu_mapping.iter_unique().count(), 1); + assert_eq!(re_pu_mapping.iter_unique().count(), 60); assert!(place_vnode(Some(&re_pu_mapping), &[], None).is_none()); } }