You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2017/09/22 19:44:53 UTC
[3/3] hbase git commit: HBASE-18786 FileNotFoundException should not
be silently handled for primary region replicas
HBASE-18786 FileNotFoundException should not be silently handled for primary region replicas
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/0c93008d
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/0c93008d
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/0c93008d
Branch: refs/heads/branch-1.4
Commit: 0c93008dd6d6c599b48cfdb714f41970e35b03c6
Parents: 10a0903
Author: Andrew Purtell <ap...@apache.org>
Authored: Thu Sep 21 13:49:07 2017 -0700
Committer: Andrew Purtell <ap...@apache.org>
Committed: Fri Sep 22 12:41:06 2017 -0700
----------------------------------------------------------------------
.../hadoop/hbase/regionserver/HRegion.java | 49 +++-----------
.../hbase/regionserver/RegionUnassigner.java | 68 --------------------
2 files changed, 8 insertions(+), 109 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/0c93008d/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
index de2461b..f5d0299 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
@@ -216,9 +216,6 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
public static final String HREGION_MVCC_PRE_ASSIGN = "hbase.hregion.mvcc.preassign";
public static final boolean DEFAULT_HREGION_MVCC_PRE_ASSIGN = true;
- public static final String HREGION_UNASSIGN_FOR_FNFE = "hbase.hregion.unassign.for.fnfe";
- public static final boolean DEFAULT_HREGION_UNASSIGN_FOR_FNFE = true;
-
public static final String HBASE_MAX_CELL_SIZE_KEY = "hbase.server.keyvalue.maxsize";
public static final int DEFAULT_MAX_CELL_SIZE = 10485760;
@@ -674,8 +671,6 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
private final Durability durability;
private final boolean regionStatsEnabled;
- // whether to unassign region if we hit FNFE
- private final RegionUnassigner regionUnassigner;
/**
* HRegion constructor. This constructor should only be used for testing and
* extensions. Instances of HRegion should be instantiated with the
@@ -827,14 +822,6 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
HConstants.DEFAULT_ENABLE_CLIENT_BACKPRESSURE);
this.maxCellSize = conf.getLong(HBASE_MAX_CELL_SIZE_KEY, DEFAULT_MAX_CELL_SIZE);
-
- boolean unassignForFNFE =
- conf.getBoolean(HREGION_UNASSIGN_FOR_FNFE, DEFAULT_HREGION_UNASSIGN_FOR_FNFE);
- if (unassignForFNFE) {
- this.regionUnassigner = new RegionUnassigner(rsServices, fs.getRegionInfo());
- } else {
- this.regionUnassigner = null;
- }
}
void setHTableSpecificConf() {
@@ -5993,20 +5980,8 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
}
}
- private void handleFileNotFound(Throwable fnfe) {
- // Try reopening the region since we have lost some storefiles.
- // See HBASE-17712 for more details.
- LOG.warn("A store file got lost, so close and reopen region", fnfe);
- if (regionUnassigner != null) {
- regionUnassigner.unassign();
- }
- }
-
private IOException handleException(List<KeyValueScanner> instantiatedScanners,
Throwable t) {
- if (t instanceof FileNotFoundException) {
- handleFileNotFound(t);
- }
// remove scaner read point before throw the exception
scannerReadPoints.remove(this);
if (storeHeap != null) {
@@ -6089,19 +6064,14 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
throw new UnknownScannerException("Scanner was closed");
}
boolean moreValues = false;
- try {
- if (outResults.isEmpty()) {
- // Usually outResults is empty. This is true when next is called
- // to handle scan or get operation.
- moreValues = nextInternal(outResults, scannerContext);
- } else {
- List<Cell> tmpList = new ArrayList<Cell>();
- moreValues = nextInternal(tmpList, scannerContext);
- outResults.addAll(tmpList);
- }
- } catch (FileNotFoundException e) {
- handleFileNotFound(e);
- throw e;
+ if (outResults.isEmpty()) {
+ // Usually outResults is empty. This is true when next is called
+ // to handle scan or get operation.
+ moreValues = nextInternal(outResults, scannerContext);
+ } else {
+ List<Cell> tmpList = new ArrayList<Cell>();
+ moreValues = nextInternal(tmpList, scannerContext);
+ outResults.addAll(tmpList);
}
// If the size limit was reached it means a partial Result is being returned. Returning a
@@ -6541,9 +6511,6 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
if (this.joinedHeap != null) {
result = this.joinedHeap.requestSeek(kv, true, true) || result;
}
- } catch (FileNotFoundException e) {
- handleFileNotFound(e);
- throw e;
} finally {
closeRegionOperation();
}
http://git-wip-us.apache.org/repos/asf/hbase/blob/0c93008d/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionUnassigner.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionUnassigner.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionUnassigner.java
deleted file mode 100644
index b347b4b..0000000
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionUnassigner.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hbase.regionserver;
-
-import java.io.IOException;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.hbase.HRegionInfo;
-import org.apache.hadoop.hbase.classification.InterfaceAudience;
-
-/**
- * Used to unssign a region when we hit FNFE.
- */
-@InterfaceAudience.Private
-class RegionUnassigner {
-
- private static final Log LOG = LogFactory.getLog(RegionUnassigner.class);
-
- private final RegionServerServices rsServices;
-
- private final HRegionInfo regionInfo;
-
- private boolean unassigning = false;
-
- RegionUnassigner(RegionServerServices rsServices, HRegionInfo regionInfo) {
- this.rsServices = rsServices;
- this.regionInfo = regionInfo;
- }
-
- synchronized void unassign() {
- if (unassigning) {
- return;
- }
- unassigning = true;
- new Thread("Unassign-" + regionInfo) {
-
- @Override
- public void run() {
- LOG.info("Unassign " + regionInfo.getRegionNameAsString());
- try {
- rsServices.unassign(regionInfo.getRegionName());
- } catch (IOException e) {
- LOG.warn("Unassigned " + regionInfo.getRegionNameAsString() + " failed", e);
- } finally {
- synchronized (RegionUnassigner.this) {
- unassigning = false;
- }
- }
- }
- }.start();
- }
-}