當前位置: 首頁>>代碼示例>>Java>>正文


Java HConstants.FILE_SYSTEM_VERSION屬性代碼示例

本文整理匯總了Java中org.apache.hadoop.hbase.HConstants.FILE_SYSTEM_VERSION屬性的典型用法代碼示例。如果您正苦於以下問題:Java HConstants.FILE_SYSTEM_VERSION屬性的具體用法?Java HConstants.FILE_SYSTEM_VERSION怎麽用?Java HConstants.FILE_SYSTEM_VERSION使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.apache.hadoop.hbase.HConstants的用法示例。


在下文中一共展示了HConstants.FILE_SYSTEM_VERSION屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testVersion

@Test
public void testVersion() throws DeserializationException, IOException {
  HBaseTestingUtility htu = new HBaseTestingUtility();
  final FileSystem fs = htu.getTestFileSystem();
  final Path rootdir = htu.getDataTestDir();
  assertNull(FSUtils.getVersion(fs, rootdir));
  // Write out old format version file.  See if we can read it in and convert.
  Path versionFile = new Path(rootdir, HConstants.VERSION_FILE_NAME);
  FSDataOutputStream s = fs.create(versionFile);
  final String version = HConstants.FILE_SYSTEM_VERSION;
  s.writeUTF(version);
  s.close();
  assertTrue(fs.exists(versionFile));
  FileStatus [] status = fs.listStatus(versionFile);
  assertNotNull(status);
  assertTrue(status.length > 0);
  String newVersion = FSUtils.getVersion(fs, rootdir);
  assertEquals(version.length(), newVersion.length());
  assertEquals(version, newVersion);
  // File will have been converted. Exercise the pb format
  assertEquals(version, FSUtils.getVersion(fs, rootdir));
  FSUtils.checkVersion(fs, rootdir, true);
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:23,代碼來源:TestFSUtils.java

示例2: checkVersion

/**
 * Verifies current version of file system
 *
 * @param fs file system
 * @param rootdir root directory of HBase installation
 * @param message if true, issues a message on System.out
 * @param wait wait interval
 * @param retries number of times to retry
 *
 * @throws IOException e
 * @throws DeserializationException
 */
public static void checkVersion(FileSystem fs, Path rootdir,
    boolean message, int wait, int retries)
throws IOException, DeserializationException {
  String version = getVersion(fs, rootdir);
  if (version == null) {
    if (!metaRegionExists(fs, rootdir)) {
      // rootDir is empty (no version file and no root region)
      // just create new version file (HBASE-1195)
      setVersion(fs, rootdir, wait, retries);
      return;
    }
  } else if (version.compareTo(HConstants.FILE_SYSTEM_VERSION) == 0) return;

  // version is deprecated require migration
  // Output on stdout so user sees it in terminal.
  String msg = "HBase file layout needs to be upgraded."
    + " You have version " + version
    + " and I want version " + HConstants.FILE_SYSTEM_VERSION
    + ". Consult http://hbase.apache.org/book.html for further information about upgrading HBase."
    + " Is your hbase.rootdir valid? If so, you may need to run "
    + "'hbase hbck -fixVersionFile'.";
  if (message) {
    System.out.println("WARNING! " + msg);
  }
  throw new FileSystemVersionException(msg);
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:38,代碼來源:FSUtils.java


注:本文中的org.apache.hadoop.hbase.HConstants.FILE_SYSTEM_VERSION屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。