private Path getHdfsDestinationDir() { Path rootDir = TEST_UTIL.getHBaseCluster().getMaster().getMasterFileSystem().getRootDir(); Path path = new Path(new Path(rootDir, "export-test"), "export-" + System.currentTimeMillis()); LOG.info("HDFS export destination path: " + path); return path; }
public static void deleteArchiveDirectory(final HBaseTestingUtility util) throws IOException { // Ensure the archiver to be empty MasterFileSystem mfs = util.getMiniHBaseCluster().getMaster().getMasterFileSystem(); Path archiveDir = new Path(mfs.getRootDir(), HConstants.HFILE_ARCHIVE_DIRECTORY); mfs.getFileSystem().delete(archiveDir, true); }
private Path getRootDir() { return UTIL.getHBaseCluster().getMaster().getMasterFileSystem().getRootDir(); } }
private FileSystem getFileSystem() { return UTIL.getHBaseCluster().getMaster().getMasterFileSystem().getFileSystem(); }
protected final void waitUntilDeleted(HBaseTestingUtility util, Path remoteWAL) throws Exception { MasterFileSystem mfs = util.getMiniHBaseCluster().getMaster().getMasterFileSystem(); util.waitFor(30000, new ExplainingPredicate<Exception>() { @Override public boolean evaluate() throws Exception { return !mfs.getWALFileSystem().exists(remoteWAL); } @Override public String explainFailure() throws Exception { return remoteWAL + " has not been deleted yet"; } }); } }
protected void addHFilesToRegions() throws IOException { MasterFileSystem mfs = HTU.getMiniHBaseCluster().getMaster().getMasterFileSystem(); Path tableDir = FSUtils.getTableDir(mfs.getRootDir(), TABLE_NAME); for (Region region : cluster.getRegions(TABLE_NAME)) { Path regionDir = new Path(tableDir, region.getRegionInfo().getEncodedName()); Path familyDir = new Path(regionDir, Bytes.toString(FAMILY)); HFileTestUtil .createHFile(HTU.getConfiguration(), HTU.getTestFileSystem(), new Path(familyDir, HFILE_NAME), FAMILY, QUALIFIER, Bytes.toBytes("50"), Bytes.toBytes("60"), NUM_ROWS); } } }
private Set<String> getFamiliesFromFS(final TableName tableName) throws IOException { MasterFileSystem mfs = TEST_UTIL.getMiniHBaseCluster().getMaster().getMasterFileSystem(); Set<String> families = new HashSet<>(); Path tableDir = FSUtils.getTableDir(mfs.getRootDir(), tableName); for (Path regionDir : FSUtils.getRegionDirs(mfs.getFileSystem(), tableDir)) { for (Path familyDir : FSUtils.getFamilyDirs(mfs.getFileSystem(), regionDir)) { families.add(familyDir.getName()); } } return families; }
@Test public void testFsUriSetProperly() throws Exception { HMaster master = UTIL.getMiniHBaseCluster().getMaster(); MasterFileSystem fs = master.getMasterFileSystem(); Path masterRoot = FSUtils.getRootDir(fs.getConfiguration()); Path rootDir = FSUtils.getRootDir(fs.getFileSystem().getConf()); // make sure the fs and the found root dir have the same scheme LOG.debug("from fs uri:" + FileSystem.getDefaultUri(fs.getFileSystem().getConf())); LOG.debug("from configuration uri:" + FileSystem.getDefaultUri(fs.getConfiguration())); // make sure the set uri matches by forcing it. assertEquals(masterRoot, rootDir); } }
@BeforeClass public static void setupCluster() throws Exception { setupConf(UTIL.getConfiguration()); UTIL.startMiniCluster(NUM_RS); fs = UTIL.getHBaseCluster().getMaster().getMasterFileSystem().getFileSystem(); rootDir = UTIL.getHBaseCluster().getMaster().getMasterFileSystem().getRootDir(); }
public static void validateTableDeletion( final HMaster master, final TableName tableName) throws IOException { // check filesystem final FileSystem fs = master.getMasterFileSystem().getFileSystem(); final Path tableDir = FSUtils.getTableDir(master.getMasterFileSystem().getRootDir(), tableName); assertFalse(fs.exists(tableDir)); // check meta assertFalse(MetaTableAccessor.tableExists(master.getConnection(), tableName)); assertEquals(0, countMetaRegions(master, tableName)); // check htd assertTrue("found htd of deleted table", master.getTableDescriptors().get(tableName) == null); }
public static void confirmSnapshotValid(HBaseTestingUtility testUtil, SnapshotProtos.SnapshotDescription snapshotDescriptor, TableName tableName, byte[] family) throws IOException { MasterFileSystem mfs = testUtil.getHBaseCluster().getMaster().getMasterFileSystem(); confirmSnapshotValid(snapshotDescriptor, tableName, family, mfs.getRootDir(), testUtil.getAdmin(), mfs.getFileSystem()); }
/** * Setup the config for the cluster */ @BeforeClass public static void setupCluster() throws Exception { setupConf(UTIL.getConfiguration()); UTIL.startMiniCluster(NUM_RS); fs = UTIL.getDFSCluster().getFileSystem(); master = UTIL.getMiniHBaseCluster().getMaster(); rootDir = master.getMasterFileSystem().getRootDir(); archiveDir = new Path(rootDir, HConstants.HFILE_ARCHIVE_DIRECTORY); }
private void verifyTableDescriptor(final TableName tableName, final byte[]... families) throws Exception { // Verify descriptor from master TableDescriptor htd = admin.getDescriptor(tableName).get(); verifyTableDescriptor(htd, tableName, families); // Verify descriptor from HDFS MasterFileSystem mfs = TEST_UTIL.getMiniHBaseCluster().getMaster().getMasterFileSystem(); Path tableDir = FSUtils.getTableDir(mfs.getRootDir(), tableName); TableDescriptor td = FSTableDescriptors.getTableDescriptorFromFs(mfs.getFileSystem(), tableDir); verifyTableDescriptor(td, tableName, families); }
public void setupCluster() throws Exception { setupConf(UTIL.getConfiguration()); StartMiniClusterOption option = StartMiniClusterOption.builder() .numRegionServers(NUM_REGION_SERVERS).numDataNodes(NUM_REGION_SERVERS) .createRootDir(true).build(); UTIL.startMiniCluster(option); rootDir = UTIL.getHBaseCluster().getMaster().getMasterFileSystem().getRootDir(); fs = rootDir.getFileSystem(UTIL.getConfiguration()); }
@Test public void testFsUriSetProperly() throws Exception { HMaster master = UTIL.getMiniHBaseCluster().getMaster(); MasterFileSystem fs = master.getMasterFileSystem(); Path masterRoot = FSUtils.getRootDir(fs.getConfiguration()); Path rootDir = FSUtils.getRootDir(fs.getFileSystem().getConf()); assertEquals(masterRoot, rootDir); assertEquals(FSUtils.getWALRootDir(UTIL.getConfiguration()), fs.getWALRootDir()); } }
public void setupCluster() throws Exception { setupConf(UTIL.getConfiguration()); StartMiniClusterOption option = StartMiniClusterOption.builder() .numRegionServers(NUM_REGION_SERVERS).numDataNodes(NUM_REGION_SERVERS) .createRootDir(true).build(); UTIL.startMiniCluster(option); rootDir = UTIL.getHBaseCluster().getMaster().getMasterFileSystem().getRootDir(); fs = rootDir.getFileSystem(UTIL.getConfiguration()); }
/** * Setup the config for the cluster */ @BeforeClass public static void setupCluster() throws Exception { setupConf(TEST_UTIL.getConfiguration()); TEST_UTIL.startMiniCluster(NUM_RS); fs = TEST_UTIL.getDFSCluster().getFileSystem(); rootDir = TEST_UTIL.getMiniHBaseCluster().getMaster().getMasterFileSystem().getRootDir(); }
@BeforeClass public static void setupCluster() throws Exception { UTIL.startMiniCluster(RS_NUMBER); UTIL.getHBaseCluster().waitForActiveAndReadyMaster(); conf = UTIL.getConfiguration(); HMaster master = UTIL.getHBaseCluster().getMaster(); fs = master.getMasterFileSystem().getWALFileSystem(); syncReplicationReplayWALManager = master.getSyncReplicationReplayWALManager(); procExec = master.getMasterProcedureExecutor(); }
private void verifyTableDescriptor(final TableName tableName, final byte[]... families) throws IOException { Admin admin = TEST_UTIL.getAdmin(); // Verify descriptor from master HTableDescriptor htd = admin.getTableDescriptor(tableName); verifyTableDescriptor(htd, tableName, families); // Verify descriptor from HDFS MasterFileSystem mfs = TEST_UTIL.getMiniHBaseCluster().getMaster().getMasterFileSystem(); Path tableDir = FSUtils.getTableDir(mfs.getRootDir(), tableName); TableDescriptor td = FSTableDescriptors.getTableDescriptorFromFs(mfs.getFileSystem(), tableDir); verifyTableDescriptor(td, tableName, families); }
private void verifyHColumnDescriptor(int expected, final TableName tableName, final byte[]... families) throws IOException { Admin admin = TEST_UTIL.getAdmin(); // Verify descriptor from master TableDescriptor htd = admin.getDescriptor(tableName); ColumnFamilyDescriptor[] hcds = htd.getColumnFamilies(); verifyHColumnDescriptor(expected, hcds, tableName, families); // Verify descriptor from HDFS MasterFileSystem mfs = TEST_UTIL.getMiniHBaseCluster().getMaster().getMasterFileSystem(); Path tableDir = FSUtils.getTableDir(mfs.getRootDir(), tableName); TableDescriptor td = FSTableDescriptors.getTableDescriptorFromFs(mfs.getFileSystem(), tableDir); hcds = td.getColumnFamilies(); verifyHColumnDescriptor(expected, hcds, tableName, families); }