-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-29596 Migrate Canary Status Jamon page back to JSP #7390
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
Open
PDavid
wants to merge
7
commits into
apache:master
Choose a base branch
from
PDavid:HBASE-29596-jamon-jsp-canary
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+383
−771
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
aa3d172
HBASE-29596 Migrate Canary Status Jamon page back to JSP
PDavid 58613e5
HBASE-29596 Drop Jamon dependency, add unit tests for Canary Status page
PDavid d87ea8c
HBASE-29596 Added unit tests for CanaryStatusUtil
PDavid 99cf033
HBASE-29596 Unit test for /canary-status redirects to /canary.jsp
PDavid 555a40e
HBASE-29596 Made CanaryStatusUtil to final to fix checkstyle issue
PDavid 30da6b3
HBASE-29223 Removed duplicated import
PDavid 0244319
HBASE-29223 Corrected spelling of 'URl' to 'URL'
PDavid File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
391 changes: 0 additions & 391 deletions
391
hbase-resource-bundle/src/main/resources/supplemental-models.xml
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
158 changes: 0 additions & 158 deletions
158
hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/tool/CanaryStatusTmpl.jamon
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
hbase-server/src/main/java/org/apache/hadoop/hbase/util/CanaryStatusUtil.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package org.apache.hadoop.hbase.util; | ||
|
|
||
| import org.apache.hadoop.hbase.ServerName; | ||
| import org.apache.yetus.audience.InterfaceAudience; | ||
|
|
||
| /** | ||
| * Utility used by the web UI JSP pages. | ||
| */ | ||
| @InterfaceAudience.Private | ||
| public final class CanaryStatusUtil { | ||
|
|
||
| private CanaryStatusUtil() { | ||
| // Do not instantiate. | ||
| } | ||
|
|
||
| public static String serverNameLink(ServerName serverName) { | ||
| int infoPort = serverName.getPort() + 1; | ||
| String url = "//" + serverName.getHostname() + ":" + infoPort + "/"; | ||
| if (infoPort > 0) { | ||
| return "<a href=\"" + url + "\">" + serverName.getServerName() + "</a>"; | ||
| } else { | ||
| return serverName.getServerName(); | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic is incorrect: when
serverName.getPort()returns -1,infoPortbecomes 0, but the condition checksif (infoPort > 0). This means when the port is -1,infoPortis 0, which fails the> 0check correctly. However, when the port is valid (e.g., 12345),infoPortis 12346 (always > 0), so the link is always returned. The condition should check if the original port is valid (>= 0) before creating the link, not ifinfoPort > 0. The correct check should beif (serverName.getPort() >= 0)orif (infoPort > 0)should beif (serverName.getPort() >= 0).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method was actually a Jamon sub-template which I converted to Java (as close as possible) and added unit tests.
I think it is correct as is because when
serverName.getPort()returns -1 (invalid port),infoPortbecomes 0 and then we only returnserverName.getServerName(). Otherwise we use the the port to build the URL.But please correct me if I'm wrong.