Search in sources :

Example 1 with DefaultCompletedCheckpointStore

use of org.apache.flink.runtime.checkpoint.DefaultCompletedCheckpointStore in project flink by apache.

the class ZooKeeperUtils method createCompletedCheckpoints.

/**
 * Creates a {@link DefaultCompletedCheckpointStore} instance with {@link
 * ZooKeeperStateHandleStore}.
 *
 * @param client The {@link CuratorFramework} ZooKeeper client to use
 * @param configuration {@link Configuration} object
 * @param maxNumberOfCheckpointsToRetain The maximum number of checkpoints to retain
 * @param executor to run ZooKeeper callbacks
 * @return {@link DefaultCompletedCheckpointStore} instance
 * @throws Exception if the completed checkpoint store cannot be created
 */
public static CompletedCheckpointStore createCompletedCheckpoints(CuratorFramework client, Configuration configuration, int maxNumberOfCheckpointsToRetain, SharedStateRegistryFactory sharedStateRegistryFactory, Executor ioExecutor, Executor executor) throws Exception {
    checkNotNull(configuration, "Configuration");
    RetrievableStateStorageHelper<CompletedCheckpoint> stateStorage = createFileSystemStateStorage(configuration, HA_STORAGE_COMPLETED_CHECKPOINT);
    final ZooKeeperStateHandleStore<CompletedCheckpoint> completedCheckpointStateHandleStore = createZooKeeperStateHandleStore(client, getCheckpointsPath(), stateStorage);
    Collection<CompletedCheckpoint> completedCheckpoints = DefaultCompletedCheckpointStoreUtils.retrieveCompletedCheckpoints(completedCheckpointStateHandleStore, ZooKeeperCheckpointStoreUtil.INSTANCE);
    final CompletedCheckpointStore zooKeeperCompletedCheckpointStore = new DefaultCompletedCheckpointStore<>(maxNumberOfCheckpointsToRetain, completedCheckpointStateHandleStore, ZooKeeperCheckpointStoreUtil.INSTANCE, completedCheckpoints, sharedStateRegistryFactory.create(ioExecutor, completedCheckpoints), executor);
    LOG.info("Initialized {} in '{}' with {}.", DefaultCompletedCheckpointStore.class.getSimpleName(), completedCheckpointStateHandleStore, getCheckpointsPath());
    return zooKeeperCompletedCheckpointStore;
}
Also used : CompletedCheckpoint(org.apache.flink.runtime.checkpoint.CompletedCheckpoint) DefaultCompletedCheckpointStore(org.apache.flink.runtime.checkpoint.DefaultCompletedCheckpointStore) CompletedCheckpointStore(org.apache.flink.runtime.checkpoint.CompletedCheckpointStore) DefaultCompletedCheckpointStore(org.apache.flink.runtime.checkpoint.DefaultCompletedCheckpointStore)

Aggregations

CompletedCheckpoint (org.apache.flink.runtime.checkpoint.CompletedCheckpoint)1 CompletedCheckpointStore (org.apache.flink.runtime.checkpoint.CompletedCheckpointStore)1 DefaultCompletedCheckpointStore (org.apache.flink.runtime.checkpoint.DefaultCompletedCheckpointStore)1