Skip to content

HBASE-28432 Refactor tools which are under test packaging to a new mo… - #6249

Closed
NihalJain wants to merge 1 commit into
apache:masterfrom
NihalJain:HBASE-28432
Closed

HBASE-28432 Refactor tools which are under test packaging to a new mo…#6249
NihalJain wants to merge 1 commit into
apache:masterfrom
NihalJain:HBASE-28432

Conversation

@NihalJain

@NihalJainNihalJain commented Sep 15, 2024

Copy link
Copy Markdown
Contributor

…dule hbase-diagnostics

The purpose of this task is to refactor and move certain tools currently located under the test packaging to a new module, named 'hbase-diagnostics'.

The following tools have been initially identified for relocation(will add more as and when identified):

These tools are valuable beyond the scope of testing and should be accessible in the binary distribution of HBase. However, their current location within the test jars adds unnecessary bloat to the assembly and classpath, and potentially introduces CVE-prone JARs into the binary assemblies. We plan to remove all test jars from assembly with HBASE-28433.

This task involves creating the new 'hbase-diagnostics' module, and moving the identified tools into this module. It also includes ensuring that these tools function correctly in their new location and that their relocation does not negatively impact any existing functionality or dependencies.

Also see draft patch without this change for follow up work HBASE-28433 at #6184

@NihalJain
NihalJain marked this pull request as draft September 15, 2024 12:57
@NihalJain

NihalJain commented Sep 15, 2024

Copy link
Copy Markdown
ContributorAuthor

very rough change. lot of things to handle:

  • code duplication
  • cleanup
  • commented code
  • organising methods into proper files
  • testing: did basic ltt and pe run w/o mapreduce with local build, worked fine
  • also seems i didnot pull code before working here, so need to resolve those as well 🤦

Will post a summary of changes and things to be take care of later tomorrow

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@NihalJain

NihalJain commented Sep 16, 2024

Copy link
Copy Markdown
ContributorAuthor

Change Summary

  • Added a new module called hbase-diagnostics (as suggested by @stoty)
    • Question: Any better names?
  • Moved all the targeted tools we intend to move (i.e. PerformanceEvaluation, LoadTestTool, HFilePerformanceEvaluation, ScanPerformanceEvaluation and LoadBalancerPerformanceEvaluation) as part of this task to main of hbase-diagnostics along with all related classes:
    • Question: Anything else which we need to handle?
  • Created a copy just to bring out the all the usages of the class to help decide (based on references) where we move this in final patch:
    • RandomDistribution
    • KeyProviderForTesting
    • LoadTestKVGenerator
  • Added a new util DiagnosticToolsCommonUtils and moved method required to loginAndReturnUGI() from HBaseKerberosUtils
  • Added a new util LoadTestUtil and moved all load test related code from HFileTestUtil and HBaseTestingUtil to here
    • Question: Should we merge this to DiagnosticToolsCommonUtils?
  • Copied generateData() from PerformanceEvaluation in TestHFileOutputFormat2 to break cyclic dependency
  • Added @InterfaceAudience.Private to all classes moved from test code to main
  • Replaced UTIL.getConfiguration() with HBaseConfiguration.create() in LoadBalancerPerformanceEvaluation

TODO

  • Need to handle testHBASE14489() in hbase-server tests which depends on FilterAllFilter()
    • Should we move this class to main of hbase-server or hbase-common?
  • Deal with copied classes which have cyclic dependencies and remove all copies and its references
    • Should we copy these to main of hbase-server or hbase-common?
  • Need to do some manual testing, once code is well polished

@ndimiduk, @stoty@Apache9 Would you be able to provide some early feedback for this draft PR.?

@Apache-HBase

This comment has been minimized.

@Apache-HBase

Copy link
Copy Markdown

💔 -1 overall

