Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -100,22 +100,22 @@ public void teardown() throws Exception {

@Test
public void testWALArchiveWithDifferentWalAndRootFS() throws Exception{
HBaseTestingUtility test_util_2 = new HBaseTestingUtility();
HBaseTestingUtility testUtil2 = new HBaseTestingUtility();
Path dir = TEST_UTIL.getDataTestDirOnTestFS("testWalDir");
test_util_2.getConfiguration().set(CommonFSUtils.HBASE_WAL_DIR, dir.toString());
CommonFSUtils.setWALRootDir(test_util_2.getConfiguration(), dir);
test_util_2.startMiniCluster(3);
HMaster master2 = test_util_2.getHBaseCluster().getMaster();
testUtil2.getConfiguration().set(CommonFSUtils.HBASE_WAL_DIR, dir.toString());
CommonFSUtils.setWALRootDir(testUtil2.getConfiguration(), dir);
testUtil2.startMiniCluster(3);
HMaster master2 = testUtil2.getHBaseCluster().getMaster();
LOG.info("The Master FS is pointing to: " + master2.getMasterFileSystem()
.getFileSystem().getUri());
LOG.info("The WAL FS is pointing to: " + master2.getMasterFileSystem()
.getWALFileSystem().getUri());
Table table = test_util_2.createTable(TABLE_NAME, FAMILY);
test_util_2.waitTableAvailable(TABLE_NAME);
Admin admin = test_util_2.getAdmin();
MasterProcedureEnv env = test_util_2.getMiniHBaseCluster().getMaster()
Table table = testUtil2.createTable(TABLE_NAME, FAMILY);
testUtil2.waitTableAvailable(TABLE_NAME);
Admin admin = testUtil2.getAdmin();
MasterProcedureEnv env = testUtil2.getMiniHBaseCluster().getMaster()
.getMasterProcedureExecutor().getEnvironment();
final ProcedureExecutor<MasterProcedureEnv> executor = test_util_2.getMiniHBaseCluster()
final ProcedureExecutor<MasterProcedureEnv> executor = testUtil2.getMiniHBaseCluster()
.getMaster().getMasterProcedureExecutor();
List<RegionInfo> regionInfos = admin.getRegions(TABLE_NAME);
SplitTableRegionProcedure splitProcedure = new SplitTableRegionProcedure(
Expand All @@ -131,14 +131,14 @@ public void testWALArchiveWithDifferentWalAndRootFS() throws Exception{
}
executor.submitProcedure(splitProcedure);
LOG.info("Submitted SplitProcedure.");
test_util_2.waitFor(30000, () -> executor.getProcedures().stream()
.filter(p -> p instanceof TransitRegionStateProcedure)
.map(p -> (TransitRegionStateProcedure) p)
.anyMatch(p -> TABLE_NAME.equals(p.getTableName())));
test_util_2.getMiniHBaseCluster().killRegionServer(
test_util_2.getMiniHBaseCluster().getRegionServer(0).getServerName());
test_util_2.getMiniHBaseCluster().startRegionServer();
test_util_2.waitUntilNoRegionsInTransition();
testUtil2.waitFor(30000, () -> executor.getProcedures().stream()
.filter(p -> p instanceof SplitTableRegionProcedure)
.map(p -> (SplitTableRegionProcedure) p)
.anyMatch(p -> TABLE_NAME.equals(p.getTableName())) && splitProcedure.isSuccess());
testUtil2.getMiniHBaseCluster().killRegionServer(
testUtil2.getMiniHBaseCluster().getRegionServer(0).getServerName());
testUtil2.getMiniHBaseCluster().startRegionServer();
testUtil2.waitUntilNoRegionsInTransition();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test looks fine, functionally wise, but could we simplify it and make it more clear by directly testing the log splitting? Sorry, don't want to be picky, it just looks we are doing more than needed here, maybe it would be simpler to just to do same thing as testSplitLogs(), after making sure wal is under a different file system. You could move current testSplitLogs() to a separate method that would be called by both this test and testSplitLogs.

WDYT, @dasanjan1296 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I agree with you. Simply doing a split wal operation should be enough to test this particular scenario. I went overboard with the test while trying to explore a few things. I've updated the test per your suggestion. PTAL.

Scan scan = new Scan();
ResultScanner results = table.getScanner(scan);
int scanRowCount = 0;
Expand All @@ -147,7 +147,7 @@ public void testWALArchiveWithDifferentWalAndRootFS() throws Exception{
}
Assert.assertEquals("Got " + scanRowCount + " rows when " + rowCount +
" were expected.", rowCount, scanRowCount);
test_util_2.shutdownMiniCluster();
testUtil2.shutdownMiniCluster();
}

@Test
Expand Down