当前位置: 首页>>代码示例>>Java>>正文


Java FSUtils.getFamilyDirs方法代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.util.FSUtils.getFamilyDirs方法的典型用法代码示例。如果您正苦于以下问题:Java FSUtils.getFamilyDirs方法的具体用法?Java FSUtils.getFamilyDirs怎么用?Java FSUtils.getFamilyDirs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hbase.util.FSUtils的用法示例。


在下文中一共展示了FSUtils.getFamilyDirs方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: compactRegion

import org.apache.hadoop.hbase.util.FSUtils; //导入方法依赖的package包/类
private void compactRegion(final Path tableDir, final HTableDescriptor htd,
    final Path regionDir, final boolean compactOnce, final boolean major)
    throws IOException {
  HRegionInfo hri = HRegionFileSystem.loadRegionInfoFileContent(fs, regionDir);
  for (Path familyDir: FSUtils.getFamilyDirs(fs, regionDir)) {
    compactStoreFiles(tableDir, htd, hri, familyDir.getName(), compactOnce, major);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:9,代码来源:CompactionTool.java

示例2: getFamiliesFromFS

import org.apache.hadoop.hbase.util.FSUtils; //导入方法依赖的package包/类
private Set<String> getFamiliesFromFS(final TableName tableName) throws IOException {
  MasterFileSystem mfs = TEST_UTIL.getMiniHBaseCluster().getMaster().getMasterFileSystem();
  Set<String> families = new HashSet<String>();
  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;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:12,代码来源:TestRestoreSnapshotFromClient.java

示例3: testRestoreSnapshotDoesNotCreateBackRefLinks

import org.apache.hadoop.hbase.util.FSUtils; //导入方法依赖的package包/类
@Test
public void testRestoreSnapshotDoesNotCreateBackRefLinks() throws Exception {
  setupCluster();
  TableName tableName = TableName.valueOf("testRestoreSnapshotDoesNotCreateBackRefLinks");
  String snapshotName = "foo";

  try {
    createTableAndSnapshot(UTIL, tableName, snapshotName, getStartRow(), getEndRow(), 1);

    Path tmpTableDir = UTIL.getRandomDir();

    testRestoreSnapshotDoesNotCreateBackRefLinksInit(tableName, snapshotName,tmpTableDir);

    Path rootDir = FSUtils.getRootDir(UTIL.getConfiguration());
    for (Path regionDir : FSUtils.getRegionDirs(fs, FSUtils.getTableDir(rootDir, tableName))) {
      for (Path storeDir : FSUtils.getFamilyDirs(fs, regionDir)) {
        for (FileStatus status : fs.listStatus(storeDir)) {
          System.out.println(status.getPath());
          if (StoreFileInfo.isValid(status)) {
            Path archiveStoreDir = HFileArchiveUtil.getStoreArchivePath(UTIL.getConfiguration(),
              tableName, regionDir.getName(), storeDir.getName());

            Path path = HFileLink.getBackReferencesDir(storeDir, status.getPath().getName());
            // assert back references directory is empty
            assertFalse("There is a back reference in " + path, fs.exists(path));

            path = HFileLink.getBackReferencesDir(archiveStoreDir, status.getPath().getName());
            // assert back references directory is empty
            assertFalse("There is a back reference in " + path, fs.exists(path));
          }
        }
      }
    }
  } finally {
    UTIL.getHBaseAdmin().deleteSnapshot(snapshotName);
    UTIL.deleteTable(tableName);
    tearDownCluster();
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:40,代码来源:TableSnapshotInputFormatTestBase.java

示例4: validateTableCreation

import org.apache.hadoop.hbase.util.FSUtils; //导入方法依赖的package包/类
public static void validateTableCreation(final HMaster master, final TableName tableName,
    final HRegionInfo[] regions, boolean hasFamilyDirs, String... family) throws IOException {
  // check filesystem
  final FileSystem fs = master.getMasterFileSystem().getFileSystem();
  final Path tableDir = FSUtils.getTableDir(master.getMasterFileSystem().getRootDir(), tableName);
  assertTrue(fs.exists(tableDir));
  FSUtils.logFileSystemState(fs, tableDir, LOG);
  List<Path> allRegionDirs = FSUtils.getRegionDirs(fs, tableDir);
  for (int i = 0; i < regions.length; ++i) {
    Path regionDir = new Path(tableDir, regions[i].getEncodedName());
    assertTrue(regions[i] + " region dir does not exist", fs.exists(regionDir));
    assertTrue(allRegionDirs.remove(regionDir));
    List<Path> allFamilyDirs = FSUtils.getFamilyDirs(fs, regionDir);
    for (int j = 0; j < family.length; ++j) {
      final Path familyDir = new Path(regionDir, family[j]);
      if (hasFamilyDirs) {
        assertTrue(family[j] + " family dir does not exist", fs.exists(familyDir));
        assertTrue(allFamilyDirs.remove(familyDir));
      } else {
        // TODO: WARN: Modify Table/Families does not create a family dir
        if (!fs.exists(familyDir)) {
          LOG.warn(family[j] + " family dir does not exist");
        }
        allFamilyDirs.remove(familyDir);
      }
    }
    assertTrue("found extraneous families: " + allFamilyDirs, allFamilyDirs.isEmpty());
  }
  assertTrue("found extraneous regions: " + allRegionDirs, allRegionDirs.isEmpty());

  // check meta
  assertTrue(MetaTableAccessor.tableExists(master.getConnection(), tableName));
  assertEquals(regions.length, countMetaRegions(master, tableName));

  // check htd
  HTableDescriptor htd = master.getTableDescriptors().get(tableName);
  assertTrue("table descriptor not found", htd != null);
  for (int i = 0; i < family.length; ++i) {
    assertTrue("family not found " + family[i], htd.getFamily(Bytes.toBytes(family[i])) != null);
  }
  assertEquals(family.length, htd.getFamilies().size());
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:43,代码来源:MasterProcedureTestingUtility.java


注:本文中的org.apache.hadoop.hbase.util.FSUtils.getFamilyDirs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。