priyankporwal commented on a change in pull request #683: PHOENIX-5674 
IndexTool to not write already correct index rows/CFs
URL: https://github.com/apache/phoenix/pull/683#discussion_r366713145
 
 

 ##########
 File path: 
phoenix-core/src/main/java/org/apache/phoenix/coprocessor/IndexRebuildRegionScanner.java
 ##########
 @@ -504,11 +537,82 @@ public Boolean call() throws Exception {
         });
     }
 
+    private void parallelizeIndexVerify() throws IOException {
+        addToBeVerifiedIndexRows();
+        ArrayList<KeyRange> keys = new ArrayList<>(rowCountPerTask);
+        Map<byte[], Put> perTaskDataKeyToDataPutMap = 
Maps.newTreeMap(Bytes.BYTES_COMPARATOR);
+        for (Map.Entry<byte[], Put> entry: indexKeyToDataPutMap.entrySet()) {
+            keys.add(PVarbinary.INSTANCE.getKeyRange(entry.getKey()));
+            perTaskDataKeyToDataPutMap.put(entry.getValue().getRow(), 
entry.getValue());
+            if (keys.size() == rowCountPerTask) {
+                addVerifyTask(keys, perTaskDataKeyToDataPutMap);
+                keys = new ArrayList<>(rowCountPerTask);
+                perTaskDataKeyToDataPutMap = 
Maps.newTreeMap(Bytes.BYTES_COMPARATOR);
+            }
+        }
+        if (keys.size() > 0) {
+            addVerifyTask(keys, perTaskDataKeyToDataPutMap);
+        }
+        List<Boolean> taskResultList = null;
+        try {
+            LOGGER.debug("Waiting on index verify tasks to complete...");
+            taskResultList = this.pool.submitUninterruptible(tasks);
+        } catch (ExecutionException e) {
+            throw new RuntimeException("Should not fail on the results while 
using a WaitForCompletionTaskRunner", e);
+        } catch (EarlyExitFailure e) {
+            throw new RuntimeException("Stopped while waiting for batch, 
quitting!", e);
+        } finally {
+            tasks.getTasks().clear();
+        }
+        for (Boolean result : taskResultList) {
+            if (result == null) {
+                // there was a failure
+                throw new IOException(exceptionMessage);
+            }
+        }
+    }
+
+    private void verifyAndOrRebuildIndex() throws IOException {
+        if (verifyType == IndexTool.IndexVerifyType.AFTER || verifyType == 
IndexTool.IndexVerifyType.NONE ||
 
 Review comment:
   Readability suggestion : (shortened the names)
   
   if (vt == AFTER || vt == NONE) {
   
      if (vt == NONE) {
          return;
      }
   }
   else if (vt == BEFORE || vt == BOTH || vt == ONLY) {
      ...
      if (vt == ONLY)  {
         return;
      }
      ....
   }
   
   

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to