Skip to content

Commit

Permalink
HBASE-23776 Removed deprecated method createLocalHTU() from HBaseTest…
Browse files Browse the repository at this point in the history
…ingUtility

Signed-off-by: stack <[email protected]>
  • Loading branch information
HorizonNet authored Feb 1, 2020
1 parent 9b6d250 commit 5a3ad6f
Show file tree
Hide file tree
Showing 33 changed files with 32 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -302,11 +302,6 @@ public static List<Object[]> memStoreTSTagsAndOffheapCombination() {
* <p>Initially, all tmp files are written to a local test data directory.
* Once {@link #startMiniDFSCluster} is called, either directly or via
* {@link #startMiniCluster()}, tmp data will be written to the DFS directory instead.
*
* <p>Previously, there was a distinction between the type of utility returned by
* {@link #createLocalHTU()} and this constructor; this is no longer the case. All
* HBaseTestingUtility objects will behave as local until a DFS cluster is started,
* at which point they will switch to using mini DFS for storage.
*/
public HBaseTestingUtility() {
this(HBaseConfiguration.create());
Expand All @@ -319,11 +314,6 @@ public HBaseTestingUtility() {
* Once {@link #startMiniDFSCluster} is called, either directly or via
* {@link #startMiniCluster()}, tmp data will be written to the DFS directory instead.
*
* <p>Previously, there was a distinction between the type of utility returned by
* {@link #createLocalHTU()} and this constructor; this is no longer the case. All
* HBaseTestingUtility objects will behave as local until a DFS cluster is started,
* at which point they will switch to using mini DFS for storage.
*
* @param conf The configuration to use for further operations
*/
public HBaseTestingUtility(@Nullable Configuration conf) {
Expand Down Expand Up @@ -352,18 +342,6 @@ public HBaseTestingUtility(@Nullable Configuration conf) {
this.conf.getBoolean(LocalHBaseCluster.ASSIGN_RANDOM_PORTS, true));
}

/**
* @deprecated since 2.0.0 and will be removed in 3.0.0. Use {@link #HBaseTestingUtility()}
* instead.
* @return a normal HBaseTestingUtility
* @see #HBaseTestingUtility()
* @see <a href="https://issues.apache.org/jira/browse/HBASE-19841">HBASE-19841</a>
*/
@Deprecated
public static HBaseTestingUtility createLocalHTU() {
return new HBaseTestingUtility();
}

/**
* @deprecated since 2.0.0 and will be removed in 3.0.0. Use
* {@link #HBaseTestingUtility(Configuration)} instead.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public class TestCoprocessorInterface {

@Rule public TestName name = new TestName();
private static final Logger LOG = LoggerFactory.getLogger(TestCoprocessorInterface.class);
private static final HBaseTestingUtility TEST_UTIL = HBaseTestingUtility.createLocalHTU();
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
static final Path DIR = TEST_UTIL.getDataTestDir();

private static class CustomScanner implements RegionScanner {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class TestCoreMasterCoprocessor {
HBaseClassTestRule.forClass(TestCoreMasterCoprocessor.class);

@Rule public TestName name = new TestName();
private static final HBaseTestingUtility HTU = HBaseTestingUtility.createLocalHTU();
private static final HBaseTestingUtility HTU = new HBaseTestingUtility();
private MasterServices ms;
private MasterCoprocessorHost mch;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class TestCoreRegionCoprocessor {
HBaseClassTestRule.forClass(TestCoreRegionCoprocessor.class);

@Rule public TestName name = new TestName();
HBaseTestingUtility HTU = HBaseTestingUtility.createLocalHTU();
HBaseTestingUtility HTU = new HBaseTestingUtility();
private HRegion region = null;
private RegionServerServices rss;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class TestCoreRegionServerCoprocessor {
HBaseClassTestRule.forClass(TestCoreRegionServerCoprocessor.class);

@Rule public TestName name = new TestName();
private static final HBaseTestingUtility HTU = HBaseTestingUtility.createLocalHTU();
private static final HBaseTestingUtility HTU = new HBaseTestingUtility();
private RegionServerServices rss;
private RegionServerCoprocessorHost rsch;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public class TestEncodedSeekers {
private static final int NUM_HFILES = 4;
private static final int NUM_ROWS_PER_FLUSH = NUM_ROWS / NUM_HFILES;

private final HBaseTestingUtility testUtil = HBaseTestingUtility.createLocalHTU();
private final HBaseTestingUtility testUtil = new HBaseTestingUtility();
private final DataBlockEncoding encoding;
private final boolean includeTags;
private final boolean compressTags;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public class TestCacheOnWrite {

private static final Logger LOG = LoggerFactory.getLogger(TestCacheOnWrite.class);

private static final HBaseTestingUtility TEST_UTIL = HBaseTestingUtility.createLocalHTU();
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
private Configuration conf;
private CacheConfig cacheConf;
private FileSystem fs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public class TestForceCacheImportantBlocks {
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestForceCacheImportantBlocks.class);

private final HBaseTestingUtility TEST_UTIL = HBaseTestingUtility.createLocalHTU();
private final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();

private static final String TABLE = "myTable";
private static final String CF = "myCF";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public class TestScannerFromBucketCache {
private TableName tableName;

private void setUp(boolean useBucketCache) throws IOException {
test_util = HBaseTestingUtility.createLocalHTU();
test_util = new HBaseTestingUtility();
conf = test_util.getConfiguration();
if (useBucketCache) {
conf.setInt("hbase.bucketcache.size", 400);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public class TestScannerSelectionUsingKeyRange {
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestScannerSelectionUsingKeyRange.class);

private static final HBaseTestingUtility TEST_UTIL = HBaseTestingUtility.createLocalHTU();
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
private static TableName TABLE = TableName.valueOf("myTable");
private static String FAMILY = "myCF";
private static byte[] FAMILY_BYTES = Bytes.toBytes(FAMILY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public class TestScannerSelectionUsingTTL {
private static final Logger LOG =
LoggerFactory.getLogger(TestScannerSelectionUsingTTL.class);

private static final HBaseTestingUtility TEST_UTIL = HBaseTestingUtility.createLocalHTU();
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
private static TableName TABLE = TableName.valueOf("myTable");
private static String FAMILY = "myCF";
private static byte[] FAMILY_BYTES = Bytes.toBytes(FAMILY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class TestHMasterRPCException {

private static final Logger LOG = LoggerFactory.getLogger(TestHMasterRPCException.class);

private final HBaseTestingUtility testUtil = HBaseTestingUtility.createLocalHTU();
private final HBaseTestingUtility testUtil = new HBaseTestingUtility();

private HMaster master;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public class TestMobFileCache {

@Before
public void setUp() throws Exception {
UTIL = HBaseTestingUtility.createLocalHTU();
UTIL = new HBaseTestingUtility();
conf = UTIL.getConfiguration();
conf.set(MobConstants.MOB_FILE_CACHE_SIZE_KEY, TEST_CACHE_SIZE);
TableDescriptorBuilder tableDescriptorBuilder =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public class TestAtomicOperation {
@Rule public TestName name = new TestName();

HRegion region = null;
private HBaseTestingUtility TEST_UTIL = HBaseTestingUtility.createLocalHTU();
private HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();

// Test names
static byte[] tableName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public class TestCacheOnWriteInSchema {
private static final Logger LOG = LoggerFactory.getLogger(TestCacheOnWriteInSchema.class);
@Rule public TestName name = new TestName();

private static final HBaseTestingUtility TEST_UTIL = HBaseTestingUtility.createLocalHTU();
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
private static final String DIR = TEST_UTIL.getDataTestDir("TestCacheOnWriteInSchema").toString();
private static byte [] table;
private static byte [] family = Bytes.toBytes("family");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public class TestColumnSeeking {
HBaseClassTestRule.forClass(TestColumnSeeking.class);

@Rule public TestName name = new TestName();
private final static HBaseTestingUtility TEST_UTIL = HBaseTestingUtility.createLocalHTU();
private final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();

private static final Logger LOG = LoggerFactory.getLogger(TestColumnSeeking.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public class TestCompaction {
HBaseClassTestRule.forClass(TestCompaction.class);

@Rule public TestName name = new TestName();
private static final HBaseTestingUtility UTIL = HBaseTestingUtility.createLocalHTU();
private static final HBaseTestingUtility UTIL = new HBaseTestingUtility();
protected Configuration conf = UTIL.getConfiguration();

private HRegion r = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public class TestCompactionArchiveConcurrentClose {

@Before
public void setup() throws Exception {
testUtil = HBaseTestingUtility.createLocalHTU();
testUtil = new HBaseTestingUtility();
testDir = testUtil.getDataTestDir("TestStoreFileRefresherChore");
FSUtils.setRootDir(testUtil.getConfiguration(), testDir);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public class TestFailedAppendAndSync {

@Before
public void setup() throws IOException {
TEST_UTIL = HBaseTestingUtility.createLocalHTU();
TEST_UTIL = new HBaseTestingUtility();
CONF = TEST_UTIL.getConfiguration();
// Disable block cache.
CONF.setFloat(HConstants.HFILE_BLOCK_CACHE_SIZE_KEY, 0f);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ public class TestHRegion {

@Before
public void setup() throws IOException {
TEST_UTIL = HBaseTestingUtility.createLocalHTU();
TEST_UTIL = new HBaseTestingUtility();
CONF = TEST_UTIL.getConfiguration();
NettyAsyncFSWALConfigHelper.setEventLoopConfig(CONF, GROUP, NioSocketChannel.class);
dir = TEST_UTIL.getDataTestDir("TestHRegion").toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public class TestKeepDeletes {
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestKeepDeletes.class);

HBaseTestingUtility hbu = HBaseTestingUtility.createLocalHTU();
HBaseTestingUtility hbu = new HBaseTestingUtility();
private final byte[] T0 = Bytes.toBytes("0");
private final byte[] T1 = Bytes.toBytes("1");
private final byte[] T2 = Bytes.toBytes("2");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public static Object[] data() {
}
@Rule public TestName name;
private static final Logger LOG = LoggerFactory.getLogger(TestMajorCompaction.class.getName());
private static final HBaseTestingUtility UTIL = HBaseTestingUtility.createLocalHTU();
private static final HBaseTestingUtility UTIL = new HBaseTestingUtility();
protected Configuration conf = UTIL.getConfiguration();

private HRegion r = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class TestMinorCompaction {

@Rule public TestName name = new TestName();
private static final Logger LOG = LoggerFactory.getLogger(TestMinorCompaction.class.getName());
private static final HBaseTestingUtility UTIL = HBaseTestingUtility.createLocalHTU();
private static final HBaseTestingUtility UTIL = new HBaseTestingUtility();
protected Configuration conf = UTIL.getConfiguration();

private HRegion r = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public abstract class TestMultiColumnScanner {
/** The probability to delete a row/column pair */
private static final double DELETE_PROBABILITY = 0.02;

private final static HBaseTestingUtility TEST_UTIL = HBaseTestingUtility.createLocalHTU();
private final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();

@Parameter(0)
public Compression.Algorithm comprAlgo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public class TestMultiLogThreshold {
@BeforeClass
public static void setup() throws Exception {
final TableName tableName = TableName.valueOf("tableName");
TEST_UTIL = HBaseTestingUtility.createLocalHTU();
TEST_UTIL = new HBaseTestingUtility();
CONF = TEST_UTIL.getConfiguration();
THRESHOLD = CONF.getInt(RSRpcServices.BATCH_ROWS_THRESHOLD_NAME,
RSRpcServices.BATCH_ROWS_THRESHOLD_DEFAULT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public class TestRegionIncrement {

@Before
public void setUp() throws Exception {
TEST_UTIL = HBaseTestingUtility.createLocalHTU();
TEST_UTIL = new HBaseTestingUtility();
}

@After
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class TestRowTooBig {
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestRowTooBig.class);

private final static HBaseTestingUtility HTU = HBaseTestingUtility.createLocalHTU();
private final static HBaseTestingUtility HTU = new HBaseTestingUtility();
private static Path rootRegionDir;
private static final HTableDescriptor TEST_HTD =
new HTableDescriptor(TableName.valueOf(TestRowTooBig.class.getSimpleName()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public class TestScanWithBloomError {
private FileSystem fs;
private Configuration conf;

private final static HBaseTestingUtility TEST_UTIL = HBaseTestingUtility.createLocalHTU();
private final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();

@Parameters
public static final Collection<Object[]> parameters() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public class TestScanner {
@Rule public TestName name = new TestName();

private static final Logger LOG = LoggerFactory.getLogger(TestScanner.class);
private final static HBaseTestingUtility TEST_UTIL = HBaseTestingUtility.createLocalHTU();
private final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();

private static final byte [] FIRST_ROW = HConstants.EMPTY_START_ROW;
private static final byte [][] COLS = { HConstants.CATALOG_FAMILY };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class TestScannerWithCorruptHFile {

@Rule public TestName name = new TestName();
private static final byte[] FAMILY_NAME = Bytes.toBytes("f");
private final static HBaseTestingUtility TEST_UTIL = HBaseTestingUtility.createLocalHTU();
private final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();


@BeforeClass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public class TestSeekOptimizations {

private long totalSeekDiligent, totalSeekLazy;

private final static HBaseTestingUtility TEST_UTIL = HBaseTestingUtility.createLocalHTU();
private final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();

@Parameters
public static final Collection<Object[]> parameters() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class TestTimestampFilterSeekHint {
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestTimestampFilterSeekHint.class);

private final static HBaseTestingUtility TEST_UTIL = HBaseTestingUtility.createLocalHTU();
private final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
private final static String RK = "myRK";
private final static byte[] RK_BYTES = Bytes.toBytes(RK);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public class TestSnapshotManifest {

@Before
public void setup() throws Exception {
TEST_UTIL = HBaseTestingUtility.createLocalHTU();
TEST_UTIL = new HBaseTestingUtility();

rootDir = TEST_UTIL.getDataTestDir(TABLE_NAME_STR);
fs = TEST_UTIL.getTestFileSystem();
Expand Down

0 comments on commit 5a3ad6f

Please sign in to comment.