本文整理了Java中org.apache.hadoop.hbase.zookeeper.ZKSplitLog
类的一些代码示例,展示了ZKSplitLog
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZKSplitLog
类的具体详情如下:
包路径:org.apache.hadoop.hbase.zookeeper.ZKSplitLog
类名称:ZKSplitLog
[英]Common methods and attributes used by SplitLogManager and SplitLogWorker running distributed splitting of WAL logs.
[中]SplitLogManager和SplitLogWorker运行分布式拆分WAL日志时使用的常用方法和属性。
代码示例来源:origin: apache/hbase
public static boolean isCorrupted(Path rootdir, String logFileName,
FileSystem fs) throws IOException {
Path file = new Path(getSplitLogDir(rootdir, logFileName), "corrupt");
boolean isCorrupt;
isCorrupt = fs.exists(file);
return isCorrupt;
}
}
代码示例来源:origin: apache/hbase
@Override
public String prepareTask(String taskname) {
return ZKSplitLog.getEncodedNodeName(watcher, taskname);
}
代码示例来源:origin: apache/hbase
} else if (slt.isDone()) {
LOG.info("Task " + path + " entered state=" + slt.toString());
if (taskFinisher != null && !ZKSplitLog.isRescanNode(watcher, path)) {
if (taskFinisher.finish(slt.getServerName(), ZKSplitLog.getFileName(path)) == Status.DONE) {
setDone(path, SUCCESS);
} else {
代码示例来源:origin: apache/hbase
private static void finishSplitLogFile(Path walDir, Path oldLogDir,
Path logPath, Configuration conf) throws IOException {
List<Path> processedLogs = new ArrayList<>();
List<Path> corruptedLogs = new ArrayList<>();
FileSystem walFS = walDir.getFileSystem(conf);
if (ZKSplitLog.isCorrupted(walDir, logPath.getName(), walFS)) {
corruptedLogs.add(logPath);
} else {
processedLogs.add(logPath);
}
archiveLogs(corruptedLogs, processedLogs, oldLogDir, walFS, conf);
Path stagingDir = ZKSplitLog.getSplitLogDir(walDir, logPath.getName());
walFS.delete(stagingDir, true);
}
代码示例来源:origin: apache/hbase
private void deleteNodeSuccess(String path) {
if (ignoreZKDeleteForTesting) {
return;
}
Task task;
task = details.getTasks().remove(path);
if (task == null) {
if (ZKSplitLog.isRescanNode(watcher, path)) {
SplitLogCounters.tot_mgr_rescan_deleted.increment();
}
SplitLogCounters.tot_mgr_missing_state_in_delete.increment();
LOG.debug("Deleted task without in memory state " + path);
return;
}
synchronized (task) {
task.status = DELETED;
task.notify();
}
SplitLogCounters.tot_mgr_task_deleted.increment();
}
代码示例来源:origin: apache/hbase
String task = ZKSplitLog.getEncodedNodeName(zkw, "task");
SplitLogTask slt = new SplitLogTask.Unassigned(MANAGER);
zkw.getRecoverableZooKeeper().create(task,slt.toByteArray(), Ids.OPEN_ACL_UNSAFE,
String rescan = ZKSplitLog.getEncodedNodeName(zkw, "RESCAN");
rescan = zkw.getRecoverableZooKeeper().create(rescan, slt.toByteArray(), Ids.OPEN_ACL_UNSAFE,
CreateMode.PERSISTENT_SEQUENTIAL);
num++;
if (node.startsWith("RESCAN")) {
String name = ZKSplitLog.getEncodedNodeName(zkw, node);
String fn = ZKSplitLog.getFileName(name);
byte [] data = ZKUtil.getData(zkw,
ZNodePaths.joinZNode(zkw.getZNodePaths().splitLogZNode, fn));
代码示例来源:origin: apache/hbase
/**
* Checks if the given path represents a rescan node.
*
* @param zkw reference to the {@link ZKWatcher} which also contains configuration and constants
* @param path the absolute path, starts with '/'
* @return whether the path represents a rescan node
*/
public static boolean isRescanNode(ZKWatcher zkw, String path) {
String prefix = getRescanNode(zkw);
if (path.length() <= prefix.length()) {
return false;
}
for (int i = 0; i < prefix.length(); i++) {
if (prefix.charAt(i) != path.charAt(i)) {
return false;
}
}
return true;
}
代码示例来源:origin: apache/hbase
/**
* Gets the full path node name for the log file being split.
* This method will url encode the filename.
* @param zkw zk reference
* @param filename log file name (only the basename)
*/
public static String getEncodedNodeName(ZKWatcher zkw, String filename) {
return ZNodePaths.joinZNode(zkw.getZNodePaths().splitLogZNode, encode(filename));
}
代码示例来源:origin: apache/hbase
@Override
public String getWALFile() {
return ZKSplitLog.getFileName(taskNode);
}
}
代码示例来源:origin: apache/hbase
@Override
public void markCorrupted(Path rootDir, String name, FileSystem fs) {
ZKSplitLog.markCorrupted(rootDir, name, fs);
}
代码示例来源:origin: apache/hbase
public static String getFileName(String node) {
String basename = node.substring(node.lastIndexOf('/') + 1);
return decode(basename);
}
代码示例来源:origin: harbby/presto-connectors
int listSize = tasks.size();
for (int i = 0; i < listSize; i++) {
if (!ZKSplitLog.isRescanNode(tasks.get(i))) {
count++;
&& !this.details.getMaster().getServerManager().areDeadServersInProgress()) {
ZKSplitLog.deleteRecoveringRegionZNodes(watcher, null);
代码示例来源:origin: harbby/presto-connectors
static void finishSplitLogFile(Path rootdir, Path oldLogDir,
Path logPath, Configuration conf) throws IOException {
List<Path> processedLogs = new ArrayList<Path>();
List<Path> corruptedLogs = new ArrayList<Path>();
FileSystem fs;
fs = rootdir.getFileSystem(conf);
if (ZKSplitLog.isCorrupted(rootdir, logPath.getName(), fs)) {
corruptedLogs.add(logPath);
} else {
processedLogs.add(logPath);
}
archiveLogs(corruptedLogs, processedLogs, oldLogDir, fs, conf);
Path stagingDir = ZKSplitLog.getSplitLogDir(rootdir, logPath.getName());
fs.delete(stagingDir, true);
}
代码示例来源:origin: apache/hbase
@Override
public int remainingTasksInCoordination() {
int count = 0;
try {
List<String> tasks = ZKUtil.listChildrenNoWatch(watcher,
watcher.getZNodePaths().splitLogZNode);
if (tasks != null) {
int listSize = tasks.size();
for (int i = 0; i < listSize; i++) {
if (!ZKSplitLog.isRescanNode(tasks.get(i))) {
count++;
}
}
}
} catch (KeeperException ke) {
LOG.warn("Failed to check remaining tasks", ke);
count = -1;
}
return count;
}
代码示例来源:origin: org.apache.hbase/hbase-server
String task = ZKSplitLog.getEncodedNodeName(zkw, "task");
SplitLogTask slt = new SplitLogTask.Unassigned(MANAGER);
zkw.getRecoverableZooKeeper().create(task,slt.toByteArray(), Ids.OPEN_ACL_UNSAFE,
String rescan = ZKSplitLog.getEncodedNodeName(zkw, "RESCAN");
rescan = zkw.getRecoverableZooKeeper().create(rescan, slt.toByteArray(), Ids.OPEN_ACL_UNSAFE,
CreateMode.PERSISTENT_SEQUENTIAL);
num++;
if (node.startsWith("RESCAN")) {
String name = ZKSplitLog.getEncodedNodeName(zkw, node);
String fn = ZKSplitLog.getFileName(name);
byte [] data = ZKUtil.getData(zkw,
ZNodePaths.joinZNode(zkw.getZNodePaths().splitLogZNode, fn));
代码示例来源:origin: apache/hbase
/**
* signal the workers that a task was resubmitted by creating the RESCAN node.
*/
private void rescan(long retries) {
// The RESCAN node will be deleted almost immediately by the
// SplitLogManager as soon as it is created because it is being
// created in the DONE state. This behavior prevents a buildup
// of RESCAN nodes. But there is also a chance that a SplitLogWorker
// might miss the watch-trigger that creation of RESCAN node provides.
// Since the TimeoutMonitor will keep resubmitting UNASSIGNED tasks
// therefore this behavior is safe.
SplitLogTask slt = new SplitLogTask.Done(this.details.getServerName());
this.watcher
.getRecoverableZooKeeper()
.getZooKeeper()
.create(ZKSplitLog.getRescanNode(watcher), slt.toByteArray(), Ids.OPEN_ACL_UNSAFE,
CreateMode.EPHEMERAL_SEQUENTIAL, new CreateRescanAsyncCallback(), Long.valueOf(retries));
}
代码示例来源:origin: co.cask.hbase/hbase
public static String getSplitLogDirTmpComponent(String worker, String file) {
return (worker + "_" + ZKSplitLog.encode(file));
}
代码示例来源:origin: harbby/presto-connectors
@Override
public String getWALFile() {
return ZKSplitLog.getFileName(taskNode);
}
}
代码示例来源:origin: apache/hbase
} else {
ZKSplitLog.markCorrupted(walDir, logfile.getPath().getName(), walFS);
代码示例来源:origin: co.cask.hbase/hbase
public static String getFileName(String node) {
String basename = node.substring(node.lastIndexOf('/') + 1);
return decode(basename);
}
内容来源于网络,如有侵权,请联系作者删除!