本文整理了Java中org.apache.flink.runtime.checkpoint.ZooKeeperCompletedCheckpointStore.checkpointIdToPath()
方法的一些代码示例,展示了ZooKeeperCompletedCheckpointStore.checkpointIdToPath()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooKeeperCompletedCheckpointStore.checkpointIdToPath()
方法的具体详情如下:
包路径:org.apache.flink.runtime.checkpoint.ZooKeeperCompletedCheckpointStore
类名称:ZooKeeperCompletedCheckpointStore
方法名:checkpointIdToPath
[英]Convert a checkpoint id into a ZooKeeper path.
[中]将检查点id转换为ZooKeeper路径。
代码示例来源:origin: org.apache.flink/flink-runtime
/**
* Tries to remove the checkpoint identified by the given checkpoint id.
*
* @param checkpointId identifying the checkpoint to remove
* @return true if the checkpoint could be removed
*/
private boolean tryRemove(long checkpointId) throws Exception {
return checkpointsInZooKeeper.releaseAndTryRemove(checkpointIdToPath(checkpointId));
}
代码示例来源:origin: org.apache.flink/flink-runtime_2.11
/**
* Tries to remove the checkpoint identified by the given checkpoint id.
*
* @param checkpointId identifying the checkpoint to remove
* @return true if the checkpoint could be removed
*/
private boolean tryRemove(long checkpointId) throws Exception {
return checkpointsInZooKeeper.releaseAndTryRemove(checkpointIdToPath(checkpointId));
}
代码示例来源:origin: org.apache.flink/flink-runtime_2.10
/**
* Removes a subsumed checkpoint from ZooKeeper and drops the state.
*/
private void removeSubsumed(
final CompletedCheckpoint completedCheckpoint) throws Exception {
if (completedCheckpoint == null) {
return;
}
ZooKeeperStateHandleStore.RemoveCallback<CompletedCheckpoint> action =
new ZooKeeperStateHandleStore.RemoveCallback<CompletedCheckpoint>() {
@Override
public void apply(@Nullable RetrievableStateHandle<CompletedCheckpoint> value) throws FlinkException {
if (value != null) {
try {
completedCheckpoint.discardOnSubsume();
} catch (Exception e) {
throw new FlinkException("Could not discard the completed checkpoint on subsume.", e);
}
}
}
};
checkpointsInZooKeeper.releaseAndTryRemove(
checkpointIdToPath(completedCheckpoint.getCheckpointID()),
action);
}
代码示例来源:origin: com.alibaba.blink/flink-runtime
/**
* Removes a checkpoint from ZooKeeper because of Job shutdown and drops the state.
*/
private void removeShutdown(
final CompletedCheckpoint completedCheckpoint,
final JobStatus jobStatus) throws Exception {
if (completedCheckpoint == null) {
return;
}
ZooKeeperStateHandleStore.RemoveCallback<CompletedCheckpoint> removeAction = new ZooKeeperStateHandleStore.RemoveCallback<CompletedCheckpoint>() {
@Override
public void apply(@Nullable RetrievableStateHandle<CompletedCheckpoint> value) throws FlinkException {
try {
completedCheckpoint.discardOnShutdown(jobStatus);
} catch (Exception e) {
throw new FlinkException("Could not discard the completed checkpoint on subsume.", e);
}
}
};
checkpointsInZooKeeper.releaseAndTryRemove(
checkpointIdToPath(completedCheckpoint.getCheckpointID()),
removeAction);
}
代码示例来源:origin: org.apache.flink/flink-runtime_2.10
/**
* Removes a checkpoint from ZooKeeper because of Job shutdown and drops the state.
*/
private void removeShutdown(
final CompletedCheckpoint completedCheckpoint,
final JobStatus jobStatus) throws Exception {
if (completedCheckpoint == null) {
return;
}
ZooKeeperStateHandleStore.RemoveCallback<CompletedCheckpoint> removeAction = new ZooKeeperStateHandleStore.RemoveCallback<CompletedCheckpoint>() {
@Override
public void apply(@Nullable RetrievableStateHandle<CompletedCheckpoint> value) throws FlinkException {
try {
completedCheckpoint.discardOnShutdown(jobStatus);
} catch (Exception e) {
throw new FlinkException("Could not discard the completed checkpoint on subsume.", e);
}
}
};
checkpointsInZooKeeper.releaseAndTryRemove(
checkpointIdToPath(completedCheckpoint.getCheckpointID()),
removeAction);
}
代码示例来源:origin: org.apache.flink/flink-runtime_2.10
/**
* Synchronously writes the new checkpoints to ZooKeeper and asynchronously removes older ones.
*
* @param checkpoint Completed checkpoint to add.
*/
@Override
public void addCheckpoint(final CompletedCheckpoint checkpoint) throws Exception {
checkNotNull(checkpoint, "Checkpoint");
final String path = checkpointIdToPath(checkpoint.getCheckpointID());
// Now add the new one. If it fails, we don't want to loose existing data.
checkpointsInZooKeeper.addAndLock(path, checkpoint);
completedCheckpoints.addLast(checkpoint);
// Everything worked, let's remove a previous checkpoint if necessary.
while (completedCheckpoints.size() > maxNumberOfCheckpointsToRetain) {
try {
removeSubsumed(completedCheckpoints.removeFirst());
} catch (Exception e) {
LOG.warn("Failed to subsume the old checkpoint", e);
}
}
LOG.debug("Added {} to {}.", checkpoint, path);
}
代码示例来源:origin: com.alibaba.blink/flink-runtime
/**
* Removes a subsumed checkpoint from ZooKeeper and drops the state.
*/
private void removeSubsumed(
final CompletedCheckpoint completedCheckpoint) throws Exception {
if (completedCheckpoint == null) {
return;
}
ZooKeeperStateHandleStore.RemoveCallback<CompletedCheckpoint> action =
new ZooKeeperStateHandleStore.RemoveCallback<CompletedCheckpoint>() {
@Override
public void apply(@Nullable RetrievableStateHandle<CompletedCheckpoint> value) throws FlinkException {
if (value != null) {
try {
completedCheckpoint.discardOnSubsume();
} catch (Exception e) {
throw new FlinkException("Could not discard the completed checkpoint on subsume.", e);
}
}
}
};
checkpointsInZooKeeper.releaseAndTryRemove(
checkpointIdToPath(completedCheckpoint.getCheckpointID()),
action);
}
代码示例来源:origin: org.apache.flink/flink-runtime_2.11
/**
* Synchronously writes the new checkpoints to ZooKeeper and asynchronously removes older ones.
*
* @param checkpoint Completed checkpoint to add.
*/
@Override
public void addCheckpoint(final CompletedCheckpoint checkpoint) throws Exception {
checkNotNull(checkpoint, "Checkpoint");
final String path = checkpointIdToPath(checkpoint.getCheckpointID());
// Now add the new one. If it fails, we don't want to loose existing data.
checkpointsInZooKeeper.addAndLock(path, checkpoint);
completedCheckpoints.addLast(checkpoint);
// Everything worked, let's remove a previous checkpoint if necessary.
while (completedCheckpoints.size() > maxNumberOfCheckpointsToRetain) {
final CompletedCheckpoint completedCheckpoint = completedCheckpoints.removeFirst();
tryRemoveCompletedCheckpoint(completedCheckpoint, CompletedCheckpoint::discardOnSubsume);
}
LOG.debug("Added {} to {}.", checkpoint, path);
}
代码示例来源:origin: com.alibaba.blink/flink-runtime
/**
* Synchronously writes the new checkpoints to ZooKeeper and asynchronously removes older ones.
*
* @param checkpoint Completed checkpoint to add.
*/
@Override
public void addCheckpoint(final CompletedCheckpoint checkpoint) throws Exception {
checkNotNull(checkpoint, "Checkpoint");
final String path = checkpointIdToPath(checkpoint.getCheckpointID());
// Now add the new one. If it fails, we don't want to loose existing data.
checkpointsInZooKeeper.addAndLock(path, checkpoint);
completedCheckpoints.addLast(checkpoint);
// Everything worked, let's remove a previous checkpoint if necessary.
while (completedCheckpoints.size() > maxNumberOfCheckpointsToRetain) {
try {
removeSubsumed(completedCheckpoints.removeFirst());
} catch (Exception e) {
LOG.warn("Failed to subsume the old checkpoint", e);
}
}
LOG.debug("Added {} to {}.", checkpoint, path);
}
代码示例来源:origin: org.apache.flink/flink-runtime
/**
* Synchronously writes the new checkpoints to ZooKeeper and asynchronously removes older ones.
*
* @param checkpoint Completed checkpoint to add.
*/
@Override
public void addCheckpoint(final CompletedCheckpoint checkpoint) throws Exception {
checkNotNull(checkpoint, "Checkpoint");
final String path = checkpointIdToPath(checkpoint.getCheckpointID());
// Now add the new one. If it fails, we don't want to loose existing data.
checkpointsInZooKeeper.addAndLock(path, checkpoint);
completedCheckpoints.addLast(checkpoint);
// Everything worked, let's remove a previous checkpoint if necessary.
while (completedCheckpoints.size() > maxNumberOfCheckpointsToRetain) {
final CompletedCheckpoint completedCheckpoint = completedCheckpoints.removeFirst();
tryRemoveCompletedCheckpoint(completedCheckpoint, CompletedCheckpoint::discardOnSubsume);
}
LOG.debug("Added {} to {}.", checkpoint, path);
}
内容来源于网络,如有侵权,请联系作者删除!