You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2016/11/11 01:21:55 UTC
hbase git commit: HBASE-17063 Cleanup TestHRegion : remove duplicate
variables for method name and two unused params in initRegion - Replaces
local tablename and method names in individual tests with those initialized
in setup() function - Remove unused
Repository: hbase
Updated Branches:
refs/heads/master 12eec5bc5 -> 62e3b1ece
HBASE-17063 Cleanup TestHRegion : remove duplicate variables for method name and two unused params in initRegion
- Replaces local tablename and method names in individual tests with those initialized in setup() function
- Remove unused params from initHRegion().
Change-Id: Id0fe25890c833f7cc9b91277d5015480a007d788
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/62e3b1ec
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/62e3b1ec
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/62e3b1ec
Branch: refs/heads/master
Commit: 62e3b1ece6d574f3d303861bef94e3160eec299e
Parents: 12eec5b
Author: Apekshit Sharma <ap...@apache.org>
Authored: Wed Nov 9 20:03:19 2016 -0800
Committer: Apekshit Sharma <ap...@apache.org>
Committed: Thu Nov 10 17:21:06 2016 -0800
----------------------------------------------------------------------
.../hadoop/hbase/regionserver/TestHRegion.java | 203 ++++++-------------
.../TestHRegionWithInMemoryFlush.java | 7 +-
2 files changed, 62 insertions(+), 148 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/62e3b1ec/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
index 6c63cff..5e0f3f8 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
@@ -197,7 +197,8 @@ public class TestHRegion {
// Do not spin up clusters in here. If you need to spin up a cluster, do it
// over in TestHRegionOnCluster.
private static final Log LOG = LogFactory.getLog(TestHRegion.class);
- @Rule public TestName name = new TestName();
+ @Rule
+ public TestName name = new TestName();
@ClassRule
public static final TestRule timeout =
CategoryBasedTimeout.forClass(TestHRegion.class);
@@ -234,7 +235,7 @@ public class TestHRegion {
CONF = TEST_UTIL.getConfiguration();
dir = TEST_UTIL.getDataTestDir("TestHRegion").toString();
method = name.getMethodName();
- tableName = TableName.valueOf(name.getMethodName());
+ tableName = TableName.valueOf(method);
}
@After
@@ -244,17 +245,13 @@ public class TestHRegion {
TEST_UTIL.cleanupTestDir();
}
- String getName() {
- return name.getMethodName();
- }
-
/**
* Test that I can use the max flushed sequence id after the close.
* @throws IOException
*/
@Test
public void testSequenceId() throws IOException {
- HRegion region = initHRegion(tableName, name.getMethodName(), CONF, COLUMN_FAMILY_BYTES);
+ HRegion region = initHRegion(tableName, method, CONF, COLUMN_FAMILY_BYTES);
assertEquals(HConstants.NO_SEQNUM, region.getMaxFlushedSeqId());
// Weird. This returns 0 if no store files or no edits. Afraid to change it.
assertEquals(0, (long)region.getMaxStoreSeqId().get(COLUMN_FAMILY_BYTES));
@@ -262,8 +259,8 @@ public class TestHRegion {
assertEquals(HConstants.NO_SEQNUM, region.getMaxFlushedSeqId());
assertEquals(0, (long)region.getMaxStoreSeqId().get(COLUMN_FAMILY_BYTES));
// Open region again.
- region = initHRegion(tableName, name.getMethodName(), CONF, COLUMN_FAMILY_BYTES);
- byte [] value = Bytes.toBytes(name.getMethodName());
+ region = initHRegion(tableName, method, CONF, COLUMN_FAMILY_BYTES);
+ byte [] value = Bytes.toBytes(method);
// Make a random put against our cf.
Put put = new Put(value);
put.addColumn(COLUMN_FAMILY_BYTES, null, value);
@@ -289,10 +286,10 @@ public class TestHRegion {
*/
@Test
public void testCloseCarryingSnapshot() throws IOException {
- HRegion region = initHRegion(tableName, name.getMethodName(), CONF, COLUMN_FAMILY_BYTES);
+ HRegion region = initHRegion(tableName, method, CONF, COLUMN_FAMILY_BYTES);
Store store = region.getStore(COLUMN_FAMILY_BYTES);
// Get some random bytes.
- byte [] value = Bytes.toBytes(name.getMethodName());
+ byte [] value = Bytes.toBytes(method);
// Make a random put against our cf.
Put put = new Put(value);
put.addColumn(COLUMN_FAMILY_BYTES, null, value);
@@ -336,12 +333,12 @@ public class TestHRegion {
FileSystem fs = FileSystem.get(CONF);
Path rootDir = new Path(dir + "testMemstoreSnapshotSize");
MyFaultyFSLog faultyLog = new MyFaultyFSLog(fs, rootDir, "testMemstoreSnapshotSize", CONF);
- HRegion region = initHRegion(tableName, null, null, name.getMethodName(),
- CONF, false, Durability.SYNC_WAL, faultyLog, COLUMN_FAMILY_BYTES);
+ HRegion region = initHRegion(tableName, null, null, false, Durability.SYNC_WAL, faultyLog,
+ COLUMN_FAMILY_BYTES);
Store store = region.getStore(COLUMN_FAMILY_BYTES);
// Get some random bytes.
- byte [] value = Bytes.toBytes(name.getMethodName());
+ byte [] value = Bytes.toBytes(method);
faultyLog.setStoreFlushCtx(store.createFlushContext(12345));
Put put = new Put(value);
@@ -386,13 +383,13 @@ public class TestHRegion {
FileSystem fs = FileSystem.get(CONF);
Path rootDir = new Path(dir + "testMemstoreSizeWithFlushCanceling");
FSHLog hLog = new FSHLog(fs, rootDir, "testMemstoreSizeWithFlushCanceling", CONF);
- HRegion region = initHRegion(tableName, null, null, name.getMethodName(),
- CONF, false, Durability.SYNC_WAL, hLog, COLUMN_FAMILY_BYTES);
+ HRegion region = initHRegion(tableName, null, null, false, Durability.SYNC_WAL, hLog,
+ COLUMN_FAMILY_BYTES);
Store store = region.getStore(COLUMN_FAMILY_BYTES);
assertEquals(0, region.getMemstoreSize());
// Put some value and make sure flush could be completed normally
- byte [] value = Bytes.toBytes(name.getMethodName());
+ byte [] value = Bytes.toBytes(method);
Put put = new Put(value);
put.addColumn(COLUMN_FAMILY_BYTES, Bytes.toBytes("abc"), value);
region.put(put);
@@ -428,13 +425,13 @@ public class TestHRegion {
FileSystem fs = FileSystem.get(CONF);
Path rootDir = new Path(dir + testName);
FSHLog hLog = new FSHLog(fs, rootDir, testName, CONF);
- HRegion region = initHRegion(tableName, null, null, name.getMethodName(),
- CONF, false, Durability.SYNC_WAL, hLog, COLUMN_FAMILY_BYTES);
+ HRegion region = initHRegion(tableName, null, null, false, Durability.SYNC_WAL, hLog,
+ COLUMN_FAMILY_BYTES);
Store store = region.getStore(COLUMN_FAMILY_BYTES);
assertEquals(0, region.getMemstoreSize());
// Put one value
- byte [] value = Bytes.toBytes(name.getMethodName());
+ byte [] value = Bytes.toBytes(method);
Put put = new Put(value);
put.addColumn(COLUMN_FAMILY_BYTES, Bytes.toBytes("abc"), value);
region.put(put);
@@ -480,12 +477,11 @@ public class TestHRegion {
@Test
public void testFlushSizeAccounting() throws Exception {
final Configuration conf = HBaseConfiguration.create(CONF);
- final String callingMethod = name.getMethodName();
- final WAL wal = createWALCompatibleWithFaultyFileSystem(callingMethod, conf, tableName);
+ final WAL wal = createWALCompatibleWithFaultyFileSystem(method, conf, tableName);
// Only retry once.
conf.setInt("hbase.hstore.flush.retries.number", 1);
final User user =
- User.createUserForTesting(conf, this.name.getMethodName(), new String[]{"foo"});
+ User.createUserForTesting(conf, method, new String[]{"foo"});
// Inject our faulty LocalFileSystem
conf.setClass("fs.file.impl", FaultyFileSystem.class, FileSystem.class);
user.runAs(new PrivilegedExceptionAction<Object>() {
@@ -498,8 +494,8 @@ public class TestHRegion {
HRegion region = null;
try {
// Initialize region
- region = initHRegion(tableName, null, null, callingMethod, conf, false,
- Durability.SYNC_WAL, wal, COLUMN_FAMILY_BYTES);
+ region = initHRegion(tableName, null, null, false, Durability.SYNC_WAL, wal,
+ COLUMN_FAMILY_BYTES);
long size = region.getMemstoreSize();
Assert.assertEquals(0, size);
// Put one item into memstore. Measure the size of one item in memstore.
@@ -546,12 +542,11 @@ public class TestHRegion {
@Test
public void testCloseWithFailingFlush() throws Exception {
final Configuration conf = HBaseConfiguration.create(CONF);
- final String callingMethod = name.getMethodName();
- final WAL wal = createWALCompatibleWithFaultyFileSystem(callingMethod, conf, tableName);
+ final WAL wal = createWALCompatibleWithFaultyFileSystem(method, conf, tableName);
// Only retry once.
conf.setInt("hbase.hstore.flush.retries.number", 1);
final User user =
- User.createUserForTesting(conf, this.name.getMethodName(), new String[]{"foo"});
+ User.createUserForTesting(conf, this.method, new String[]{"foo"});
// Inject our faulty LocalFileSystem
conf.setClass("fs.file.impl", FaultyFileSystem.class, FileSystem.class);
user.runAs(new PrivilegedExceptionAction<Object>() {
@@ -564,7 +559,7 @@ public class TestHRegion {
HRegion region = null;
try {
// Initialize region
- region = initHRegion(tableName, null, null, callingMethod, conf, false,
+ region = initHRegion(tableName, null, null, false,
Durability.SYNC_WAL, wal, COLUMN_FAMILY_BYTES);
long size = region.getMemstoreSize();
Assert.assertEquals(0, size);
@@ -678,8 +673,6 @@ public class TestHRegion {
@Test
public void testSkipRecoveredEditsReplay() throws Exception {
- String method = "testSkipRecoveredEditsReplay";
- TableName tableName = TableName.valueOf(method);
byte[] family = Bytes.toBytes("family");
this.region = initHRegion(tableName, method, CONF, family);
final WALFactory wals = new WALFactory(CONF, null, method);
@@ -731,8 +724,6 @@ public class TestHRegion {
@Test
public void testSkipRecoveredEditsReplaySomeIgnored() throws Exception {
- String method = "testSkipRecoveredEditsReplaySomeIgnored";
- TableName tableName = TableName.valueOf(method);
byte[] family = Bytes.toBytes("family");
this.region = initHRegion(tableName, method, CONF, family);
final WALFactory wals = new WALFactory(CONF, null, method);
@@ -821,8 +812,6 @@ public class TestHRegion {
@Test
public void testSkipRecoveredEditsReplayTheLastFileIgnored() throws Exception {
- String method = "testSkipRecoveredEditsReplayTheLastFileIgnored";
- TableName tableName = TableName.valueOf(method);
byte[] family = Bytes.toBytes("family");
this.region = initHRegion(tableName, method, CONF, family);
final WALFactory wals = new WALFactory(CONF, null, method);
@@ -889,9 +878,8 @@ public class TestHRegion {
testRecoveredEditsReplayCompaction(false);
testRecoveredEditsReplayCompaction(true);
}
+
public void testRecoveredEditsReplayCompaction(boolean mismatchedRegionName) throws Exception {
- String method = name.getMethodName();
- TableName tableName = TableName.valueOf(method);
byte[] family = Bytes.toBytes("family");
this.region = initHRegion(tableName, method, CONF, family);
final WALFactory wals = new WALFactory(CONF, null, method);
@@ -1000,8 +988,6 @@ public class TestHRegion {
@Test
public void testFlushMarkers() throws Exception {
// tests that flush markers are written to WAL and handled at recovered edits
- String method = name.getMethodName();
- TableName tableName = TableName.valueOf(method);
byte[] family = Bytes.toBytes("family");
Path logDir = TEST_UTIL.getDataTestDirOnTestFS(method + ".log");
final Configuration walConf = new Configuration(TEST_UTIL.getConfiguration());
@@ -1010,7 +996,7 @@ public class TestHRegion {
final WAL wal = wals.getWAL(tableName.getName(), tableName.getNamespace());
this.region = initHRegion(tableName, HConstants.EMPTY_START_ROW,
- HConstants.EMPTY_END_ROW, method, CONF, false, Durability.USE_DEFAULT, wal, family);
+ HConstants.EMPTY_END_ROW, false, Durability.USE_DEFAULT, wal, family);
try {
Path regiondir = region.getRegionFileSystem().getRegionDir();
FileSystem fs = region.getRegionFileSystem().getFileSystem();
@@ -1154,8 +1140,6 @@ public class TestHRegion {
@Test
public void testFlushMarkersWALFail() throws Exception {
// test the cases where the WAL append for flush markers fail.
- String method = name.getMethodName();
- TableName tableName = TableName.valueOf(method);
byte[] family = Bytes.toBytes("family");
// spy an actual WAL implementation to throw exception (was not able to mock)
@@ -1211,9 +1195,9 @@ public class TestHRegion {
}
FailAppendFlushMarkerWAL wal =
new FailAppendFlushMarkerWAL(FileSystem.get(walConf), FSUtils.getRootDir(walConf),
- getName(), walConf);
+ method, walConf);
this.region = initHRegion(tableName, HConstants.EMPTY_START_ROW,
- HConstants.EMPTY_END_ROW, method, CONF, false, Durability.USE_DEFAULT, wal, family);
+ HConstants.EMPTY_END_ROW, false, Durability.USE_DEFAULT, wal, family);
try {
int i = 0;
Put put = new Put(Bytes.toBytes(i));
@@ -1242,10 +1226,10 @@ public class TestHRegion {
// 2. Test case where START_FLUSH succeeds but COMMIT_FLUSH will throw exception
wal.flushActions = new FlushAction [] {FlushAction.COMMIT_FLUSH};
wal = new FailAppendFlushMarkerWAL(FileSystem.get(walConf), FSUtils.getRootDir(walConf),
- getName(), walConf);
+ method, walConf);
this.region = initHRegion(tableName, HConstants.EMPTY_START_ROW,
- HConstants.EMPTY_END_ROW, method, CONF, false, Durability.USE_DEFAULT, wal, family);
+ HConstants.EMPTY_END_ROW, false, Durability.USE_DEFAULT, wal, family);
region.put(put);
// 3. Test case where ABORT_FLUSH will throw exception.
@@ -1271,13 +1255,11 @@ public class TestHRegion {
@Test
public void testGetWhileRegionClose() throws IOException {
- TableName tableName = TableName.valueOf(name.getMethodName());
Configuration hc = initSplit();
int numRows = 100;
byte[][] families = { fam1, fam2, fam3 };
// Setting up region
- String method = name.getMethodName();
this.region = initHRegion(tableName, method, hc, families);
try {
// Put data in region
@@ -1366,7 +1348,7 @@ public class TestHRegion {
TableName TABLE = TableName.valueOf("testWeirdCacheBehaviour");
byte[][] FAMILIES = new byte[][] { Bytes.toBytes("trans-blob"), Bytes.toBytes("trans-type"),
Bytes.toBytes("trans-date"), Bytes.toBytes("trans-tags"), Bytes.toBytes("trans-group") };
- this.region = initHRegion(TABLE, getName(), CONF, FAMILIES);
+ this.region = initHRegion(TABLE, method, CONF, FAMILIES);
try {
String value = "this is the value";
String value2 = "this is some other value";
@@ -1407,7 +1389,7 @@ public class TestHRegion {
@Test
public void testAppendWithReadOnlyTable() throws Exception {
TableName TABLE = TableName.valueOf("readOnlyTable");
- this.region = initHRegion(TABLE, getName(), CONF, true, Bytes.toBytes("somefamily"));
+ this.region = initHRegion(TABLE, method, CONF, true, Bytes.toBytes("somefamily"));
boolean exceptionCaught = false;
Append append = new Append(Bytes.toBytes("somerow"));
append.setDurability(Durability.SKIP_WAL);
@@ -1427,7 +1409,7 @@ public class TestHRegion {
@Test
public void testIncrWithReadOnlyTable() throws Exception {
TableName TABLE = TableName.valueOf("readOnlyTable");
- this.region = initHRegion(TABLE, getName(), CONF, true, Bytes.toBytes("somefamily"));
+ this.region = initHRegion(TABLE, method, CONF, true, Bytes.toBytes("somefamily"));
boolean exceptionCaught = false;
Increment inc = new Increment(Bytes.toBytes("somerow"));
inc.setDurability(Durability.SKIP_WAL);
@@ -1518,11 +1500,10 @@ public class TestHRegion {
@Test
public void testFamilyWithAndWithoutColon() throws Exception {
- TableName b = TableName.valueOf(getName());
byte[] cf = Bytes.toBytes(COLUMN_FAMILY);
- this.region = initHRegion(b, getName(), CONF, cf);
+ this.region = initHRegion(tableName, method, CONF, cf);
try {
- Put p = new Put(b.toBytes());
+ Put p = new Put(tableName.toBytes());
byte[] cfwithcolon = Bytes.toBytes(COLUMN_FAMILY + ":");
p.addColumn(cfwithcolon, cfwithcolon, cfwithcolon);
boolean exception = false;
@@ -1543,7 +1524,7 @@ public class TestHRegion {
byte[] cf = Bytes.toBytes(COLUMN_FAMILY);
byte[] qual = Bytes.toBytes("qual");
byte[] val = Bytes.toBytes("val");
- this.region = initHRegion(TableName.valueOf(getName()), getName(), CONF, cf);
+ this.region = initHRegion(tableName, method, CONF, cf);
MetricsWALSource source = CompatibilitySingletonFactory.getInstance(MetricsWALSource.class);
try {
long syncs = metricsAssertHelper.getCounter("syncTimeNumOps", source);
@@ -1584,7 +1565,7 @@ public class TestHRegion {
byte[] cf = Bytes.toBytes(COLUMN_FAMILY);
byte[] qual = Bytes.toBytes("qual");
byte[] val = Bytes.toBytes("val");
- this.region = initHRegion(TableName.valueOf(getName()), getName(), CONF, cf);
+ this.region = initHRegion(tableName, method, CONF, cf);
MetricsWALSource source = CompatibilitySingletonFactory.getInstance(MetricsWALSource.class);
try {
long syncs = metricsAssertHelper.getCounter("syncTimeNumOps", source);
@@ -1683,14 +1664,13 @@ public class TestHRegion {
@Test
public void testBatchPutWithTsSlop() throws Exception {
- TableName b = TableName.valueOf(getName());
byte[] cf = Bytes.toBytes(COLUMN_FAMILY);
byte[] qual = Bytes.toBytes("qual");
byte[] val = Bytes.toBytes("val");
// add data with a timestamp that is too recent for range. Ensure assert
CONF.setInt("hbase.hregion.keyvalue.timestamp.slop.millisecs", 1000);
- this.region = initHRegion(b, getName(), CONF, cf);
+ this.region = initHRegion(tableName, method, CONF, cf);
try {
MetricsWALSource source = CompatibilitySingletonFactory.getInstance(MetricsWALSource.class);
@@ -1730,7 +1710,6 @@ public class TestHRegion {
byte[] val2 = Bytes.toBytes("value2");
// Setting up region
- String method = this.getName();
this.region = initHRegion(tableName, method, CONF, fam1);
try {
// Putting empty data in key
@@ -1804,7 +1783,6 @@ public class TestHRegion {
byte[] val2 = Bytes.toBytes("value2");
// Setting up region
- String method = this.getName();
this.region = initHRegion(tableName, method, CONF, fam1);
try {
// Putting data in key
@@ -1837,7 +1815,6 @@ public class TestHRegion {
byte[] val1 = Bytes.toBytes("value1");
// Setting up region
- String method = this.getName();
this.region = initHRegion(tableName, method, CONF, fam1);
try {
// Putting data in key
@@ -1873,7 +1850,6 @@ public class TestHRegion {
byte[] val4 = Bytes.toBytes("value4");
// Setting up region
- String method = this.getName();
this.region = initHRegion(tableName, method, CONF, fam1);
try {
// Putting val3 in key
@@ -1969,7 +1945,6 @@ public class TestHRegion {
byte[][] families = { fam1, fam2 };
// Setting up region
- String method = this.getName();
this.region = initHRegion(tableName, method, CONF, families);
try {
// Putting data in the key to check
@@ -2006,8 +1981,7 @@ public class TestHRegion {
@Test
public void testCheckAndPut_wrongRowInPut() throws IOException {
- TableName tableName = TableName.valueOf(name.getMethodName());
- this.region = initHRegion(tableName, this.getName(), CONF, COLUMNS);
+ this.region = initHRegion(tableName, method, CONF, COLUMNS);
try {
Put put = new Put(row2);
put.addColumn(fam1, qual1, value1);
@@ -2040,7 +2014,6 @@ public class TestHRegion {
byte[][] families = { fam1, fam2 };
// Setting up region
- String method = this.getName();
this.region = initHRegion(tableName, method, CONF, families);
try {
// Put content
@@ -2115,7 +2088,6 @@ public class TestHRegion {
put.addColumn(fam1, qual, (long) 1, value);
put.addColumn(fam1, qual, (long) 2, value);
- String method = this.getName();
this.region = initHRegion(tableName, method, CONF, fam1);
try {
region.put(put);
@@ -2145,7 +2117,6 @@ public class TestHRegion {
byte[] fam4 = Bytes.toBytes("fam4");
// Setting up region
- String method = this.getName();
this.region = initHRegion(tableName, method, CONF, fam1, fam2, fam3);
try {
List<Cell> kvs = new ArrayList<Cell>();
@@ -2184,7 +2155,6 @@ public class TestHRegion {
public void testDelete_mixed() throws IOException, InterruptedException {
byte[] fam = Bytes.toBytes("info");
byte[][] families = { fam };
- String method = this.getName();
this.region = initHRegion(tableName, method, CONF, families);
try {
EnvironmentEdgeManagerTestHelper.injectEdge(new IncrementingEnvironmentEdge());
@@ -2252,7 +2222,6 @@ public class TestHRegion {
public void testDeleteRowWithFutureTs() throws IOException {
byte[] fam = Bytes.toBytes("info");
byte[][] families = { fam };
- String method = this.getName();
this.region = initHRegion(tableName, method, CONF, families);
try {
byte[] row = Bytes.toBytes("table_name");
@@ -2295,7 +2264,6 @@ public class TestHRegion {
public void testPutWithLatestTS() throws IOException {
byte[] fam = Bytes.toBytes("info");
byte[][] families = { fam };
- String method = this.getName();
this.region = initHRegion(tableName, method, CONF, families);
try {
byte[] row = Bytes.toBytes("row1");
@@ -2347,7 +2315,6 @@ public class TestHRegion {
public void testPutWithTsSlop() throws IOException {
byte[] fam = Bytes.toBytes("info");
byte[][] families = { fam };
- String method = this.getName();
// add data with a timestamp that is too recent for range. Ensure assert
CONF.setInt("hbase.hregion.keyvalue.timestamp.slop.millisecs", 1000);
@@ -2376,7 +2343,7 @@ public class TestHRegion {
public void testScanner_DeleteOneFamilyNotAnother() throws IOException {
byte[] fam1 = Bytes.toBytes("columnA");
byte[] fam2 = Bytes.toBytes("columnB");
- this.region = initHRegion(tableName, getName(), CONF, fam1, fam2);
+ this.region = initHRegion(tableName, method, CONF, fam1, fam2);
try {
byte[] rowA = Bytes.toBytes("rowA");
byte[] rowB = Bytes.toBytes("rowB");
@@ -2419,8 +2386,8 @@ public class TestHRegion {
FileSystem fs = FileSystem.get(CONF);
Path rootDir = new Path(dir + "testDataInMemoryWithoutWAL");
FSHLog hLog = new FSHLog(fs, rootDir, "testDataInMemoryWithoutWAL", CONF);
- HRegion region = initHRegion(tableName, null, null, name.getMethodName(),
- CONF, false, Durability.SYNC_WAL, hLog, COLUMN_FAMILY_BYTES);
+ HRegion region = initHRegion(tableName, null, null, false, Durability.SYNC_WAL, hLog,
+ COLUMN_FAMILY_BYTES);
Cell originalCell = CellUtil.createCell(row, COLUMN_FAMILY_BYTES, qual1,
System.currentTimeMillis(), KeyValue.Type.Put.getCode(), value1);
@@ -2500,8 +2467,7 @@ public class TestHRegion {
}
public void doTestDelete_AndPostInsert(Delete delete) throws IOException, InterruptedException {
- TableName tableName = TableName.valueOf(name.getMethodName());
- this.region = initHRegion(tableName, getName(), CONF, fam1);
+ this.region = initHRegion(tableName, method, CONF, fam1);
try {
EnvironmentEdgeManagerTestHelper.injectEdge(new IncrementingEnvironmentEdge());
Put put = new Put(row);
@@ -2546,14 +2512,12 @@ public class TestHRegion {
@Test
public void testDelete_CheckTimestampUpdated() throws IOException {
- TableName tableName = TableName.valueOf(name.getMethodName());
byte[] row1 = Bytes.toBytes("row1");
byte[] col1 = Bytes.toBytes("col1");
byte[] col2 = Bytes.toBytes("col2");
byte[] col3 = Bytes.toBytes("col3");
// Setting up region
- String method = this.getName();
this.region = initHRegion(tableName, method, CONF, fam1);
try {
// Building checkerList
@@ -2595,7 +2559,6 @@ public class TestHRegion {
byte[] col1 = Bytes.toBytes("col1");
// Setting up region
- String method = this.getName();
this.region = initHRegion(tableName, method, CONF, fam1);
try {
Get get = new Get(row1);
@@ -2626,7 +2589,6 @@ public class TestHRegion {
byte[] col5 = Bytes.toBytes("col5");
// Setting up region
- String method = this.getName();
this.region = initHRegion(tableName, method, CONF, fam1);
try {
// Add to memstore
@@ -2672,7 +2634,6 @@ public class TestHRegion {
byte[] row = Bytes.toBytes("row");
byte[] fam = Bytes.toBytes("fam");
- String method = this.getName();
this.region = initHRegion(tableName, method, CONF, fam);
try {
Get get = new Get(row);
@@ -2694,7 +2655,6 @@ public class TestHRegion {
byte[][] families = { fam1, fam2, fam3 };
Configuration hc = initSplit();
// Setting up region
- String method = this.getName();
this.region = initHRegion(tableName, method, hc, families);
try {
LOG.info("" + HBaseTestCase.addContent(region, fam3));
@@ -2786,7 +2746,6 @@ public class TestHRegion {
byte[][] families = { fam1, fam2 };
// Setting up region
- String method = this.getName();
this.region = initHRegion(tableName, method, CONF, families);
try {
Scan scan = new Scan();
@@ -2811,7 +2770,6 @@ public class TestHRegion {
byte[][] families = { fam1 };
// Setting up region
- String method = this.getName();
this.region = initHRegion(tableName, method, CONF, families);
try {
Scan scan = new Scan();
@@ -2840,7 +2798,6 @@ public class TestHRegion {
byte[][] families = { fam1, fam2, fam3, fam4 };
// Setting up region
- String method = this.getName();
this.region = initHRegion(tableName, method, CONF, families);
try {
@@ -2886,7 +2843,6 @@ public class TestHRegion {
byte[][] families = { fam1, fam2 };
// Setting up region
- String method = this.getName();
try {
this.region = initHRegion(tableName, method, CONF, families);
} catch (IOException e) {
@@ -2924,7 +2880,6 @@ public class TestHRegion {
long ts = System.currentTimeMillis();
// Setting up region
- String method = this.getName();
this.region = initHRegion(tableName, method, CONF, families);
try {
// Putting data in Region
@@ -2990,7 +2945,6 @@ public class TestHRegion {
long ts3 = ts1 + 2;
// Setting up region
- String method = this.getName();
this.region = initHRegion(tableName, method, CONF, families);
try {
// Putting data in Region
@@ -3049,7 +3003,6 @@ public class TestHRegion {
long ts3 = ts1 + 2;
// Setting up region
- String method = this.getName();
this.region = initHRegion(tableName, method, CONF, families);
try {
// Putting data in Region
@@ -3114,7 +3067,6 @@ public class TestHRegion {
long ts4 = ts1 + 3;
// Setting up region
- String method = this.getName();
this.region = initHRegion(tableName, method, CONF, families);
try {
// Putting data in Region
@@ -3195,7 +3147,6 @@ public class TestHRegion {
long ts3 = ts1 + 2;
// Setting up region
- String method = this.getName();
this.region = initHRegion(tableName, method, CONF, families);
try {
// Putting data in Region
@@ -3255,7 +3206,6 @@ public class TestHRegion {
long ts3 = ts1 + 2;
// Setting up region
- String method = this.getName();
this.region = initHRegion(tableName, method, CONF, fam1);
try {
// Putting data in Region
@@ -3307,7 +3257,7 @@ public class TestHRegion {
@Test
public void testScanner_StopRow1542() throws IOException {
byte[] family = Bytes.toBytes("testFamily");
- this.region = initHRegion(tableName, getName(), CONF, family);
+ this.region = initHRegion(tableName, method, CONF, family);
try {
byte[] row1 = Bytes.toBytes("row111");
byte[] row2 = Bytes.toBytes("row222");
@@ -3365,7 +3315,6 @@ public class TestHRegion {
long ts4 = ts1 + 3;
// Setting up region
- String method = this.getName();
this.region = initHRegion(tableName, method, CONF, fam1);
try {
// Putting data in Region
@@ -3442,7 +3391,7 @@ public class TestHRegion {
byte[] cf_essential = Bytes.toBytes("essential");
byte[] cf_joined = Bytes.toBytes("joined");
byte[] cf_alpha = Bytes.toBytes("alpha");
- this.region = initHRegion(tableName, getName(), CONF, cf_essential, cf_joined, cf_alpha);
+ this.region = initHRegion(tableName, method, CONF, cf_essential, cf_joined, cf_alpha);
try {
byte[] row1 = Bytes.toBytes("row1");
byte[] row2 = Bytes.toBytes("row2");
@@ -3510,7 +3459,7 @@ public class TestHRegion {
final byte[] cf_first = Bytes.toBytes("first");
final byte[] cf_second = Bytes.toBytes("second");
- this.region = initHRegion(tableName, getName(), CONF, cf_first, cf_second);
+ this.region = initHRegion(tableName, method, CONF, cf_first, cf_second);
try {
final byte[] col_a = Bytes.toBytes("a");
final byte[] col_b = Bytes.toBytes("b");
@@ -3603,8 +3552,6 @@ public class TestHRegion {
*/
@Test
public void testLongQualifier() throws Exception {
- String method = name.getMethodName();
- TableName tableName = TableName.valueOf(method);
byte[] family = Bytes.toBytes("family");
this.region = initHRegion(tableName, method, CONF, family);
byte[] q = new byte[Short.MAX_VALUE+2];
@@ -3634,7 +3581,6 @@ public class TestHRegion {
Configuration hc = initSplit();
// Setting up region
- String method = this.getName();
this.region = initHRegion(tableName, method, hc, families);
try {
@@ -3723,7 +3669,6 @@ public class TestHRegion {
byte[][] families = { fam1, fam3 };
// Setting up region
- String method = this.getName();
this.region = initHRegion(tableName, method, hc, families);
// Put data in region
@@ -3762,7 +3707,6 @@ public class TestHRegion {
byte[][] families = { fam1, fam3 };
// Setting up region
- String method = this.getName();
this.region = initHRegion(tableName, method, hc, families);
// Put data in region
@@ -3839,7 +3783,6 @@ public class TestHRegion {
int flushAndScanInterval = 10;
int compactInterval = 10 * flushAndScanInterval;
- String method = "testFlushCacheWhileScanning";
this.region = initHRegion(tableName, method, CONF, family);
FlushThread flushThread = new FlushThread();
try {
@@ -3981,7 +3924,6 @@ public class TestHRegion {
qualifiers[i] = Bytes.toBytes("qual" + i);
}
- String method = "testWritesWhileScanning";
this.region = initHRegion(tableName, method, CONF, families);
FlushThread flushThread = new FlushThread();
PutThread putThread = new PutThread(numRows, families, qualifiers);
@@ -4156,7 +4098,6 @@ public class TestHRegion {
}
- String method = "testWritesWhileGetting";
// This test flushes constantly and can cause many files to be created,
// possibly
// extending over the ulimit. Make sure compactions are aggressive in
@@ -4273,7 +4214,6 @@ public class TestHRegion {
byte[] family = Bytes.toBytes("family");
// Setting up region
- String method = "testIndexesScanWithOneDeletedRow";
this.region = initHRegion(tableName, method, CONF, family);
try {
Put put = new Put(Bytes.toBytes(1L));
@@ -4475,7 +4415,7 @@ public class TestHRegion {
try {
cluster = htu.startMiniCluster(1, regionServersCount, dataNodeHosts);
byte[][] families = { fam1, fam2 };
- Table ht = htu.createTable(TableName.valueOf(this.getName()), families);
+ Table ht = htu.createTable(tableName, families);
// Setting up region
byte row[] = Bytes.toBytes("row1");
@@ -4486,8 +4426,7 @@ public class TestHRegion {
put.addColumn(fam2, col, (long) 1, Bytes.toBytes("test2"));
ht.put(put);
- HRegion firstRegion = htu.getHBaseCluster().getRegions(TableName.valueOf(this.getName()))
- .get(0);
+ HRegion firstRegion = htu.getHBaseCluster().getRegions(tableName).get(0);
firstRegion.flush(true);
HDFSBlocksDistribution blocksDistribution1 = firstRegion.getHDFSBlocksDistribution();
@@ -4535,8 +4474,7 @@ public class TestHRegion {
*/
@Test
public void testStatusSettingToAbortIfAnyExceptionDuringRegionInitilization() throws Exception {
- TableName tableName = TableName.valueOf(name.getMethodName());
- HRegionInfo info = null;
+ HRegionInfo info;
try {
FileSystem fs = Mockito.mock(FileSystem.class);
Mockito.when(fs.exists((Path) Mockito.anyObject())).thenThrow(new IOException());
@@ -4621,7 +4559,7 @@ public class TestHRegion {
private final static byte[] incRow = Bytes.toBytes("incRow");
private final static byte[] family = Bytes.toBytes("family");
private final static byte[] qualifier = Bytes.toBytes("qualifier");
- private final static long ONE = 1l;
+ private final static long ONE = 1L;
private int incCounter;
public Incrementer(HRegion region, int incCounter) {
@@ -4800,7 +4738,6 @@ public class TestHRegion {
@Test
public void testPutWithMemStoreFlush() throws Exception {
byte[] family = Bytes.toBytes("family");
- ;
byte[] qualifier = Bytes.toBytes("qualifier");
byte[] row = Bytes.toBytes("putRow");
byte[] value = null;
@@ -4812,7 +4749,7 @@ public class TestHRegion {
put = new Put(row);
value = Bytes.toBytes("value0");
- put.addColumn(family, qualifier, 1234567l, value);
+ put.addColumn(family, qualifier, 1234567L, value);
region.put(put);
get = new Get(row);
get.addColumn(family, qualifier);
@@ -4833,7 +4770,7 @@ public class TestHRegion {
put = new Put(row);
value = Bytes.toBytes("value1");
- put.addColumn(family, qualifier, 1234567l, value);
+ put.addColumn(family, qualifier, 1234567L, value);
region.put(put);
get = new Get(row);
get.addColumn(family, qualifier);
@@ -4855,7 +4792,6 @@ public class TestHRegion {
@Test
public void testDurability() throws Exception {
- String method = "testDurability";
// there are 5 x 5 cases:
// table durability(SYNC,FSYNC,ASYC,SKIP,USE_DEFAULT) x mutation
// durability(SYNC,FSYNC,ASYC,SKIP,USE_DEFAULT)
@@ -4909,7 +4845,6 @@ public class TestHRegion {
final boolean expectSyncFromLogSyncer) throws Exception {
Configuration conf = HBaseConfiguration.create(CONF);
method = method + "_" + tableDurability.name() + "_" + mutationDurability.name();
- TableName tableName = TableName.valueOf(method);
byte[] family = Bytes.toBytes("family");
Path logDir = new Path(new Path(dir + method), "log");
final Configuration walConf = new Configuration(conf);
@@ -4920,7 +4855,7 @@ public class TestHRegion {
final WALFactory wals = new WALFactory(walConf, null, UUID.randomUUID().toString());
final WAL wal = spy(wals.getWAL(tableName.getName(), tableName.getNamespace()));
this.region = initHRegion(tableName, HConstants.EMPTY_START_ROW,
- HConstants.EMPTY_END_ROW, method, conf, false, tableDurability, wal,
+ HConstants.EMPTY_END_ROW, false, tableDurability, wal,
new byte[][] { family });
Put put = new Put(Bytes.toBytes("r1"));
@@ -5224,8 +5159,6 @@ public class TestHRegion {
*/
@Test
public void testFlushResult() throws IOException {
- String method = name.getMethodName();
- TableName tableName = TableName.valueOf(method);
byte[] family = Bytes.toBytes("family");
this.region = initHRegion(tableName, method, family);
@@ -5278,7 +5211,7 @@ public class TestHRegion {
*/
protected HRegion initHRegion(TableName tableName, String callingMethod, Configuration conf,
byte[]... families) throws IOException {
- return initHRegion(tableName, null, null, callingMethod, conf, false, families);
+ return initHRegion(tableName, callingMethod, conf, false, families);
}
/**
@@ -5296,7 +5229,7 @@ public class TestHRegion {
Path logDir = TEST_UTIL.getDataTestDirOnTestFS(callingMethod + ".log");
HRegionInfo hri = new HRegionInfo(tableName, startKey, stopKey);
final WAL wal = HBaseTestingUtility.createWal(conf, logDir, hri);
- return initHRegion(tableName, startKey, stopKey, callingMethod, conf, isReadOnly,
+ return initHRegion(tableName, startKey, stopKey, isReadOnly,
Durability.SYNC_WAL, wal, families);
}
@@ -5305,8 +5238,7 @@ public class TestHRegion {
* {@link HBaseTestingUtility#closeRegionAndWAL(HRegion)} when done.
*/
public HRegion initHRegion(TableName tableName, byte[] startKey, byte[] stopKey,
- String callingMethod, Configuration conf, boolean isReadOnly, Durability durability,
- WAL wal, byte[]... families) throws IOException {
+ boolean isReadOnly, Durability durability, WAL wal, byte[]... families) throws IOException {
return TEST_UTIL.createLocalHRegion(tableName, startKey, stopKey,
isReadOnly, durability, wal, families);
}
@@ -5338,7 +5270,6 @@ public class TestHRegion {
byte[][] families = { cf };
byte[] col = Bytes.toBytes("C");
long ts = 1;
- String method = this.getName();
this.region = initHRegion(tableName, method, families);
try {
KeyValue kv1 = new KeyValue(rowC, cf, col, ts, KeyValue.Type.Put, null);
@@ -5398,7 +5329,6 @@ public class TestHRegion {
byte[][] families = { cf };
byte[] col = Bytes.toBytes("C");
long ts = 1;
- String method = this.getName();
this.region = initHRegion(tableName, method, families);
try {
KeyValue kv1 = new KeyValue(rowC, cf, col, ts, KeyValue.Type.Put, null);
@@ -5457,7 +5387,6 @@ public class TestHRegion {
byte[][] families = { cf };
byte[] col = Bytes.toBytes("C");
long ts = 1;
- String method = this.getName();
this.region = initHRegion(tableName, method, families);
try {
KeyValue kv1 = new KeyValue(rowC, cf, col, ts, KeyValue.Type.Put, null);
@@ -5517,7 +5446,6 @@ public class TestHRegion {
byte[] col1 = Bytes.toBytes("col1");
byte[] col2 = Bytes.toBytes("col2");
long ts = 1;
- String method = this.getName();
this.region = initHRegion(tableName, method, families);
try {
KeyValue kv1 = new KeyValue(rowA, cf, col1, ts, KeyValue.Type.Put, null);
@@ -5599,7 +5527,6 @@ public class TestHRegion {
byte[] col1 = Bytes.toBytes("col1");
byte[] col2 = Bytes.toBytes("col2");
long ts = 1;
- String method = this.getName();
HBaseConfiguration config = new HBaseConfiguration();
config.setInt("test.block.size", 1);
this.region = initHRegion(tableName, method, config, families);
@@ -5685,7 +5612,6 @@ public class TestHRegion {
byte[][] families = { cf1, cf2, cf3 };
byte[] col = Bytes.toBytes("C");
long ts = 1;
- String method = this.getName();
HBaseConfiguration conf = new HBaseConfiguration();
// disable compactions in this test.
conf.setInt("hbase.hstore.compactionThreshold", 10000);
@@ -5853,7 +5779,6 @@ public class TestHRegion {
byte[][] families = { cf1, cf2, cf3, cf4 };
byte[] col = Bytes.toBytes("C");
long ts = 1;
- String method = this.getName();
HBaseConfiguration conf = new HBaseConfiguration();
// disable compactions in this test.
conf.setInt("hbase.hstore.compactionThreshold", 10000);
@@ -5925,7 +5850,6 @@ public class TestHRegion {
byte[] cf1 = Bytes.toBytes("CF1");
byte[][] families = {cf1};
byte[] col = Bytes.toBytes("C");
- String method = this.getName();
HBaseConfiguration conf = new HBaseConfiguration();
this.region = initHRegion(tableName, method, conf, families);
try {
@@ -5980,7 +5904,6 @@ public class TestHRegion {
byte[] cf1 = Bytes.toBytes("CF1");
byte[][] families = { cf1 };
byte[] col = Bytes.toBytes("C");
- String method = this.getName();
HBaseConfiguration conf = new HBaseConfiguration();
this.region = initHRegion(tableName, method, conf, families);
try {
@@ -6042,7 +5965,6 @@ public class TestHRegion {
byte [][] families = {fam1};
//Setting up region
- String method = this.getName();
this.region = initHRegion(tableName, method, hc, families);
//Put data in region
@@ -6439,8 +6361,6 @@ public class TestHRegion {
*/
@Test
public void testRegionTooBusy() throws IOException {
- String method = "testRegionTooBusy";
- TableName tableName = TableName.valueOf(method);
byte[] family = Bytes.toBytes("family");
long defaultBusyWaitDuration = CONF.getLong("hbase.busy.wait.duration",
HRegion.DEFAULT_BUSY_WAIT_DURATION);
@@ -6616,7 +6536,7 @@ public class TestHRegion {
@Test
public void testIncrementTimestampsAreMonotonic() throws IOException {
- HRegion region = initHRegion(tableName, name.getMethodName(), CONF, fam1);
+ HRegion region = initHRegion(tableName, method, CONF, fam1);
ManualEnvironmentEdge edge = new ManualEnvironmentEdge();
EnvironmentEdgeManager.injectEdge(edge);
@@ -6641,7 +6561,7 @@ public class TestHRegion {
@Test
public void testAppendTimestampsAreMonotonic() throws IOException {
- HRegion region = initHRegion(tableName, name.getMethodName(), CONF, fam1);
+ HRegion region = initHRegion(tableName, method, CONF, fam1);
ManualEnvironmentEdge edge = new ManualEnvironmentEdge();
EnvironmentEdgeManager.injectEdge(edge);
@@ -6672,7 +6592,7 @@ public class TestHRegion {
@Test
public void testCheckAndMutateTimestampsAreMonotonic() throws IOException {
- HRegion region = initHRegion(tableName, name.getMethodName(), CONF, fam1);
+ HRegion region = initHRegion(tableName, method, CONF, fam1);
ManualEnvironmentEdge edge = new ManualEnvironmentEdge();
EnvironmentEdgeManager.injectEdge(edge);
@@ -6708,7 +6628,7 @@ public class TestHRegion {
int prevLockTimeout = CONF.getInt("hbase.rowlock.wait.duration", 30000);
CONF.setInt("hbase.rowlock.wait.duration", 1000);
- final HRegion region = initHRegion(tableName, a, c, name.getMethodName(), CONF, false, fam1);
+ final HRegion region = initHRegion(tableName, a, c, method, CONF, false, fam1);
Mutation[] mutations = new Mutation[] {
new Put(a).addImmutable(fam1, null, null),
@@ -6764,7 +6684,7 @@ public class TestHRegion {
@Test
public void testCheckAndRowMutateTimestampsAreMonotonic() throws IOException {
- HRegion region = initHRegion(tableName, name.getMethodName(), CONF, fam1);
+ HRegion region = initHRegion(tableName, method, CONF, fam1);
ManualEnvironmentEdge edge = new ManualEnvironmentEdge();
EnvironmentEdgeManager.injectEdge(edge);
@@ -6822,7 +6742,6 @@ public class TestHRegion {
qualifiers[i] = Bytes.toBytes("qual" + i);
}
- String method = "testWritesWhileRollWriter";
CONF.setInt("hbase.regionserver.wal.disruptor.event.count", 2);
this.region = initHRegion(tableName, method, CONF, families);
try {
http://git-wip-us.apache.org/repos/asf/hbase/blob/62e3b1ec/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionWithInMemoryFlush.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionWithInMemoryFlush.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionWithInMemoryFlush.java
index d66899b..d31d395 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionWithInMemoryFlush.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionWithInMemoryFlush.java
@@ -29,14 +29,11 @@ import org.apache.hadoop.hbase.HBaseTestCase;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Durability;
-import org.apache.hadoop.hbase.client.TestMobSnapshotCloneIndependence;
-import org.apache.hadoop.hbase.master.procedure.TestMasterFailoverWithProcedures;
import org.apache.hadoop.hbase.testclassification.LargeTests;
import org.apache.hadoop.hbase.testclassification.VerySlowRegionServerTests;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.wal.WAL;
import org.junit.ClassRule;
-import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.rules.TestRule;
@@ -66,8 +63,7 @@ public class TestHRegionWithInMemoryFlush extends TestHRegion{
*/
@Override
public HRegion initHRegion(TableName tableName, byte[] startKey, byte[] stopKey,
- String callingMethod, Configuration conf, boolean isReadOnly, Durability durability,
- WAL wal, byte[]... families) throws IOException {
+ boolean isReadOnly, Durability durability, WAL wal, byte[]... families) throws IOException {
boolean[] inMemory = new boolean[families.length];
for(int i = 0; i < inMemory.length; i++) {
inMemory[i] = true;
@@ -87,7 +83,6 @@ public class TestHRegionWithInMemoryFlush extends TestHRegion{
Configuration hc = initSplit();
// Setting up region
- String method = this.getName();
this.region = initHRegion(tableName, method, hc, families);
try {