HBASE-15126 HBaseFsck's checkRegionBoundaries function sets incorrect storesFirstKey (chenrongwei)

This commit is contained in:
tedyu 2016-01-21 07:46:58 -08:00
parent 4bf6f8379d
commit 1d2b0d8311
2 changed files with 25 additions and 1 deletions

View File

@ -795,7 +795,7 @@ public class HBaseFsck extends Configured implements Closeable {
}
currentRegionBoundariesInformation.metaFirstKey = regionInfo.getStartKey();
currentRegionBoundariesInformation.metaLastKey = regionInfo.getEndKey();
currentRegionBoundariesInformation.storesFirstKey = storeFirstKey;
currentRegionBoundariesInformation.storesFirstKey = keyOnly(storeFirstKey);
currentRegionBoundariesInformation.storesLastKey = keyOnly(storeLastKey);
if (currentRegionBoundariesInformation.metaFirstKey.length == 0)
currentRegionBoundariesInformation.metaFirstKey = null;

View File

@ -580,6 +580,30 @@ public class TestHBaseFsckOneRS extends BaseTestHBaseFsck {
}
}
/**
* test region boundaries and make sure store file had been created.
* @throws Exception
*/
@Test(timeout = 180000)
public void testRegionBoundariesCheckWithFlushTable() throws Exception {
HBaseFsck hbck = doFsck(conf, false);
assertNoErrors(hbck); // no errors
TableName table = TableName.valueOf("testRegionBoundariesCheckWithFlushTable");
try {
setupTable(table);
admin.flush(table);
hbck.connect(); // need connection to have access to META
hbck.checkRegionBoundaries();
assertNoErrors(hbck); // no errors
} catch (IllegalArgumentException e) {
if (e.getMessage().endsWith("not a valid DFS filename.")) {
fail("Table directory path is not valid." + e.getMessage());
}
} finally {
hbck.close();
}
}
@Test (timeout=180000)
public void testHbckAfterRegionMerge() throws Exception {
TableName table = TableName.valueOf("testMergeRegionFilesInHdfs");