PHOENIX-4977 Make KillServerOnFailurePolicy a configurable option in PhoenixIndexFailurePolicy
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/DelegateIndexFailurePolicy.java b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/DelegateIndexFailurePolicy.java
index a7fb7ec..caf2b38 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/DelegateIndexFailurePolicy.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/DelegateIndexFailurePolicy.java
@@ -28,7 +28,7 @@
public class DelegateIndexFailurePolicy implements IndexFailurePolicy {
- private final IndexFailurePolicy delegate;
+ private IndexFailurePolicy delegate;
public DelegateIndexFailurePolicy(IndexFailurePolicy delegate) {
this.delegate = delegate;
@@ -55,4 +55,7 @@
delegate.stop(arg0);
}
+ public void setDelegate(IndexFailurePolicy delegate) {
+ this.delegate = delegate;
+ }
}
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java b/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java
index 397565b..0ad865d 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java
@@ -60,6 +60,7 @@
import org.apache.phoenix.hbase.index.util.ImmutableBytesPtr;
import org.apache.phoenix.hbase.index.write.DelegateIndexFailurePolicy;
import org.apache.phoenix.hbase.index.write.KillServerOnFailurePolicy;
+import org.apache.phoenix.hbase.index.write.LeaveIndexActiveFailurePolicy;
import org.apache.phoenix.jdbc.PhoenixConnection;
import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
import org.apache.phoenix.query.QueryServices;
@@ -133,6 +134,11 @@
} else {
throwIndexWriteFailure = Boolean.parseBoolean(value);
}
+
+ boolean killServer = env.getConfiguration().getBoolean(QueryServices.INDEX_FAILURE_KILL_SERVER, true);
+ if (!killServer) {
+ setDelegate(new LeaveIndexActiveFailurePolicy());
+ } // else, default in constructor is KillServerOnFailurePolicy
}
/**
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServices.java b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServices.java
index 559d165..48b7b7f 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServices.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServices.java
@@ -152,6 +152,7 @@
public static final String INDEX_FAILURE_BLOCK_WRITE = "phoenix.index.failure.block.write";
public static final String INDEX_FAILURE_DISABLE_INDEX = "phoenix.index.failure.disable.index";
public static final String INDEX_FAILURE_THROW_EXCEPTION_ATTRIB = "phoenix.index.failure.throw.exception";
+ public static final String INDEX_FAILURE_KILL_SERVER = "phoenix.index.failure.unhandled.killserver";
// Index will be partially re-built from index disable time stamp - following overlap time
@Deprecated