Skip to content

Conversation

@PDavid
Copy link
Contributor

@PDavid PDavid commented Apr 1, 2025

ℹ️ Sorry, this PR is quite large. Maybe it is better to check the changes commit-by-commit.

This is the first step of the Jamon to JSP migration is the Master Status page.

Moved the Jamon code back to JSP. Changed the Jamon syntax back to JSP.
To transfer data between JSP pages I used request attributes.
Tried to preserve the code as much as possible but did some changes:

Sub-templates were usually extracted to separate JSP file (and included with <jsp:include), in some case it was extracted as Java method.

Extracted some sections from master page to separate JSP pages:

  • Software Attributes
  • Warnings

Extracted the long JavaScript from the master page which executes on page load to separate JS file.

Extracted some frequently used static methods to a new util class: MasterStatusUtil. Also added unit tests for the static methods in MasterStatusUtil.

Changed the Master Status page back to /master.jsp again. Now made sure that /master-status redirects to /master.jsp.

What do you think about this?

I'll create a new Jira for the rest of the Jamon files.

Comment on lines 28 to 35
public static final String FRAGS = "frags";
public static final String SERVER_NAMES = "serverNames";
public static final String SERVER_NAME = "serverName";
public static final String RS_GROUP_INFOS = "rsGroupInfos";
public static final String COLLECT_SERVERS = "collectServers";
public static final String FILTER = "filter";
public static final String FORMAT = "format";
public static final String PARENT = "parent";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe we could just have these constants in MasterStatusUtil and then we don't need a separate class for this. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

No preference from me.

@Apache-HBase

This comment has been minimized.

@PDavid PDavid force-pushed the HBASE-29223-jamon-jsp branch from c5216a6 to e09403a Compare April 1, 2025 13:44
@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.

@PDavid PDavid marked this pull request as ready for review April 2, 2025 11:51
@Apache-HBase

This comment has been minimized.

@PDavid
Copy link
Contributor Author

PDavid commented Apr 2, 2025

I tested this locally in standalone mode after building with maven (mvn clean install -DskipTests && bin/start-hbase.sh). I created some tables, adding data with the ltt tool (bin/hbase ltt -num_keys 10000 -write 100:100 -num_tables 10 -multiput)

image

I will still have to test these special cases as these have special UI parts:

  • Dead region servers
  • Replication - peers
  • Backup master
  • RS groups

I will also test with Pseudo-Distributed mode.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache9 Apache9 requested a review from Copilot April 9, 2025 14:50
@Apache9
Copy link
Contributor

Apache9 commented Apr 9, 2025

Let me see if the copilot can give some feedbacks since this is a very big change...

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 39 out of 45 changed files in this pull request and generated 3 comments.

Files not reviewed (6)
  • hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/AssignmentManagerStatusTmpl.jamon: Language not supported
  • hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/BackupMasterStatusTmpl.jamon: Language not supported
  • hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/RSGroupListTmpl.jamon: Language not supported
  • hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/RegionVisualizerTmpl.jamon: Language not supported
  • hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/RSStatusTmpl.jamon: Language not supported
  • hbase-server/src/main/resources/hbase-webapps/master/index.html: Language not supported

Comment on lines 96 to 97
rsGroupName = server2GroupMap.get(serverName.getAddress()).getName();
}
Copy link

Copilot AI Apr 9, 2025

Choose a reason for hiding this comment

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

This line assumes that server2GroupMap.get(serverName.getAddress()) is non-null. Add a null check before calling getName() to avoid a possible NullPointerException.

Suggested change
rsGroupName = server2GroupMap.get(serverName.getAddress()).getName();
}
RSGroupInfo groupInfo = server2GroupMap.get(serverName.getAddress());
if (groupInfo != null) {
rsGroupName = groupInfo.getName();
} else {
rsGroupName = "default";
}
}

Copilot uses AI. Check for mistakes.
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 be honest I'm not sure if this is a good suggestion.
What do you all think?

@PDavid PDavid force-pushed the HBASE-29223-jamon-jsp branch from 396d471 to 2464b4f Compare May 25, 2025 12:09
@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.

Comment on lines +103 to +127
String hostname = master.getServerName().getHostname();
assertTrue(page.contains("<h1>Master <small>" + hostname + "</small></h1>"));
assertTrue(page.contains("<h2><a name=\"regionservers\">Region Servers</a></h2>"));
assertRegionServerLinks(master, page);

assertTrue(page.contains("<h2>Backup Masters</h2>"));
assertTrue(page.contains("<h2><a name=\"tables\">Tables</a></h2>"));
assertTableLinks(master, page);

assertTrue(page.contains("<h2><a name=\"region_visualizer\"></a>Region Visualizer</h2>"));
assertTrue(page.contains("<h2><a name=\"peers\">Peers</a></h2>"));
assertTrue(page.contains("<h2><a name=\"tasks\">Tasks</a></h2>"));
assertTrue(page.contains("<h2><a name=\"attributes\">Software Attributes</a></h2>"));

assertTrue(page.contains(VersionInfo.getVersion()));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For now I only added these assertions on the HTML content of the Master Status page. But we can add more sophisticated asserts in the future.

@PDavid PDavid requested a review from Apache9 May 26, 2025 05:13
@PDavid PDavid self-assigned this Aug 15, 2025
@PDavid PDavid force-pushed the HBASE-29223-jamon-jsp branch from ad03910 to 2931323 Compare August 15, 2025 18:06
@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

- getUserTables
- getFragmentationInfo
- getMetaLocationOrNull
as it is one line and not complex.
…tusUtil

as they are only static helper classes.
Added missing slash.
so that we test that `/master-status` redirects to `/master.jsp`.
…mon after rebase

they were brought back while resolving conflicts.
- HBASE-28388 Avoid index based field sorting in tablesorter apache#6779
- HBASE-27802 Manage static javascript resources programatically apache#6864
from org.apache.hadoop.hbase.util to org.apache.hadoop.hbase.master.http package. Reason: these are exclusively used by the web UI.
@PDavid PDavid force-pushed the HBASE-29223-jamon-jsp branch from 63c4861 to a83fbf0 Compare September 30, 2025 14:45
@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 27s 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.
+0 🆗 jshint 0m 0s jshint 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.
_ master Compile Tests _
+1 💚 mvninstall 3m 52s master passed
+1 💚 compile 3m 26s master passed
+1 💚 checkstyle 0m 35s master passed
+1 💚 spotbugs 1m 37s master passed
+1 💚 spotless 0m 52s branch has no errors when running spotless:check.
-0 ⚠️ patch 0m 59s Used diff version of patch file. Binary files and potentially other changes not applied. Please rebase and squash commits if necessary.
_ Patch Compile Tests _
+1 💚 mvninstall 3m 7s the patch passed
+1 💚 compile 3m 25s the patch passed
+1 💚 javac 3m 25s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 checkstyle 0m 37s hbase-server: The patch generated 0 new + 0 unchanged - 2 fixed = 0 total (was 2)
+1 💚 xmllint 0m 0s No new issues.
+1 💚 spotbugs 1m 38s the patch passed
+1 💚 hadoopcheck 12m 20s Patch does not cause any errors with Hadoop 3.3.6 3.4.1.
+1 💚 spotless 0m 45s patch has no errors when running spotless:check.
_ Other Tests _
+1 💚 asflicense 0m 12s The patch does not generate ASF License warnings.
40m 39s
Subsystem Report/Notes
Docker ClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6875/11/artifact/yetus-general-check/output/Dockerfile
GITHUB PR #6875
Optional Tests dupname asflicense javac codespell detsecrets spotless spotbugs checkstyle compile hadoopcheck hbaseanti xmllint jshint
uname Linux 8912bec941ba 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 master / a83fbf0
Default Java Eclipse Adoptium-17.0.11+9
Max. process+thread count 83 (vs. ulimit of 30000)
modules C: hbase-server U: hbase-server
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6875/11/console
versions git=2.34.1 maven=3.9.8 spotbugs=4.7.3 xmllint=20913
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 29s Docker mode activated.
-0 ⚠️ yetus 0m 3s Unprocessed 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 _
+1 💚 mvninstall 4m 0s master passed
+1 💚 compile 0m 59s master passed
+1 💚 javadoc 0m 30s master passed
+1 💚 shadedjars 6m 17s branch has no errors when building our shaded downstream artifacts.
-0 ⚠️ patch 6m 26s Used diff version of patch file. Binary files and potentially other changes not applied. Please rebase and squash commits if necessary.
_ Patch Compile Tests _
+1 💚 mvninstall 3m 17s the patch passed
+1 💚 compile 0m 59s the patch passed
+1 💚 javac 0m 59s the patch passed
+1 💚 javadoc 0m 27s the patch passed
+1 💚 shadedjars 6m 14s patch has no errors when building our shaded downstream artifacts.
_ Other Tests _
+1 💚 unit 215m 6s hbase-server in the patch passed.
242m 46s
Subsystem Report/Notes
Docker ClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6875/11/artifact/yetus-jdk17-hadoop3-check/output/Dockerfile
GITHUB PR #6875
Optional Tests javac javadoc unit compile shadedjars
uname Linux a27b97ee3a00 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 master / a83fbf0
Default Java Eclipse Adoptium-17.0.11+9
Test Results https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6875/11/testReport/
Max. process+thread count 3800 (vs. ulimit of 30000)
modules C: hbase-server U: hbase-server
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6875/11/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.

@PDavid
Copy link
Contributor Author

PDavid commented Oct 1, 2025

@NihalJain Can you please maybe check this PR? I'd appreciate your help very much. 🙏

@stoty stoty requested a review from ndimiduk October 7, 2025 05:26
@PDavid PDavid merged commit be40011 into apache:master Oct 8, 2025
1 check passed
@PDavid PDavid deleted the HBASE-29223-jamon-jsp branch October 8, 2025 11:16
PDavid added a commit that referenced this pull request Oct 16, 2025
This is the 2/3 step of the Jamon to JSP migration: the Region Server Status page.

Did the migration the same way as for the Master Status page: #6875

Migrated the Jamon code to JSP as close as possible. Extracted the duplicated `formatZKString` method to new java class: ZKStringFormatter and added unit tests.

Changed the Region Server Status page back to `/regionserver.jsp`. Made sure that `/rs-status` redirects to `/regionserver.jsp`.

Extracted the BlockCache inline CSS styles to `hbase.css` file. Also extracted the large BlockCache Hit Ratio periods paging JavaScript code to separate .js file.

Introduced a `src/main/resources/hbase-webapps/common` directory where we can place common JSP files which are used by both Master and RegionServer JSP pages. This required to adjust the JSP compiler Maven Antrun plugin a bit.

Extracted the inline tablesorter initialization JavaScript code to separate file.

Signed-off-by: Duo Zhang <[email protected]>
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.

5 participants