huaxiangsun commented on a change in pull request #2753:
URL: https://github.com/apache/hbase/pull/2753#discussion_r538798602
##########
File path:
hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionInfo.java
##########
@@ -363,7 +363,23 @@ static TableName getTable(final byte [] regionName) {
@InterfaceAudience.Private // For use by internals only.
public static boolean isEncodedRegionName(byte[] regionName) {
// If not parseable as region name, presume encoded. TODO: add stringency;
e.g. if hex.
- return parseRegionNameOrReturnNull(regionName) == null &&
regionName.length <= MD5_HEX_LENGTH;
+ if (parseRegionNameOrReturnNull(regionName) == null) {
+ if (regionName.length > MD5_HEX_LENGTH) {
+ return false;
+ } else if (regionName.length == MD5_HEX_LENGTH) {
+ return true;
+ } else {
+ String encodedName = Bytes.toString(regionName);
+ try {
+ Integer.parseInt(encodedName);
+ // If this is a valid integer, it could be hbase:meta's encoded
region name.
+ return true;
Review comment:
It needs to have meta regionname to compare (another query). This will
defeat the purpose of optimization, so instead, it just check if it is an
integer. If it is an integer, then this is a possible encoded region name.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]