Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HBASE-29013 Make PerformanceEvaluation support larger data sets (branch-2) #6559

Merged
merged 5 commits into from
Dec 29, 2024

Conversation

junegunn
Copy link
Contributor

Cherry-picked 6ebd48e and replaced Random#nextLong(bound) which is not available on JDK 8 with ThreadLocalRandom#nextLong(bound) (e140ae7).

Not being able to provide a seed doesn't matter in this context, so this should be good enough.

Use 8-byte long integers in the code to prevent integer overflows.

Signed-off-by: Duo Zhang <zhangduo@apache.org>
Reviewed-by: Peng Lu <lupeng_nwpu@qq.com>
@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

Copy link
Contributor

@Apache9 Apache9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's change to use ThreadLocalRandom.

And also please open an addendum PR against master branch too, so we can align the code with branch-2.

@@ -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());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we can remove this now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we can. I didn't remove it in the first place because I wanted to minimize the code change, but now that we agree on using ThreadLocalRandom, let me clean this up.

Copy link
Contributor Author

@junegunn junegunn Dec 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 --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;
 

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to minimize the required code change

generateData is used in other places, but without a custom seed value.

private byte[][] generateRandomStartKeys(int numKeys) {
Random random = new Random();
byte[][] ret = new byte[numKeys][];
// first region start key is always empty
ret[0] = HConstants.EMPTY_BYTE_ARRAY;
for (int i = 1; i < numKeys; i++) {
ret[i] =
PerformanceEvaluation.generateData(random, PerformanceEvaluation.DEFAULT_VALUE_LENGTH);
}
return ret;
}

private byte[][] generateRandomStartKeys(int numKeys) {
Random random = ThreadLocalRandom.current();
byte[][] ret = new byte[numKeys][];
// first region start key is always empty
ret[0] = HConstants.EMPTY_BYTE_ARRAY;
for (int i = 1; i < numKeys; i++) {
ret[i] =
PerformanceEvaluation.generateData(random, PerformanceEvaluation.DEFAULT_VALUE_LENGTH);
}
return ret;
}

So it's actually trivial to remove the Random parameter altogether.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I have pushed two commits.

  • 756ca4e is a minimal change that only replaces the value of rand to ThreadLocalRandom.current()
  • 09099f7 then completely removes Random parameters from the methods.

