本文整理匯總了Java中org.apache.hadoop.hbase.HConstants.BASE_NAMESPACE_DIR屬性的典型用法代碼示例。如果您正苦於以下問題:Java HConstants.BASE_NAMESPACE_DIR屬性的具體用法?Java HConstants.BASE_NAMESPACE_DIR怎麽用?Java HConstants.BASE_NAMESPACE_DIR使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.apache.hadoop.hbase.HConstants
的用法示例。
在下文中一共展示了HConstants.BASE_NAMESPACE_DIR屬性的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: migrateDotDirs
/**
* Rename all the dot dirs -- .data, .archive, etc. -- as data, archive, etc.; i.e. minus the dot.
* @throws IOException
*/
public void migrateDotDirs() throws IOException {
// Dot dirs to rename. Leave the tmp dir named '.tmp' and snapshots as .hbase-snapshot.
final Path archiveDir = new Path(rootDir, HConstants.HFILE_ARCHIVE_DIRECTORY);
Path [][] dirs = new Path[][] {
new Path [] {new Path(rootDir, DOT_CORRUPT), new Path(rootDir, HConstants.CORRUPT_DIR_NAME)},
new Path [] {new Path(rootDir, DOT_LOGS), new Path(rootDir, HConstants.HREGION_LOGDIR_NAME)},
new Path [] {new Path(rootDir, DOT_OLD_LOGS),
new Path(rootDir, HConstants.HREGION_OLDLOGDIR_NAME)},
new Path [] {new Path(rootDir, TMP_DATA_DIR),
new Path(rootDir, HConstants.BASE_NAMESPACE_DIR)},
new Path[] { new Path(rootDir, DOT_LIB_DIR),
new Path(rootDir, HConstants.LIB_DIR)}};
for (Path [] dir: dirs) {
Path src = dir[0];
Path tgt = dir[1];
if (!this.fs.exists(src)) {
LOG.info("Does not exist: " + src);
continue;
}
rename(src, tgt);
}
// Do the .archive dir. Need to move its subdirs to the default ns dir under data dir... so
// from '.archive/foo', to 'archive/data/default/foo'.
Path oldArchiveDir = new Path(rootDir, DOT_ARCHIVE);
if (this.fs.exists(oldArchiveDir)) {
// This is a pain doing two nn calls but portable over h1 and h2.
mkdirs(archiveDir);
Path archiveDataDir = new Path(archiveDir, HConstants.BASE_NAMESPACE_DIR);
mkdirs(archiveDataDir);
rename(oldArchiveDir, new Path(archiveDataDir,
NamespaceDescriptor.DEFAULT_NAMESPACE_NAME_STR));
}
// Update the system and user namespace dirs removing the dot in front of .data.
Path dataDir = new Path(rootDir, HConstants.BASE_NAMESPACE_DIR);
sysNsDir = new Path(dataDir, NamespaceDescriptor.SYSTEM_NAMESPACE_NAME_STR);
defNsDir = new Path(dataDir, NamespaceDescriptor.DEFAULT_NAMESPACE_NAME_STR);
}
示例2: testNewDirsArePresentPostMigration
@Test (timeout=300000)
public void testNewDirsArePresentPostMigration() throws IOException {
FileSystem fs = FileSystem.get(TEST_UTIL.getConfiguration());
// Below list does not include 'corrupt' because there is no 'corrupt' in the tgz
String [] newdirs = new String [] {HConstants.BASE_NAMESPACE_DIR,
HConstants.HREGION_LOGDIR_NAME};
Path hbaseRootDir = TEST_UTIL.getDefaultRootDirPath();
for (String dir: newdirs) {
assertTrue(dir, fs.exists(new Path(hbaseRootDir, dir)));
}
}
示例3: setDefaultNamespaceDir
private void setDefaultNamespaceDir() throws IOException {
Path dataDir = new Path(FSUtils.getRootDir(getConf()), HConstants.BASE_NAMESPACE_DIR);
defaultNamespace = new Path(dataDir, NamespaceDescriptor.DEFAULT_NAMESPACE_NAME_STR);
}
示例4: getNamespaceDir
/**
* Returns the {@link org.apache.hadoop.fs.Path} object representing
* the namespace directory under path rootdir
*
* @param rootdir qualified path of HBase root directory
* @param namespace namespace name
* @return {@link org.apache.hadoop.fs.Path} for table
*/
public static Path getNamespaceDir(Path rootdir, final String namespace) {
return new Path(rootdir, new Path(HConstants.BASE_NAMESPACE_DIR,
new Path(namespace)));
}