HBASE-22649: Encode StoreFile path URLs in the UI to handle scenarios where CF contains special characters (like # etc.)
Signed-off-by: Sakthi<sakthi@apache.org>
(cherry picked from commit 49718b8b46
)
This commit is contained in:
parent
5b75bef36e
commit
63593d6cce
|
@ -19,6 +19,8 @@
|
||||||
package org.apache.hadoop.hbase.regionserver;
|
package org.apache.hadoop.hbase.regionserver;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.net.URLEncoder;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -33,6 +35,7 @@ import org.apache.hadoop.fs.FileSystem;
|
||||||
import org.apache.hadoop.fs.Path;
|
import org.apache.hadoop.fs.Path;
|
||||||
import org.apache.hadoop.hbase.Cell;
|
import org.apache.hadoop.hbase.Cell;
|
||||||
import org.apache.hadoop.hbase.CellComparator;
|
import org.apache.hadoop.hbase.CellComparator;
|
||||||
|
import org.apache.hadoop.hbase.HConstants;
|
||||||
import org.apache.hadoop.hbase.HDFSBlocksDistribution;
|
import org.apache.hadoop.hbase.HDFSBlocksDistribution;
|
||||||
import org.apache.hadoop.hbase.io.TimeRange;
|
import org.apache.hadoop.hbase.io.TimeRange;
|
||||||
import org.apache.hadoop.hbase.io.hfile.BlockType;
|
import org.apache.hadoop.hbase.io.hfile.BlockType;
|
||||||
|
@ -263,6 +266,15 @@ public class HStoreFile implements StoreFile {
|
||||||
return this.fileInfo.getPath();
|
return this.fileInfo.getPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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
|
@Override
|
||||||
public Path getQualifiedPath() {
|
public Path getQualifiedPath() {
|
||||||
return this.fileInfo.getPath().makeQualified(fs.getUri(), fs.getWorkingDirectory());
|
return this.fileInfo.getPath().makeQualified(fs.getUri(), fs.getWorkingDirectory());
|
||||||
|
|
|
@ -65,6 +65,11 @@ public interface StoreFile {
|
||||||
*/
|
*/
|
||||||
Path getPath();
|
Path getPath();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Encoded Path if this StoreFile was made with a Stream.
|
||||||
|
*/
|
||||||
|
Path getEncodedPath();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Returns the qualified path of this StoreFile
|
* @return Returns the qualified path of this StoreFile
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -67,7 +67,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<% for(StoreFile sf : storeFiles) { %>
|
<% for(StoreFile sf : storeFiles) { %>
|
||||||
<tr>
|
<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><%= (int) (rs.getFileSystem().getLength(sf.getPath()) / 1024 / 1024) %></td>
|
||||||
<td><%= new Date(sf.getModificationTimestamp()) %></td>
|
<td><%= new Date(sf.getModificationTimestamp()) %></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
Loading…
Reference in New Issue