Skip to content

Commit 59ca6d1

Browse files
committed
HBASE-25445: Address feedback; Remove un-needed result variable; Rename local variables
1 parent d03125f commit 59ca6d1

File tree

1 file changed

+21
-23
lines changed

1 file changed

+21
-23
lines changed

hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestSplitWALManager.java

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import org.apache.hadoop.hbase.client.Admin;
3535
import org.apache.hadoop.hbase.client.Put;
3636
import org.apache.hadoop.hbase.client.RegionInfo;
37-
import org.apache.hadoop.hbase.client.Result;
3837
import org.apache.hadoop.hbase.client.ResultScanner;
3938
import org.apache.hadoop.hbase.client.Scan;
4039
import org.apache.hadoop.hbase.client.Table;
@@ -101,22 +100,22 @@ public void teardown() throws Exception {
101100

102101
@Test
103102
public void testWALArchiveWithDifferentWalAndRootFS() throws Exception{
104-
HBaseTestingUtility TEST_UTIL_2 = new HBaseTestingUtility();
103+
HBaseTestingUtility test_util_2 = new HBaseTestingUtility();
105104
Path dir = TEST_UTIL.getDataTestDirOnTestFS("testWalDir");
106-
TEST_UTIL_2.getConfiguration().set(CommonFSUtils.HBASE_WAL_DIR, dir.toString());
107-
CommonFSUtils.setWALRootDir(TEST_UTIL_2.getConfiguration(), dir);
108-
TEST_UTIL_2.startMiniCluster(3);
109-
HMaster TU2_master = TEST_UTIL_2.getHBaseCluster().getMaster();
110-
LOG.info("The Master FS is pointing to: " + TU2_master.getMasterFileSystem()
105+
test_util_2.getConfiguration().set(CommonFSUtils.HBASE_WAL_DIR, dir.toString());
106+
CommonFSUtils.setWALRootDir(test_util_2.getConfiguration(), dir);
107+
test_util_2.startMiniCluster(3);
108+
HMaster master2 = test_util_2.getHBaseCluster().getMaster();
109+
LOG.info("The Master FS is pointing to: " + master2.getMasterFileSystem()
111110
.getFileSystem().getUri());
112-
LOG.info("The WAL FS is pointing to: " + TU2_master.getMasterFileSystem()
111+
LOG.info("The WAL FS is pointing to: " + master2.getMasterFileSystem()
113112
.getWALFileSystem().getUri());
114-
Table TABLE = TEST_UTIL_2.createTable(TABLE_NAME, FAMILY);
115-
TEST_UTIL_2.waitTableAvailable(TABLE_NAME);
116-
Admin admin = TEST_UTIL_2.getAdmin();
117-
MasterProcedureEnv env = TEST_UTIL_2.getMiniHBaseCluster().getMaster()
113+
Table table = test_util_2.createTable(TABLE_NAME, FAMILY);
114+
test_util_2.waitTableAvailable(TABLE_NAME);
115+
Admin admin = test_util_2.getAdmin();
116+
MasterProcedureEnv env = test_util_2.getMiniHBaseCluster().getMaster()
118117
.getMasterProcedureExecutor().getEnvironment();
119-
final ProcedureExecutor<MasterProcedureEnv> executor = TEST_UTIL_2.getMiniHBaseCluster()
118+
final ProcedureExecutor<MasterProcedureEnv> executor = test_util_2.getMiniHBaseCluster()
120119
.getMaster().getMasterProcedureExecutor();
121120
List<RegionInfo> regionInfos = admin.getRegions(TABLE_NAME);
122121
SplitTableRegionProcedure splitProcedure = new SplitTableRegionProcedure(
@@ -128,28 +127,27 @@ public void testWALArchiveWithDifferentWalAndRootFS() throws Exception{
128127
byte[] row = Bytes.toBytes("row" + i);
129128
Put put = new Put(row);
130129
put.addColumn(FAMILY, FAMILY, FAMILY);
131-
TABLE.put(put);
130+
table.put(put);
132131
}
133132
executor.submitProcedure(splitProcedure);
134133
LOG.info("Submitted SplitProcedure.");
135-
TEST_UTIL_2.waitFor(30000, () -> executor.getProcedures().stream()
134+
test_util_2.waitFor(30000, () -> executor.getProcedures().stream()
136135
.filter(p -> p instanceof TransitRegionStateProcedure)
137136
.map(p -> (TransitRegionStateProcedure) p)
138137
.anyMatch(p -> TABLE_NAME.equals(p.getTableName())));
139-
TEST_UTIL_2.getMiniHBaseCluster().killRegionServer(
140-
TEST_UTIL_2.getMiniHBaseCluster().getRegionServer(0).getServerName());
141-
TEST_UTIL_2.getMiniHBaseCluster().startRegionServer();
142-
TEST_UTIL_2.waitUntilNoRegionsInTransition();
138+
test_util_2.getMiniHBaseCluster().killRegionServer(
139+
test_util_2.getMiniHBaseCluster().getRegionServer(0).getServerName());
140+
test_util_2.getMiniHBaseCluster().startRegionServer();
141+
test_util_2.waitUntilNoRegionsInTransition();
143142
Scan scan = new Scan();
144-
ResultScanner results = TABLE.getScanner(scan);
143+
ResultScanner results = table.getScanner(scan);
145144
int scanRowCount = 0;
146-
Result result = null;
147-
while ((result = results.next()) != null) {
145+
while (results.next() != null) {
148146
scanRowCount++;
149147
}
150148
Assert.assertEquals("Got " + scanRowCount + " rows when " + rowCount +
151149
" were expected.", rowCount, scanRowCount);
152-
TEST_UTIL_2.shutdownMiniCluster();
150+
test_util_2.shutdownMiniCluster();
153151
}
154152

155153
@Test

0 commit comments

Comments
 (0)