This is an automated email from the ASF dual-hosted git repository.
dataroaring pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 065d65fb768 [fix](fe ut) fix unstable SystemInfoServiceTest (#36893)
065d65fb768 is described below
commit 065d65fb768181961f7e15f9419cd72970c5884e
Author: yujun <[email protected]>
AuthorDate: Thu Jun 27 22:54:50 2024 +0800
[fix](fe ut) fix unstable SystemInfoServiceTest (#36893)
For a random alg, (max -min) < 5% is too unstable. Make this diff
bigger, change it to 30%.
---
.../org/apache/doris/system/SystemInfoServiceTest.java | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/system/SystemInfoServiceTest.java
b/fe/fe-core/src/test/java/org/apache/doris/system/SystemInfoServiceTest.java
index 0ac72df4a6d..b36f4b2a815 100644
---
a/fe/fe-core/src/test/java/org/apache/doris/system/SystemInfoServiceTest.java
+++
b/fe/fe-core/src/test/java/org/apache/doris/system/SystemInfoServiceTest.java
@@ -46,6 +46,8 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
public class SystemInfoServiceTest {
private SystemInfoService infoService;
@@ -403,7 +405,7 @@ public class SystemInfoServiceTest {
ReplicaAllocation replicaAlloc = ReplicaAllocation.DEFAULT_ALLOCATION;
// also check if the random selection logic can evenly distribute the
replica.
Map<Long, Integer> beCounterMap = Maps.newHashMap();
- for (int i = 0; i < 10000; ++i) {
+ for (int i = 0; i < 30000; ++i) {
Pair<Map<Tag, List<Long>>, TStorageMedium> ret =
infoService.selectBackendIdsForReplicaCreation(replicaAlloc,
Maps.newHashMap(), TStorageMedium.HDD, false, false);
Map<Tag, List<Long>> res = ret.first;
@@ -412,11 +414,16 @@ public class SystemInfoServiceTest {
beCounterMap.put(beId, beCounterMap.getOrDefault(beId, 0) + 1);
}
}
+ Set<Long> expectBackendIds = infoService.getMixBackends().stream()
+ .filter(Backend::isAlive).map(Backend::getId)
+ .collect(Collectors.toSet());
+ Assert.assertEquals(expectBackendIds,
beCounterMap.keySet().stream().collect(Collectors.toSet()));
List<Integer> list = Lists.newArrayList(beCounterMap.values());
Collections.sort(list);
- int diff = list.get(list.size() - 1) - list.get(0);
- // The max replica num and min replica num's diff is less than 5%.
- Assert.assertTrue((diff * 1.0 / list.get(0)) < 0.05);
+ int max = list.get(list.size() - 1);
+ int diff = max - list.get(0);
+ // The max replica num and min replica num's diff is less than 30%.
+ Assert.assertTrue((diff * 1.0 / max) < 0.3);
}
private void addDisk(Backend be, String path, TStorageMedium medium, long
totalB, long availB) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]