VoteSubsystemRuntimeLogfileComment
+0 🆗reexec0m 29sDocker mode activated.
-0 ⚠️yetus0m 2sUnprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --author-ignore-list --blanks-eol-ignore-file --blanks-tabs-ignore-file --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+0 🆗mvndep0m 16sMaven dependency ordering for branch
+1 💚mvninstall3m 1smaster passed
+1 💚compile2m 5smaster passed
+1 💚javadoc3m 54smaster passed
+1 💚shadedjars5m 36sbranch has no errors when building our shaded downstream artifacts.
_ Patch Compile Tests _
+0 🆗mvndep0m 16sMaven dependency ordering for patch
+1 💚mvninstall2m 55sthe patch passed
+1 💚compile2m 8sthe patch passed
+1 💚javac2m 8sthe patch passed
-0 ⚠️javadoc0m 12s/results-javadoc-javadoc-hbase-diagnostics.txthbase-diagnostics generated 2 new + 0 unchanged - 0 fixed = 2 total (was 0)
-0 ⚠️javadoc1m 57s/results-javadoc-javadoc-root.txtroot generated 2 new + 91 unchanged - 0 fixed = 93 total (was 91)
+1 💚shadedjars5m 33spatch has no errors when building our shaded downstream artifacts.
_ Other Tests _
-1 ❌unit245m 15s/patch-unit-root.txtroot in the patch failed.
282m 15s
SubsystemReport/Notes
DockerClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6249/2/artifact/yetus-jdk17-hadoop3-check/output/Dockerfile
GITHUB PR#6249
Optional Testsjavac javadoc unit compile shadedjars
unameLinux 633e00b5ce0a 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 toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / 469be3d
Default JavaEclipse Adoptium-17.0.11+9
Test Resultshttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6249/2/testReport/
Max. process+thread count6078 (vs. ulimit of 30000)
modulesC: hbase-common hbase-client hbase-balancer hbase-asyncfs hbase-server hbase-mapreduce hbase-diagnostics hbase-compression/hbase-compression-zstd . hbase-assembly hbase-it U: .
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6249/2/console
versionsgit=2.34.1 maven=3.9.8
Powered byApache Yetus 0.15.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase

Copy link
Copy Markdown

💔 -1 overall

