You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zh...@apache.org on 2018/04/11 07:27:26 UTC
[14/30] hbase git commit: HBASE-20182 Addendum throw IOException
instead of NoServerForRegionException because it is a
DoNotRetryRegionException
HBASE-20182 Addendum throw IOException instead of NoServerForRegionException because it is a DoNotRetryRegionException
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/a2b91727
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/a2b91727
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/a2b91727
Branch: refs/heads/HBASE-19064
Commit: a2b91727715e10afa29c759cef20540f29a79228
Parents: a2c1be9
Author: zhangduo <zh...@apache.org>
Authored: Wed Apr 11 14:37:56 2018 +0800
Committer: zhangduo <zh...@apache.org>
Committed: Wed Apr 11 14:47:06 2018 +0800
----------------------------------------------------------------------
.../org/apache/hadoop/hbase/HRegionInfo.java | 8 ++++---
.../hbase/client/AsyncNonMetaRegionLocator.java | 23 ++++++++++----------
.../hbase/client/ConnectionImplementation.java | 4 ++--
.../hadoop/hbase/client/RegionInfoBuilder.java | 8 ++++---
4 files changed, 24 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/a2b91727/hbase-client/src/main/java/org/apache/hadoop/hbase/HRegionInfo.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/HRegionInfo.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/HRegionInfo.java
index e2982bd..fc03926 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/HRegionInfo.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/HRegionInfo.java
@@ -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;
http://git-wip-us.apache.org/repos/asf/hbase/blob/a2b91727/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncNonMetaRegionLocator.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncNonMetaRegionLocator.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncNonMetaRegionLocator.java
index c30de9a..7634b10 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncNonMetaRegionLocator.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncNonMetaRegionLocator.java
@@ -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;
http://git-wip-us.apache.org/repos/asf/hbase/blob/a2b91727/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java
index a272ffb..53e4b7f 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java
@@ -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();
http://git-wip-us.apache.org/repos/asf/hbase/blob/a2b91727/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionInfoBuilder.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionInfoBuilder.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionInfoBuilder.java
index fc35afb..3de9860 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionInfoBuilder.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionInfoBuilder.java
@@ -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;