junegunn commented on code in PR #6559:
URL: https://github.com/apache/hbase/pull/6559#discussion_r1897596809
##########
hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java:
##########
@@ -1149,7 +1149,7 @@ private static long nextRandomSeed() {
return randomSeed.nextLong();
}
- private final int everyN;
+ private final long everyN;
protected final Random rand = new Random(nextRandomSeed());
Review Comment:
On the second thought, we can keep this member and just set it to
`ThreadLocalRandom.current()` to minimize the required code change. `TestBase`
instances are created on the fly by each thread in the pool (`TestClient-%s`),
so I think it's safe to do it this way. What do you think?
```diff
diff --git
a/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java
b/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java
index ffe33a9e8b..7bbccbd48d 100644
---
a/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java
+++
b/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java
@@ -1141,17 +1141,9 @@ public class PerformanceEvaluation extends Configured
implements Tool {
* A test. Subclass to particularize what happens per row.
*/
static abstract class TestBase {
- // Below is make it so when Tests are all running in the one
- // jvm, that they each have a differently seeded Random.
- private static final Random randomSeed = new
Random(EnvironmentEdgeManager.currentTime());
-
- private static long nextRandomSeed() {
- return randomSeed.nextLong();
- }
-
private final long everyN;
- protected final Random rand = new Random(nextRandomSeed());
+ protected final Random rand = ThreadLocalRandom.current();
protected final Configuration conf;
protected final TestOptions opts;
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]