hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r1571884 - in /hbase/branches/hbase-10070/hbase-server/src: main/java/org/apache/hadoop/hbase/util/HBaseFsck.java test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java
Date Wed, 26 Feb 2014 00:38:15 GMT
Author: ddas
Date: Wed Feb 26 00:38:15 2014
New Revision: 1571884

URL: http://svn.apache.org/r1571884
Log:
HBASE-10362. HBCK changes for supporting region replicas

Modified:
    hbase/branches/hbase-10070/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java
    hbase/branches/hbase-10070/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java

Modified: hbase/branches/hbase-10070/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java
URL: http://svn.apache.org/viewvc/hbase/branches/hbase-10070/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java?rev=1571884&r1=1571883&r2=1571884&view=diff
==============================================================================
--- hbase/branches/hbase-10070/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java
(original)
+++ hbase/branches/hbase-10070/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java
Wed Feb 26 00:38:15 2014
@@ -80,6 +80,7 @@ import org.apache.hadoop.hbase.client.HC
 import org.apache.hadoop.hbase.client.HConnectionManager;
 import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.client.MetaScanner;
+import org.apache.hadoop.hbase.client.RegionReplicaUtil;
 import org.apache.hadoop.hbase.client.MetaScanner.MetaScannerVisitor;
 import org.apache.hadoop.hbase.client.MetaScanner.MetaScannerVisitorBase;
 import org.apache.hadoop.hbase.client.Put;
@@ -1758,6 +1759,7 @@ public class HBaseFsck extends Configure
     if (hbi.containsOnlyHdfsEdits()) {
       return;
     }
+    if (hbi.isSkipChecks()) return;
     if (inMeta && inHdfs && isDeployed && deploymentMatchesMeta &&
shouldBeDeployed) {
       return;
     } else if (inMeta && inHdfs && !shouldBeDeployed && !isDeployed)
{
@@ -1922,13 +1924,11 @@ public class HBaseFsck extends Configure
    */
   SortedMap<TableName, TableInfo> checkIntegrity() throws IOException {
     tablesInfo = new TreeMap<TableName,TableInfo> ();
-    List<HbckInfo> noHDFSRegionInfos = new ArrayList<HbckInfo>();
     LOG.debug("There are " + regionInfoMap.size() + " region info entries");
     for (HbckInfo hbi : regionInfoMap.values()) {
       // Check only valid, working regions
       if (hbi.metaEntry == null) {
         // this assumes that consistency check has run loadMetaEntry
-        noHDFSRegionInfos.add(hbi);
         Path p = hbi.getHdfsRegionDir();
         if (p == null) {
           errors.report("No regioninfo in Meta or HDFS. " + hbi);
@@ -3384,6 +3384,7 @@ public class HBaseFsck extends Configure
         // check to see if the existence of this region matches the region in META
         for (HRegionInfo r:regions) {
           HbckInfo hbi = hbck.getOrCreateInfo(r.getEncodedName());
+          if (!RegionReplicaUtil.isDefaultReplica(r)) hbi.setSkipChecks(true);
           hbi.addServer(r, rsinfo);
         }
       } catch (IOException e) {          // unable to connect to the region server.

Modified: hbase/branches/hbase-10070/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java
URL: http://svn.apache.org/viewvc/hbase/branches/hbase-10070/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java?rev=1571884&r1=1571883&r2=1571884&view=diff
==============================================================================
--- hbase/branches/hbase-10070/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java
(original)
+++ hbase/branches/hbase-10070/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java
Wed Feb 26 00:38:15 2014
@@ -356,7 +356,19 @@ public class TestHBaseFsck {
    * @throws KeeperException
    */
   HTable setupTable(TableName tablename) throws Exception {
+    return setupTableWithRegionReplica(tablename, 1);
+  }
+
+  /**
+   * Setup a clean table with a certain region_replica count
+   * @param tableName
+   * @param replicaCount
+   * @return
+   * @throws Exception
+   */
+  HTable setupTableWithRegionReplica(TableName tablename, int replicaCount) throws Exception
{
     HTableDescriptor desc = new HTableDescriptor(tablename);
+    desc.setRegionReplication(replicaCount);
     HColumnDescriptor hcd = new HColumnDescriptor(Bytes.toString(FAM));
     desc.addFamily(hcd); // If a table has no CF's it doesn't get checked
     TEST_UTIL.getHBaseAdmin().createTable(desc, SPLITS);
@@ -552,6 +564,23 @@ public class TestHBaseFsck {
     }
   }
 
+  /*
+   * This creates a table with region_replica > 1 and verifies hbck runs
+   * successfully
+   */
+  @Test
+  public void testHbckWithRegionReplica() throws Exception {
+    TableName table =
+        TableName.valueOf("tableWithReplica");
+    try {
+      setupTableWithRegionReplica(table, 2);
+      assertNoErrors(doFsck(conf, false));
+      assertEquals(ROWKEYS.length, countRows());
+    } finally {
+      deleteTable(table);
+    }
+  }
+
   /**
    * Get region info from local cluster.
    */



Mime
View raw message