HBASE-9710 Use the region name, not the encoded name, when region is not on current server
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1541820 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5583310bb1
commit
e15f36cdde
|
@ -2584,10 +2584,15 @@ public class HRegionServer implements ClientProtos.ClientService.BlockingInterfa
|
||||||
protected HRegion getRegion(final byte[] regionName)
|
protected HRegion getRegion(final byte[] regionName)
|
||||||
throws NotServingRegionException {
|
throws NotServingRegionException {
|
||||||
String encodedRegionName = HRegionInfo.encodeRegionName(regionName);
|
String encodedRegionName = HRegionInfo.encodeRegionName(regionName);
|
||||||
return getRegionByEncodedName(encodedRegionName);
|
return getRegionByEncodedName(regionName, encodedRegionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected HRegion getRegionByEncodedName(String encodedRegionName)
|
protected HRegion getRegionByEncodedName(String encodedRegionName)
|
||||||
|
throws NotServingRegionException {
|
||||||
|
return getRegionByEncodedName(null, encodedRegionName);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected HRegion getRegionByEncodedName(byte[] regionName, String encodedRegionName)
|
||||||
throws NotServingRegionException {
|
throws NotServingRegionException {
|
||||||
HRegion region = this.onlineRegions.get(encodedRegionName);
|
HRegion region = this.onlineRegions.get(encodedRegionName);
|
||||||
if (region == null) {
|
if (region == null) {
|
||||||
|
@ -2596,10 +2601,12 @@ public class HRegionServer implements ClientProtos.ClientService.BlockingInterfa
|
||||||
throw new RegionMovedException(moveInfo.getServerName(), moveInfo.getSeqNum());
|
throw new RegionMovedException(moveInfo.getServerName(), moveInfo.getSeqNum());
|
||||||
}
|
}
|
||||||
Boolean isOpening = this.regionsInTransitionInRS.get(Bytes.toBytes(encodedRegionName));
|
Boolean isOpening = this.regionsInTransitionInRS.get(Bytes.toBytes(encodedRegionName));
|
||||||
|
String regionNameStr = regionName == null?
|
||||||
|
encodedRegionName: Bytes.toStringBinary(regionName);
|
||||||
if (isOpening != null && isOpening.booleanValue()) {
|
if (isOpening != null && isOpening.booleanValue()) {
|
||||||
throw new RegionOpeningException("Region is being opened: " + encodedRegionName);
|
throw new RegionOpeningException("Region " + regionNameStr + " is opening");
|
||||||
}
|
}
|
||||||
throw new NotServingRegionException("Region is not online: " + encodedRegionName);
|
throw new NotServingRegionException("Region " + regionNameStr + " is not online");
|
||||||
}
|
}
|
||||||
return region;
|
return region;
|
||||||
}
|
}
|
||||||
|
@ -3965,7 +3972,7 @@ public class HRegionServer implements ClientProtos.ClientService.BlockingInterfa
|
||||||
*/
|
*/
|
||||||
protected HRegion getRegion(
|
protected HRegion getRegion(
|
||||||
final RegionSpecifier regionSpecifier) throws IOException {
|
final RegionSpecifier regionSpecifier) throws IOException {
|
||||||
return getRegionByEncodedName(
|
return getRegionByEncodedName(regionSpecifier.getValue().toByteArray(),
|
||||||
ProtobufUtil.getRegionEncodedName(regionSpecifier));
|
ProtobufUtil.getRegionEncodedName(regionSpecifier));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue