You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2021/01/07 06:38:04 UTC

[GitHub] [hbase] virajjasani commented on a change in pull request #2844: HBASE-25445: Use WAL FS instead of master FS in SplitWALManager

virajjasani commented on a change in pull request #2844:
URL: https://github.com/apache/hbase/pull/2844#discussion_r553132840



##########
File path: hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestSplitWALManager.java
##########
@@ -86,6 +99,59 @@ public void teardown() throws Exception {
     TEST_UTIL.shutdownMiniCluster();
   }
 
+  @Test
+  public void testWALArchiveWithDifferentWalAndRootFS() throws Exception{
+    HBaseTestingUtility TEST_UTIL_2 = new HBaseTestingUtility();

Review comment:
       Since this is not class level constant, no need to keep it in capital letters, keep it `test_util_2`

##########
File path: hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestSplitWALManager.java
##########
@@ -86,6 +99,59 @@ public void teardown() throws Exception {
     TEST_UTIL.shutdownMiniCluster();
   }
 
+  @Test
+  public void testWALArchiveWithDifferentWalAndRootFS() throws Exception{
+    HBaseTestingUtility TEST_UTIL_2 = 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 TU2_master = TEST_UTIL_2.getHBaseCluster().getMaster();

Review comment:
       Same here, this can be `master2` or something similar

##########
File path: hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestSplitWALManager.java
##########
@@ -86,6 +99,59 @@ public void teardown() throws Exception {
     TEST_UTIL.shutdownMiniCluster();
   }
 
+  @Test
+  public void testWALArchiveWithDifferentWalAndRootFS() throws Exception{
+    HBaseTestingUtility TEST_UTIL_2 = 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 TU2_master = TEST_UTIL_2.getHBaseCluster().getMaster();
+    LOG.info("The Master FS is pointing to: " + TU2_master.getMasterFileSystem()
+      .getFileSystem().getUri());
+    LOG.info("The WAL FS is pointing to: " + TU2_master.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()
+      .getMasterProcedureExecutor().getEnvironment();
+    final ProcedureExecutor<MasterProcedureEnv> executor = TEST_UTIL_2.getMiniHBaseCluster()
+      .getMaster().getMasterProcedureExecutor();
+    List<RegionInfo> regionInfos = admin.getRegions(TABLE_NAME);
+    SplitTableRegionProcedure splitProcedure = new SplitTableRegionProcedure(
+      env, regionInfos.get(0), Bytes.toBytes("row5"));
+    // Populate some rows in the table
+    LOG.info("Beginning put data to the table: " + TABLE_NAME.toString());
+    int rowCount = 5;
+    for (int i = 0; i < rowCount; i++) {
+      byte[] row = Bytes.toBytes("row" + i);
+      Put put = new Put(row);
+      put.addColumn(FAMILY, FAMILY, FAMILY);
+      TABLE.put(put);
+    }
+    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();
+    Scan scan = new Scan();
+    ResultScanner results = TABLE.getScanner(scan);
+    int scanRowCount = 0;
+    Result result = null;
+    while ((result = results.next()) != null) {

Review comment:
       Not using `result` will work?
   ```
       while (results.next() != null) {
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org