PHOENIX-4977 Make KillServerOnFailurePolicy a configurable option in PhoenixIndexFailurePolicy
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/091ef814 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/091ef814 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/091ef814 Branch: refs/heads/4.14-cdh5.11 Commit: 091ef8141070b80ae1fb273a7282caffa4bf351b Parents: 65e9af0 Author: Vincent Poon <vincentp...@apache.org> Authored: Wed Oct 24 00:03:22 2018 +0100 Committer: Pedro Boado <pbo...@apache.org> Committed: Fri Oct 26 23:05:51 2018 +0100 ---------------------------------------------------------------------- .../phoenix/hbase/index/write/DelegateIndexFailurePolicy.java | 5 ++++- .../org/apache/phoenix/index/PhoenixIndexFailurePolicy.java | 6 ++++++ .../src/main/java/org/apache/phoenix/query/QueryServices.java | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/091ef814/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/DelegateIndexFailurePolicy.java ---------------------------------------------------------------------- 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 @@ import com.google.common.collect.Multimap; public class DelegateIndexFailurePolicy implements IndexFailurePolicy { - private final IndexFailurePolicy delegate; + private IndexFailurePolicy delegate; public DelegateIndexFailurePolicy(IndexFailurePolicy delegate) { this.delegate = delegate; @@ -55,4 +55,7 @@ public class DelegateIndexFailurePolicy implements IndexFailurePolicy { delegate.stop(arg0); } + public void setDelegate(IndexFailurePolicy delegate) { + this.delegate = delegate; + } } http://git-wip-us.apache.org/repos/asf/phoenix/blob/091ef814/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java ---------------------------------------------------------------------- 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 e7f5ac2..eabf481 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.table.HTableInterfaceReference; 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; @@ -134,6 +135,11 @@ public class PhoenixIndexFailurePolicy extends DelegateIndexFailurePolicy { } 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 } /** http://git-wip-us.apache.org/repos/asf/phoenix/blob/091ef814/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServices.java ---------------------------------------------------------------------- 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 interface QueryServices extends SQLCloseable { 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