hgromer commented on code in PR #5051:
URL: https://github.com/apache/hbase/pull/5051#discussion_r1277932478


##########
hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/replication/VerifyReplication.java:
##########
@@ -329,6 +350,56 @@ protected void cleanup(Context context) {
           LOG.error("fail to close replicated connection in cleanup", e);
         }
       }
+      if (reCompareExecutor != null && !reCompareExecutor.isShutdown()) {
+        reCompareExecutor.shutdown();
+        try {
+          boolean terminated = reCompareExecutor.awaitTermination(1, 
TimeUnit.MINUTES);
+          if (!terminated) {
+            List<Runnable> queue = reCompareExecutor.shutdownNow();
+            for (Runnable runnable : queue) {
+
+              ((VerifyReplicationRecompareRunnable) runnable).fail();
+            }
+
+            terminated = reCompareExecutor.awaitTermination(1, 
TimeUnit.MINUTES);
+
+            if (!terminated) {
+              int activeCount = Math.max(1, 
reCompareExecutor.getActiveCount());
+              LOG.warn("Found {} possible recompares still running in the 
executable"
+                + " incrementing BADROWS and FAILED_RECOMPARE", activeCount);
+              context.getCounter(Counters.BADROWS).increment(activeCount);
+              
context.getCounter(Counters.FAILED_RECOMPARE).increment(activeCount);
+            }
+          }
+        } catch (InterruptedException e) {
+          LOG.error("fail to await executor termination in cleanup", e);
+        }
+      }
+    }
+
+    private void syncLogFailRowAndIncreaseCounter(Mapper.Context context, 
Counters counter,
+      byte[] row) {
+      Threads.sleep(sleepMsBeforeReCompare);
+      try {
+        Result sourceResult = sourceTable.get(new Get(row));

Review Comment:
   Would it make sense to put this in a loop and re-try it `recompareTries` # 
of times?



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

To unsubscribe, e-mail: issues-unsubscr...@hbase.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to