hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mi...@apache.org
Subject [05/13] hbase-site git commit: Published site at f9e69b51e1997c6de2ed74f9edbc6947b11c88dc.
Date Fri, 22 Jan 2016 17:00:47 GMT
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/29e33858/testdevapidocs/src-html/org/apache/hadoop/hbase/util/TestHBaseFsckOneRS.html
----------------------------------------------------------------------
diff --git a/testdevapidocs/src-html/org/apache/hadoop/hbase/util/TestHBaseFsckOneRS.html b/testdevapidocs/src-html/org/apache/hadoop/hbase/util/TestHBaseFsckOneRS.html
index 5fb70d8..dbf34e2 100644
--- a/testdevapidocs/src-html/org/apache/hadoop/hbase/util/TestHBaseFsckOneRS.html
+++ b/testdevapidocs/src-html/org/apache/hadoop/hbase/util/TestHBaseFsckOneRS.html
@@ -588,1238 +588,1262 @@
 <span class="sourceLineNo">580</span>    }<a name="line.580"></a>
 <span class="sourceLineNo">581</span>  }<a name="line.581"></a>
 <span class="sourceLineNo">582</span><a name="line.582"></a>
-<span class="sourceLineNo">583</span>  @Test (timeout=180000)<a name="line.583"></a>
-<span class="sourceLineNo">584</span>  public void testHbckAfterRegionMerge() throws Exception {<a name="line.584"></a>
-<span class="sourceLineNo">585</span>    TableName table = TableName.valueOf("testMergeRegionFilesInHdfs");<a name="line.585"></a>
-<span class="sourceLineNo">586</span>    Table meta = null;<a name="line.586"></a>
-<span class="sourceLineNo">587</span>    try {<a name="line.587"></a>
-<span class="sourceLineNo">588</span>      // disable CatalogJanitor<a name="line.588"></a>
-<span class="sourceLineNo">589</span>      TEST_UTIL.getHBaseCluster().getMaster().setCatalogJanitorEnabled(false);<a name="line.589"></a>
-<span class="sourceLineNo">590</span>      setupTable(table);<a name="line.590"></a>
-<span class="sourceLineNo">591</span>      assertEquals(ROWKEYS.length, countRows());<a name="line.591"></a>
-<span class="sourceLineNo">592</span><a name="line.592"></a>
-<span class="sourceLineNo">593</span>      try(RegionLocator rl = connection.getRegionLocator(tbl.getName())) {<a name="line.593"></a>
-<span class="sourceLineNo">594</span>        // make sure data in regions, if in wal only there is no data loss<a name="line.594"></a>
-<span class="sourceLineNo">595</span>        admin.flush(table);<a name="line.595"></a>
-<span class="sourceLineNo">596</span>        HRegionInfo region1 = rl.getRegionLocation(Bytes.toBytes("A")).getRegionInfo();<a name="line.596"></a>
-<span class="sourceLineNo">597</span>        HRegionInfo region2 = rl.getRegionLocation(Bytes.toBytes("B")).getRegionInfo();<a name="line.597"></a>
-<span class="sourceLineNo">598</span><a name="line.598"></a>
-<span class="sourceLineNo">599</span>        int regionCountBeforeMerge = rl.getAllRegionLocations().size();<a name="line.599"></a>
-<span class="sourceLineNo">600</span><a name="line.600"></a>
-<span class="sourceLineNo">601</span>        assertNotEquals(region1, region2);<a name="line.601"></a>
-<span class="sourceLineNo">602</span><a name="line.602"></a>
-<span class="sourceLineNo">603</span>        // do a region merge<a name="line.603"></a>
-<span class="sourceLineNo">604</span>        admin.mergeRegions(region1.getEncodedNameAsBytes(), region2.getEncodedNameAsBytes(), false);<a name="line.604"></a>
-<span class="sourceLineNo">605</span><a name="line.605"></a>
-<span class="sourceLineNo">606</span>        // wait until region merged<a name="line.606"></a>
-<span class="sourceLineNo">607</span>        long timeout = System.currentTimeMillis() + 30 * 1000;<a name="line.607"></a>
-<span class="sourceLineNo">608</span>        while (true) {<a name="line.608"></a>
-<span class="sourceLineNo">609</span>          if (rl.getAllRegionLocations().size() &lt; regionCountBeforeMerge) {<a name="line.609"></a>
-<span class="sourceLineNo">610</span>            break;<a name="line.610"></a>
-<span class="sourceLineNo">611</span>          } else if (System.currentTimeMillis() &gt; timeout) {<a name="line.611"></a>
-<span class="sourceLineNo">612</span>            fail("Time out waiting on region " + region1.getEncodedName() + " and " + region2<a name="line.612"></a>
-<span class="sourceLineNo">613</span>                .getEncodedName() + " be merged");<a name="line.613"></a>
-<span class="sourceLineNo">614</span>          }<a name="line.614"></a>
-<span class="sourceLineNo">615</span>          Thread.sleep(10);<a name="line.615"></a>
-<span class="sourceLineNo">616</span>        }<a name="line.616"></a>
-<span class="sourceLineNo">617</span><a name="line.617"></a>
-<span class="sourceLineNo">618</span>        assertEquals(ROWKEYS.length, countRows());<a name="line.618"></a>
-<span class="sourceLineNo">619</span><a name="line.619"></a>
-<span class="sourceLineNo">620</span>        HBaseFsck hbck = doFsck(conf, false);<a name="line.620"></a>
-<span class="sourceLineNo">621</span>        assertNoErrors(hbck); // no errors<a name="line.621"></a>
-<span class="sourceLineNo">622</span>      }<a name="line.622"></a>
-<span class="sourceLineNo">623</span><a name="line.623"></a>
-<span class="sourceLineNo">624</span>    } finally {<a name="line.624"></a>
-<span class="sourceLineNo">625</span>      TEST_UTIL.getHBaseCluster().getMaster().setCatalogJanitorEnabled(true);<a name="line.625"></a>
-<span class="sourceLineNo">626</span>      cleanupTable(table);<a name="line.626"></a>
-<span class="sourceLineNo">627</span>      IOUtils.closeQuietly(meta);<a name="line.627"></a>
-<span class="sourceLineNo">628</span>    }<a name="line.628"></a>
-<span class="sourceLineNo">629</span>  }<a name="line.629"></a>
-<span class="sourceLineNo">630</span>  /**<a name="line.630"></a>
-<span class="sourceLineNo">631</span>   * This creates entries in hbase:meta with no hdfs data.  This should cleanly<a name="line.631"></a>
-<span class="sourceLineNo">632</span>   * remove the table.<a name="line.632"></a>
-<span class="sourceLineNo">633</span>   */<a name="line.633"></a>
-<span class="sourceLineNo">634</span>  @Test (timeout=180000)<a name="line.634"></a>
-<span class="sourceLineNo">635</span>  public void testNoHdfsTable() throws Exception {<a name="line.635"></a>
-<span class="sourceLineNo">636</span>    TableName table = TableName.valueOf("NoHdfsTable");<a name="line.636"></a>
-<span class="sourceLineNo">637</span>    setupTable(table);<a name="line.637"></a>
-<span class="sourceLineNo">638</span>    assertEquals(ROWKEYS.length, countRows());<a name="line.638"></a>
-<span class="sourceLineNo">639</span><a name="line.639"></a>
-<span class="sourceLineNo">640</span>    // make sure data in regions, if in wal only there is no data loss<a name="line.640"></a>
-<span class="sourceLineNo">641</span>    admin.flush(table);<a name="line.641"></a>
-<span class="sourceLineNo">642</span><a name="line.642"></a>
-<span class="sourceLineNo">643</span>    // Mess it up by deleting hdfs dirs<a name="line.643"></a>
-<span class="sourceLineNo">644</span>    deleteRegion(conf, tbl.getTableDescriptor(), Bytes.toBytes(""),<a name="line.644"></a>
-<span class="sourceLineNo">645</span>        Bytes.toBytes("A"), false, false, true); // don't rm meta<a name="line.645"></a>
-<span class="sourceLineNo">646</span>    deleteRegion(conf, tbl.getTableDescriptor(), Bytes.toBytes("A"),<a name="line.646"></a>
-<span class="sourceLineNo">647</span>        Bytes.toBytes("B"), false, false, true); // don't rm meta<a name="line.647"></a>
-<span class="sourceLineNo">648</span>    deleteRegion(conf, tbl.getTableDescriptor(), Bytes.toBytes("B"),<a name="line.648"></a>
-<span class="sourceLineNo">649</span>        Bytes.toBytes("C"), false, false, true); // don't rm meta<a name="line.649"></a>
-<span class="sourceLineNo">650</span>    deleteRegion(conf, tbl.getTableDescriptor(), Bytes.toBytes("C"),<a name="line.650"></a>
-<span class="sourceLineNo">651</span>        Bytes.toBytes(""), false, false, true); // don't rm meta<a name="line.651"></a>
-<span class="sourceLineNo">652</span><a name="line.652"></a>
-<span class="sourceLineNo">653</span>    // also remove the table directory in hdfs<a name="line.653"></a>
-<span class="sourceLineNo">654</span>    deleteTableDir(table);<a name="line.654"></a>
-<span class="sourceLineNo">655</span><a name="line.655"></a>
-<span class="sourceLineNo">656</span>    HBaseFsck hbck = doFsck(conf, false);<a name="line.656"></a>
-<span class="sourceLineNo">657</span>    assertErrors(hbck, new HBaseFsck.ErrorReporter.ERROR_CODE[] {HBaseFsck.ErrorReporter.ERROR_CODE.NOT_IN_HDFS,<a name="line.657"></a>
-<span class="sourceLineNo">658</span>        HBaseFsck.ErrorReporter.ERROR_CODE.NOT_IN_HDFS, HBaseFsck.ErrorReporter.ERROR_CODE.NOT_IN_HDFS,<a name="line.658"></a>
-<span class="sourceLineNo">659</span>        HBaseFsck.ErrorReporter.ERROR_CODE.NOT_IN_HDFS, HBaseFsck.ErrorReporter.ERROR_CODE.ORPHAN_TABLE_STATE, });<a name="line.659"></a>
-<span class="sourceLineNo">660</span>    // holes are separate from overlap groups<a name="line.660"></a>
-<span class="sourceLineNo">661</span>    assertEquals(0, hbck.getOverlapGroups(table).size());<a name="line.661"></a>
-<span class="sourceLineNo">662</span><a name="line.662"></a>
-<span class="sourceLineNo">663</span>    // fix hole<a name="line.663"></a>
-<span class="sourceLineNo">664</span>    doFsck(conf, true); // detect dangling regions and remove those<a name="line.664"></a>
-<span class="sourceLineNo">665</span><a name="line.665"></a>
-<span class="sourceLineNo">666</span>    // check that hole fixed<a name="line.666"></a>
-<span class="sourceLineNo">667</span>    assertNoErrors(doFsck(conf,false));<a name="line.667"></a>
-<span class="sourceLineNo">668</span>    assertFalse("Table " + table + " should have been deleted", admin.tableExists(table));<a name="line.668"></a>
-<span class="sourceLineNo">669</span>  }<a name="line.669"></a>
-<span class="sourceLineNo">670</span><a name="line.670"></a>
-<span class="sourceLineNo">671</span>  /**<a name="line.671"></a>
-<span class="sourceLineNo">672</span>   * when the hbase.version file missing, It is fix the fault.<a name="line.672"></a>
-<span class="sourceLineNo">673</span>   */<a name="line.673"></a>
-<span class="sourceLineNo">674</span>  @Test (timeout=180000)<a name="line.674"></a>
-<span class="sourceLineNo">675</span>  public void testNoVersionFile() throws Exception {<a name="line.675"></a>
-<span class="sourceLineNo">676</span>    // delete the hbase.version file<a name="line.676"></a>
-<span class="sourceLineNo">677</span>    Path rootDir = FSUtils.getRootDir(conf);<a name="line.677"></a>
-<span class="sourceLineNo">678</span>    FileSystem fs = rootDir.getFileSystem(conf);<a name="line.678"></a>
-<span class="sourceLineNo">679</span>    Path versionFile = new Path(rootDir, HConstants.VERSION_FILE_NAME);<a name="line.679"></a>
-<span class="sourceLineNo">680</span>    fs.delete(versionFile, true);<a name="line.680"></a>
-<span class="sourceLineNo">681</span><a name="line.681"></a>
-<span class="sourceLineNo">682</span>    // test<a name="line.682"></a>
-<span class="sourceLineNo">683</span>    HBaseFsck hbck = doFsck(conf, false);<a name="line.683"></a>
-<span class="sourceLineNo">684</span>    assertErrors(hbck, new HBaseFsck.ErrorReporter.ERROR_CODE[] { HBaseFsck.ErrorReporter.ERROR_CODE.NO_VERSION_FILE });<a name="line.684"></a>
-<span class="sourceLineNo">685</span>    // fix hbase.version missing<a name="line.685"></a>
-<span class="sourceLineNo">686</span>    doFsck(conf, true);<a name="line.686"></a>
-<span class="sourceLineNo">687</span><a name="line.687"></a>
-<span class="sourceLineNo">688</span>    // no version file fixed<a name="line.688"></a>
-<span class="sourceLineNo">689</span>    assertNoErrors(doFsck(conf, false));<a name="line.689"></a>
-<span class="sourceLineNo">690</span>  }<a name="line.690"></a>
-<span class="sourceLineNo">691</span><a name="line.691"></a>
-<span class="sourceLineNo">692</span>  @Test (timeout=180000)<a name="line.692"></a>
-<span class="sourceLineNo">693</span>  public void testNoTableState() throws Exception {<a name="line.693"></a>
-<span class="sourceLineNo">694</span>    // delete the hbase.version file<a name="line.694"></a>
-<span class="sourceLineNo">695</span>    TableName table =<a name="line.695"></a>
-<span class="sourceLineNo">696</span>        TableName.valueOf("testNoTableState");<a name="line.696"></a>
-<span class="sourceLineNo">697</span>    try {<a name="line.697"></a>
-<span class="sourceLineNo">698</span>      setupTable(table);<a name="line.698"></a>
-<span class="sourceLineNo">699</span>      // make sure data in regions, if in wal only there is no data loss<a name="line.699"></a>
-<span class="sourceLineNo">700</span>      admin.flush(table);<a name="line.700"></a>
-<span class="sourceLineNo">701</span><a name="line.701"></a>
-<span class="sourceLineNo">702</span>      MetaTableAccessor.deleteTableState(TEST_UTIL.getConnection(), table);<a name="line.702"></a>
-<span class="sourceLineNo">703</span><a name="line.703"></a>
-<span class="sourceLineNo">704</span>      // test<a name="line.704"></a>
-<span class="sourceLineNo">705</span>      HBaseFsck hbck = doFsck(conf, false);<a name="line.705"></a>
-<span class="sourceLineNo">706</span>      assertErrors(hbck, new HBaseFsck.ErrorReporter.ERROR_CODE[] { HBaseFsck.ErrorReporter.ERROR_CODE.NO_TABLE_STATE });<a name="line.706"></a>
-<span class="sourceLineNo">707</span>      // fix table state missing<a name="line.707"></a>
-<span class="sourceLineNo">708</span>      doFsck(conf, true);<a name="line.708"></a>
-<span class="sourceLineNo">709</span><a name="line.709"></a>
-<span class="sourceLineNo">710</span>      assertNoErrors(doFsck(conf, false));<a name="line.710"></a>
-<span class="sourceLineNo">711</span>      assertTrue(TEST_UTIL.getHBaseAdmin().isTableEnabled(table));<a name="line.711"></a>
-<span class="sourceLineNo">712</span>    } finally {<a name="line.712"></a>
-<span class="sourceLineNo">713</span>      cleanupTable(table);<a name="line.713"></a>
-<span class="sourceLineNo">714</span>    }<a name="line.714"></a>
-<span class="sourceLineNo">715</span>  }<a name="line.715"></a>
-<span class="sourceLineNo">716</span><a name="line.716"></a>
-<span class="sourceLineNo">717</span>  /**<a name="line.717"></a>
-<span class="sourceLineNo">718</span>   * This creates two tables and mess both of them and fix them one by one<a name="line.718"></a>
-<span class="sourceLineNo">719</span>   */<a name="line.719"></a>
-<span class="sourceLineNo">720</span>  @Test (timeout=180000)<a name="line.720"></a>
-<span class="sourceLineNo">721</span>  public void testFixByTable() throws Exception {<a name="line.721"></a>
-<span class="sourceLineNo">722</span>    TableName table1 =<a name="line.722"></a>
-<span class="sourceLineNo">723</span>        TableName.valueOf("testFixByTable1");<a name="line.723"></a>
-<span class="sourceLineNo">724</span>    TableName table2 =<a name="line.724"></a>
-<span class="sourceLineNo">725</span>        TableName.valueOf("testFixByTable2");<a name="line.725"></a>
-<span class="sourceLineNo">726</span>    try {<a name="line.726"></a>
-<span class="sourceLineNo">727</span>      setupTable(table1);<a name="line.727"></a>
-<span class="sourceLineNo">728</span>      // make sure data in regions, if in wal only there is no data loss<a name="line.728"></a>
-<span class="sourceLineNo">729</span>      admin.flush(table1);<a name="line.729"></a>
-<span class="sourceLineNo">730</span>      // Mess them up by leaving a hole in the hdfs data<a name="line.730"></a>
-<span class="sourceLineNo">731</span>      deleteRegion(conf, tbl.getTableDescriptor(), Bytes.toBytes("B"),<a name="line.731"></a>
-<span class="sourceLineNo">732</span>          Bytes.toBytes("C"), false, false, true); // don't rm meta<a name="line.732"></a>
+<span class="sourceLineNo">583</span>  /**<a name="line.583"></a>
+<span class="sourceLineNo">584</span>   * test region boundaries and make sure store file had been created.<a name="line.584"></a>
+<span class="sourceLineNo">585</span>   * @throws Exception<a name="line.585"></a>
+<span class="sourceLineNo">586</span>   */<a name="line.586"></a>
+<span class="sourceLineNo">587</span>  @Test(timeout = 180000)<a name="line.587"></a>
+<span class="sourceLineNo">588</span>  public void testRegionBoundariesCheckWithFlushTable() throws Exception {<a name="line.588"></a>
+<span class="sourceLineNo">589</span>    HBaseFsck hbck = doFsck(conf, false);<a name="line.589"></a>
+<span class="sourceLineNo">590</span>    assertNoErrors(hbck); // no errors<a name="line.590"></a>
+<span class="sourceLineNo">591</span>    TableName table = TableName.valueOf("testRegionBoundariesCheckWithFlushTable");<a name="line.591"></a>
+<span class="sourceLineNo">592</span>    try {<a name="line.592"></a>
+<span class="sourceLineNo">593</span>      setupTable(table);<a name="line.593"></a>
+<span class="sourceLineNo">594</span>      admin.flush(table);<a name="line.594"></a>
+<span class="sourceLineNo">595</span>      hbck.connect(); // need connection to have access to META<a name="line.595"></a>
+<span class="sourceLineNo">596</span>      hbck.checkRegionBoundaries();<a name="line.596"></a>
+<span class="sourceLineNo">597</span>      assertNoErrors(hbck); // no errors<a name="line.597"></a>
+<span class="sourceLineNo">598</span>    } catch (IllegalArgumentException e) {<a name="line.598"></a>
+<span class="sourceLineNo">599</span>      if (e.getMessage().endsWith("not a valid DFS filename.")) {<a name="line.599"></a>
+<span class="sourceLineNo">600</span>        fail("Table directory path is not valid." + e.getMessage());<a name="line.600"></a>
+<span class="sourceLineNo">601</span>      }<a name="line.601"></a>
+<span class="sourceLineNo">602</span>    } finally {<a name="line.602"></a>
+<span class="sourceLineNo">603</span>      hbck.close();<a name="line.603"></a>
+<span class="sourceLineNo">604</span>    }<a name="line.604"></a>
+<span class="sourceLineNo">605</span>  }<a name="line.605"></a>
+<span class="sourceLineNo">606</span>  <a name="line.606"></a>
+<span class="sourceLineNo">607</span>  @Test (timeout=180000)<a name="line.607"></a>
+<span class="sourceLineNo">608</span>  public void testHbckAfterRegionMerge() throws Exception {<a name="line.608"></a>
+<span class="sourceLineNo">609</span>    TableName table = TableName.valueOf("testMergeRegionFilesInHdfs");<a name="line.609"></a>
+<span class="sourceLineNo">610</span>    Table meta = null;<a name="line.610"></a>
+<span class="sourceLineNo">611</span>    try {<a name="line.611"></a>
+<span class="sourceLineNo">612</span>      // disable CatalogJanitor<a name="line.612"></a>
+<span class="sourceLineNo">613</span>      TEST_UTIL.getHBaseCluster().getMaster().setCatalogJanitorEnabled(false);<a name="line.613"></a>
+<span class="sourceLineNo">614</span>      setupTable(table);<a name="line.614"></a>
+<span class="sourceLineNo">615</span>      assertEquals(ROWKEYS.length, countRows());<a name="line.615"></a>
+<span class="sourceLineNo">616</span><a name="line.616"></a>
+<span class="sourceLineNo">617</span>      try(RegionLocator rl = connection.getRegionLocator(tbl.getName())) {<a name="line.617"></a>
+<span class="sourceLineNo">618</span>        // make sure data in regions, if in wal only there is no data loss<a name="line.618"></a>
+<span class="sourceLineNo">619</span>        admin.flush(table);<a name="line.619"></a>
+<span class="sourceLineNo">620</span>        HRegionInfo region1 = rl.getRegionLocation(Bytes.toBytes("A")).getRegionInfo();<a name="line.620"></a>
+<span class="sourceLineNo">621</span>        HRegionInfo region2 = rl.getRegionLocation(Bytes.toBytes("B")).getRegionInfo();<a name="line.621"></a>
+<span class="sourceLineNo">622</span><a name="line.622"></a>
+<span class="sourceLineNo">623</span>        int regionCountBeforeMerge = rl.getAllRegionLocations().size();<a name="line.623"></a>
+<span class="sourceLineNo">624</span><a name="line.624"></a>
+<span class="sourceLineNo">625</span>        assertNotEquals(region1, region2);<a name="line.625"></a>
+<span class="sourceLineNo">626</span><a name="line.626"></a>
+<span class="sourceLineNo">627</span>        // do a region merge<a name="line.627"></a>
+<span class="sourceLineNo">628</span>        admin.mergeRegions(region1.getEncodedNameAsBytes(), region2.getEncodedNameAsBytes(), false);<a name="line.628"></a>
+<span class="sourceLineNo">629</span><a name="line.629"></a>
+<span class="sourceLineNo">630</span>        // wait until region merged<a name="line.630"></a>
+<span class="sourceLineNo">631</span>        long timeout = System.currentTimeMillis() + 30 * 1000;<a name="line.631"></a>
+<span class="sourceLineNo">632</span>        while (true) {<a name="line.632"></a>
+<span class="sourceLineNo">633</span>          if (rl.getAllRegionLocations().size() &lt; regionCountBeforeMerge) {<a name="line.633"></a>
+<span class="sourceLineNo">634</span>            break;<a name="line.634"></a>
+<span class="sourceLineNo">635</span>          } else if (System.currentTimeMillis() &gt; timeout) {<a name="line.635"></a>
+<span class="sourceLineNo">636</span>            fail("Time out waiting on region " + region1.getEncodedName() + " and " + region2<a name="line.636"></a>
+<span class="sourceLineNo">637</span>                .getEncodedName() + " be merged");<a name="line.637"></a>
+<span class="sourceLineNo">638</span>          }<a name="line.638"></a>
+<span class="sourceLineNo">639</span>          Thread.sleep(10);<a name="line.639"></a>
+<span class="sourceLineNo">640</span>        }<a name="line.640"></a>
+<span class="sourceLineNo">641</span><a name="line.641"></a>
+<span class="sourceLineNo">642</span>        assertEquals(ROWKEYS.length, countRows());<a name="line.642"></a>
+<span class="sourceLineNo">643</span><a name="line.643"></a>
+<span class="sourceLineNo">644</span>        HBaseFsck hbck = doFsck(conf, false);<a name="line.644"></a>
+<span class="sourceLineNo">645</span>        assertNoErrors(hbck); // no errors<a name="line.645"></a>
+<span class="sourceLineNo">646</span>      }<a name="line.646"></a>
+<span class="sourceLineNo">647</span><a name="line.647"></a>
+<span class="sourceLineNo">648</span>    } finally {<a name="line.648"></a>
+<span class="sourceLineNo">649</span>      TEST_UTIL.getHBaseCluster().getMaster().setCatalogJanitorEnabled(true);<a name="line.649"></a>
+<span class="sourceLineNo">650</span>      cleanupTable(table);<a name="line.650"></a>
+<span class="sourceLineNo">651</span>      IOUtils.closeQuietly(meta);<a name="line.651"></a>
+<span class="sourceLineNo">652</span>    }<a name="line.652"></a>
+<span class="sourceLineNo">653</span>  }<a name="line.653"></a>
+<span class="sourceLineNo">654</span>  /**<a name="line.654"></a>
+<span class="sourceLineNo">655</span>   * This creates entries in hbase:meta with no hdfs data.  This should cleanly<a name="line.655"></a>
+<span class="sourceLineNo">656</span>   * remove the table.<a name="line.656"></a>
+<span class="sourceLineNo">657</span>   */<a name="line.657"></a>
+<span class="sourceLineNo">658</span>  @Test (timeout=180000)<a name="line.658"></a>
+<span class="sourceLineNo">659</span>  public void testNoHdfsTable() throws Exception {<a name="line.659"></a>
+<span class="sourceLineNo">660</span>    TableName table = TableName.valueOf("NoHdfsTable");<a name="line.660"></a>
+<span class="sourceLineNo">661</span>    setupTable(table);<a name="line.661"></a>
+<span class="sourceLineNo">662</span>    assertEquals(ROWKEYS.length, countRows());<a name="line.662"></a>
+<span class="sourceLineNo">663</span><a name="line.663"></a>
+<span class="sourceLineNo">664</span>    // make sure data in regions, if in wal only there is no data loss<a name="line.664"></a>
+<span class="sourceLineNo">665</span>    admin.flush(table);<a name="line.665"></a>
+<span class="sourceLineNo">666</span><a name="line.666"></a>
+<span class="sourceLineNo">667</span>    // Mess it up by deleting hdfs dirs<a name="line.667"></a>
+<span class="sourceLineNo">668</span>    deleteRegion(conf, tbl.getTableDescriptor(), Bytes.toBytes(""),<a name="line.668"></a>
+<span class="sourceLineNo">669</span>        Bytes.toBytes("A"), false, false, true); // don't rm meta<a name="line.669"></a>
+<span class="sourceLineNo">670</span>    deleteRegion(conf, tbl.getTableDescriptor(), Bytes.toBytes("A"),<a name="line.670"></a>
+<span class="sourceLineNo">671</span>        Bytes.toBytes("B"), false, false, true); // don't rm meta<a name="line.671"></a>
+<span class="sourceLineNo">672</span>    deleteRegion(conf, tbl.getTableDescriptor(), Bytes.toBytes("B"),<a name="line.672"></a>
+<span class="sourceLineNo">673</span>        Bytes.toBytes("C"), false, false, true); // don't rm meta<a name="line.673"></a>
+<span class="sourceLineNo">674</span>    deleteRegion(conf, tbl.getTableDescriptor(), Bytes.toBytes("C"),<a name="line.674"></a>
+<span class="sourceLineNo">675</span>        Bytes.toBytes(""), false, false, true); // don't rm meta<a name="line.675"></a>
+<span class="sourceLineNo">676</span><a name="line.676"></a>
+<span class="sourceLineNo">677</span>    // also remove the table directory in hdfs<a name="line.677"></a>
+<span class="sourceLineNo">678</span>    deleteTableDir(table);<a name="line.678"></a>
+<span class="sourceLineNo">679</span><a name="line.679"></a>
+<span class="sourceLineNo">680</span>    HBaseFsck hbck = doFsck(conf, false);<a name="line.680"></a>
+<span class="sourceLineNo">681</span>    assertErrors(hbck, new HBaseFsck.ErrorReporter.ERROR_CODE[] {HBaseFsck.ErrorReporter.ERROR_CODE.NOT_IN_HDFS,<a name="line.681"></a>
+<span class="sourceLineNo">682</span>        HBaseFsck.ErrorReporter.ERROR_CODE.NOT_IN_HDFS, HBaseFsck.ErrorReporter.ERROR_CODE.NOT_IN_HDFS,<a name="line.682"></a>
+<span class="sourceLineNo">683</span>        HBaseFsck.ErrorReporter.ERROR_CODE.NOT_IN_HDFS, HBaseFsck.ErrorReporter.ERROR_CODE.ORPHAN_TABLE_STATE, });<a name="line.683"></a>
+<span class="sourceLineNo">684</span>    // holes are separate from overlap groups<a name="line.684"></a>
+<span class="sourceLineNo">685</span>    assertEquals(0, hbck.getOverlapGroups(table).size());<a name="line.685"></a>
+<span class="sourceLineNo">686</span><a name="line.686"></a>
+<span class="sourceLineNo">687</span>    // fix hole<a name="line.687"></a>
+<span class="sourceLineNo">688</span>    doFsck(conf, true); // detect dangling regions and remove those<a name="line.688"></a>
+<span class="sourceLineNo">689</span><a name="line.689"></a>
+<span class="sourceLineNo">690</span>    // check that hole fixed<a name="line.690"></a>
+<span class="sourceLineNo">691</span>    assertNoErrors(doFsck(conf,false));<a name="line.691"></a>
+<span class="sourceLineNo">692</span>    assertFalse("Table " + table + " should have been deleted", admin.tableExists(table));<a name="line.692"></a>
+<span class="sourceLineNo">693</span>  }<a name="line.693"></a>
+<span class="sourceLineNo">694</span><a name="line.694"></a>
+<span class="sourceLineNo">695</span>  /**<a name="line.695"></a>
+<span class="sourceLineNo">696</span>   * when the hbase.version file missing, It is fix the fault.<a name="line.696"></a>
+<span class="sourceLineNo">697</span>   */<a name="line.697"></a>
+<span class="sourceLineNo">698</span>  @Test (timeout=180000)<a name="line.698"></a>
+<span class="sourceLineNo">699</span>  public void testNoVersionFile() throws Exception {<a name="line.699"></a>
+<span class="sourceLineNo">700</span>    // delete the hbase.version file<a name="line.700"></a>
+<span class="sourceLineNo">701</span>    Path rootDir = FSUtils.getRootDir(conf);<a name="line.701"></a>
+<span class="sourceLineNo">702</span>    FileSystem fs = rootDir.getFileSystem(conf);<a name="line.702"></a>
+<span class="sourceLineNo">703</span>    Path versionFile = new Path(rootDir, HConstants.VERSION_FILE_NAME);<a name="line.703"></a>
+<span class="sourceLineNo">704</span>    fs.delete(versionFile, true);<a name="line.704"></a>
+<span class="sourceLineNo">705</span><a name="line.705"></a>
+<span class="sourceLineNo">706</span>    // test<a name="line.706"></a>
+<span class="sourceLineNo">707</span>    HBaseFsck hbck = doFsck(conf, false);<a name="line.707"></a>
+<span class="sourceLineNo">708</span>    assertErrors(hbck, new HBaseFsck.ErrorReporter.ERROR_CODE[] { HBaseFsck.ErrorReporter.ERROR_CODE.NO_VERSION_FILE });<a name="line.708"></a>
+<span class="sourceLineNo">709</span>    // fix hbase.version missing<a name="line.709"></a>
+<span class="sourceLineNo">710</span>    doFsck(conf, true);<a name="line.710"></a>
+<span class="sourceLineNo">711</span><a name="line.711"></a>
+<span class="sourceLineNo">712</span>    // no version file fixed<a name="line.712"></a>
+<span class="sourceLineNo">713</span>    assertNoErrors(doFsck(conf, false));<a name="line.713"></a>
+<span class="sourceLineNo">714</span>  }<a name="line.714"></a>
+<span class="sourceLineNo">715</span><a name="line.715"></a>
+<span class="sourceLineNo">716</span>  @Test (timeout=180000)<a name="line.716"></a>
+<span class="sourceLineNo">717</span>  public void testNoTableState() throws Exception {<a name="line.717"></a>
+<span class="sourceLineNo">718</span>    // delete the hbase.version file<a name="line.718"></a>
+<span class="sourceLineNo">719</span>    TableName table =<a name="line.719"></a>
+<span class="sourceLineNo">720</span>        TableName.valueOf("testNoTableState");<a name="line.720"></a>
+<span class="sourceLineNo">721</span>    try {<a name="line.721"></a>
+<span class="sourceLineNo">722</span>      setupTable(table);<a name="line.722"></a>
+<span class="sourceLineNo">723</span>      // make sure data in regions, if in wal only there is no data loss<a name="line.723"></a>
+<span class="sourceLineNo">724</span>      admin.flush(table);<a name="line.724"></a>
+<span class="sourceLineNo">725</span><a name="line.725"></a>
+<span class="sourceLineNo">726</span>      MetaTableAccessor.deleteTableState(TEST_UTIL.getConnection(), table);<a name="line.726"></a>
+<span class="sourceLineNo">727</span><a name="line.727"></a>
+<span class="sourceLineNo">728</span>      // test<a name="line.728"></a>
+<span class="sourceLineNo">729</span>      HBaseFsck hbck = doFsck(conf, false);<a name="line.729"></a>
+<span class="sourceLineNo">730</span>      assertErrors(hbck, new HBaseFsck.ErrorReporter.ERROR_CODE[] { HBaseFsck.ErrorReporter.ERROR_CODE.NO_TABLE_STATE });<a name="line.730"></a>
+<span class="sourceLineNo">731</span>      // fix table state missing<a name="line.731"></a>
+<span class="sourceLineNo">732</span>      doFsck(conf, true);<a name="line.732"></a>
 <span class="sourceLineNo">733</span><a name="line.733"></a>
-<span class="sourceLineNo">734</span>      setupTable(table2);<a name="line.734"></a>
-<span class="sourceLineNo">735</span>      // make sure data in regions, if in wal only there is no data loss<a name="line.735"></a>
-<span class="sourceLineNo">736</span>      admin.flush(table2);<a name="line.736"></a>
-<span class="sourceLineNo">737</span>      // Mess them up by leaving a hole in the hdfs data<a name="line.737"></a>
-<span class="sourceLineNo">738</span>      deleteRegion(conf, tbl.getTableDescriptor(), Bytes.toBytes("B"), Bytes.toBytes("C"), false,<a name="line.738"></a>
-<span class="sourceLineNo">739</span>          false, true); // don't rm meta<a name="line.739"></a>
+<span class="sourceLineNo">734</span>      assertNoErrors(doFsck(conf, false));<a name="line.734"></a>
+<span class="sourceLineNo">735</span>      assertTrue(TEST_UTIL.getHBaseAdmin().isTableEnabled(table));<a name="line.735"></a>
+<span class="sourceLineNo">736</span>    } finally {<a name="line.736"></a>
+<span class="sourceLineNo">737</span>      cleanupTable(table);<a name="line.737"></a>
+<span class="sourceLineNo">738</span>    }<a name="line.738"></a>
+<span class="sourceLineNo">739</span>  }<a name="line.739"></a>
 <span class="sourceLineNo">740</span><a name="line.740"></a>
-<span class="sourceLineNo">741</span>      HBaseFsck hbck = doFsck(conf, false);<a name="line.741"></a>
-<span class="sourceLineNo">742</span>      assertErrors(hbck, new HBaseFsck.ErrorReporter.ERROR_CODE[] { HBaseFsck.ErrorReporter.ERROR_CODE.NOT_IN_HDFS, HBaseFsck.ErrorReporter.ERROR_CODE.NOT_IN_HDFS });<a name="line.742"></a>
-<span class="sourceLineNo">743</span><a name="line.743"></a>
-<span class="sourceLineNo">744</span>      // fix hole in table 1<a name="line.744"></a>
-<span class="sourceLineNo">745</span>      doFsck(conf, true, table1);<a name="line.745"></a>
-<span class="sourceLineNo">746</span>      // check that hole in table 1 fixed<a name="line.746"></a>
-<span class="sourceLineNo">747</span>      assertNoErrors(doFsck(conf, false, table1));<a name="line.747"></a>
-<span class="sourceLineNo">748</span>      // check that hole in table 2 still there<a name="line.748"></a>
-<span class="sourceLineNo">749</span>      assertErrors(doFsck(conf, false, table2), new HBaseFsck.ErrorReporter.ERROR_CODE[] { HBaseFsck.ErrorReporter.ERROR_CODE.NOT_IN_HDFS });<a name="line.749"></a>
-<span class="sourceLineNo">750</span><a name="line.750"></a>
-<span class="sourceLineNo">751</span>      // fix hole in table 2<a name="line.751"></a>
-<span class="sourceLineNo">752</span>      doFsck(conf, true, table2);<a name="line.752"></a>
-<span class="sourceLineNo">753</span>      // check that hole in both tables fixed<a name="line.753"></a>
-<span class="sourceLineNo">754</span>      assertNoErrors(doFsck(conf, false));<a name="line.754"></a>
-<span class="sourceLineNo">755</span>      assertEquals(ROWKEYS.length - 2, countRows());<a name="line.755"></a>
-<span class="sourceLineNo">756</span>    } finally {<a name="line.756"></a>
-<span class="sourceLineNo">757</span>      cleanupTable(table1);<a name="line.757"></a>
-<span class="sourceLineNo">758</span>      cleanupTable(table2);<a name="line.758"></a>
-<span class="sourceLineNo">759</span>    }<a name="line.759"></a>
-<span class="sourceLineNo">760</span>  }<a name="line.760"></a>
-<span class="sourceLineNo">761</span>  /**<a name="line.761"></a>
-<span class="sourceLineNo">762</span>   * A split parent in meta, in hdfs, and not deployed<a name="line.762"></a>
-<span class="sourceLineNo">763</span>   */<a name="line.763"></a>
-<span class="sourceLineNo">764</span>  @Test (timeout=180000)<a name="line.764"></a>
-<span class="sourceLineNo">765</span>  public void testLingeringSplitParent() throws Exception {<a name="line.765"></a>
-<span class="sourceLineNo">766</span>    TableName table =<a name="line.766"></a>
-<span class="sourceLineNo">767</span>        TableName.valueOf("testLingeringSplitParent");<a name="line.767"></a>
-<span class="sourceLineNo">768</span>    Table meta = null;<a name="line.768"></a>
-<span class="sourceLineNo">769</span>    try {<a name="line.769"></a>
-<span class="sourceLineNo">770</span>      setupTable(table);<a name="line.770"></a>
-<span class="sourceLineNo">771</span>      assertEquals(ROWKEYS.length, countRows());<a name="line.771"></a>
-<span class="sourceLineNo">772</span><a name="line.772"></a>
-<span class="sourceLineNo">773</span>      // make sure data in regions, if in wal only there is no data loss<a name="line.773"></a>
-<span class="sourceLineNo">774</span>      admin.flush(table);<a name="line.774"></a>
-<span class="sourceLineNo">775</span><a name="line.775"></a>
-<span class="sourceLineNo">776</span>      HRegionLocation location;<a name="line.776"></a>
-<span class="sourceLineNo">777</span>      try(RegionLocator rl = connection.getRegionLocator(tbl.getName())) {<a name="line.777"></a>
-<span class="sourceLineNo">778</span>        location = rl.getRegionLocation(Bytes.toBytes("B"));<a name="line.778"></a>
-<span class="sourceLineNo">779</span>      }<a name="line.779"></a>
-<span class="sourceLineNo">780</span><a name="line.780"></a>
-<span class="sourceLineNo">781</span>      // Delete one region from meta, but not hdfs, unassign it.<a name="line.781"></a>
-<span class="sourceLineNo">782</span>      deleteRegion(conf, tbl.getTableDescriptor(), Bytes.toBytes("B"),<a name="line.782"></a>
-<span class="sourceLineNo">783</span>          Bytes.toBytes("C"), true, true, false);<a name="line.783"></a>
-<span class="sourceLineNo">784</span><a name="line.784"></a>
-<span class="sourceLineNo">785</span>      // Create a new meta entry to fake it as a split parent.<a name="line.785"></a>
-<span class="sourceLineNo">786</span>      meta = connection.getTable(TableName.META_TABLE_NAME, tableExecutorService);<a name="line.786"></a>
-<span class="sourceLineNo">787</span>      HRegionInfo hri = location.getRegionInfo();<a name="line.787"></a>
-<span class="sourceLineNo">788</span><a name="line.788"></a>
-<span class="sourceLineNo">789</span>      HRegionInfo a = new HRegionInfo(tbl.getName(),<a name="line.789"></a>
-<span class="sourceLineNo">790</span>          Bytes.toBytes("B"), Bytes.toBytes("BM"));<a name="line.790"></a>
-<span class="sourceLineNo">791</span>      HRegionInfo b = new HRegionInfo(tbl.getName(),<a name="line.791"></a>
-<span class="sourceLineNo">792</span>          Bytes.toBytes("BM"), Bytes.toBytes("C"));<a name="line.792"></a>
-<span class="sourceLineNo">793</span><a name="line.793"></a>
-<span class="sourceLineNo">794</span>      hri.setOffline(true);<a name="line.794"></a>
-<span class="sourceLineNo">795</span>      hri.setSplit(true);<a name="line.795"></a>
+<span class="sourceLineNo">741</span>  /**<a name="line.741"></a>
+<span class="sourceLineNo">742</span>   * This creates two tables and mess both of them and fix them one by one<a name="line.742"></a>
+<span class="sourceLineNo">743</span>   */<a name="line.743"></a>
+<span class="sourceLineNo">744</span>  @Test (timeout=180000)<a name="line.744"></a>
+<span class="sourceLineNo">745</span>  public void testFixByTable() throws Exception {<a name="line.745"></a>
+<span class="sourceLineNo">746</span>    TableName table1 =<a name="line.746"></a>
+<span class="sourceLineNo">747</span>        TableName.valueOf("testFixByTable1");<a name="line.747"></a>
+<span class="sourceLineNo">748</span>    TableName table2 =<a name="line.748"></a>
+<span class="sourceLineNo">749</span>        TableName.valueOf("testFixByTable2");<a name="line.749"></a>
+<span class="sourceLineNo">750</span>    try {<a name="line.750"></a>
+<span class="sourceLineNo">751</span>      setupTable(table1);<a name="line.751"></a>
+<span class="sourceLineNo">752</span>      // make sure data in regions, if in wal only there is no data loss<a name="line.752"></a>
+<span class="sourceLineNo">753</span>      admin.flush(table1);<a name="line.753"></a>
+<span class="sourceLineNo">754</span>      // Mess them up by leaving a hole in the hdfs data<a name="line.754"></a>
+<span class="sourceLineNo">755</span>      deleteRegion(conf, tbl.getTableDescriptor(), Bytes.toBytes("B"),<a name="line.755"></a>
+<span class="sourceLineNo">756</span>          Bytes.toBytes("C"), false, false, true); // don't rm meta<a name="line.756"></a>
+<span class="sourceLineNo">757</span><a name="line.757"></a>
+<span class="sourceLineNo">758</span>      setupTable(table2);<a name="line.758"></a>
+<span class="sourceLineNo">759</span>      // make sure data in regions, if in wal only there is no data loss<a name="line.759"></a>
+<span class="sourceLineNo">760</span>      admin.flush(table2);<a name="line.760"></a>
+<span class="sourceLineNo">761</span>      // Mess them up by leaving a hole in the hdfs data<a name="line.761"></a>
+<span class="sourceLineNo">762</span>      deleteRegion(conf, tbl.getTableDescriptor(), Bytes.toBytes("B"), Bytes.toBytes("C"), false,<a name="line.762"></a>
+<span class="sourceLineNo">763</span>          false, true); // don't rm meta<a name="line.763"></a>
+<span class="sourceLineNo">764</span><a name="line.764"></a>
+<span class="sourceLineNo">765</span>      HBaseFsck hbck = doFsck(conf, false);<a name="line.765"></a>
+<span class="sourceLineNo">766</span>      assertErrors(hbck, new HBaseFsck.ErrorReporter.ERROR_CODE[] { HBaseFsck.ErrorReporter.ERROR_CODE.NOT_IN_HDFS, HBaseFsck.ErrorReporter.ERROR_CODE.NOT_IN_HDFS });<a name="line.766"></a>
+<span class="sourceLineNo">767</span><a name="line.767"></a>
+<span class="sourceLineNo">768</span>      // fix hole in table 1<a name="line.768"></a>
+<span class="sourceLineNo">769</span>      doFsck(conf, true, table1);<a name="line.769"></a>
+<span class="sourceLineNo">770</span>      // check that hole in table 1 fixed<a name="line.770"></a>
+<span class="sourceLineNo">771</span>      assertNoErrors(doFsck(conf, false, table1));<a name="line.771"></a>
+<span class="sourceLineNo">772</span>      // check that hole in table 2 still there<a name="line.772"></a>
+<span class="sourceLineNo">773</span>      assertErrors(doFsck(conf, false, table2), new HBaseFsck.ErrorReporter.ERROR_CODE[] { HBaseFsck.ErrorReporter.ERROR_CODE.NOT_IN_HDFS });<a name="line.773"></a>
+<span class="sourceLineNo">774</span><a name="line.774"></a>
+<span class="sourceLineNo">775</span>      // fix hole in table 2<a name="line.775"></a>
+<span class="sourceLineNo">776</span>      doFsck(conf, true, table2);<a name="line.776"></a>
+<span class="sourceLineNo">777</span>      // check that hole in both tables fixed<a name="line.777"></a>
+<span class="sourceLineNo">778</span>      assertNoErrors(doFsck(conf, false));<a name="line.778"></a>
+<span class="sourceLineNo">779</span>      assertEquals(ROWKEYS.length - 2, countRows());<a name="line.779"></a>
+<span class="sourceLineNo">780</span>    } finally {<a name="line.780"></a>
+<span class="sourceLineNo">781</span>      cleanupTable(table1);<a name="line.781"></a>
+<span class="sourceLineNo">782</span>      cleanupTable(table2);<a name="line.782"></a>
+<span class="sourceLineNo">783</span>    }<a name="line.783"></a>
+<span class="sourceLineNo">784</span>  }<a name="line.784"></a>
+<span class="sourceLineNo">785</span>  /**<a name="line.785"></a>
+<span class="sourceLineNo">786</span>   * A split parent in meta, in hdfs, and not deployed<a name="line.786"></a>
+<span class="sourceLineNo">787</span>   */<a name="line.787"></a>
+<span class="sourceLineNo">788</span>  @Test (timeout=180000)<a name="line.788"></a>
+<span class="sourceLineNo">789</span>  public void testLingeringSplitParent() throws Exception {<a name="line.789"></a>
+<span class="sourceLineNo">790</span>    TableName table =<a name="line.790"></a>
+<span class="sourceLineNo">791</span>        TableName.valueOf("testLingeringSplitParent");<a name="line.791"></a>
+<span class="sourceLineNo">792</span>    Table meta = null;<a name="line.792"></a>
+<span class="sourceLineNo">793</span>    try {<a name="line.793"></a>
+<span class="sourceLineNo">794</span>      setupTable(table);<a name="line.794"></a>
+<span class="sourceLineNo">795</span>      assertEquals(ROWKEYS.length, countRows());<a name="line.795"></a>
 <span class="sourceLineNo">796</span><a name="line.796"></a>
-<span class="sourceLineNo">797</span>      MetaTableAccessor.addRegionToMeta(meta, hri, a, b);<a name="line.797"></a>
-<span class="sourceLineNo">798</span>      meta.close();<a name="line.798"></a>
-<span class="sourceLineNo">799</span>      admin.flush(TableName.META_TABLE_NAME);<a name="line.799"></a>
-<span class="sourceLineNo">800</span><a name="line.800"></a>
-<span class="sourceLineNo">801</span>      HBaseFsck hbck = doFsck(conf, false);<a name="line.801"></a>
-<span class="sourceLineNo">802</span>      assertErrors(hbck, new HBaseFsck.ErrorReporter.ERROR_CODE[] {<a name="line.802"></a>
-<span class="sourceLineNo">803</span>          HBaseFsck.ErrorReporter.ERROR_CODE.LINGERING_SPLIT_PARENT, HBaseFsck.ErrorReporter.ERROR_CODE.HOLE_IN_REGION_CHAIN});<a name="line.803"></a>
+<span class="sourceLineNo">797</span>      // make sure data in regions, if in wal only there is no data loss<a name="line.797"></a>
+<span class="sourceLineNo">798</span>      admin.flush(table);<a name="line.798"></a>
+<span class="sourceLineNo">799</span><a name="line.799"></a>
+<span class="sourceLineNo">800</span>      HRegionLocation location;<a name="line.800"></a>
+<span class="sourceLineNo">801</span>      try(RegionLocator rl = connection.getRegionLocator(tbl.getName())) {<a name="line.801"></a>
+<span class="sourceLineNo">802</span>        location = rl.getRegionLocation(Bytes.toBytes("B"));<a name="line.802"></a>
+<span class="sourceLineNo">803</span>      }<a name="line.803"></a>
 <span class="sourceLineNo">804</span><a name="line.804"></a>
-<span class="sourceLineNo">805</span>      // regular repair cannot fix lingering split parent<a name="line.805"></a>
-<span class="sourceLineNo">806</span>      hbck = doFsck(conf, true);<a name="line.806"></a>
-<span class="sourceLineNo">807</span>      assertErrors(hbck, new HBaseFsck.ErrorReporter.ERROR_CODE[] {<a name="line.807"></a>
-<span class="sourceLineNo">808</span>          HBaseFsck.ErrorReporter.ERROR_CODE.LINGERING_SPLIT_PARENT, HBaseFsck.ErrorReporter.ERROR_CODE.HOLE_IN_REGION_CHAIN });<a name="line.808"></a>
-<span class="sourceLineNo">809</span>      assertFalse(hbck.shouldRerun());<a name="line.809"></a>
-<span class="sourceLineNo">810</span>      hbck = doFsck(conf, false);<a name="line.810"></a>
-<span class="sourceLineNo">811</span>      assertErrors(hbck, new HBaseFsck.ErrorReporter.ERROR_CODE[] {<a name="line.811"></a>
-<span class="sourceLineNo">812</span>          HBaseFsck.ErrorReporter.ERROR_CODE.LINGERING_SPLIT_PARENT, HBaseFsck.ErrorReporter.ERROR_CODE.HOLE_IN_REGION_CHAIN});<a name="line.812"></a>
-<span class="sourceLineNo">813</span><a name="line.813"></a>
-<span class="sourceLineNo">814</span>      // fix lingering split parent<a name="line.814"></a>
-<span class="sourceLineNo">815</span>      hbck = new HBaseFsck(conf, hbfsckExecutorService);<a name="line.815"></a>
-<span class="sourceLineNo">816</span>      hbck.connect();<a name="line.816"></a>
-<span class="sourceLineNo">817</span>      HBaseFsck.setDisplayFullReport(); // i.e. -details<a name="line.817"></a>
-<span class="sourceLineNo">818</span>      hbck.setTimeLag(0);<a name="line.818"></a>
-<span class="sourceLineNo">819</span>      hbck.setFixSplitParents(true);<a name="line.819"></a>
-<span class="sourceLineNo">820</span>      hbck.onlineHbck();<a name="line.820"></a>
-<span class="sourceLineNo">821</span>      assertTrue(hbck.shouldRerun());<a name="line.821"></a>
-<span class="sourceLineNo">822</span>      hbck.close();<a name="line.822"></a>
-<span class="sourceLineNo">823</span><a name="line.823"></a>
-<span class="sourceLineNo">824</span>      Get get = new Get(hri.getRegionName());<a name="line.824"></a>
-<span class="sourceLineNo">825</span>      Result result = meta.get(get);<a name="line.825"></a>
-<span class="sourceLineNo">826</span>      assertTrue(result.getColumnCells(HConstants.CATALOG_FAMILY,<a name="line.826"></a>
-<span class="sourceLineNo">827</span>          HConstants.SPLITA_QUALIFIER).isEmpty());<a name="line.827"></a>
-<span class="sourceLineNo">828</span>      assertTrue(result.getColumnCells(HConstants.CATALOG_FAMILY,<a name="line.828"></a>
-<span class="sourceLineNo">829</span>          HConstants.SPLITB_QUALIFIER).isEmpty());<a name="line.829"></a>
-<span class="sourceLineNo">830</span>      admin.flush(TableName.META_TABLE_NAME);<a name="line.830"></a>
-<span class="sourceLineNo">831</span><a name="line.831"></a>
-<span class="sourceLineNo">832</span>      // fix other issues<a name="line.832"></a>
-<span class="sourceLineNo">833</span>      doFsck(conf, true);<a name="line.833"></a>
-<span class="sourceLineNo">834</span><a name="line.834"></a>
-<span class="sourceLineNo">835</span>      // check that all are fixed<a name="line.835"></a>
-<span class="sourceLineNo">836</span>      assertNoErrors(doFsck(conf, false));<a name="line.836"></a>
-<span class="sourceLineNo">837</span>      assertEquals(ROWKEYS.length, countRows());<a name="line.837"></a>
-<span class="sourceLineNo">838</span>    } finally {<a name="line.838"></a>
-<span class="sourceLineNo">839</span>      cleanupTable(table);<a name="line.839"></a>
-<span class="sourceLineNo">840</span>      IOUtils.closeQuietly(meta);<a name="line.840"></a>
-<span class="sourceLineNo">841</span>    }<a name="line.841"></a>
-<span class="sourceLineNo">842</span>  }<a name="line.842"></a>
-<span class="sourceLineNo">843</span><a name="line.843"></a>
-<span class="sourceLineNo">844</span>  /**<a name="line.844"></a>
-<span class="sourceLineNo">845</span>   * Tests that LINGERING_SPLIT_PARENT is not erroneously reported for<a name="line.845"></a>
-<span class="sourceLineNo">846</span>   * valid cases where the daughters are there.<a name="line.846"></a>
-<span class="sourceLineNo">847</span>   */<a name="line.847"></a>
-<span class="sourceLineNo">848</span>  @Test (timeout=180000)<a name="line.848"></a>
-<span class="sourceLineNo">849</span>  public void testValidLingeringSplitParent() throws Exception {<a name="line.849"></a>
-<span class="sourceLineNo">850</span>    TableName table =<a name="line.850"></a>
-<span class="sourceLineNo">851</span>        TableName.valueOf("testLingeringSplitParent");<a name="line.851"></a>
-<span class="sourceLineNo">852</span>    Table meta = null;<a name="line.852"></a>
-<span class="sourceLineNo">853</span>    try {<a name="line.853"></a>
-<span class="sourceLineNo">854</span>      setupTable(table);<a name="line.854"></a>
-<span class="sourceLineNo">855</span>      assertEquals(ROWKEYS.length, countRows());<a name="line.855"></a>
-<span class="sourceLineNo">856</span><a name="line.856"></a>
-<span class="sourceLineNo">857</span>      // make sure data in regions, if in wal only there is no data loss<a name="line.857"></a>
-<span class="sourceLineNo">858</span>      admin.flush(table);<a name="line.858"></a>
-<span class="sourceLineNo">859</span><a name="line.859"></a>
-<span class="sourceLineNo">860</span>      try(RegionLocator rl = connection.getRegionLocator(tbl.getName())) {<a name="line.860"></a>
-<span class="sourceLineNo">861</span>        HRegionLocation location = rl.getRegionLocation(Bytes.toBytes("B"));<a name="line.861"></a>
-<span class="sourceLineNo">862</span><a name="line.862"></a>
-<span class="sourceLineNo">863</span>        meta = connection.getTable(TableName.META_TABLE_NAME, tableExecutorService);<a name="line.863"></a>
-<span class="sourceLineNo">864</span>        HRegionInfo hri = location.getRegionInfo();<a name="line.864"></a>
-<span class="sourceLineNo">865</span><a name="line.865"></a>
-<span class="sourceLineNo">866</span>        // do a regular split<a name="line.866"></a>
-<span class="sourceLineNo">867</span>        byte[] regionName = location.getRegionInfo().getRegionName();<a name="line.867"></a>
-<span class="sourceLineNo">868</span>        admin.splitRegion(location.getRegionInfo().getRegionName(), Bytes.toBytes("BM"));<a name="line.868"></a>
-<span class="sourceLineNo">869</span>        TestEndToEndSplitTransaction.blockUntilRegionSplit(conf, 60000, regionName, true);<a name="line.869"></a>
-<span class="sourceLineNo">870</span><a name="line.870"></a>
-<span class="sourceLineNo">871</span>        // TODO: fixHdfsHoles does not work against splits, since the parent dir lingers on<a name="line.871"></a>
-<span class="sourceLineNo">872</span>        // for some time until children references are deleted. HBCK erroneously sees this as<a name="line.872"></a>
-<span class="sourceLineNo">873</span>        // overlapping regions<a name="line.873"></a>
-<span class="sourceLineNo">874</span>        HBaseFsck hbck = doFsck(conf, true, true, false, false, false, true, true, true, false,<a name="line.874"></a>
-<span class="sourceLineNo">875</span>            false, false, null);<a name="line.875"></a>
-<span class="sourceLineNo">876</span>        assertErrors(hbck, new HBaseFsck.ErrorReporter.ERROR_CODE[] {}); //no LINGERING_SPLIT_PARENT reported<a name="line.876"></a>
-<span class="sourceLineNo">877</span><a name="line.877"></a>
-<span class="sourceLineNo">878</span>        // assert that the split hbase:meta entry is still there.<a name="line.878"></a>
-<span class="sourceLineNo">879</span>        Get get = new Get(hri.getRegionName());<a name="line.879"></a>
-<span class="sourceLineNo">880</span>        Result result = meta.get(get);<a name="line.880"></a>
-<span class="sourceLineNo">881</span>        assertNotNull(result);<a name="line.881"></a>
-<span class="sourceLineNo">882</span>        assertNotNull(MetaTableAccessor.getHRegionInfo(result));<a name="line.882"></a>
+<span class="sourceLineNo">805</span>      // Delete one region from meta, but not hdfs, unassign it.<a name="line.805"></a>
+<span class="sourceLineNo">806</span>      deleteRegion(conf, tbl.getTableDescriptor(), Bytes.toBytes("B"),<a name="line.806"></a>
+<span class="sourceLineNo">807</span>          Bytes.toBytes("C"), true, true, false);<a name="line.807"></a>
+<span class="sourceLineNo">808</span><a name="line.808"></a>
+<span class="sourceLineNo">809</span>      // Create a new meta entry to fake it as a split parent.<a name="line.809"></a>
+<span class="sourceLineNo">810</span>      meta = connection.getTable(TableName.META_TABLE_NAME, tableExecutorService);<a name="line.810"></a>
+<span class="sourceLineNo">811</span>      HRegionInfo hri = location.getRegionInfo();<a name="line.811"></a>
+<span class="sourceLineNo">812</span><a name="line.812"></a>
+<span class="sourceLineNo">813</span>      HRegionInfo a = new HRegionInfo(tbl.getName(),<a name="line.813"></a>
+<span class="sourceLineNo">814</span>          Bytes.toBytes("B"), Bytes.toBytes("BM"));<a name="line.814"></a>
+<span class="sourceLineNo">815</span>      HRegionInfo b = new HRegionInfo(tbl.getName(),<a name="line.815"></a>
+<span class="sourceLineNo">816</span>          Bytes.toBytes("BM"), Bytes.toBytes("C"));<a name="line.816"></a>
+<span class="sourceLineNo">817</span><a name="line.817"></a>
+<span class="sourceLineNo">818</span>      hri.setOffline(true);<a name="line.818"></a>
+<span class="sourceLineNo">819</span>      hri.setSplit(true);<a name="line.819"></a>
+<span class="sourceLineNo">820</span><a name="line.820"></a>
+<span class="sourceLineNo">821</span>      MetaTableAccessor.addRegionToMeta(meta, hri, a, b);<a name="line.821"></a>
+<span class="sourceLineNo">822</span>      meta.close();<a name="line.822"></a>
+<span class="sourceLineNo">823</span>      admin.flush(TableName.META_TABLE_NAME);<a name="line.823"></a>
+<span class="sourceLineNo">824</span><a name="line.824"></a>
+<span class="sourceLineNo">825</span>      HBaseFsck hbck = doFsck(conf, false);<a name="line.825"></a>
+<span class="sourceLineNo">826</span>      assertErrors(hbck, new HBaseFsck.ErrorReporter.ERROR_CODE[] {<a name="line.826"></a>
+<span class="sourceLineNo">827</span>          HBaseFsck.ErrorReporter.ERROR_CODE.LINGERING_SPLIT_PARENT, HBaseFsck.ErrorReporter.ERROR_CODE.HOLE_IN_REGION_CHAIN});<a name="line.827"></a>
+<span class="sourceLineNo">828</span><a name="line.828"></a>
+<span class="sourceLineNo">829</span>      // regular repair cannot fix lingering split parent<a name="line.829"></a>
+<span class="sourceLineNo">830</span>      hbck = doFsck(conf, true);<a name="line.830"></a>
+<span class="sourceLineNo">831</span>      assertErrors(hbck, new HBaseFsck.ErrorReporter.ERROR_CODE[] {<a name="line.831"></a>
+<span class="sourceLineNo">832</span>          HBaseFsck.ErrorReporter.ERROR_CODE.LINGERING_SPLIT_PARENT, HBaseFsck.ErrorReporter.ERROR_CODE.HOLE_IN_REGION_CHAIN });<a name="line.832"></a>
+<span class="sourceLineNo">833</span>      assertFalse(hbck.shouldRerun());<a name="line.833"></a>
+<span class="sourceLineNo">834</span>      hbck = doFsck(conf, false);<a name="line.834"></a>
+<span class="sourceLineNo">835</span>      assertErrors(hbck, new HBaseFsck.ErrorReporter.ERROR_CODE[] {<a name="line.835"></a>
+<span class="sourceLineNo">836</span>          HBaseFsck.ErrorReporter.ERROR_CODE.LINGERING_SPLIT_PARENT, HBaseFsck.ErrorReporter.ERROR_CODE.HOLE_IN_REGION_CHAIN});<a name="line.836"></a>
+<span class="sourceLineNo">837</span><a name="line.837"></a>
+<span class="sourceLineNo">838</span>      // fix lingering split parent<a name="line.838"></a>
+<span class="sourceLineNo">839</span>      hbck = new HBaseFsck(conf, hbfsckExecutorService);<a name="line.839"></a>
+<span class="sourceLineNo">840</span>      hbck.connect();<a name="line.840"></a>
+<span class="sourceLineNo">841</span>      HBaseFsck.setDisplayFullReport(); // i.e. -details<a name="line.841"></a>
+<span class="sourceLineNo">842</span>      hbck.setTimeLag(0);<a name="line.842"></a>
+<span class="sourceLineNo">843</span>      hbck.setFixSplitParents(true);<a name="line.843"></a>
+<span class="sourceLineNo">844</span>      hbck.onlineHbck();<a name="line.844"></a>
+<span class="sourceLineNo">845</span>      assertTrue(hbck.shouldRerun());<a name="line.845"></a>
+<span class="sourceLineNo">846</span>      hbck.close();<a name="line.846"></a>
+<span class="sourceLineNo">847</span><a name="line.847"></a>
+<span class="sourceLineNo">848</span>      Get get = new Get(hri.getRegionName());<a name="line.848"></a>
+<span class="sourceLineNo">849</span>      Result result = meta.get(get);<a name="line.849"></a>
+<span class="sourceLineNo">850</span>      assertTrue(result.getColumnCells(HConstants.CATALOG_FAMILY,<a name="line.850"></a>
+<span class="sourceLineNo">851</span>          HConstants.SPLITA_QUALIFIER).isEmpty());<a name="line.851"></a>
+<span class="sourceLineNo">852</span>      assertTrue(result.getColumnCells(HConstants.CATALOG_FAMILY,<a name="line.852"></a>
+<span class="sourceLineNo">853</span>          HConstants.SPLITB_QUALIFIER).isEmpty());<a name="line.853"></a>
+<span class="sourceLineNo">854</span>      admin.flush(TableName.META_TABLE_NAME);<a name="line.854"></a>
+<span class="sourceLineNo">855</span><a name="line.855"></a>
+<span class="sourceLineNo">856</span>      // fix other issues<a name="line.856"></a>
+<span class="sourceLineNo">857</span>      doFsck(conf, true);<a name="line.857"></a>
+<span class="sourceLineNo">858</span><a name="line.858"></a>
+<span class="sourceLineNo">859</span>      // check that all are fixed<a name="line.859"></a>
+<span class="sourceLineNo">860</span>      assertNoErrors(doFsck(conf, false));<a name="line.860"></a>
+<span class="sourceLineNo">861</span>      assertEquals(ROWKEYS.length, countRows());<a name="line.861"></a>
+<span class="sourceLineNo">862</span>    } finally {<a name="line.862"></a>
+<span class="sourceLineNo">863</span>      cleanupTable(table);<a name="line.863"></a>
+<span class="sourceLineNo">864</span>      IOUtils.closeQuietly(meta);<a name="line.864"></a>
+<span class="sourceLineNo">865</span>    }<a name="line.865"></a>
+<span class="sourceLineNo">866</span>  }<a name="line.866"></a>
+<span class="sourceLineNo">867</span><a name="line.867"></a>
+<span class="sourceLineNo">868</span>  /**<a name="line.868"></a>
+<span class="sourceLineNo">869</span>   * Tests that LINGERING_SPLIT_PARENT is not erroneously reported for<a name="line.869"></a>
+<span class="sourceLineNo">870</span>   * valid cases where the daughters are there.<a name="line.870"></a>
+<span class="sourceLineNo">871</span>   */<a name="line.871"></a>
+<span class="sourceLineNo">872</span>  @Test (timeout=180000)<a name="line.872"></a>
+<span class="sourceLineNo">873</span>  public void testValidLingeringSplitParent() throws Exception {<a name="line.873"></a>
+<span class="sourceLineNo">874</span>    TableName table =<a name="line.874"></a>
+<span class="sourceLineNo">875</span>        TableName.valueOf("testLingeringSplitParent");<a name="line.875"></a>
+<span class="sourceLineNo">876</span>    Table meta = null;<a name="line.876"></a>
+<span class="sourceLineNo">877</span>    try {<a name="line.877"></a>
+<span class="sourceLineNo">878</span>      setupTable(table);<a name="line.878"></a>
+<span class="sourceLineNo">879</span>      assertEquals(ROWKEYS.length, countRows());<a name="line.879"></a>
+<span class="sourceLineNo">880</span><a name="line.880"></a>
+<span class="sourceLineNo">881</span>      // make sure data in regions, if in wal only there is no data loss<a name="line.881"></a>
+<span class="sourceLineNo">882</span>      admin.flush(table);<a name="line.882"></a>
 <span class="sourceLineNo">883</span><a name="line.883"></a>
-<span class="sourceLineNo">884</span>        assertEquals(ROWKEYS.length, countRows());<a name="line.884"></a>
-<span class="sourceLineNo">885</span><a name="line.885"></a>
-<span class="sourceLineNo">886</span>        // assert that we still have the split regions<a name="line.886"></a>
-<span class="sourceLineNo">887</span>        assertEquals(rl.getStartKeys().length, SPLITS.length + 1 + 1); //SPLITS + 1 is # regions<a name="line.887"></a>
-<span class="sourceLineNo">888</span>        // pre-split.<a name="line.888"></a>
-<span class="sourceLineNo">889</span>        assertNoErrors(doFsck(conf, false));<a name="line.889"></a>
-<span class="sourceLineNo">890</span>      }<a name="line.890"></a>
-<span class="sourceLineNo">891</span>    } finally {<a name="line.891"></a>
-<span class="sourceLineNo">892</span>      cleanupTable(table);<a name="line.892"></a>
-<span class="sourceLineNo">893</span>      IOUtils.closeQuietly(meta);<a name="line.893"></a>
-<span class="sourceLineNo">894</span>    }<a name="line.894"></a>
-<span class="sourceLineNo">895</span>  }<a name="line.895"></a>
-<span class="sourceLineNo">896</span><a name="line.896"></a>
-<span class="sourceLineNo">897</span>  /**<a name="line.897"></a>
-<span class="sourceLineNo">898</span>   * Split crashed after write to hbase:meta finished for the parent region, but<a name="line.898"></a>
-<span class="sourceLineNo">899</span>   * failed to write daughters (pre HBASE-7721 codebase)<a name="line.899"></a>
-<span class="sourceLineNo">900</span>   */<a name="line.900"></a>
-<span class="sourceLineNo">901</span>  @Test(timeout=75000)<a name="line.901"></a>
-<span class="sourceLineNo">902</span>  public void testSplitDaughtersNotInMeta() throws Exception {<a name="line.902"></a>
-<span class="sourceLineNo">903</span>    TableName table = TableName.valueOf("testSplitdaughtersNotInMeta");<a name="line.903"></a>
-<span class="sourceLineNo">904</span>    Table meta = connection.getTable(TableName.META_TABLE_NAME, tableExecutorService);<a name="line.904"></a>
-<span class="sourceLineNo">905</span>    try {<a name="line.905"></a>
-<span class="sourceLineNo">906</span>      setupTable(table);<a name="line.906"></a>
-<span class="sourceLineNo">907</span>      assertEquals(ROWKEYS.length, countRows());<a name="line.907"></a>
-<span class="sourceLineNo">908</span><a name="line.908"></a>
-<span class="sourceLineNo">909</span>      // make sure data in regions, if in wal only there is no data loss<a name="line.909"></a>
-<span class="sourceLineNo">910</span>      admin.flush(table);<a name="line.910"></a>
-<span class="sourceLineNo">911</span><a name="line.911"></a>
-<span class="sourceLineNo">912</span>      try(RegionLocator rl = connection.getRegionLocator(tbl.getName())) {<a name="line.912"></a>
-<span class="sourceLineNo">913</span>        HRegionLocation location = rl.getRegionLocation(Bytes.toBytes("B"));<a name="line.913"></a>
-<span class="sourceLineNo">914</span><a name="line.914"></a>
-<span class="sourceLineNo">915</span>        HRegionInfo hri = location.getRegionInfo();<a name="line.915"></a>
-<span class="sourceLineNo">916</span><a name="line.916"></a>
-<span class="sourceLineNo">917</span>        // do a regular split<a name="line.917"></a>
-<span class="sourceLineNo">918</span>        byte[] regionName = location.getRegionInfo().getRegionName();<a name="line.918"></a>
-<span class="sourceLineNo">919</span>        admin.splitRegion(location.getRegionInfo().getRegionName(), Bytes.toBytes("BM"));<a name="line.919"></a>
-<span class="sourceLineNo">920</span>        TestEndToEndSplitTransaction.blockUntilRegionSplit(conf, 60000, regionName, true);<a name="line.920"></a>
-<span class="sourceLineNo">921</span><a name="line.921"></a>
-<span class="sourceLineNo">922</span>        PairOfSameType&lt;HRegionInfo&gt; daughters = MetaTableAccessor.getDaughterRegions(<a name="line.922"></a>
-<span class="sourceLineNo">923</span>            meta.get(new Get(regionName)));<a name="line.923"></a>
-<span class="sourceLineNo">924</span><a name="line.924"></a>
-<span class="sourceLineNo">925</span>        // Delete daughter regions from meta, but not hdfs, unassign it.<a name="line.925"></a>
-<span class="sourceLineNo">926</span><a name="line.926"></a>
-<span class="sourceLineNo">927</span>        ServerName firstSN =<a name="line.927"></a>
-<span class="sourceLineNo">928</span>            rl.getRegionLocation(daughters.getFirst().getStartKey()).getServerName();<a name="line.928"></a>
-<span class="sourceLineNo">929</span>        ServerName secondSN =<a name="line.929"></a>
-<span class="sourceLineNo">930</span>            rl.getRegionLocation(daughters.getSecond().getStartKey()).getServerName();<a name="line.930"></a>
-<span class="sourceLineNo">931</span><a name="line.931"></a>
-<span class="sourceLineNo">932</span>        undeployRegion(connection, firstSN, daughters.getFirst());<a name="line.932"></a>
-<span class="sourceLineNo">933</span>        undeployRegion(connection, secondSN, daughters.getSecond());<a name="line.933"></a>
-<span class="sourceLineNo">934</span><a name="line.934"></a>
-<span class="sourceLineNo">935</span>        List&lt;Delete&gt; deletes = new ArrayList&lt;&gt;();<a name="line.935"></a>
-<span class="sourceLineNo">936</span>        deletes.add(new Delete(daughters.getFirst().getRegionName()));<a name="line.936"></a>
-<span class="sourceLineNo">937</span>        deletes.add(new Delete(daughters.getSecond().getRegionName()));<a name="line.937"></a>
-<span class="sourceLineNo">938</span>        meta.delete(deletes);<a name="line.938"></a>
-<span class="sourceLineNo">939</span><a name="line.939"></a>
-<span class="sourceLineNo">940</span>        // Remove daughters from regionStates<a name="line.940"></a>
-<span class="sourceLineNo">941</span>        RegionStates regionStates = TEST_UTIL.getMiniHBaseCluster().getMaster().<a name="line.941"></a>
-<span class="sourceLineNo">942</span>            getAssignmentManager().getRegionStates();<a name="line.942"></a>
-<span class="sourceLineNo">943</span>        regionStates.deleteRegion(daughters.getFirst());<a name="line.943"></a>
-<span class="sourceLineNo">944</span>        regionStates.deleteRegion(daughters.getSecond());<a name="line.944"></a>
+<span class="sourceLineNo">884</span>      try(RegionLocator rl = connection.getRegionLocator(tbl.getName())) {<a name="line.884"></a>
+<span class="sourceLineNo">885</span>        HRegionLocation location = rl.getRegionLocation(Bytes.toBytes("B"));<a name="line.885"></a>
+<span class="sourceLineNo">886</span><a name="line.886"></a>
+<span class="sourceLineNo">887</span>        meta = connection.getTable(TableName.META_TABLE_NAME, tableExecutorService);<a name="line.887"></a>
+<span class="sourceLineNo">888</span>        HRegionInfo hri = location.getRegionInfo();<a name="line.888"></a>
+<span class="sourceLineNo">889</span><a name="line.889"></a>
+<span class="sourceLineNo">890</span>        // do a regular split<a name="line.890"></a>
+<span class="sourceLineNo">891</span>        byte[] regionName = location.getRegionInfo().getRegionName();<a name="line.891"></a>
+<span class="sourceLineNo">892</span>        admin.splitRegion(location.getRegionInfo().getRegionName(), Bytes.toBytes("BM"));<a name="line.892"></a>
+<span class="sourceLineNo">893</span>        TestEndToEndSplitTransaction.blockUntilRegionSplit(conf, 60000, regionName, true);<a name="line.893"></a>
+<span class="sourceLineNo">894</span><a name="line.894"></a>
+<span class="sourceLineNo">895</span>        // TODO: fixHdfsHoles does not work against splits, since the parent dir lingers on<a name="line.895"></a>
+<span class="sourceLineNo">896</span>        // for some time until children references are deleted. HBCK erroneously sees this as<a name="line.896"></a>
+<span class="sourceLineNo">897</span>        // overlapping regions<a name="line.897"></a>
+<span class="sourceLineNo">898</span>        HBaseFsck hbck = doFsck(conf, true, true, false, false, false, true, true, true, false,<a name="line.898"></a>
+<span class="sourceLineNo">899</span>            false, false, null);<a name="line.899"></a>
+<span class="sourceLineNo">900</span>        assertErrors(hbck, new HBaseFsck.ErrorReporter.ERROR_CODE[] {}); //no LINGERING_SPLIT_PARENT reported<a name="line.900"></a>
+<span class="sourceLineNo">901</span><a name="line.901"></a>
+<span class="sourceLineNo">902</span>        // assert that the split hbase:meta entry is still there.<a name="line.902"></a>
+<span class="sourceLineNo">903</span>        Get get = new Get(hri.getRegionName());<a name="line.903"></a>
+<span class="sourceLineNo">904</span>        Result result = meta.get(get);<a name="line.904"></a>
+<span class="sourceLineNo">905</span>        assertNotNull(result);<a name="line.905"></a>
+<span class="sourceLineNo">906</span>        assertNotNull(MetaTableAccessor.getHRegionInfo(result));<a name="line.906"></a>
+<span class="sourceLineNo">907</span><a name="line.907"></a>
+<span class="sourceLineNo">908</span>        assertEquals(ROWKEYS.length, countRows());<a name="line.908"></a>
+<span class="sourceLineNo">909</span><a name="line.909"></a>
+<span class="sourceLineNo">910</span>        // assert that we still have the split regions<a name="line.910"></a>
+<span class="sourceLineNo">911</span>        assertEquals(rl.getStartKeys().length, SPLITS.length + 1 + 1); //SPLITS + 1 is # regions<a name="line.911"></a>
+<span class="sourceLineNo">912</span>        // pre-split.<a name="line.912"></a>
+<span class="sourceLineNo">913</span>        assertNoErrors(doFsck(conf, false));<a name="line.913"></a>
+<span class="sourceLineNo">914</span>      }<a name="line.914"></a>
+<span class="sourceLineNo">915</span>    } finally {<a name="line.915"></a>
+<span class="sourceLineNo">916</span>      cleanupTable(table);<a name="line.916"></a>
+<span class="sourceLineNo">917</span>      IOUtils.closeQuietly(meta);<a name="line.917"></a>
+<span class="sourceLineNo">918</span>    }<a name="line.918"></a>
+<span class="sourceLineNo">919</span>  }<a name="line.919"></a>
+<span class="sourceLineNo">920</span><a name="line.920"></a>
+<span class="sourceLineNo">921</span>  /**<a name="line.921"></a>
+<span class="sourceLineNo">922</span>   * Split crashed after write to hbase:meta finished for the parent region, but<a name="line.922"></a>
+<span class="sourceLineNo">923</span>   * failed to write daughters (pre HBASE-7721 codebase)<a name="line.923"></a>
+<span class="sourceLineNo">924</span>   */<a name="line.924"></a>
+<span class="sourceLineNo">925</span>  @Test(timeout=75000)<a name="line.925"></a>
+<span class="sourceLineNo">926</span>  public void testSplitDaughtersNotInMeta() throws Exception {<a name="line.926"></a>
+<span class="sourceLineNo">927</span>    TableName table = TableName.valueOf("testSplitdaughtersNotInMeta");<a name="line.927"></a>
+<span class="sourceLineNo">928</span>    Table meta = connection.getTable(TableName.META_TABLE_NAME, tableExecutorService);<a name="line.928"></a>
+<span class="sourceLineNo">929</span>    try {<a name="line.929"></a>
+<span class="sourceLineNo">930</span>      setupTable(table);<a name="line.930"></a>
+<span class="sourceLineNo">931</span>      assertEquals(ROWKEYS.length, countRows());<a name="line.931"></a>
+<span class="sourceLineNo">932</span><a name="line.932"></a>
+<span class="sourceLineNo">933</span>      // make sure data in regions, if in wal only there is no data loss<a name="line.933"></a>
+<span class="sourceLineNo">934</span>      admin.flush(table);<a name="line.934"></a>
+<span class="sourceLineNo">935</span><a name="line.935"></a>
+<span class="sourceLineNo">936</span>      try(RegionLocator rl = connection.getRegionLocator(tbl.getName())) {<a name="line.936"></a>
+<span class="sourceLineNo">937</span>        HRegionLocation location = rl.getRegionLocation(Bytes.toBytes("B"));<a name="line.937"></a>
+<span class="sourceLineNo">938</span><a name="line.938"></a>
+<span class="sourceLineNo">939</span>        HRegionInfo hri = location.getRegionInfo();<a name="line.939"></a>
+<span class="sourceLineNo">940</span><a name="line.940"></a>
+<span class="sourceLineNo">941</span>        // do a regular split<a name="line.941"></a>
+<span class="sourceLineNo">942</span>        byte[] regionName = location.getRegionInfo().getRegionName();<a name="line.942"></a>
+<span class="sourceLineNo">943</span>        admin.splitRegion(location.getRegionInfo().getRegionName(), Bytes.toBytes("BM"));<a name="line.943"></a>
+<span class="sourceLineNo">944</span>        TestEndToEndSplitTransaction.blockUntilRegionSplit(conf, 60000, regionName, true);<a name="line.944"></a>
 <span class="sourceLineNo">945</span><a name="line.945"></a>
-<span class="sourceLineNo">946</span>        HBaseFsck hbck = doFsck(conf, false);<a name="line.946"></a>
-<span class="sourceLineNo">947</span>        assertErrors(hbck, new HBaseFsck.ErrorReporter.ERROR_CODE[] {<a name="line.947"></a>
-<span class="sourceLineNo">948</span>            HBaseFsck.ErrorReporter.ERROR_CODE.NOT_IN_META_OR_DEPLOYED,<a name="line.948"></a>
-<span class="sourceLineNo">949</span>            HBaseFsck.ErrorReporter.ERROR_CODE.NOT_IN_META_OR_DEPLOYED,<a name="line.949"></a>
-<span class="sourceLineNo">950</span>            HBaseFsck.ErrorReporter.ERROR_CODE.HOLE_IN_REGION_CHAIN }); //no LINGERING_SPLIT_PARENT<a name="line.950"></a>
-<span class="sourceLineNo">951</span><a name="line.951"></a>
-<span class="sourceLineNo">952</span>        // now fix it. The fix should not revert the region split, but add daughters to META<a name="line.952"></a>
-<span class="sourceLineNo">953</span>        hbck = doFsck(conf, true, true, false, false, false, false, false, false, false,<a name="line.953"></a>
-<span class="sourceLineNo">954</span>            false, false, null);<a name="line.954"></a>
-<span class="sourceLineNo">955</span>        assertErrors(hbck, new HBaseFsck.ErrorReporter.ERROR_CODE[] {<a name="line.955"></a>
-<span class="sourceLineNo">956</span>            HBaseFsck.ErrorReporter.ERROR_CODE.NOT_IN_META_OR_DEPLOYED,<a name="line.956"></a>
-<span class="sourceLineNo">957</span>            HBaseFsck.ErrorReporter.ERROR_CODE.NOT_IN_META_OR_DEPLOYED,<a name="line.957"></a>
-<span class="sourceLineNo">958</span>            HBaseFsck.ErrorReporter.ERROR_CODE.HOLE_IN_REGION_CHAIN });<a name="line.958"></a>
-<span class="sourceLineNo">959</span><a name="line.959"></a>
-<span class="sourceLineNo">960</span>        // assert that the split hbase:meta entry is still there.<a name="line.960"></a>
-<span class="sourceLineNo">961</span>        Get get = new Get(hri.getRegionName());<a name="line.961"></a>
-<span class="sourceLineNo">962</span>        Result result = meta.get(get);<a name="line.962"></a>
-<span class="sourceLineNo">963</span>        assertNotNull(result);<a name="line.963"></a>
-<span class="sourceLineNo">964</span>        assertNotNull(MetaTableAccessor.getHRegionInfo(result));<a name="line.964"></a>
-<span class="sourceLineNo">965</span><a name="line.965"></a>
-<span class="sourceLineNo">966</span>        assertEquals(ROWKEYS.length, countRows());<a name="line.966"></a>
-<span class="sourceLineNo">967</span><a name="line.967"></a>
-<span class="sourceLineNo">968</span>        // assert that we still have the split regions<a name="line.968"></a>
-<span class="sourceLineNo">969</span>        assertEquals(rl.getStartKeys().length, SPLITS.length + 1 + 1); //SPLITS + 1 is # regions<a name="line.969"></a>
-<span class="sourceLineNo">970</span>        // pre-split.<a name="line.970"></a>
-<span class="sourceLineNo">971</span>        assertNoErrors(doFsck(conf, false)); //should be fixed by now<a name="line.971"></a>
-<span class="sourceLineNo">972</span>      }<a name="line.972"></a>
-<span class="sourceLineNo">973</span>    } finally {<a name="line.973"></a>
-<span class="sourceLineNo">974</span>      meta.close();<a name="line.974"></a>
-<span class="sourceLineNo">975</span>      cleanupTable(table);<a name="line.975"></a>
-<span class="sourceLineNo">976</span>    }<a name="line.976"></a>
-<span class="sourceLineNo">977</span>  }<a name="line.977"></a>
-<span class="sourceLineNo">978</span><a name="line.978"></a>
-<span class="sourceLineNo">979</span>  /**<a name="line.979"></a>
-<span class="sourceLineNo">980</span>   * This creates and fixes a bad table with a missing region which is the 1st region -- hole in<a name="line.980"></a>
-<span class="sourceLineNo">981</span>   * meta and data missing in the fs.<a name="line.981"></a>
-<span class="sourceLineNo">982</span>   */<a name="line.982"></a>
-<span class="sourceLineNo">983</span>  @Test(timeout=120000)<a name="line.983"></a>
-<span class="sourceLineNo">984</span>  public void testMissingFirstRegion() throws Exception {<a name="line.984"></a>
-<span class="sourceLineNo">985</span>    TableName table = TableName.valueOf("testMissingFirstRegion");<a name="line.985"></a>
-<span class="sourceLineNo">986</span>    try {<a name="line.986"></a>
-<span class="sourceLineNo">987</span>      setupTable(table);<a name="line.987"></a>
-<span class="sourceLineNo">988</span>      assertEquals(ROWKEYS.length, countRows());<a name="line.988"></a>
+<span class="sourceLineNo">946</span>        PairOfSameType&lt;HRegionInfo&gt; daughters = MetaTableAccessor.getDaughterRegions(<a name="line.946"></a>
+<span class="sourceLineNo">947</span>            meta.get(new Get(regionName)));<a name="line.947"></a>
+<span class="sourceLineNo">948</span><a name="line.948"></a>
+<span class="sourceLineNo">949</span>        // Delete daughter regions from meta, but not hdfs, unassign it.<a name="line.949"></a>
+<span class="sourceLineNo">950</span><a name="line.950"></a>
+<span class="sourceLineNo">951</span>        ServerName firstSN =<a name="line.951"></a>
+<span class="sourceLineNo">952</span>            rl.getRegionLocation(daughters.getFirst().getStartKey()).getServerName();<a name="line.952"></a>
+<span class="sourceLineNo">953</span>        ServerName secondSN =<a name="line.953"></a>
+<span class="sourceLineNo">954</span>            rl.getRegionLocation(daughters.getSecond().getStartKey()).getServerName();<a name="line.954"></a>
+<span class="sourceLineNo">955</span><a name="line.955"></a>
+<span class="sourceLineNo">956</span>        undeployRegion(connection, firstSN, daughters.getFirst());<a name="line.956"></a>
+<span class="sourceLineNo">957</span>        undeployRegion(connection, secondSN, daughters.getSecond());<a name="line.957"></a>
+<span class="sourceLineNo">958</span><a name="line.958"></a>
+<span class="sourceLineNo">959</span>        List&lt;Delete&gt; deletes = new ArrayList&lt;&gt;();<a name="line.959"></a>
+<span class="sourceLineNo">960</span>        deletes.add(new Delete(daughters.getFirst().getRegionName()));<a name="line.960"></a>
+<span class="sourceLineNo">961</span>        deletes.add(new Delete(daughters.getSecond().getRegionName()));<a name="line.961"></a>
+<span class="sourceLineNo">962</span>        meta.delete(deletes);<a name="line.962"></a>
+<span class="sourceLineNo">963</span><a name="line.963"></a>
+<span class="sourceLineNo">964</span>        // Remove daughters from regionStates<a name="line.964"></a>
+<span class="sourceLineNo">965</span>        RegionStates regionStates = TEST_UTIL.getMiniHBaseCluster().getMaster().<a name="line.965"></a>
+<span class="sourceLineNo">966</span>            getAssignmentManager().getRegionStates();<a name="line.966"></a>
+<span class="sourceLineNo">967</span>        regionStates.deleteRegion(daughters.getFirst());<a name="line.967"></a>
+<span class="sourceLineNo">968</span>        regionStates.deleteRegion(daughters.getSecond());<a name="line.968"></a>
+<span class="sourceLineNo">969</span><a name="line.969"></a>
+<span class="sourceLineNo">970</span>        HBaseFsck hbck = doFsck(conf, false);<a name="line.970"></a>
+<span class="sourceLineNo">971</span>        assertErrors(hbck, new HBaseFsck.ErrorReporter.ERROR_CODE[] {<a name="line.971"></a>
+<span class="sourceLineNo">972</span>            HBaseFsck.ErrorReporter.ERROR_CODE.NOT_IN_META_OR_DEPLOYED,<a name="line.972"></a>
+<span class="sourceLineNo">973</span>            HBaseFsck.ErrorReporter.ERROR_CODE.NOT_IN_META_OR_DEPLOYED,<a name="line.973"></a>
+<span class="sourceLineNo">974</span>            HBaseFsck.ErrorReporter.ERROR_CODE.HOLE_IN_REGION_CHAIN }); //no LINGERING_SPLIT_PARENT<a name="line.974"></a>
+<span class="sourceLineNo">975</span><a name="line.975"></a>
+<span class="sourceLineNo">976</span>        // now fix it. The fix should not revert the region split, but add daughters to META<a name="line.976"></a>
+<span class="sourceLineNo">977</span>        hbck = doFsck(conf, true, true, false, false, false, false, false, false, false,<a name="line.977"></a>
+<span class="sourceLineNo">978</span>            false, false, null);<a name="line.978"></a>
+<span class="sourceLineNo">979</span>        assertErrors(hbck, new HBaseFsck.ErrorReporter.ERROR_CODE[] {<a name="line.979"></a>
+<span class="sourceLineNo">980</span>            HBaseFsck.ErrorReporter.ERROR_CODE.NOT_IN_META_OR_DEPLOYED,<a name="line.980"></a>
+<span class="sourceLineNo">981</span>            HBaseFsck.ErrorReporter.ERROR_CODE.NOT_IN_META_OR_DEPLOYED,<a name="line.981"></a>
+<span class="sourceLineNo">982</span>            HBaseFsck.ErrorReporter.ERROR_CODE.HOLE_IN_REGION_CHAIN });<a name="line.982"></a>
+<span class="sourceLineNo">983</span><a name="line.983"></a>
+<span class="sourceLineNo">984</span>        // assert that the split hbase:meta entry is still there.<a name="line.984"></a>
+<span class="sourceLineNo">985</span>        Get get = new Get(hri.getRegionName());<a name="line.985"></a>
+<span class="sourceLineNo">986</span>        Result result = meta.get(get);<a name="line.986"></a>
+<span class="sourceLineNo">987</span>        assertNotNull(result);<a name="line.987"></a>
+<span class="sourceLineNo">988</span>        assertNotNull(MetaTableAccessor.getHRegionInfo(result));<a name="line.988"></a>
 <span class="sourceLineNo">989</span><a name="line.989"></a>
-<span class="sourceLineNo">990</span>      // Mess it up by leaving a hole in the assignment, meta, and hdfs data<a name="line.990"></a>
-<span class="sourceLineNo">991</span>      admin.disableTable(table);<a name="line.991"></a>
-<span class="sourceLineNo">992</span>      deleteRegion(conf, tbl.getTableDescriptor(), Bytes.toBytes(""), Bytes.toBytes("A"), true,<a name="line.992"></a>
-<span class="sourceLineNo">993</span>          true, true);<a name="line.993"></a>
-<span class="sourceLineNo">994</span>      admin.enableTable(table);<a name="line.994"></a>
-<span class="sourceLineNo">995</span><a name="line.995"></a>
-<span class="sourceLineNo">996</span>      HBaseFsck hbck = doFsck(conf, false);<a name="line.996"></a>
-<span class="sourceLineNo">997</span>      assertErrors(hbck, new HBaseFsck.ErrorReporter.ERROR_CODE[] { HBaseFsck.ErrorReporter.ERROR_CODE.FIRST_REGION_STARTKEY_NOT_EMPTY });<a name="line.997"></a>
-<span class="sourceLineNo">998</span>      // fix hole<a name="line.998"></a>
-<span class="sourceLineNo">999</span>      doFsck(conf, true);<a name="line.999"></a>
-<span class="sourceLineNo">1000</span>      // check that hole fixed<a name="line.1000"></a>
-<span class="sourceLineNo">1001</span>      assertNoErrors(doFsck(conf, false));<a name="line.1001"></a>
-<span class="sourceLineNo">1002</span>    } finally {<a name="line.1002"></a>
-<span class="sourceLineNo">1003</span>      cleanupTable(table);<a name="line.1003"></a>
-<span class="sourceLineNo">1004</span>    }<a name="line.1004"></a>
-<span class="sourceLineNo">1005</span>  }<a name="line.1005"></a>
-<span class="sourceLineNo">1006</span><a name="line.1006"></a>
-<span class="sourceLineNo">1007</span>  /**<a name="line.1007"></a>
-<span class="sourceLineNo">1008</span>   * This creates and fixes a bad table with a missing region which is the 1st region -- hole in<a name="line.1008"></a>
-<span class="sourceLineNo">1009</span>   * meta and data missing in the fs.<a name="line.1009"></a>
-<span class="sourceLineNo">1010</span>   */<a name="line.1010"></a>
-<span class="sourceLineNo">1011</span>  @Test(timeout=120000)<a name="line.1011"></a>
-<span class="sourceLineNo">1012</span>  public void testRegionDeployedNotInHdfs() throws Exception {<a name="line.1012"></a>
-<span class="sourceLineNo">1013</span>    TableName table =<a name="line.1013"></a>
-<span class="sourceLineNo">1014</span>        TableName.valueOf("testSingleRegionDeployedNotInHdfs");<a name="line.1014"></a>
-<span class="sourceLineNo">1015</span>    try {<a name="line.1015"></a>
-<span class="sourceLineNo">1016</span>      setupTable(table);<a name="line.1016"></a>
-<span class="sourceLineNo">1017</span>      admin.flush(table);<a name="line.1017"></a>
-<span class="sourceLineNo">1018</span><a name="line.1018"></a>
-<span class="sourceLineNo">1019</span>      // Mess it up by deleting region dir<a name="line.1019"></a>
-<span class="sourceLineNo">1020</span>      deleteRegion(conf, tbl.getTableDescriptor(),<a name="line.1020"></a>
-<span class="sourceLineNo">1021</span>          HConstants.EMPTY_START_ROW, Bytes.toBytes("A"), false,<a name="line.1021"></a>
-<span class="sourceLineNo">1022</span>          false, true);<a name="line.1022"></a>
-<span class="sourceLineNo">1023</span><a name="line.1023"></a>
-<span class="sourceLineNo">1024</span>      HBaseFsck hbck = doFsck(conf, false);<a name="line.1024"></a>
-<span class="sourceLineNo">1025</span>      assertErrors(hbck, new HBaseFsck.ErrorReporter.ERROR_CODE[] { HBaseFsck.ErrorReporter.ERROR_CODE.NOT_IN_HDFS });<a name="line.1025"></a>
-<span class="sourceLineNo">1026</span>      // fix hole<a name="line.1026"></a>
-<span class="sourceLineNo">1027</span>      doFsck(conf, true);<a name="line.1027"></a>
-<span class="sourceLineNo">1028</span>      // check that hole fixed<a name="line.1028"></a>
-<span class="sourceLineNo">1029</span>      assertNoErrors(doFsck(conf, false));<a name="line.1029"></a>
-<span class="sourceLineNo">1030</span>    } finally {<a name="line.1030"></a>
-<span class="sourceLineNo">1031</span>      cleanupTable(table);<a name="line.1031"></a>
-<span class="sourceLineNo">1032</span>    }<a name="line.1032"></a>
-<span class="sourceLineNo">1033</span>  }<a name="line.1033"></a>
-<span class="sourceLineNo">1034</span><a name="line.1034"></a>
-<span class="sourceLineNo">1035</span>  /**<a name="line.1035"></a>
-<span class="sourceLineNo">1036</span>   * This creates and fixes a bad table with missing last region -- hole in meta and data missing in<a name="line.1036"></a>
-<span class="sourceLineNo">1037</span>   * the fs.<a name="line.1037"></a>
-<span class="sourceLineNo">1038</span>   */<a name="line.1038"></a>
-<span class="sourceLineNo">1039</span>  @Test(timeout=120000)<a name="line.1039"></a>
-<span class="sourceLineNo">1040</span>  public void testMissingLastRegion() throws Exception {<a name="line.1040"></a>
-<span class="sourceLineNo">1041</span>    TableName table =<a name="line.1041"></a>
-<span class="sourceLineNo">1042</span>        TableName.valueOf("testMissingLastRegion");<a name="line.1042"></a>
-<span class="sourceLineNo">1043</span>    try {<a name="line.1043"></a>
-<span class="sourceLineNo">1044</span>      setupTable(table);<a name="line.1044"></a>
-<span class="sourceLineNo">1045</span>      assertEquals(ROWKEYS.length, countRows());<a name="line.1045"></a>
-<span class="sourceLineNo">1046</span><a name="line.1046"></a>
-<span class="sourceLineNo">1047</span>      // Mess it up by leaving a hole in the assignment, meta, and hdfs data<a name="line.1047"></a>
-<span class="sourceLineNo">1048</span>      admin.disableTable(table);<a name="line.1048"></a>
-<span class="sourceLineNo">1049</span>      deleteRegion(conf, tbl.getTableDescriptor(), Bytes.toBytes("C"), Bytes.toBytes(""), true,<a name="line.1049"></a>
-<span class="sourceLineNo">1050</span>          true, true);<a name="line.1050"></a>
-<span class="sourceLineNo">1051</span>      admin.enableTable(table);<a name="line.1051"></a>
-<span class="sourceLineNo">1052</span><a name="line.1052"></a>
-<span class="sourceLineNo">1053</span>      HBaseFsck hbck = doFsck(conf, false);<a name="line.1053"></a>
-<span class="sourceLineNo">1054</span>      assertErrors(hbck, new HBaseFsck.ErrorReporter.ERROR_CODE[] { HBaseFsck.ErrorReporter.ERROR_CODE.LAST_REGION_ENDKEY_NOT_EMPTY });<a name="line.1054"></a>
-<span class="sourceLineNo">1055</span>      // fix hole<a name="line.1055"></a>
-<span class="sourceLineNo">1056</span>      doFsck(conf, true);<a name="line.1056"></a>
-<span class="sourceLineNo">1057</span>      // check that hole fixed<a name="line.1057"></a>
-<span class="sourceLineNo">1058</span>      assertNoErrors(doFsck(conf, false));<a name="line.1058"></a>
-<span class="sourceLineNo">1059</span>    } finally {<a name="line.1059"></a>
-<span class="sourceLineNo">1060</span>      cleanupTable(table);<a name="line.1060"></a>
-<span class="sourceLineNo">1061</span>    }<a name

<TRUNCATED>

Mime
View raw message