### Eclipse Workspace Patch 1.0 #P hbase 0.94 Index: src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java (revision 1326900) +++ src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java (working copy) @@ -1782,7 +1782,7 @@ } public HTableDescriptor[] getHTableDescriptors(List tableNames) throws IOException { - if (tableNames == null || tableNames.size() == 0) return null; + if (tableNames == null || tableNames.size() == 0) return new HTableDescriptor[0]; if (this.master == null) { this.master = getMaster(); } Index: src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java (revision 1326900) +++ src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java (working copy) @@ -202,7 +202,13 @@ * When initially looking at HDFS, we attempt to find any orphaned data. */ private List orphanHdfsDirs = new ArrayList(); + + // Set this to true while HBCK rerun after the fix. + private boolean inRerun = false; + // all the skipped recently modified regions during the HBCK check + private List skippedRegions = new ArrayList(); + /** * Constructor * @@ -1274,8 +1280,14 @@ boolean splitParent = (hbi.metaEntry == null)? false: hbi.metaEntry.isSplit() && hbi.metaEntry.isOffline(); boolean shouldBeDeployed = inMeta && !isTableDisabled(hbi.metaEntry); - boolean recentlyModified = hbi.getHdfsRegionDir() != null && - hbi.getModTime() + timelag > System.currentTimeMillis(); + boolean recentlyModified; + if (this.inRerun) { + // In case of rerun just see whether this region was skipped previously. If so skip it + recentlyModified = skippedRegions.contains(hbi.getRegionNameAsString()); + } else { + recentlyModified = hbi.getHdfsRegionDir() != null + && hbi.getModTime() + timelag > System.currentTimeMillis(); + } // ========== First the healthy cases ============= if (hbi.containsOnlyHdfsEdits()) { @@ -1292,6 +1304,7 @@ return; } else if (recentlyModified) { LOG.warn("Region " + descriptiveName + " was recently modified -- skipping"); + skippedRegions.add(hbi.getRegionNameAsString()); return; } // ========== Cases where the region is not in META ============= @@ -2045,7 +2058,10 @@ // if the start key is zero, then we have found the first region of a table. // pick only those tables that were not modified in the last few milliseconds. if (info != null && info.getStartKey().length == 0 && !info.isMetaRegion()) { - if (info.modTime + timelag < now) { + // TODO we just consider the Meta modTime of the 1st region to tell table is ignored. + // Actually in the consistency check regions are skipped not entire table. + // Also there it consider the HDFS modtime. + if (inRerun || info.modTime + timelag < now) { tableNames.add(info.getTableNameAsString()); } else { numSkipped.incrementAndGet(); // one more in-flux table @@ -3042,6 +3058,7 @@ } catch (InterruptedException ie) { Runtime.getRuntime().exit(code); } + fsck.inRerun = true; // Just report fsck.setFixAssignments(false); fsck.setFixMeta(false); Index: src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java (revision 1326900) +++ src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java (working copy) @@ -1616,7 +1616,8 @@ /** * Get tableDescriptors * @param tableNames List of table names - * @return HTD[] the tableDescriptor + * @return HTD[] the tableDescriptor. This will be never null even when empty tableNames + * arg is passed. Will return empty array then. * @throws IOException if a remote or network exception occurs */ public HTableDescriptor[] getTableDescriptors(List tableNames)