You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by td...@apache.org on 2015/04/02 00:58:01 UTC

phoenix git commit: Fix NPE in PhoenixIndexCodec.getIndexUpdates()

Repository: phoenix
Updated Branches:
  refs/heads/txn 5a558e16c -> 0c0dbb56c


Fix NPE in PhoenixIndexCodec.getIndexUpdates()


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

Branch: refs/heads/txn
Commit: 0c0dbb56c06582ff6398f651f3a945d845b9d432
Parents: 5a558e1
Author: Thomas <td...@salesforce.com>
Authored: Wed Apr 1 15:57:48 2015 -0700
Committer: Thomas <td...@salesforce.com>
Committed: Wed Apr 1 15:57:48 2015 -0700

----------------------------------------------------------------------
 .../hbase/index/covered/NonTxIndexBuilder.java      | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/0c0dbb56/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/NonTxIndexBuilder.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/NonTxIndexBuilder.java b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/NonTxIndexBuilder.java
index 79a485c..4ba3671 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/NonTxIndexBuilder.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/NonTxIndexBuilder.java
@@ -63,16 +63,19 @@ public class NonTxIndexBuilder extends BaseIndexBuilder {
 
     @Override
     public Collection<Pair<Mutation, byte[]>> getIndexUpdate(Mutation mutation) throws IOException {
+    	// create a state manager, so we can manage each batch
+        LocalTableState state = new LocalTableState(env, localTable, mutation);
+    	codec.setContext(state, mutation);
         // build the index updates for each group
-        IndexUpdateManager updateMap = new IndexUpdateManager();
+        IndexUpdateManager manager = new IndexUpdateManager();
 
-        batchMutationAndAddUpdates(updateMap, mutation);
+        batchMutationAndAddUpdates(manager, state, mutation);
 
         if (LOG.isDebugEnabled()) {
-            LOG.debug("Found index updates for Mutation: " + mutation + "\n" + updateMap);
+            LOG.debug("Found index updates for Mutation: " + mutation + "\n" + manager);
         }
 
-        return updateMap.toMap();
+        return manager.toMap();
     }
 
     /**
@@ -90,13 +93,10 @@ public class NonTxIndexBuilder extends BaseIndexBuilder {
      *            mutation to batch
      * @throws IOException
      */
-    private void batchMutationAndAddUpdates(IndexUpdateManager manager, Mutation m) throws IOException {
+    private void batchMutationAndAddUpdates(IndexUpdateManager manager, LocalTableState state, Mutation m) throws IOException {
         // split the mutation into timestamp-based batches
         Collection<Batch> batches = createTimestampBatchesFromMutation(m);
 
-        // create a state manager, so we can manage each batch
-        LocalTableState state = new LocalTableState(env, localTable, m);
-
         // go through each batch of keyvalues and build separate index entries for each
         boolean cleanupCurrentState = true;
         for (Batch batch : batches) {