HBASE-20182 Addendum throw IOException instead of NoServerForRegionException because it is a DoNotRetryRegionException
This commit is contained in:
parent
a2c1be9a76
commit
a2b9172771
|
@ -159,9 +159,11 @@ public class HRegionInfo implements RegionInfo, Comparable<HRegionInfo> {
|
|||
}
|
||||
|
||||
private byte [] endKey = HConstants.EMPTY_BYTE_ARRAY;
|
||||
// This flag is in the parent of a split while the parent is still referenced
|
||||
// by daughter regions. We USED to set this flag when we disabled a table
|
||||
// but now table state is kept up in zookeeper as of 0.90.0 HBase.
|
||||
// This flag is in the parent of a split while the parent is still referenced by daughter regions.
|
||||
// We USED to set this flag when we disabled a table but now table state is kept up in zookeeper
|
||||
// as of 0.90.0 HBase. And now in DisableTableProcedure, finally we will create bunch of
|
||||
// UnassignProcedures and at the last of the procedure we will set the region state to CLOSED, and
|
||||
// will not change the offLine flag.
|
||||
private boolean offLine = false;
|
||||
private long regionId = -1;
|
||||
private transient byte [] regionName = HConstants.EMPTY_BYTE_ARRAY;
|
||||
|
|
|
@ -269,12 +269,7 @@ class AsyncNonMetaRegionLocator {
|
|||
}
|
||||
|
||||
// return whether we should stop the scan
|
||||
private boolean onScanNext(TableName tableName, LocateRequest req, Result result,
|
||||
Throwable error) {
|
||||
if (error != null) {
|
||||
complete(tableName, req, null, error);
|
||||
return true;
|
||||
}
|
||||
private boolean onScanNext(TableName tableName, LocateRequest req, Result result) {
|
||||
RegionLocations locs = MetaTableAccessor.getRegionLocations(result);
|
||||
LOG.debug("The fetched location of '{}', row='{}', locateType={} is {}", tableName,
|
||||
Bytes.toStringBinary(req.row), req.locateType, locs);
|
||||
|
@ -298,7 +293,7 @@ class AsyncNonMetaRegionLocator {
|
|||
}
|
||||
if (loc.getServerName() == null) {
|
||||
complete(tableName, req, null,
|
||||
new NoServerForRegionException(
|
||||
new IOException(
|
||||
String.format("No server address listed for region '%s', row='%s', locateType=%s",
|
||||
info.getRegionNameAsString(), Bytes.toStringBinary(req.row), req.locateType)));
|
||||
return true;
|
||||
|
@ -370,22 +365,28 @@ class AsyncNonMetaRegionLocator {
|
|||
|
||||
private boolean completeNormally = false;
|
||||
|
||||
private boolean tableNotFound = true;
|
||||
|
||||
@Override
|
||||
public void onError(Throwable error) {
|
||||
onScanNext(tableName, req, null, error);
|
||||
complete(tableName, req, null, error);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
if (!completeNormally) {
|
||||
onScanNext(tableName, req, null, new TableNotFoundException(tableName));
|
||||
if (tableNotFound) {
|
||||
complete(tableName, req, null, new TableNotFoundException(tableName));
|
||||
} else if (!completeNormally) {
|
||||
complete(tableName, req, null, new IOException(
|
||||
"Unable to find region for " + Bytes.toStringBinary(req.row) + " in " + tableName));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(Result[] results, ScanController controller) {
|
||||
for (Result result : results) {
|
||||
if (onScanNext(tableName, req, result, null)) {
|
||||
tableNotFound = false;
|
||||
if (onScanNext(tableName, req, result)) {
|
||||
completeNormally = true;
|
||||
controller.terminate();
|
||||
return;
|
||||
|
|
|
@ -836,7 +836,7 @@ class ConnectionImplementation implements ClusterConnection, Closeable {
|
|||
if (tableNotFound) {
|
||||
throw new TableNotFoundException(tableName);
|
||||
} else {
|
||||
throw new NoServerForRegionException(
|
||||
throw new IOException(
|
||||
"Unable to find region for " + Bytes.toStringBinary(row) + " in " + tableName);
|
||||
}
|
||||
}
|
||||
|
@ -864,7 +864,7 @@ class ConnectionImplementation implements ClusterConnection, Closeable {
|
|||
// the parent in the above condition, so we may have already reached a region which does
|
||||
// not contains us.
|
||||
if (!regionInfo.containsRow(row)) {
|
||||
throw new NoServerForRegionException(
|
||||
throw new IOException(
|
||||
"Unable to find region for " + Bytes.toStringBinary(row) + " in " + tableName);
|
||||
}
|
||||
ServerName serverName = locations.getRegionLocation(replicaId).getServerName();
|
||||
|
|
|
@ -149,9 +149,11 @@ public class RegionInfoBuilder {
|
|||
* old region name format.
|
||||
*/
|
||||
|
||||
// This flag is in the parent of a split while the parent is still referenced
|
||||
// by daughter regions. We USED to set this flag when we disabled a table
|
||||
// but now table state is kept up in zookeeper as of 0.90.0 HBase.
|
||||
// This flag is in the parent of a split while the parent is still referenced by daughter
|
||||
// regions. We USED to set this flag when we disabled a table but now table state is kept up in
|
||||
// zookeeper as of 0.90.0 HBase. And now in DisableTableProcedure, finally we will create bunch
|
||||
// of UnassignProcedures and at the last of the procedure we will set the region state to
|
||||
// CLOSED, and will not change the offLine flag.
|
||||
private boolean offLine = false;
|
||||
private boolean split = false;
|
||||
private final long regionId;
|
||||
|
|
Loading…
Reference in New Issue