VoteSubsystemRuntimeLogfileComment
+0 🆗reexec2m 25sDocker mode activated.
_ Prechecks _
+1 💚dupname0m 1sNo case conflicting files found.
+0 🆗codespell0m 0scodespell was not available.
+0 🆗detsecrets0m 0sdetect-secrets was not available.
+1 💚@author0m 0sThe patch does not contain any @author tags.
+1 💚hbaseanti0m 0sPatch does not have any anti-patterns.
_ master Compile Tests _
+0 🆗mvndep0m 23sMaven dependency ordering for branch
+1 💚mvninstall3m 2smaster passed
+1 💚compile7m 56smaster passed
+1 💚checkstyle1m 13smaster passed
+1 💚spotbugs12m 0smaster passed
+1 💚spotless0m 44sbranch has no errors when running spotless:check.
_ Patch Compile Tests _
+0 🆗mvndep0m 16sMaven dependency ordering for patch
+1 💚mvninstall3m 3sthe patch passed
+1 💚compile8m 1sthe patch passed
-0 ⚠️javac8m 1s/results-compile-javac-root.txtroot generated 61 new + 1207 unchanged - 4 fixed = 1268 total (was 1211)
+1 💚blanks0m 0sThe patch has no blanks issues.
-0 ⚠️checkstyle1m 13s/results-checkstyle-root.txtroot: The patch generated 43 new + 58 unchanged - 36 fixed = 101 total (was 94)
+1 💚xmllint0m 0sNo new issues.
-1 ❌spotbugs7m 42s/new-spotbugs-root.htmlroot generated 11 new + 0 unchanged - 0 fixed = 11 total (was 0)
+1 💚hadoopcheck11m 33sPatch does not cause any errors with Hadoop 3.3.6 3.4.0.
+1 💚spotless0m 43spatch has no errors when running spotless:check.
_ Other Tests _
+1 💚asflicense1m 34sThe patch does not generate ASF License warnings.
77m 17s
ReasonTests
SpotBugsmodule:root
Integral division result cast to double or float in org.apache.hadoop.hbase.PerformanceEvaluation.calculateRowsAndSize(PerformanceEvaluation$TestOptions) At PerformanceEvaluation.java:double or float in org.apache.hadoop.hbase.PerformanceEvaluation.calculateRowsAndSize(PerformanceEvaluation$TestOptions) At PerformanceEvaluation.java:[line 3154]
org.apache.hadoop.hbase.PerformanceEvaluation$RunResult defines compareTo(PerformanceEvaluation$RunResult) and uses Object.equals() At PerformanceEvaluation.java:Object.equals() At PerformanceEvaluation.java:[line 250]
Random object created and used only once in org.apache.hadoop.hbase.util.LoadTestKVGenerator.getValueForRowColumn(int, byte[][]) At LoadTestKVGenerator.java:only once in org.apache.hadoop.hbase.util.LoadTestKVGenerator.getValueForRowColumn(int, byte[][]) At LoadTestKVGenerator.java:[line 111]
org.apache.hadoop.hbase.util.LoadTestTool.DEFAULT_NUM_REGIONS_PER_SERVER isn't final but should be At LoadTestTool.java:be At LoadTestTool.java:[line 163]
org.apache.hadoop.hbase.util.LoadTestUtil.DEFAULT_COLUMN_FAMILY should be both final and package protected At LoadTestUtil.java:and package protected At LoadTestUtil.java:[line 50]
org.apache.hadoop.hbase.util.MultiThreadedAction.verifyResultAgainstDataGenerator(Result, boolean, boolean) concatenates strings using + in a loop At MultiThreadedAction.java:using + in a loop At MultiThreadedAction.java:[line 415]
Integral division result cast to double or float in org.apache.hadoop.hbase.util.MultiThreadedAction$ProgressReporter.run() At MultiThreadedAction.java:double or float in org.apache.hadoop.hbase.util.MultiThreadedAction$ProgressReporter.run() At MultiThreadedAction.java:[line 206]
org.apache.hadoop.hbase.util.MultiThreadedReader$HBaseReaderThread.createGet(long) concatenates strings using + in a loop At MultiThreadedReader.java:in a loop At MultiThreadedReader.java:[line 318]
Dead store to rowKey in org.apache.hadoop.hbase.util.MultiThreadedReaderWithACL$HBaseReaderThreadWithACL.queryKey(Get, boolean, long) At MultiThreadedReaderWithACL.java:org.apache.hadoop.hbase.util.MultiThreadedReaderWithACL$HBaseReaderThreadWithACL.queryKey(Get, boolean, long) At MultiThreadedReaderWithACL.java:[line 91]
Inconsistent synchronization of org.apache.hadoop.hbase.util.MultiThreadedUpdater.writer; locked 75% of time Unsynchronized access at MultiThreadedUpdater.java:75% of time Unsynchronized access at MultiThreadedUpdater.java:[line 80]
Unwritten field:MultiThreadedUpdaterWithACL.java:[line 94]
SubsystemReport/Notes
DockerClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6249/3/artifact/yetus-general-check/output/Dockerfile
GITHUB PR#6249
Optional Testsdupname asflicense javac codespell detsecrets xmllint spotless spotbugs checkstyle compile hadoopcheck hbaseanti
unameLinux 162b34e96fd4 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 toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / 167c153
Default JavaEclipse Adoptium-17.0.11+9
Max. process+thread count192 (vs. ulimit of 30000)
modulesC: hbase-common hbase-client hbase-balancer hbase-asyncfs hbase-server hbase-mapreduce hbase-diagnostics hbase-it hbase-compression/hbase-compression-zstd hbase-assembly . U: .
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6249/3/console
versionsgit=2.34.1 maven=3.9.8 spotbugs=4.7.3 xmllint=20913
Powered byApache Yetus 0.15.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase

Copy link
Copy Markdown

💔 -1 overall

VoteSubsystemRuntimeLogfileComment
+0 🆗reexec2m 28sDocker mode activated.
-0 ⚠️yetus0m 3sUnprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --author-ignore-list --blanks-eol-ignore-file --blanks-tabs-ignore-file --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+0 🆗mvndep0m 36sMaven dependency ordering for branch
+1 💚mvninstall3m 1smaster passed
+1 💚compile2m 4smaster passed
+1 💚javadoc3m 56smaster passed
+1 💚shadedjars5m 31sbranch has no errors when building our shaded downstream artifacts.
_ Patch Compile Tests _
+0 🆗mvndep0m 15sMaven dependency ordering for patch
+1 💚mvninstall2m 52sthe patch passed
+1 💚compile2m 5sthe patch passed
+1 💚javac2m 5sthe patch passed
-0 ⚠️javadoc0m 12s/results-javadoc-javadoc-hbase-diagnostics.txthbase-diagnostics generated 2 new + 0 unchanged - 0 fixed = 2 total (was 0)
-0 ⚠️javadoc2m 4s/results-javadoc-javadoc-root.txtroot generated 2 new + 91 unchanged - 0 fixed = 93 total (was 91)
+1 💚shadedjars6m 7spatch has no errors when building our shaded downstream artifacts.
_ Other Tests _
-1 ❌unit244m 9s/patch-unit-root.txtroot in the patch failed.
283m 48s
SubsystemReport/Notes
DockerClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6249/3/artifact/yetus-jdk17-hadoop3-check/output/Dockerfile
GITHUB PR#6249
Optional Testsjavac javadoc unit compile shadedjars
unameLinux 75c2ec15443b 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 toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / 167c153
Default JavaEclipse Adoptium-17.0.11+9
Test Resultshttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6249/3/testReport/
Max. process+thread count5110 (vs. ulimit of 30000)
modulesC: hbase-common hbase-client hbase-balancer hbase-asyncfs hbase-server hbase-mapreduce hbase-diagnostics hbase-it hbase-compression/hbase-compression-zstd hbase-assembly . U: .
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6249/3/console
versionsgit=2.34.1 maven=3.9.8
Powered byApache Yetus 0.15.0 https://yetus.apache.org

This message was automatically generated.

@stotystoty left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not having to deal with Copy classes would also make the patch much smaller, half the files only differ due to those renames.

* Remove after tfile is committed and use the tfile version of this class instead.
* </p>
*/
public class RandomDistributionCopy {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is a bad name.

Do we need two copies of this class ? Can't we just move this from hbase-compression to hbase-common with the same name ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The same applies to the other "Copy" classes.

@NihalJainNihalJainSep 17, 2024

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Hey @stoty Thanks for having a look at the PR.

Do we need two copies of this class ? Can't we just move this from hbase-compression to hbase-common with the same name ?

These files are not supposed to be bundled and are here only for draft change. please see previous comment where I have captured a summary of changes: #6249 (comment)

See

Created a copy just to bring out the all the usages of the class to help decide (based on references) where we move this in final patch:
RandomDistribution
KeyProviderForTesting
LoadTestKVGenerator

Also see

Deal with copied classes which have cyclic dependencies and remove all copies and its references
Should we copy these to main of hbase-server or hbase-common?

I have created copy to show case how these files are being used across the project. Just want to discuss

  • if it is fine to move these files to proper module, outside hbase-diagnostics to resolve cyclic dependencies of usage
  • or is it fine to create a new copy them retaining the test copies where ever they are, which IMO is not clean code.

@NihalJainNihalJainSep 17, 2024

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Can't we just move this from hbase-compression to hbase-common with the same name ?

I am +1 on moving to hbase-common. Will wait some time before updating draft with this change, lets also see what other think about this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you add a separete patch on top of this one which moves the classes to hbase-common ?
You can open a separate PR for that one, so this one still shows what you wanted.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd like to see how big the patch is without the copies.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Can you add a separete patch on top of this one which moves the classes to hbase-common ?

Sure @stoty let me post a new PR with suggested change.

table.close();

}
// TODO: Below test seems to be using FilterAllFilter

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Need to resolve this before commit

@stoty

Copy link
Copy Markdown
Contributor

Sorry I did not read your comments @NihalJain .

@NihalJain

Copy link
Copy Markdown
ContributorAuthor

Sorry I did not read your comments @NihalJain .

Hey @stoty no problem at all. I have raised a new PR with suggested changes where I will continue rest of the work, will close this one soon

Sign up for freeto 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

@NihalJain@Apache-HBase@stoty