You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by sa...@apache.org on 2019/09/20 08:14:15 UTC
[hbase] branch branch-2.1 updated: HBASE-22649: Encode StoreFile
path URLs in the UI to handle scenarios where CF contains special
characters (like # etc.)
This is an automated email from the ASF dual-hosted git repository.
sakthi pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2.1 by this push:
new 7a29334 HBASE-22649: Encode StoreFile path URLs in the UI to handle scenarios where CF contains special characters (like # etc.)
7a29334 is described below
commit 7a293345ff6ad44e3fdf6da273fad3a4701915e4
Author: sreenivasulureddy <sr...@huawei.com>
AuthorDate: Thu Sep 5 12:05:26 2019 +0530
HBASE-22649: Encode StoreFile path URLs in the UI to handle scenarios where CF contains special characters (like # etc.)
Signed-off-by: Sakthi<sa...@apache.org>
(cherry picked from commit 49718b8b46cd9e06aeef3f74647b32c6df99f7ae)
---
.../org/apache/hadoop/hbase/regionserver/HStoreFile.java | 12 ++++++++++++
.../java/org/apache/hadoop/hbase/regionserver/StoreFile.java | 5 +++++
.../src/main/resources/hbase-webapps/regionserver/region.jsp | 2 +-
3 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStoreFile.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStoreFile.java
index 17789d4..155c0d3 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStoreFile.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStoreFile.java
@@ -19,6 +19,8 @@
package org.apache.hadoop.hbase.regionserver;
import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
import java.util.Collections;
import java.util.Map;
import java.util.Optional;
@@ -33,6 +35,7 @@ import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellComparator;
+import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.HDFSBlocksDistribution;
import org.apache.hadoop.hbase.io.TimeRange;
import org.apache.hadoop.hbase.io.hfile.BlockType;
@@ -259,6 +262,15 @@ public class HStoreFile implements StoreFile, StoreFileReader.Listener {
}
@Override
+ public Path getEncodedPath() {
+ try {
+ return new Path(URLEncoder.encode(fileInfo.getPath().toString(), HConstants.UTF8_ENCODING));
+ } catch (UnsupportedEncodingException ex) {
+ throw new RuntimeException("URLEncoder doesn't support UTF-8", ex);
+ }
+ }
+
+ @Override
public Path getQualifiedPath() {
return this.fileInfo.getPath().makeQualified(fs.getUri(), fs.getWorkingDirectory());
}
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFile.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFile.java
index 0d2f461..7cfdfee 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFile.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFile.java
@@ -66,6 +66,11 @@ public interface StoreFile {
Path getPath();
/**
+ * @return Encoded Path if this StoreFile was made with a Stream.
+ */
+ Path getEncodedPath();
+
+ /**
* @return Returns the qualified path of this StoreFile
*/
Path getQualifiedPath();
diff --git a/hbase-server/src/main/resources/hbase-webapps/regionserver/region.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/region.jsp
index ff83374..8183c69 100644
--- a/hbase-server/src/main/resources/hbase-webapps/regionserver/region.jsp
+++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/region.jsp
@@ -67,7 +67,7 @@
</tr>
<% for(StoreFile sf : storeFiles) { %>
<tr>
- <td><a href="storeFile.jsp?name=<%= sf.getPath() %>"><%= sf.getPath() %></a></td>
+ <td><a href="storeFile.jsp?name=<%= sf.getEncodedPath() %>"><%= sf.getPath() %></a></td>
<td><%= (int) (rs.getFileSystem().getLength(sf.getPath()) / 1024 / 1024) %></td>
<td><%= new Date(sf.getModificationTimestamp()) %></td>
</tr>