phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jamestay...@apache.org
Subject phoenix git commit: PHOENIX-4028 Provide option to not throw index write failure back to client
Date Wed, 19 Jul 2017 04:59:50 GMT
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 0fbb4e59b -> 0ebae7cc9


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/0ebae7cc
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/0ebae7cc
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/0ebae7cc

Branch: refs/heads/4.x-HBase-0.98
Commit: 0ebae7cc958536d90beb93edaba9fcca3fb92829
Parents: 0fbb4e5
Author: James Taylor <jamestaylor@apache.org>
Authored: Tue Jul 18 21:56:33 2017 -0700
Committer: James Taylor <jamestaylor@apache.org>
Committed: Tue Jul 18 21:57:58 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/0ebae7cc/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/0ebae7cc/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() {


Mime
View raw message