Repository: phoenix Updated Branches: refs/heads/master 269e8c47f -> ba0a67f82
PHOENIX-4028 Provide option to not throw index write failure back to client Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/ba0a67f8 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/ba0a67f8 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/ba0a67f8 Branch: refs/heads/master Commit: ba0a67f827c40a3ce2974970e49e1760c164161a Parents: 269e8c4 Author: James Taylor <[email protected]> Authored: Tue Jul 18 21:56:33 2017 -0700 Committer: James Taylor <[email protected]> Committed: Tue Jul 18 21:56:33 2017 -0700 ---------------------------------------------------------------------- .../org/apache/phoenix/index/PhoenixIndexFailurePolicy.java | 5 ++++- .../java/org/apache/phoenix/index/PhoenixIndexMetaData.java | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/ba0a67f8/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 a4f1f29..82360f7 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 @@ -146,7 +146,10 @@ public class PhoenixIndexFailurePolicy extends DelegateIndexFailurePolicy { } finally { if (!throwing) { IOException ioException = ServerUtil.wrapInDoNotRetryIOException("Unable to update the following indexes: " + attempted.keySet(), cause, timestamp); - if (throwIndexWriteFailure) { + Mutation m = attempted.entries().iterator().next().getValue(); + boolean isIndexRebuild = PhoenixIndexMetaData.isIndexRebuild(m.getAttributesMap()); + // Always throw if rebuilding index since the rebuilder needs to know if it was successful + if (throwIndexWriteFailure || isIndexRebuild) { throw ioException; } else { LOG.warn("Swallowing index write failure", ioException); http://git-wip-us.apache.org/repos/asf/phoenix/blob/ba0a67f8/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexMetaData.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexMetaData.java b/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexMetaData.java index fa2fed2..83201ba 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexMetaData.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexMetaData.java @@ -90,6 +90,10 @@ public class PhoenixIndexMetaData implements IndexMetaData { } + public static boolean isIndexRebuild(Map<String,byte[]> attributes) { + return attributes.get(BaseScannerRegionObserver.IGNORE_NEWER_MUTATIONS) != null; + } + public PhoenixIndexMetaData(RegionCoprocessorEnvironment env, Map<String,byte[]> attributes) throws IOException { this.indexMetaDataCache = getIndexMetaData(env, attributes); boolean isImmutable = true; @@ -98,7 +102,7 @@ public class PhoenixIndexMetaData implements IndexMetaData { } this.isImmutable = isImmutable; this.attributes = attributes; - this.ignoreNewerMutations = attributes.get(BaseScannerRegionObserver.IGNORE_NEWER_MUTATIONS) != null; + this.ignoreNewerMutations = isIndexRebuild(attributes); } public PhoenixTransactionContext getTransactionContext() {
