You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by jm...@apache.org on 2015/02/22 21:55:45 UTC

[12/50] [abbrv] hbase git commit: HBASE-12891 Parallel execution for Hbck checkRegionConsistency

HBASE-12891 Parallel execution for Hbck checkRegionConsistency

Signed-off-by: Andrew Purtell <ap...@apache.org>


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

Branch: refs/heads/hbase-11339
Commit: eddd5739a14ceb5cfc9b9c7d2e357eea96bd9703
Parents: 3b56d2a
Author: rahulgidwani <ra...@flurry.com>
Authored: Fri Feb 6 15:14:18 2015 -0800
Committer: Andrew Purtell <ap...@apache.org>
Committed: Fri Feb 6 15:14:18 2015 -0800

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/util/HBaseFsck.java | 28 +++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/eddd5739/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java
index 8e1d848..96bd0f7 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java
@@ -1703,9 +1703,19 @@ public class HBaseFsck extends Configured implements Closeable {
   throws IOException, KeeperException, InterruptedException {
     // Divide the checks in two phases. One for default/primary replicas and another
     // for the non-primary ones. Keeps code cleaner this way.
+    List<WorkItemRegionConsistency> workItems =
+        new ArrayList<WorkItemRegionConsistency>(regionInfoMap.size());
     for (java.util.Map.Entry<String, HbckInfo> e: regionInfoMap.entrySet()) {
       if (e.getValue().getReplicaId() == HRegionInfo.DEFAULT_REPLICA_ID) {
-        checkRegionConsistency(e.getKey(), e.getValue());
+        workItems.add(new WorkItemRegionConsistency(e.getKey(), e.getValue()));
+      }
+    }
+    List<Future<Void>> workFutures = executor.invokeAll(workItems);
+    for(Future<Void> f: workFutures) {
+      try {
+        f.get();
+      } catch(ExecutionException e1) {
+        LOG.warn("Could not check region consistency " , e1.getCause());
       }
     }
     boolean prevHdfsCheck = shouldCheckHdfs();
@@ -2355,6 +2365,22 @@ public class HBaseFsck extends Configured implements Closeable {
     }
   };
 
+  class WorkItemRegionConsistency implements Callable<Void> {
+    private final String key;
+    private final HbckInfo hbi;
+
+    WorkItemRegionConsistency(String key, HbckInfo hbi) {
+      this.key = key;
+      this.hbi = hbi;
+    }
+
+    @Override
+    public synchronized Void call() throws Exception {
+      checkRegionConsistency(key, hbi);
+      return null;
+    }
+  }
+
 
   /**
    * Maintain information about a particular table.