You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ja...@apache.org on 2017/09/11 21:51:06 UTC

[2/3] phoenix git commit: PHOENIX-4190 Salted local index failure is causing region server to abort

PHOENIX-4190 Salted local index failure is causing region server to abort


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 1c4e09f3b5baa24d250b9c44b076b816bef8b6e5
Parents: 23bb1c6
Author: James Taylor <jt...@salesforce.com>
Authored: Mon Sep 11 12:21:50 2017 -0700
Committer: James Taylor <jt...@salesforce.com>
Committed: Mon Sep 11 14:49:43 2017 -0700

----------------------------------------------------------------------
 .../main/java/org/apache/phoenix/index/IndexMaintainer.java   | 2 +-
 .../org/apache/phoenix/index/PhoenixIndexFailurePolicy.java   | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/1c4e09f3/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java b/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java
index 840d535..c5c3dda 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java
@@ -784,7 +784,7 @@ public class IndexMaintainer implements Writable, Iterable<ColumnReference> {
         assert (isLocalIndex);
         ImmutableBytesPtr ptr =
                 new ImmutableBytesPtr(indexRowKeyPtr.get(),( indexRowKeyPtr.getOffset()
-                        + (nIndexSaltBuckets > 0 ? 1 : 0)), viewIndexId.length);
+                        + (!isLocalIndex && nIndexSaltBuckets > 0 ? 1 : 0)), viewIndexId.length);
         return ptr.copyBytesIfNecessary();
     }
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/1c4e09f3/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 c91e36e..671e3ef 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
@@ -39,6 +39,7 @@ import org.apache.hadoop.hbase.client.HTableInterface;
 import org.apache.hadoop.hbase.client.Mutation;
 import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
+import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.phoenix.coprocessor.MetaDataProtocol.MetaDataMutationResult;
 import org.apache.phoenix.coprocessor.MetaDataProtocol.MutationCode;
 import org.apache.phoenix.hbase.index.table.HTableInterfaceReference;
@@ -288,7 +289,11 @@ public class PhoenixIndexFailurePolicy extends DelegateIndexFailurePolicy {
                                 new ImmutableBytesWritable(mutation.getRow(), offset,
                                         mutation.getRow().length - offset));
                 String indexTableName = localIndexNames.get(new ImmutableBytesWritable(viewId));
-                indexTableNames.add(indexTableName);
+                if (indexTableName == null) {
+                    LOG.error("Unable to find local index on " + ref.getTableName() + " with viewID of " + Bytes.toStringBinary(viewId));
+                } else {
+                    indexTableNames.add(indexTableName);
+                }
             }
         } catch (ClassNotFoundException e) {
             throw new IOException(e);