Return-Path: X-Original-To: apmail-hbase-commits-archive@www.apache.org Delivered-To: apmail-hbase-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5DBA07999 for ; Tue, 11 Oct 2011 02:02:56 +0000 (UTC) Received: (qmail 33829 invoked by uid 500); 11 Oct 2011 02:02:56 -0000 Delivered-To: apmail-hbase-commits-archive@hbase.apache.org Received: (qmail 33814 invoked by uid 500); 11 Oct 2011 02:02:56 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 33807 invoked by uid 99); 11 Oct 2011 02:02:56 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Oct 2011 02:02:56 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Oct 2011 02:02:53 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id E13B1238897D for ; Tue, 11 Oct 2011 02:02:32 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1181369 - /hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/client/HBaseFsck.java Date: Tue, 11 Oct 2011 02:02:32 -0000 To: commits@hbase.apache.org From: nspiegelberg@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20111011020232.E13B1238897D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: nspiegelberg Date: Tue Oct 11 02:02:32 2011 New Revision: 1181369 URL: http://svn.apache.org/viewvc?rev=1181369&view=rev Log: HBCK: Skip regions containing only recovered.edits info Summary: Modified HBCK to skip checking of regions, which contain only recovered.edits info. These regions are left-overs after splitting a region and are not harmful. Test Plan: Tested on dev cluster. DiffCamp Revision: 154420 Reviewed By: jgray Commenters: kannan CC: jgray, nspiegelberg, kannan, hbase@lists Revert Plan: OK Modified: hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/client/HBaseFsck.java Modified: hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/client/HBaseFsck.java URL: http://svn.apache.org/viewvc/hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/client/HBaseFsck.java?rev=1181369&r1=1181368&r2=1181369&view=diff ============================================================================== --- hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/client/HBaseFsck.java (original) +++ hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/client/HBaseFsck.java Tue Oct 11 02:02:32 2011 @@ -48,6 +48,7 @@ import org.apache.hadoop.hbase.client.Me import org.apache.hadoop.hbase.ipc.HRegionInterface; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.Writables; +import org.apache.hadoop.hbase.regionserver.wal.HLog; import com.google.common.base.Joiner; import com.google.common.collect.Lists; @@ -219,6 +220,19 @@ public class HBaseFsck { HbckInfo hbi = getOrCreateInfo(encodedName); hbi.foundRegionDir = regionDir; + + // Set a flag if this region contains only edits + // This is special case if a region is left after split + hbi.onlyEdits = true; + FileStatus[] subDirs = fs.listStatus(regionDir.getPath()); + Path ePath = HLog.getRegionDirRecoveredEditsDir(regionDir.getPath()); + for (FileStatus subDir : subDirs) { + String sdName = subDir.getPath().getName(); + if (!sdName.startsWith(".") && !sdName.equals(ePath.getName())) { + hbi.onlyEdits = false; + break; + } + } } } } @@ -317,8 +331,10 @@ public class HBaseFsck { hbi.foundRegionDir.getModificationTime() + timelag > System.currentTimeMillis(); // ========== First the healthy cases ============= + if (hbi.onlyEdits) { + return; + } if (inMeta && inHdfs && isDeployed && deploymentMatchesMeta && shouldBeDeployed) { - //LOG.debug("Region " + descriptiveName + " healthy"); return; } else if (inMeta && !shouldBeDeployed && !isDeployed) { // offline regions shouldn't cause complaints @@ -403,6 +419,7 @@ public class HBaseFsck { if (hbi.metaEntry.regionServer == null) continue; if (hbi.foundRegionDir == null) continue; if (hbi.deployedOn.size() != 1) continue; + if (hbi.onlyEdits) continue; // We should be safe here String tableName = hbi.metaEntry.getTableDesc().getNameAsString(); @@ -463,13 +480,15 @@ public class HBaseFsck { while (true) { // Check if chain is broken if (!edges.containsKey(last)) { - errors.detail("Chain of regions in table " + tableName + " is broken."); + errors.detail("Chain of regions in table " + tableName + + " is broken."); return false; } next = edges.get(last); // Found a cycle if (visited.contains(next)) { - errors.detail("Chain of regions in table " + tableName + " has a cycle."); + errors.detail("Chain of regions in table " + tableName + + " has a cycle."); return false; } // Mark next node as visited @@ -478,15 +497,15 @@ public class HBaseFsck { if (next.length == 0) { // If we have visited all elements we are fine if (edges.size() != visited.size()) { - errors.detail("Chain of regions in table " + tableName + " contains " + - "less elements than are listed in META."); + errors.detail("Chain of regions in table " + tableName + + " contains less elements than are listed in META."); return false; } return true; } last = next; } - // How shouldn't be here + // How did we get here? } } @@ -682,6 +701,7 @@ public class HBaseFsck { * Maintain information about a particular region. */ static class HbckInfo { + boolean onlyEdits = false; MetaEntry metaEntry = null; FileStatus foundRegionDir = null; List deployedOn = Lists.newArrayList(); @@ -743,7 +763,8 @@ public class HBaseFsck { } public int summarize() { - System.out.println(Integer.toString(errorCount) + " inconsistencies detected."); + System.out.println(Integer.toString(errorCount) + + " inconsistencies detected."); if (errorCount == 0) { System.out.println("Status: OK"); return 0; @@ -777,25 +798,26 @@ public class HBaseFsck { } /** - * Display the full report from fsck. This displays all live and dead region servers , - * and all known regions. + * Display the full report from fsck. + * This displays all live and dead region servers, and all known regions. */ void displayFullReport() { details = true; } /** - * Set summary mode. Print only summary of the tables and status (OK or INCONSISTENT) + * Set summary mode. + * Print only summary of the tables and status (OK or INCONSISTENT) */ void setSummary() { summary = true; } /** - * Check if we should rerun fsck again. This checks if we've tried to fix - * something and we should rerun fsck tool again. - * Display the full report from fsck. This displays all live and dead region servers , - * and all known regions. + * Check if we should rerun fsck again. This checks if we've tried to + * fix something and we should rerun fsck tool again. + * Display the full report from fsck. This displays all live and dead + * region servers, and all known regions. */ void setShouldRerun() { rerun = true;