### Eclipse Workspace Patch 1.0 #P HBase Trunk Index: src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java (revision 1327005) +++ src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java (working copy) @@ -2195,7 +2195,7 @@ @Override public HTableDescriptor[] getHTableDescriptors(List tableNames) throws IOException { - if (tableNames == null || tableNames.isEmpty()) return null; + if (tableNames == null || tableNames.isEmpty()) return new HTableDescriptor[0]; MasterKeepAliveConnection master = getKeepAliveMaster(); try { return master.getHTableDescriptors(tableNames); Index: src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java (revision 1327005) +++ src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java (working copy) @@ -1691,7 +1691,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) Index: src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java (revision 1327005) +++ src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java (working copy) @@ -207,6 +207,12 @@ */ 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 * @@ -1283,8 +1289,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()) { @@ -1301,6 +1313,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 ============= @@ -2054,7 +2067,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 @@ -3051,6 +3067,7 @@ } catch (InterruptedException ie) { Runtime.getRuntime().exit(code); } + fsck.inRerun = true; // Just report fsck.setFixAssignments(false); fsck.setFixMeta(false);