-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-25445: Use WAL FS instead of master FS in SplitWALManager #2844
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
513b6b4
HBASE-25445: Use WAL FS instead of master FS
dasanjan1296 df2b027
HBASE-25445: Add UT for splitWALManager archive
dasanjan1296 d03125f
Rectify LOG line
dasanjan1296 59ca6d1
HBASE-25445: Address feedback; Remove un-needed result variable; Rena…
dasanjan1296 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,6 +31,14 @@ | |
| import org.apache.hadoop.hbase.HConstants; | ||
| import org.apache.hadoop.hbase.ServerName; | ||
| import org.apache.hadoop.hbase.TableName; | ||
| import org.apache.hadoop.hbase.client.Admin; | ||
| import org.apache.hadoop.hbase.client.Put; | ||
| import org.apache.hadoop.hbase.client.RegionInfo; | ||
| import org.apache.hadoop.hbase.client.ResultScanner; | ||
| import org.apache.hadoop.hbase.client.Scan; | ||
| import org.apache.hadoop.hbase.client.Table; | ||
| import org.apache.hadoop.hbase.master.assignment.SplitTableRegionProcedure; | ||
| import org.apache.hadoop.hbase.master.assignment.TransitRegionStateProcedure; | ||
| import org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv; | ||
| import org.apache.hadoop.hbase.master.procedure.ServerProcedureInterface; | ||
| import org.apache.hadoop.hbase.procedure2.Procedure; | ||
|
|
@@ -43,6 +51,7 @@ | |
| import org.apache.hadoop.hbase.testclassification.LargeTests; | ||
| import org.apache.hadoop.hbase.testclassification.MasterTests; | ||
| import org.apache.hadoop.hbase.util.Bytes; | ||
| import org.apache.hadoop.hbase.util.CommonFSUtils; | ||
| import org.apache.hadoop.hbase.util.JVMClusterUtil; | ||
| import org.apache.hadoop.hbase.wal.AbstractFSWALProvider; | ||
| import org.junit.After; | ||
|
|
@@ -54,6 +63,8 @@ | |
| import org.apache.hbase.thirdparty.com.google.common.collect.Lists; | ||
| import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil; | ||
| import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
|
|
||
| @Category({ MasterTests.class, LargeTests.class }) | ||
|
|
||
|
|
@@ -63,6 +74,7 @@ public class TestSplitWALManager { | |
| public static final HBaseClassTestRule CLASS_RULE = | ||
| HBaseClassTestRule.forClass(TestSplitWALManager.class); | ||
|
|
||
| private static final Logger LOG = LoggerFactory.getLogger(TestSplitWALManager.class); | ||
| private static HBaseTestingUtility TEST_UTIL; | ||
| private HMaster master; | ||
| private SplitWALManager splitWALManager; | ||
|
|
@@ -86,6 +98,58 @@ 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 master2 = test_util_2.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() | ||
| .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() | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't we filter by the split procedure submitted and assert it has completed success? |
||
| .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; | ||
| while (results.next() != null) { | ||
| scanRowCount++; | ||
| } | ||
| Assert.assertEquals("Got " + scanRowCount + " rows when " + rowCount + | ||
| " were expected.", rowCount, scanRowCount); | ||
| test_util_2.shutdownMiniCluster(); | ||
| } | ||
|
|
||
| @Test | ||
| public void testAcquireAndRelease() throws Exception { | ||
| List<FakeServerProcedure> testProcedures = new ArrayList<>(); | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: non static variables should follow camel case style.