/** * @param regionName * @return the encodedName */ public static String encodeRegionName(final byte [] regionName) { String encodedName; if (hasEncodedName(regionName)) { // region is in new format: // <tableName>,<startKey>,<regionIdTimeStamp>/encodedName/ encodedName = Bytes.toString(regionName, regionName.length - MD5_HEX_LENGTH - 1, MD5_HEX_LENGTH); } else { // old format region name. First hbase:meta region also // use this format.EncodedName is the JenkinsHash value. int hashVal = Math.abs(JenkinsHash.getInstance().hash(regionName, regionName.length, 0)); encodedName = String.valueOf(hashVal); } return encodedName; }
/** * @param regionName * @return the encodedName */ public static String encodeRegionName(final byte [] regionName) { String encodedName; if (hasEncodedName(regionName)) { // region is in new format: // <tableName>,<startKey>,<regionIdTimeStamp>/encodedName/ encodedName = Bytes.toString(regionName, regionName.length - MD5_HEX_LENGTH - 1, MD5_HEX_LENGTH); } else { // old format region name. ROOT and first META region also // use this format.EncodedName is the JenkinsHash value. int hashVal = Math.abs(JenkinsHash.getInstance().hash(regionName, regionName.length, 0)); encodedName = String.valueOf(hashVal); } return encodedName; }
/** * @return the encodedName */ @InterfaceAudience.Private static String encodeRegionName(final byte [] regionName) { String encodedName; if (hasEncodedName(regionName)) { // region is in new format: // <tableName>,<startKey>,<regionIdTimeStamp>/encodedName/ encodedName = Bytes.toString(regionName, regionName.length - MD5_HEX_LENGTH - 1, MD5_HEX_LENGTH); } else { // old format region name. First hbase:meta region also // use this format.EncodedName is the JenkinsHash value. HashKey<byte[]> key = new ByteArrayHashKey(regionName, 0, regionName.length); int hashVal = Math.abs(JenkinsHash.getInstance().hash(key, 0)); encodedName = String.valueOf(hashVal); } return encodedName; }