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:55:03 UTC

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

Branch: refs/heads/master
Commit: 9e5cd3ffe20779be9b1f3a8a5d28a0b05d664236
Parents: 3392fa6
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:53:55 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/9e5cd3ff/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/9e5cd3ff/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);