You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by te...@apache.org on 2023/04/26 14:16:53 UTC
[pulsar] branch master updated: [fix][test] Fix flaky test `ConcurrentBitmapSortedLongPairSetTest` (#20165)
This is an automated email from the ASF dual-hosted git repository.
technoboy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new 0ec576b25fd [fix][test] Fix flaky test `ConcurrentBitmapSortedLongPairSetTest` (#20165)
0ec576b25fd is described below
commit 0ec576b25fdd7e4890799184ac03f66deb4735f6
Author: Jiwei Guo <te...@apache.org>
AuthorDate: Wed Apr 26 22:16:39 2023 +0800
[fix][test] Fix flaky test `ConcurrentBitmapSortedLongPairSetTest` (#20165)
---
.../pulsar/utils/ConcurrentBitmapSortedLongPairSetTest.java | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/utils/ConcurrentBitmapSortedLongPairSetTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/utils/ConcurrentBitmapSortedLongPairSetTest.java
index 47379c3b6f1..5f8f13288cf 100644
--- a/pulsar-broker/src/test/java/org/apache/pulsar/utils/ConcurrentBitmapSortedLongPairSetTest.java
+++ b/pulsar-broker/src/test/java/org/apache/pulsar/utils/ConcurrentBitmapSortedLongPairSetTest.java
@@ -26,7 +26,6 @@ import org.apache.pulsar.common.util.collections.ConcurrentLongPairSet;
import org.testng.annotations.Test;
import java.util.ArrayList;
import java.util.List;
-import java.util.Random;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@@ -188,15 +187,12 @@ public class ConcurrentBitmapSortedLongPairSetTest {
List<Future<?>> futures = new ArrayList<>();
for (int i = 0; i < nThreads; i++) {
final int threadIdx = i;
-
futures.add(executor.submit(() -> {
- Random random = new Random();
+ int start = N * (threadIdx + 1);
for (int j = 0; j < N; j++) {
- int key = random.nextInt();
+ int key = start + j;
// Ensure keys are unique
- key -= key % (threadIdx + 1);
- key = Math.abs(key);
set.add(key, key);
}
}));