Repository: hbase Updated Branches: refs/heads/0.98 616f91f1f -> b881aed6a
Revert "HBASE-12891 concurrent region consistency checks" This reverts commit 616f91f1f7f13fdf14662bd023d635f9b595f3d8. Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/b881aed6 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/b881aed6 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/b881aed6 Branch: refs/heads/0.98 Commit: b881aed6a00508ea727306735fee236ff03132f8 Parents: 616f91f Author: Andrew Purtell <apurt...@apache.org> Authored: Thu Apr 2 13:48:01 2015 -0700 Committer: Andrew Purtell <apurt...@apache.org> Committed: Thu Apr 2 13:48:01 2015 -0700 ---------------------------------------------------------------------- .../org/apache/hadoop/hbase/util/HBaseFsck.java | 73 +------------------- 1 file changed, 3 insertions(+), 70 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/b881aed6/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 beda67a..4d21043 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 @@ -124,10 +124,8 @@ import org.apache.zookeeper.KeeperException; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Joiner; import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import com.google.common.collect.Multimap; -import com.google.common.collect.Ordering; import com.google.common.collect.TreeMultimap; import com.google.protobuf.ServiceException; @@ -1661,56 +1659,8 @@ public class HBaseFsck extends Configured { */ private void checkAndFixConsistency() throws IOException, KeeperException, InterruptedException { - List<CheckRegionConsistencyWorkItem> workItems = - new ArrayList<CheckRegionConsistencyWorkItem>(regionInfoMap.size()); for (java.util.Map.Entry<String, HbckInfo> e: regionInfoMap.entrySet()) { - workItems.add(new CheckRegionConsistencyWorkItem(e.getKey(), e.getValue())); - } - checkRegionConsistencyConcurrently(workItems); - } - - /** - * Check consistency of all regions using mulitple threads concurrently. - */ - private void checkRegionConsistencyConcurrently( - final List<CheckRegionConsistencyWorkItem> workItems) - throws IOException, KeeperException, InterruptedException { - if (workItems.isEmpty()) { - return; // nothing to check - } - - 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()); - if (e1.getCause() instanceof IOException) { - throw (IOException)e1.getCause(); - } else if (e1.getCause() instanceof KeeperException) { - throw (KeeperException)e1.getCause(); - } else if (e1.getCause() instanceof InterruptedException) { - throw (InterruptedException)e1.getCause(); - } else { - throw new IOException(e1.getCause()); - } - } - } - } - - class CheckRegionConsistencyWorkItem implements Callable<Void> { - private final String key; - private final HbckInfo hbi; - - CheckRegionConsistencyWorkItem(String key, HbckInfo hbi) { - this.key = key; - this.hbi = hbi; - } - - @Override - public synchronized Void call() throws Exception { - checkRegionConsistency(key, hbi); - return null; + checkRegionConsistency(e.getKey(), e.getValue()); } } @@ -1967,7 +1917,7 @@ public class HBaseFsck extends Configured { } Collections.sort(tableInfo.regionsFromMeta); } - for (HRegionInfo region : tableInfo.getRegionsFromMeta()) { + for (HRegionInfo region : tableInfo.regionsFromMeta) { if (Bytes.compareTo(region.getStartKey(), hri.getStartKey()) <= 0 && (region.getEndKey().length == 0 || Bytes.compareTo(region.getEndKey(), hri.getEndKey()) >= 0) @@ -2314,7 +2264,7 @@ public class HBaseFsck extends Configured { TreeMultimap.create(RegionSplitCalculator.BYTES_COMPARATOR, cmp); // list of regions derived from meta entries. - private ImmutableList<HRegionInfo> regionsFromMeta = null; + final List<HRegionInfo> regionsFromMeta = new ArrayList<HRegionInfo>(); TableInfo(TableName name) { this.tableName = name; @@ -2369,23 +2319,6 @@ public class HBaseFsck extends Configured { return sc.getStarts().size() + backwards.size(); } - public synchronized ImmutableList<HRegionInfo> getRegionsFromMeta() { - // lazy loaded, synchronized to ensure a single load - if (regionsFromMeta == null) { - List<HRegionInfo> regions = new ArrayList<HRegionInfo>(); - for (HbckInfo h : HBaseFsck.this.regionInfoMap.values()) { - if (tableName.equals(h.getTableName())) { - if (h.metaEntry != null) { - regions.add((HRegionInfo) h.metaEntry); - } - } - } - regionsFromMeta = Ordering.natural().immutableSortedCopy(regions); - } - - return regionsFromMeta; - } - private class IntegrityFixSuggester extends TableIntegrityErrorHandlerImpl { ErrorReporter errors;