kadirozde commented on a change in pull request #740: PHOENIX-5795 Supporting 
selective queries for index rows updated conc…
URL: https://github.com/apache/phoenix/pull/740#discussion_r396701804
 
 

 ##########
 File path: 
phoenix-core/src/main/java/org/apache/phoenix/hbase/index/IndexRegionObserver.java
 ##########
 @@ -409,78 +415,35 @@ private void populatePendingRows(BatchMutateContext 
context) {
       }
   }
 
-    /**
-     * This method is only used for local indexes
-     */
     private Collection<? extends Mutation> 
groupMutations(MiniBatchOperationInProgress<Mutation> miniBatchOp,
-                                                          long now) throws 
IOException {
-        Map<ImmutableBytesPtr, MultiMutation> mutationsMap = new HashMap<>();
-        boolean copyMutations = false;
-        for (int i = 0; i < miniBatchOp.size(); i++) {
-            if (miniBatchOp.getOperationStatus(i) == IGNORE) {
-                continue;
-            }
-            Mutation m = miniBatchOp.getOperation(i);
-            if (this.builder.isEnabled(m)) {
-                // Track whether or not we need to
-                ImmutableBytesPtr row = new ImmutableBytesPtr(m.getRow());
-                if (mutationsMap.containsKey(row)) {
-                    copyMutations = true;
-                } else {
-                    mutationsMap.put(row, null);
-                }
-            }
-        }
-        // early exit if it turns out we don't have any edits
-        if (mutationsMap.isEmpty()) {
-            return null;
-        }
-        // If we're copying the mutations
-        Collection<Mutation> originalMutations;
+                                                          BatchMutateContext 
context) throws IOException {
+        context.multiMutationMap = new HashMap<>();
         Collection<? extends Mutation> mutations;
-        if (copyMutations) {
-            originalMutations = null;
-            mutations = mutationsMap.values();
-        } else {
-            originalMutations = 
Lists.newArrayListWithExpectedSize(mutationsMap.size());
-            mutations = originalMutations;
-        }
+        boolean grouped = false;
         for (int i = 0; i < miniBatchOp.size(); i++) {
             Mutation m = miniBatchOp.getOperation(i);
             // skip this mutation if we aren't enabling indexing
             // unfortunately, we really should ask if the raw mutation (rather 
than the combined mutation)
             // should be indexed, which means we need to expose another method 
on the builder. Such is the
             // way optimization go though.
             if (miniBatchOp.getOperationStatus(i) != IGNORE && 
this.builder.isEnabled(m)) {
-                // Unless we're replaying edits to rebuild the index, we 
update the time stamp
-                // of the data table to prevent overlapping time stamps (which 
prevents index
-                // inconsistencies as this case isn't handled correctly 
currently).
-                for (List<Cell> cells : m.getFamilyCellMap().values()) {
-                    for (Cell cell : cells) {
-                        CellUtil.setTimestamp(cell, now);
-                    }
-                }
-                // Only copy mutations if we found duplicate rows
-                // which only occurs when we're partially rebuilding
-                // the index (since we'll potentially have both a
-                // Put and a Delete mutation for the same row).
-                if (copyMutations) {
-                    // Add the mutation to the batch set
-                    ImmutableBytesPtr row = new ImmutableBytesPtr(m.getRow());
-                    MultiMutation stored = mutationsMap.get(row);
 
 Review comment:
   Please note I removed these lines for setting the timestamp on cells as they 
were redundant. It is already done before calling this method. Also note that 
this method is not called for the rebuild path. This another reason for 
restructuring. I think I also made the code for a bit more readable.

----------------------------------------------------------------
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