本文整理汇总了Java中org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper.exists方法的典型用法代码示例。如果您正苦于以下问题:Java RecoverableZooKeeper.exists方法的具体用法?Java RecoverableZooKeeper.exists怎么用?Java RecoverableZooKeeper.exists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper
的用法示例。
在下文中一共展示了RecoverableZooKeeper.exists方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: cleanZookeeper
import org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper; //导入方法依赖的package包/类
/**
* Deletes just the splice-specific paths in zookeeper. Does not delete hbase paths.
*/
public static void cleanZookeeper() throws InterruptedException, KeeperException{
RecoverableZooKeeper rzk=getRecoverableZooKeeper();
String rootPath=HConfiguration.getConfiguration().getSpliceRootPath();
for(String path : HConfiguration.zookeeperPaths){
path=rootPath+path;
if(rzk.exists(path,false)!=null){
for(String child : rzk.getChildren(path,false)){
for(String grandChild : rzk.getChildren(path+"/"+child,false)){
rzk.delete(path+"/"+child+"/"+grandChild,-1);
}
rzk.delete(path+"/"+child,-1);
}
rzk.delete(path,-1);
}
}
}
示例2: captureIncrementalChanges
import org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper; //导入方法依赖的package包/类
/**
* An HFile is eligible for incremental backup if
* 1) There is an ongoing full backup, flush is not triggered by preparing and backup for this region is done.
* 2) There is no ongoing backup, AND there is a previous full/incremental backup
* 3) There is an ongoing incremental backup
* @param fileName
* @throws StandardException
*/
public static void captureIncrementalChanges( Configuration conf,
HRegion region,
String path,
FileSystem fs,
Path rootDir,
Path backupDir,
String tableName,
String fileName,
boolean preparing) throws StandardException {
boolean shouldRegister = false;
try {
RecoverableZooKeeper zooKeeper = ZkUtils.getRecoverableZooKeeper();
String spliceBackupPath = HConfiguration.getConfiguration().getBackupPath();
if (BackupUtils.existsDatabaseBackup(fs, rootDir)) {
if (LOG.isDebugEnabled()) {
SpliceLogUtils.debug(LOG, "There exists a successful full or incremental backup in the system");
}
shouldRegister = true;
}
else if (zooKeeper.exists(spliceBackupPath, false) != null) {
if (LOG.isDebugEnabled()) {
SpliceLogUtils.debug(LOG, "A backup is running");
}
shouldRegister = true;
}
if (shouldRegister) {
registerHFile(conf, fs, backupDir, region, fileName);
}
}
catch (Exception e) {
e.printStackTrace();
throw Exceptions.parseException(e);
}
}
示例3: validZookeeper
import org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper; //导入方法依赖的package包/类
public static boolean validZookeeper() throws InterruptedException, KeeperException{
RecoverableZooKeeper rzk=getRecoverableZooKeeper();
String rootPath=HConfiguration.getConfiguration().getSpliceRootPath();
for(String path : HConfiguration.zookeeperPaths){
if(rzk.exists(rootPath+path,false)==null)
return false;
}
return true;
}
示例4: isSpliceLoaded
import org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper; //导入方法依赖的package包/类
public static boolean isSpliceLoaded() throws InterruptedException, KeeperException{
RecoverableZooKeeper rzk=getRecoverableZooKeeper();
String path=HConfiguration.getConfiguration().getSpliceRootPath()+HConfiguration.STARTUP_PATH;
return rzk.exists(path,false)!=null;
}
示例5: backupInProgress
import org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper; //导入方法依赖的package包/类
public static boolean backupInProgress() throws Exception {
String path = HConfiguration.getConfiguration().getBackupPath();
RecoverableZooKeeper zooKeeper = ZkUtils.getRecoverableZooKeeper();
Stat stat = zooKeeper.exists(path, false);
return (stat != null);
}
示例6: backupCanceled
import org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper; //导入方法依赖的package包/类
public static boolean backupCanceled() throws KeeperException, InterruptedException {
RecoverableZooKeeper zooKeeper = ZkUtils.getRecoverableZooKeeper();
String path = HConfiguration.getConfiguration().getBackupPath();
return zooKeeper.exists(path, false) == null;
}