private void restoreSnapshotForPeerCluster(Configuration conf, String peerQuorumAddress) throws IOException { Configuration peerConf = HBaseConfiguration.createClusterConf(conf, peerQuorumAddress, PEER_CONFIG_PREFIX); FileSystem.setDefaultUri(peerConf, peerFSAddress); FSUtils.setRootDir(peerConf, new Path(peerFSAddress, peerHBaseRootAddress)); FileSystem fs = FileSystem.get(peerConf); RestoreSnapshotHelper.copySnapshotForScanner(peerConf, fs, FSUtils.getRootDir(peerConf), new Path(peerFSAddress, peerSnapshotTmpDir), peerSnapshotName); }
private void verifySnapshot(final Configuration baseConf, final FileSystem fs, final Path rootDir, final Path snapshotDir) throws IOException { // Update the conf with the current root dir, since may be a different cluster Configuration conf = new Configuration(baseConf); FSUtils.setRootDir(conf, rootDir); FSUtils.setFsDefault(conf, FSUtils.getRootDir(conf)); SnapshotDescription snapshotDesc = SnapshotDescriptionUtils.readSnapshotInfo(fs, snapshotDir); SnapshotReferenceUtil.verifySnapshot(conf, fs, snapshotDir, snapshotDesc); }
protected void setupConfiguration(Configuration conf) throws Exception { FSUtils.setRootDir(conf, util.getDataTestDir()); conf.setBoolean(WALProcedureStore.USE_HSYNC_CONF_KEY, false); conf.setInt(WALProcedureStore.SYNC_WAIT_MSEC_CONF_KEY, 10); conf.setInt(MasterProcedureConstants.MASTER_PROCEDURE_THREADS, PROC_NTHREADS); conf.setInt(RSProcedureDispatcher.RS_RPC_STARTUP_WAIT_TIME_CONF_KEY, 1000); conf.setInt(AssignmentManager.ASSIGN_MAX_ATTEMPTS, getAssignMaxAttempts()); }
@BeforeClass public static void setUpBeforeClass() throws Exception { Configuration conf = TEST_UTIL.getConfiguration(); conf.set(HConstants.CRYPTO_KEYPROVIDER_CONF_KEY, KeyProviderForTesting.class.getName()); conf.set(HConstants.CRYPTO_MASTERKEY_NAME_CONF_KEY, "hbase"); conf.setBoolean("hbase.hlog.split.skip.errors", true); conf.setBoolean(HConstants.ENABLE_WAL_ENCRYPTION, true); FSUtils.setRootDir(conf, TEST_UTIL.getDataTestDir()); }
private Path getTableDir(String tableName) throws IOException { Path testDataDir = UTIL.getDataTestDir(); FSUtils.setRootDir(UTIL.getConfiguration(), testDataDir); return new Path(testDataDir, tableName); }
@Test public void testGetArchivePath() throws Exception { Configuration conf = new Configuration(); FSUtils.setRootDir(conf, new Path("root")); assertNotNull(HFileArchiveUtil.getArchivePath(conf)); }
private String setRootDirAndCleanIt(final HBaseTestingUtility htu, final String subdir) throws IOException { Path testdir = htu.getDataTestDir(subdir); FileSystem fs = FileSystem.get(htu.getConfiguration()); if (fs.exists(testdir)) assertTrue(fs.delete(testdir, true)); FSUtils.setRootDir(htu.getConfiguration(), testdir); return FSUtils.getRootDir(htu.getConfiguration()).toString(); }
@Test public void testGetStoreArchivePath() throws IOException { byte[] family = Bytes.toBytes("Family"); Path tabledir = FSUtils.getTableDir(rootDir, TableName.valueOf(name.getMethodName())); HRegionInfo region = new HRegionInfo(TableName.valueOf(name.getMethodName())); Configuration conf = new Configuration(); FSUtils.setRootDir(conf, new Path("root")); assertNotNull(HFileArchiveUtil.getStoreArchivePath(conf, region, tabledir, family)); } }
@BeforeClass public static void setUpBeforeClass() throws Exception { Configuration conf = TEST_UTIL.getConfiguration(); // The below config supported by 0.20-append and CDH3b2 conf.setInt("dfs.client.block.recovery.retries", 2); TEST_UTIL.startMiniCluster(3); Path hbaseRootDir = TEST_UTIL.getDFSCluster().getFileSystem().makeQualified(new Path("/hbase")); LOG.info("hbase.rootdir=" + hbaseRootDir); FSUtils.setRootDir(conf, hbaseRootDir); }
@Test public void testNoHFileLinkInRootDir() throws IOException { rootDir = TEST_UTIL.getDefaultRootDirPath(); FSUtils.setRootDir(conf, rootDir); fs = rootDir.getFileSystem(conf); TableName tableName = TableName.valueOf("testNoHFileLinkInRootDir"); String snapshotName = tableName.getNameAsString() + "-snapshot"; createTableAndSnapshot(tableName, snapshotName); Path restoreDir = new Path("/hbase/.tmp-restore"); RestoreSnapshotHelper.copySnapshotForScanner(conf, fs, rootDir, restoreDir, snapshotName); checkNoHFileLinkInTableDir(tableName); }
@Before public void setup() throws Exception { rootDir = TEST_UTIL.getDataTestDir("testRestore"); archiveDir = new Path(rootDir, HConstants.HFILE_ARCHIVE_DIRECTORY); fs = TEST_UTIL.getTestFileSystem(); conf = TEST_UTIL.getConfiguration(); setupConf(conf); FSUtils.setRootDir(conf, rootDir); }
@Before public void setup() throws Exception { testUtil = HBaseTestingUtility.createLocalHTU(); testDir = testUtil.getDataTestDir("TestStoreFileRefresherChore"); FSUtils.setRootDir(testUtil.getConfiguration(), testDir); }
/** * Create a WAL outside of the usual helper in * {@link HBaseTestingUtility#createWal(Configuration, Path, RegionInfo)} because that method * doesn't play nicely with FaultyFileSystem. Call this method before overriding * {@code fs.file.impl}. * @param callingMethod a unique component for the path, probably the name of the test method. */ private static WAL createWALCompatibleWithFaultyFileSystem(String callingMethod, Configuration conf, TableName tableName) throws IOException { final Path logDir = TEST_UTIL.getDataTestDirOnTestFS(callingMethod + ".log"); final Configuration walConf = new Configuration(conf); FSUtils.setRootDir(walConf, logDir); return new WALFactory(walConf, callingMethod) .getWAL(RegionInfoBuilder.newBuilder(tableName).build()); }
@Before public void setUp() throws IOException { TEST_UTIL = new HBaseTestingUtility(); testDir = TEST_UTIL.getDataTestDir("TestStoreFileRefresherChore"); FSUtils.setRootDir(TEST_UTIL.getConfiguration(), testDir); }
@BeforeClass public static void setUp() throws Exception { Configuration c = UTIL.getConfiguration(); // We use local filesystem. Set it so it writes into the testdir. FSUtils.setRootDir(c, UTIL.getDataTestDir()); UTIL.startMiniZKCluster(); master = new HMaster(UTIL.getConfiguration()); master.start(); // As no regionservers, only wait master to create AssignmentManager. while (master.getAssignmentManager() != null) { LOG.debug("Wait master to create AssignmentManager"); Thread.sleep(1000); } }
@Before public void setup() throws Exception { testUtil = new HBaseTestingUtility(); testUtil.startMiniDFSCluster(1); testDir = testUtil.getDataTestDirOnTestFS(); FSUtils.setRootDir(testUtil.getConfiguration(), testDir); }
@BeforeClass public static void setUpBeforeClass() throws Exception { Configuration c = TESTUTIL.getConfiguration(); // We use local filesystem. Set it so it writes into the testdir. FSUtils.setRootDir(c, TESTUTIL.getDataTestDir()); DefaultMetricsSystem.setMiniClusterMode(true); // Startup a mini zk cluster. TESTUTIL.startMiniZKCluster(); }
private HRegion initHRegion(TableDescriptor htd, RegionInfo info) throws IOException { Configuration conf = testUtil.getConfiguration(); Path tableDir = FSUtils.getTableDir(testDir, htd.getTableName()); HRegionFileSystem fs = new WaitingHRegionFileSystem(conf, tableDir.getFileSystem(conf), tableDir, info); ChunkCreator.initialize(MemStoreLABImpl.CHUNK_SIZE_DEFAULT, false, 0, 0, 0, null); final Configuration walConf = new Configuration(conf); FSUtils.setRootDir(walConf, tableDir); final WALFactory wals = new WALFactory(walConf, "log_" + info.getEncodedName()); HRegion region = new HRegion(fs, wals.getWAL(info), conf, htd, null); region.initialize(); return region; }
@BeforeClass public static void setUpBeforeClass() throws Exception { CONF = TEST_UTIL.getConfiguration(); TEST_UTIL.startMiniDFSCluster(1); CLUSTER = TEST_UTIL.getDFSCluster(); FS = CLUSTER.getFileSystem(); DIR = TEST_UTIL.getDataTestDirOnTestFS("TestDurability"); FSUtils.setRootDir(CONF, DIR); }
@Before public void setUp() throws Exception { TEST_UTIL.startMiniCluster(2); cluster = TEST_UTIL.getHBaseCluster(); dfsCluster = TEST_UTIL.getDFSCluster(); admin = TEST_UTIL.getAdmin(); conf = TEST_UTIL.getConfiguration(); fs = TEST_UTIL.getDFSCluster().getFileSystem(); // disable region rebalancing (interferes with log watching) cluster.getMaster().balanceSwitch(false); FSUtils.setRootDir(conf, HBASEDIR); FSUtils.setWALRootDir(conf, HBASELOGDIR); }