Repository: phoenix
Updated Branches:
  refs/heads/5.x-HBase-2.0 b9fb72aa4 -> 69611a983


PHOENIX-4399 Remove explicit abort on RegionServerServices (addendum)


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/69611a98
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/69611a98
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/69611a98

Branch: refs/heads/5.x-HBase-2.0
Commit: 69611a983e8446af338e97cafb660201ff0caf37
Parents: b9fb72a
Author: Ankit Singhal <[email protected]>
Authored: Fri Dec 29 13:03:57 2017 +0530
Committer: Ankit Singhal <[email protected]>
Committed: Fri Dec 29 13:03:57 2017 +0530

----------------------------------------------------------------------
 .../org/apache/phoenix/hbase/index/Indexer.java |  3 +-
 .../FatalIndexBuildingFailureException.java     | 44 ++++++++++++++++++++
 .../builder/IndexBuildingFailureException.java  |  4 +-
 .../index/write/KillServerOnFailurePolicy.java  |  4 +-
 4 files changed, 51 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/69611a98/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 d6f1bcc..233721a 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
@@ -69,6 +69,7 @@ import org.apache.htrace.TraceScope;
 import org.apache.phoenix.coprocessor.BaseScannerRegionObserver.ReplayWrite;
 import org.apache.phoenix.coprocessor.DelegateRegionCoprocessorEnvironment;
 import org.apache.phoenix.hbase.index.LockManager.RowLock;
+import 
org.apache.phoenix.hbase.index.builder.FatalIndexBuildingFailureException;
 import org.apache.phoenix.hbase.index.builder.IndexBuildManager;
 import org.apache.phoenix.hbase.index.builder.IndexBuilder;
 import org.apache.phoenix.hbase.index.metrics.MetricsIndexerSource;
@@ -208,7 +209,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) {
-              throw new RuntimeException(errormsg);
+              throw new FatalIndexBuildingFailureException(errormsg);
           }
         }
     

http://git-wip-us.apache.org/repos/asf/phoenix/blob/69611a98/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/builder/FatalIndexBuildingFailureException.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/builder/FatalIndexBuildingFailureException.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/builder/FatalIndexBuildingFailureException.java
new file mode 100644
index 0000000..249f6c4
--- /dev/null
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/builder/FatalIndexBuildingFailureException.java
@@ -0,0 +1,44 @@
+/*
+ * 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.phoenix.hbase.index.builder;
+
+/**
+ * This exception should be thrown if we are unable to handle Index failure 
and want regionserver to go down to avoid
+ * inconsistency
+ */
+public class FatalIndexBuildingFailureException extends RuntimeException {
+
+    /**
+     * @param msg
+     *            reason for the failure
+     */
+    public FatalIndexBuildingFailureException(String msg) {
+        super(msg);
+    }
+
+    /**
+     * @param msg
+     *            reason
+     * @param cause
+     *            underlying cause for the failure
+     */
+    public FatalIndexBuildingFailureException(String msg, Throwable cause) {
+        super(msg, cause);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/phoenix/blob/69611a98/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 1a1aef4..cc7cc35 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,13 +19,15 @@ 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 RuntimeException {
+public class IndexBuildingFailureException extends DoNotRetryIOException {
 
   /**
    * Constructor for over the wire propagation. Generally, shouldn't be used 
since index failure

http://git-wip-us.apache.org/repos/asf/phoenix/blob/69611a98/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 f9c6f3f..6257bea 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
@@ -24,7 +24,7 @@ import org.apache.commons.logging.LogFactory;
 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.builder.FatalIndexBuildingFailureException;
 import org.apache.phoenix.hbase.index.table.HTableInterfaceReference;
 
 import com.google.common.collect.Multimap;
@@ -65,7 +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);
-    throw new IndexBuildingFailureException(msg,cause);
+    throw new FatalIndexBuildingFailureException(msg,cause);
   }
 
 }

Reply via email to