PHOENIX-4399 Remove explicit abort on RegionServerServices
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/5b9a07db Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/5b9a07db Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/5b9a07db Branch: refs/heads/5.x-HBase-2.0 Commit: 5b9a07db16d033df2a5ed1a00c4783494f38afa6 Parents: 488b528 Author: Ankit Singhal <ankitsingha...@gmail.com> Authored: Mon Nov 27 15:47:45 2017 +0530 Committer: Ankit Singhal <ankitsingha...@gmail.com> Committed: Mon Nov 27 15:47:45 2017 +0530 ---------------------------------------------------------------------- .../org/apache/phoenix/hbase/index/Indexer.java | 3 +-- .../builder/IndexBuildingFailureException.java | 4 +--- .../index/write/KillServerOnFailurePolicy.java | 17 ++++------------- 3 files changed, 6 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/5b9a07db/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/Indexer.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/Indexer.java b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/Indexer.java index f9b882c..d6f1bcc 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/Indexer.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/Indexer.java @@ -208,8 +208,7 @@ public class Indexer implements RegionObserver, RegionCoprocessor { // make sure the right version <-> combinations are allowed. String errormsg = Indexer.validateVersion(env.getHBaseVersion(), env.getConfiguration()); if (errormsg != null) { - IOException ioe = new IOException(errormsg); - throw ioe; + throw new RuntimeException(errormsg); } } http://git-wip-us.apache.org/repos/asf/phoenix/blob/5b9a07db/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/builder/IndexBuildingFailureException.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/builder/IndexBuildingFailureException.java b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/builder/IndexBuildingFailureException.java index cc7cc35..1a1aef4 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/builder/IndexBuildingFailureException.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/builder/IndexBuildingFailureException.java @@ -19,15 +19,13 @@ package org.apache.phoenix.hbase.index.builder; import java.io.IOException; -import org.apache.hadoop.hbase.DoNotRetryIOException; - /** * Unexpected failure while building index updates that wasn't caused by an {@link IOException}. * This should be used if there is some basic issue with indexing - and no matter of retries will * fix it. */ @SuppressWarnings("serial") -public class IndexBuildingFailureException extends DoNotRetryIOException { +public class IndexBuildingFailureException extends RuntimeException { /** * Constructor for over the wire propagation. Generally, shouldn't be used since index failure http://git-wip-us.apache.org/repos/asf/phoenix/blob/5b9a07db/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/KillServerOnFailurePolicy.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/KillServerOnFailurePolicy.java b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/KillServerOnFailurePolicy.java index cba2459..f9c6f3f 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/KillServerOnFailurePolicy.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/KillServerOnFailurePolicy.java @@ -21,10 +21,10 @@ import java.io.IOException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.hadoop.hbase.Abortable; import org.apache.hadoop.hbase.Stoppable; import org.apache.hadoop.hbase.client.Mutation; import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment; +import org.apache.phoenix.hbase.index.builder.IndexBuildingFailureException; import org.apache.phoenix.hbase.index.table.HTableInterfaceReference; import com.google.common.collect.Multimap; @@ -35,17 +35,15 @@ import com.google.common.collect.Multimap; public class KillServerOnFailurePolicy implements IndexFailurePolicy { private static final Log LOG = LogFactory.getLog(KillServerOnFailurePolicy.class); - private Abortable abortable; private Stoppable stoppable; @Override public void setup(Stoppable parent, RegionCoprocessorEnvironment env) { - setup(parent, env.getRegionServerServices()); + setup(parent); } - public void setup(Stoppable parent, Abortable abort) { + public void setup(Stoppable parent) { this.stoppable = parent; - this.abortable = abort; } @Override @@ -67,14 +65,7 @@ public class KillServerOnFailurePolicy implements IndexFailurePolicy { String msg = "Could not update the index table, killing server region because couldn't write to an index table"; LOG.error(msg, cause); - try { - this.abortable.abort(msg, cause); - } catch (Exception e) { - LOG.fatal("Couldn't abort this server to preserve index writes, " - + "attempting to hard kill the server"); - System.exit(1); - } - + throw new IndexBuildingFailureException(msg,cause); } }