Please let me know which version you prefer.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 45s Docker mode activated.
-0 ⚠️ yetus 0m 5s Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --author-ignore-list --blanks-eol-ignore-file --blanks-tabs-ignore-file --quick-hadoopcheck
_ Prechecks _
_ branch-2 Compile Tests _
+1 💚 mvninstall 2m 39s branch-2 passed
+1 💚 compile 0m 17s branch-2 passed
+1 💚 javadoc 0m 14s branch-2 passed
+1 💚 shadedjars 5m 15s branch has no errors when building our shaded downstream artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 3m 23s the patch passed
+1 💚 compile 0m 20s the patch passed
+1 💚 javac 0m 20s the patch passed
+1 💚 javadoc 0m 14s the patch passed
+1 💚 shadedjars 5m 18s patch has no errors when building our shaded downstream artifacts.
_ Other Tests _
+1 💚 unit 12m 15s hbase-mapreduce in the patch passed.
32m 2s
Subsystem Report/Notes
Docker ClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6559/3/artifact/yetus-jdk8-hadoop2-check/output/Dockerfile
GITHUB PR #6559
Optional Tests javac javadoc unit compile shadedjars
uname Linux 51f2498671f9 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision branch-2 / 09099f7
Default Java Temurin-1.8.0_412-b08
Test Results https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6559/3/testReport/
Max. process+thread count 2002 (vs. ulimit of 30000)
modules C: hbase-mapreduce U: hbase-mapreduce
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6559/3/console
versions git=2.34.1 maven=3.9.8
Powered by Apache Yetus 0.15.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 56s Docker mode activated.
-0 ⚠️ yetus 0m 6s Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --author-ignore-list --blanks-eol-ignore-file --blanks-tabs-ignore-file --quick-hadoopcheck
_ Prechecks _
_ branch-2 Compile Tests _
+1 💚 mvninstall 2m 46s branch-2 passed
+1 💚 compile 0m 20s branch-2 passed
+1 💚 javadoc 0m 16s branch-2 passed
+1 💚 shadedjars 5m 41s branch has no errors when building our shaded downstream artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 2m 40s the patch passed
+1 💚 compile 0m 22s the patch passed
+1 💚 javac 0m 22s the patch passed
+1 💚 javadoc 0m 15s the patch passed
+1 💚 shadedjars 5m 4s patch has no errors when building our shaded downstream artifacts.
_ Other Tests _
+1 💚 unit 12m 41s hbase-mapreduce in the patch passed.
32m 24s
Subsystem Report/Notes
Docker ClientAPI=1.47 ServerAPI=1.47 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6559/3/artifact/yetus-jdk11-hadoop3-check/output/Dockerfile
GITHUB PR #6559
Optional Tests javac javadoc unit compile shadedjars
uname Linux 42de612a53ca 5.4.0-200-generic #220-Ubuntu SMP Fri Sep 27 13:19:16 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision branch-2 / 09099f7
Default Java Eclipse Adoptium-11.0.23+9
Test Results https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6559/3/testReport/
Max. process+thread count 2241 (vs. ulimit of 30000)
modules C: hbase-mapreduce U: hbase-mapreduce
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6559/3/console
versions git=2.34.1 maven=3.9.8
Powered by Apache Yetus 0.15.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 1m 12s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+0 🆗 codespell 0m 0s codespell was not available.
+0 🆗 detsecrets 0m 0s detect-secrets was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 hbaseanti 0m 0s Patch does not have any anti-patterns.
_ branch-2 Compile Tests _
+1 💚 mvninstall 4m 14s branch-2 passed
+1 💚 compile 0m 43s branch-2 passed
+1 💚 checkstyle 0m 16s branch-2 passed
+1 💚 spotbugs 0m 40s branch-2 passed
+1 💚 spotless 0m 53s branch has no errors when running spotless:check.
_ Patch Compile Tests _
+1 💚 mvninstall 3m 18s the patch passed
+1 💚 compile 0m 37s the patch passed
+1 💚 javac 0m 37s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 checkstyle 0m 12s the patch passed
+1 💚 spotbugs 0m 52s the patch passed
+1 💚 hadoopcheck 20m 2s Patch does not cause any errors with Hadoop 2.10.2 or 3.3.6 3.4.0.
+1 💚 spotless 1m 1s patch has no errors when running spotless:check.
_ Other Tests _
+1 💚 asflicense 0m 11s The patch does not generate ASF License warnings.
36m 16s
Subsystem Report/Notes
Docker ClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6559/3/artifact/yetus-general-check/output/Dockerfile
GITHUB PR #6559
Optional Tests dupname asflicense javac spotbugs checkstyle codespell detsecrets compile hadoopcheck hbaseanti spotless
uname Linux 2f63ff6e3294 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision branch-2 / 09099f7
Default Java Eclipse Adoptium-11.0.23+9
Max. process+thread count 79 (vs. ulimit of 30000)
modules C: hbase-mapreduce U: hbase-mapreduce
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6559/3/console
versions git=2.34.1 maven=3.9.8 spotbugs=4.7.3
Powered by Apache Yetus 0.15.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 1m 15s Docker mode activated.
-0 ⚠️ yetus 0m 5s Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --author-ignore-list --blanks-eol-ignore-file --blanks-tabs-ignore-file --quick-hadoopcheck
_ Prechecks _
_ branch-2 Compile Tests _
+1 💚 mvninstall 4m 5s branch-2 passed
+1 💚 compile 0m 24s branch-2 passed
+1 💚 javadoc 0m 19s branch-2 passed
+1 💚 shadedjars 7m 5s branch has no errors when building our shaded downstream artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 3m 31s the patch passed
+1 💚 compile 0m 24s the patch passed
+1 💚 javac 0m 24s the patch passed
+1 💚 javadoc 0m 15s the patch passed
+1 💚 shadedjars 6m 24s patch has no errors when building our shaded downstream artifacts.
_ Other Tests _
+1 💚 unit 17m 14s hbase-mapreduce in the patch passed.
42m 20s
Subsystem Report/Notes
Docker ClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6559/3/artifact/yetus-jdk17-hadoop3-check/output/Dockerfile
GITHUB PR #6559
Optional Tests javac javadoc unit compile shadedjars
uname Linux 950fbea7ccc1 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision branch-2 / 09099f7
Default Java Eclipse Adoptium-17.0.11+9
Test Results https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6559/3/testReport/
Max. process+thread count 2069 (vs. ulimit of 30000)
modules C: hbase-mapreduce U: hbase-mapreduce
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6559/3/console
versions git=2.34.1 maven=3.9.8
Powered by Apache Yetus 0.15.0 https://yetus.apache.org

This message was automatically generated.

@Apache9 Apache9 merged commit 5638a38 into apache:branch-2 Dec 29, 2024
1 check passed
Apache9 pushed a commit that referenced this pull request Dec 29, 2024
…ch-2) (#6559)

Signed-off-by: Duo Zhang <zhangduo@apache.org>
(cherry picked from commit 5638a38)
Apache9 pushed a commit that referenced this pull request Dec 29, 2024
…ch-2) (#6559)

Signed-off-by: Duo Zhang <zhangduo@apache.org>
(cherry picked from commit 5638a38)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants