You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zg...@apache.org on 2020/08/19 10:27:42 UTC
[hbase] branch branch-2.2 updated: HBASE-24897
RegionReplicaFlushHandler should handle NoServerForRegionException to avoid
aborting RegionServer (#2271)
This is an automated email from the ASF dual-hosted git repository.
zghao pushed a commit to branch branch-2.2
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2.2 by this push:
new 0bbb830 HBASE-24897 RegionReplicaFlushHandler should handle NoServerForRegionException to avoid aborting RegionServer (#2271)
0bbb830 is described below
commit 0bbb83060646506250228940cb710bc834745114
Author: Guanghao Zhang <zg...@apache.org>
AuthorDate: Wed Aug 19 18:27:12 2020 +0800
HBASE-24897 RegionReplicaFlushHandler should handle NoServerForRegionException to avoid aborting RegionServer (#2271)
Signed-off-by: Duo Zhang <zh...@apache.org>
---
.../regionserver/handler/RegionReplicaFlushHandler.java | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/handler/RegionReplicaFlushHandler.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/handler/RegionReplicaFlushHandler.java
index 81b6d7e..71c112d 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/handler/RegionReplicaFlushHandler.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/handler/RegionReplicaFlushHandler.java
@@ -25,6 +25,8 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.Server;
import org.apache.hadoop.hbase.TableNotFoundException;
+import org.apache.hadoop.hbase.client.NoServerForRegionException;
+import org.apache.hadoop.hbase.client.RegionInfo;
import org.apache.yetus.audience.InterfaceAudience;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -115,11 +117,12 @@ public class RegionReplicaFlushHandler extends EventHandler {
.getRegionInfoForDefaultReplica(region.getRegionInfo()).getEncodedName() + " of region "
+ region.getRegionInfo().getEncodedName() + " to trigger a flush");
}
+ RegionInfo primaryRegion =
+ RegionReplicaUtil.getRegionInfoForDefaultReplica(region.getRegionInfo());
while (!region.isClosing() && !region.isClosed()
&& !server.isAborted() && !server.isStopped()) {
- FlushRegionCallable flushCallable = new FlushRegionCallable(
- connection, rpcControllerFactory,
- RegionReplicaUtil.getRegionInfoForDefaultReplica(region.getRegionInfo()), true);
+ FlushRegionCallable flushCallable =
+ new FlushRegionCallable(connection, rpcControllerFactory, primaryRegion, true);
// TODO: flushRegion() is a blocking call waiting for the flush to complete. Ideally we
// do not have to wait for the whole flush here, just initiate it.
@@ -132,6 +135,12 @@ public class RegionReplicaFlushHandler extends EventHandler {
|| connection.isTableDisabled(region.getRegionInfo().getTable())) {
return;
}
+ // This may happen when create a table with region replica. And the CreateTableProcedure
+ // assign secondary regions firstly, then assign primary region. See HBASE-24897
+ if (ex instanceof NoServerForRegionException) {
+ LOG.warn("Primary region {} is not online, retry", primaryRegion, ex);
+ continue;
+ }
throw ex;
}