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-24913 Refactor TestJMXConnectorServer #2286

Merged
merged 1 commit into from Aug 31, 2020
Merged

Conversation

ddupg
Copy link
Member

@ddupg ddupg commented Aug 20, 2020

Two optimization points for TestJMXConnectorServer in this issue:

  1. Just run cluster once, not once per test case.
  2. Use random free port to run ConnectorServer, avoid specifying a fixed port.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 0m 31s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+1 💚 hbaseanti 0m 0s Patch does not have any anti-patterns.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
_ master Compile Tests _
+1 💚 mvninstall 4m 10s master passed
+1 💚 checkstyle 1m 11s master passed
+1 💚 spotbugs 2m 20s master passed
_ Patch Compile Tests _
+1 💚 mvninstall 3m 45s the patch passed
+1 💚 checkstyle 1m 18s hbase-server: The patch generated 0 new + 0 unchanged - 1 fixed = 0 total (was 1)
+1 💚 whitespace 0m 0s The patch has no whitespace issues.
+1 💚 hadoopcheck 13m 34s Patch does not cause any errors with Hadoop 3.1.2 3.2.1.
+1 💚 spotbugs 2m 25s the patch passed
_ Other Tests _
+1 💚 asflicense 0m 15s The patch does not generate ASF License warnings.
37m 41s
Subsystem Report/Notes
Docker Client=19.03.12 Server=19.03.12 base: https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2286/2/artifact/yetus-general-check/output/Dockerfile
GITHUB PR #2286
Optional Tests dupname asflicense spotbugs hadoopcheck hbaseanti checkstyle
uname Linux 4da0bd5cd332 4.15.0-60-generic #67-Ubuntu SMP Thu Aug 22 16:55:30 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / 1164531
Max. process+thread count 94 (vs. ulimit of 12500)
modules C: hbase-server U: hbase-server
Console output https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2286/2/console
versions git=2.17.1 maven=(cecedd343002696d0abb50b32b541b8a6ba2883f) spotbugs=3.1.12
Powered by Apache Yetus 0.11.1 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 1m 0s Docker mode activated.
-0 ⚠️ yetus 0m 3s Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚 mvninstall 4m 15s master passed
+1 💚 compile 1m 3s master passed
+1 💚 shadedjars 6m 5s branch has no errors when building our shaded downstream artifacts.
-0 ⚠️ javadoc 0m 42s hbase-server in master failed.
_ Patch Compile Tests _
+1 💚 mvninstall 3m 59s the patch passed
+1 💚 compile 1m 5s the patch passed
+1 💚 javac 1m 5s the patch passed
+1 💚 shadedjars 5m 41s patch has no errors when building our shaded downstream artifacts.
-0 ⚠️ javadoc 0m 39s hbase-server in the patch failed.
_ Other Tests _
+1 💚 unit 136m 15s hbase-server in the patch passed.
162m 58s
Subsystem Report/Notes
Docker Client=19.03.12 Server=19.03.12 base: https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2286/2/artifact/yetus-jdk11-hadoop3-check/output/Dockerfile
GITHUB PR #2286
Optional Tests javac javadoc unit shadedjars compile
uname Linux 50b5e3173960 4.15.0-112-generic #113-Ubuntu SMP Thu Jul 9 23:41:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / 1164531
Default Java 2020-01-14
javadoc https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2286/2/artifact/yetus-jdk11-hadoop3-check/output/branch-javadoc-hbase-server.txt
javadoc https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2286/2/artifact/yetus-jdk11-hadoop3-check/output/patch-javadoc-hbase-server.txt
Test Results https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2286/2/testReport/
Max. process+thread count 3990 (vs. ulimit of 12500)
modules C: hbase-server U: hbase-server
Console output https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2286/2/console
versions git=2.17.1 maven=(cecedd343002696d0abb50b32b541b8a6ba2883f)
Powered by Apache Yetus 0.11.1 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 1m 4s Docker mode activated.
-0 ⚠️ yetus 0m 3s Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚 mvninstall 4m 4s master passed
+1 💚 compile 0m 56s master passed
+1 💚 shadedjars 6m 3s branch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 40s master passed
_ Patch Compile Tests _
+1 💚 mvninstall 3m 45s the patch passed
+1 💚 compile 1m 0s the patch passed
+1 💚 javac 1m 0s the patch passed
+1 💚 shadedjars 6m 0s patch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 36s the patch passed
_ Other Tests _
+1 💚 unit 216m 44s hbase-server in the patch passed.
242m 40s
Subsystem Report/Notes
Docker Client=19.03.12 Server=19.03.12 base: https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2286/2/artifact/yetus-jdk8-hadoop3-check/output/Dockerfile
GITHUB PR #2286
Optional Tests javac javadoc unit shadedjars compile
uname Linux 1cdfbf1bddad 4.15.0-112-generic #113-Ubuntu SMP Thu Jul 9 23:41:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / 1164531
Default Java 1.8.0_232
Test Results https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2286/2/testReport/
Max. process+thread count 2953 (vs. ulimit of 12500)
modules C: hbase-server U: hbase-server
Console output https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2286/2/console
versions git=2.17.1 maven=(cecedd343002696d0abb50b32b541b8a6ba2883f)
Powered by Apache Yetus 0.11.1 https://yetus.apache.org

This message was automatically generated.

Copy link
Contributor

@saintstack saintstack left a comment

Choose a reason for hiding this comment

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

Patch looks good except for one item.

String cps = JMXListener.class.getName() + "," + MyAccessController.class.getName();
conf.set(CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY, cps);
conf.set(CoprocessorHost.REGIONSERVER_COPROCESSOR_CONF_KEY, cps);
rmiRegistryPort = UTIL.randomFreePort();
Copy link
Contributor

Choose a reason for hiding this comment

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

While the port might have been 'free' when we got it, by the time we go to use it, it may have been occupied for another. See HBaseTestingUtility#setupMiniKdc where it loops until no BindException. This trick is used in a few places to get around port clash.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank @saintstack for reviewing.

For JMXConnectorServer starting, only use the default port or specifying port, can't find a free port by retrying. So I use HBaseTestingUtility#randomFreePort to get a free port, which mark ports as taken and don't return repeated ports. This patch may not completely avoid port clash, but at least it can reduce the possibility ?

Copy link
Contributor

Choose a reason for hiding this comment

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

In my experience it is strange how often we meet clashes. Any chance of catching BindException and retrying?

Copy link
Member Author

Choose a reason for hiding this comment

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

The port used to start JMXConnectorServer is obtained from the configuration during cluster startup. And just log even if failed to start JMXConnectorServer because of port clash.
So if we want to avoid port clash absolutely, restart cluster?

@saintstack
Copy link
Contributor

Oh, want to say why you are making these changes? You having port clashes running tests? What is the difference in test time after these changes?

@ddupg
Copy link
Member Author

ddupg commented Aug 21, 2020

Oh, want to say why you are making these changes? You having port clashes running tests? What is the difference in test time after these changes?

I just saw the code and found that maybe it can be optimized here. It saves 3 mins on my PC and 1 min in Test Results.

@saintstack
Copy link
Contributor

I just saw the code and found that maybe it can be optimized here. It saves 3 mins on my PC and 1 min in Test Results.

Thanks. Good.

admin.close();
UTIL.shutdownMiniCluster();
}

@Before
public void setUp() {
hasAccess = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems only the first call will throw AccessDeny exception. Did you know why this design?

Copy link
Member Author

Choose a reason for hiding this comment

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

HMaster#stopMaster doesn't catch any exception that cpHost.preStopMaster() throws out.
HRegionServer#stop catches exception from rsHost.preStop.
But I have no idea why the two are different in the design of handling exceptions.

Copy link
Contributor

@infraio infraio left a comment

Choose a reason for hiding this comment

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

+1

@infraio infraio merged commit 25fcc40 into apache:master Aug 31, 2020
asfgit pushed a commit that referenced this pull request Aug 31, 2020
Signed-off-by: Guanghao Zhang <zghao@apache.org>
asfgit pushed a commit that referenced this pull request Aug 31, 2020
Signed-off-by: Guanghao Zhang <zghao@apache.org>
asfgit pushed a commit that referenced this pull request Aug 31, 2020
Signed-off-by: Guanghao Zhang <zghao@apache.org>
clarax pushed a commit to clarax/hbase that referenced this pull request Nov 15, 2020
Signed-off-by: Guanghao Zhang <zghao@apache.org>
wchevreuil pushed a commit to wchevreuil/hbase that referenced this pull request May 24, 2021
Signed-off-by: Guanghao Zhang <zghao@apache.org>
(cherry picked from commit 39ebc3e)

Change-Id: If28501f3ae890d47b077f54e46d1a63f583f83ae
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants