You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ec...@apache.org on 2014/08/01 00:08:01 UTC
[25/50] [abbrv] git commit: [master] Encode/decode value of region
nane with URL-safe base64
[master] Encode/decode value of region nane with URL-safe base64
Summary: Since there may be some abnormal characters in region name.
Test Plan: Local web server.
Reviewers: elliott, manukranthk
Reviewed By: manukranthk
Subscribers: hbase-eng@
Differential Revision: https://phabricator.fb.com/D1396428
git-svn-id: svn+ssh://tubbs/svnhive/hadoop/branches/titan/VENDOR.hbase/hbase-trunk@43033 e7acf4d4-3532-417f-9e73-7a9ae25a1f51
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/2e5a0d82
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/2e5a0d82
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/2e5a0d82
Branch: refs/heads/0.89-fb
Commit: 2e5a0d827235204ea82aca25b00e4b002b464069
Parents: 13c94a3
Author: daviddeng <da...@e7acf4d4-3532-417f-9e73-7a9ae25a1f51>
Authored: Sat Jun 21 00:59:30 2014 +0000
Committer: Elliott Clark <el...@fb.com>
Committed: Thu Jul 31 14:44:23 2014 -0700
----------------------------------------------------------------------
.../hbase-webapps/master/assignmentPlan.jsp | 27 +++++++++++++-------
1 file changed, 18 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/2e5a0d82/src/main/resources/hbase-webapps/master/assignmentPlan.jsp
----------------------------------------------------------------------
diff --git a/src/main/resources/hbase-webapps/master/assignmentPlan.jsp b/src/main/resources/hbase-webapps/master/assignmentPlan.jsp
index 10851bf..cb6ddbc 100644
--- a/src/main/resources/hbase-webapps/master/assignmentPlan.jsp
+++ b/src/main/resources/hbase-webapps/master/assignmentPlan.jsp
@@ -14,6 +14,7 @@
import="org.apache.hadoop.hbase.master.AssignmentPlan"
import="org.apache.hadoop.hbase.master.RegionPlacement"
import="org.apache.hadoop.hbase.master.RegionAssignmentSnapshot"
+ import="org.apache.hadoop.hbase.util.Base64"
import="org.apache.hadoop.hbase.util.Bytes"
import="org.apache.hadoop.hbase.util.FSUtils"
import="org.apache.hadoop.hbase.util.JvmVersion"
@@ -24,14 +25,21 @@
RegionAssignmentSnapshot snapShot = rp.getRegionAssignmentSnapshot();
Map<String, HRegionInfo> regionNameToRegionInfoMap = snapShot.getRegionNameToRegionInfoMap();
- String regionName = request.getParameter("regionName");
+ String regionNameStr = null;
+ String regionName64 = request.getParameter("regionName64");
+ if (regionName64 != null && regionName64.length() > 0) {
+ byte[] regionName = Base64.decode(regionName64, Base64.URL_SAFE);
+ if (regionName != null) {
+ regionNameStr = Bytes.toStringBinary(regionName);
+ }
+ }
String primaryRS = null;
String secondaryRS = null;
String tertiaryRS = null;
String favoredNodes = "";
String error = "";
- if (regionName != null) {
- HRegionInfo region = regionNameToRegionInfoMap.get(regionName);
+ if (regionNameStr != null) {
+ HRegionInfo region = regionNameToRegionInfoMap.get(regionNameStr);
List<HServerAddress> favoredNodesList = null;
if (region == null) {
error = " because cannot find this region in META !";
@@ -90,13 +98,13 @@
if (error.length() != 0) {
%>
<h3>Failed to update the favored nodes: <font color="#FF0000"><%=favoredNodes%> </font>, </h3>
- <h3>for the region: <font color="#FF0000"> <%= StringEscapeUtils.escapeHtml(regionName) %> </font></h3>
+ <h3>for the region: <font color="#FF0000"> <%= StringEscapeUtils.escapeHtml(regionNameStr) %> </font></h3>
<h3><%=error%></h3>
<%
- } else if (regionName != null) {
+ } else if (regionNameStr != null) {
%>
<h3> Succeeded to update the favored nodes: <font color="#32CD32"><%=favoredNodes%> </font>,</h3>
- <h3> for the region: <font color="#32CD32"><%= StringEscapeUtils.escapeHtml(regionName) %> </font></h3>
+ <h3> for the region: <font color="#32CD32"><%= StringEscapeUtils.escapeHtml(regionNameStr) %> </font></h3>
<%
}
%>
@@ -113,7 +121,8 @@
for (Map.Entry<String, HRegionInfo> entry : regionNameToRegionInfoMap.entrySet()) {
HRegionInfo regionInfo = entry.getValue();
List<HServerAddress> favoredNodeList = assignmentMap.get(regionInfo);
- regionName = regionInfo.getRegionNameAsString();
+ byte[] regionName = regionInfo.getRegionName();
+ regionNameStr = regionInfo.getRegionNameAsString();
String position = "Not Assigned";
String tdClass = "bad";
@@ -135,8 +144,8 @@
}
%>
<tr><form method="post">
- <input type="hidden" name="regionName" value="<%= StringEscapeUtils.escapeHtml(regionName) %>">
- <td><%= StringEscapeUtils.escapeHtml(regionName) %></td>
+ <input type="hidden" name="regionName64" value="<%= Base64.encodeBytes(regionName, Base64.URL_SAFE) %>">
+ <td><%= StringEscapeUtils.escapeHtml(regionNameStr) %></td>
<td class="<%= tdClass %>"><%= position %></td>
<td><input type="text" size="40" name="primaryRS" value="<%= favoredNodeList == null ? "" : favoredNodeList.get(AssignmentPlan.POSITION.PRIMARY.ordinal()).getHostNameWithPort() %>"</td>
<td><input type="text" size="40" name="secondaryRS" value="<%= favoredNodeList == null ? "" : favoredNodeList.get(AssignmentPlan.POSITION.SECONDARY.ordinal()).getHostNameWithPort() %>"</td>