gjacoby126 commented on a change in pull request #638: PHOENIX-5494
URL: https://github.com/apache/phoenix/pull/638#discussion_r347618849
 
 

 ##########
 File path: 
phoenix-core/src/main/java/org/apache/phoenix/hbase/index/builder/IndexBuildManager.java
 ##########
 @@ -88,27 +111,102 @@ public void 
getIndexUpdates(ListMultimap<HTableInterfaceReference, Pair<Mutation
       IndexMetaData indexMetaData) throws Throwable {
     // notify the delegate that we have started processing a batch
     this.delegate.batchStarted(miniBatchOp, indexMetaData);
-
+    CachedLocalTable cachedLocalTable =
+            preScanAllRequiredRows(
+                    mutations,
+                    (PhoenixIndexMetaData)indexMetaData,
+                    this.regionCoprocessorEnvironment);
     // Avoid the Object overhead of the executor when it's not actually 
parallelizing anything.
     for (Mutation m : mutations) {
-      Collection<Pair<Mutation, byte[]>> updates = delegate.getIndexUpdate(m, 
indexMetaData);
+      Collection<Pair<Mutation, byte[]>> updates = delegate.getIndexUpdate(m, 
indexMetaData, cachedLocalTable);
       for (Pair<Mutation, byte[]> update : updates) {
         indexUpdates.put(new HTableInterfaceReference(new 
ImmutableBytesPtr(update.getSecond())), new Pair<>(update.getFirst(), 
m.getRow()));
       }
     }
   }
 
+  @VisibleForTesting
+  public static CachedLocalTable preScanAllRequiredRows(
+          Collection<? extends Mutation> 
dataTableMutationsWithSameRowKeyAndTimestamp,
+          final PhoenixIndexMetaData indexMetaData,
+          RegionCoprocessorEnvironment regionCoprocessorEnvironment) throws 
IOException {
 
 Review comment:
   Since we only use the RegionCoprocessorEnvironment to get the HRegion, 
probably better to just pass in the region. RegionCoprocessorEnvironment has a 
lot of sensitive things on it like the RegionServerServices, and it's better 
not to let it "leak" too far. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to