Class ZooKeeperCheckpointIDCounter
java.lang.Object
org.apache.flink.runtime.checkpoint.ZooKeeperCheckpointIDCounter
- All Implemented Interfaces:
CheckpointIDCounter
CheckpointIDCounter instances for JobManagers running in HighAvailabilityMode.ZOOKEEPER.
Each counter creates a ZNode:
+----O /flink/checkpoint-counter/<job-id> 1 [persistent] . . . +----O /flink/checkpoint-counter/<job-id> N [persistent]
The checkpoints IDs are required to be ascending (per job). In order to guarantee this in case of job manager failures we use ZooKeeper to have a shared counter across job manager instances.
-
Field Summary
Fields inherited from interface org.apache.flink.runtime.checkpoint.CheckpointIDCounter
INITIAL_CHECKPOINT_ID -
Constructor Summary
ConstructorsConstructorDescriptionZooKeeperCheckpointIDCounter(org.apache.flink.shaded.curator5.org.apache.curator.framework.CuratorFramework client, LastStateConnectionStateListener connectionStateListener) Creates aZooKeeperCheckpointIDCounterinstance. -
Method Summary
Modifier and TypeMethodDescriptionlongget()Atomically gets the current checkpoint ID.longAtomically increments the current checkpoint ID.voidsetCount(long newId) Sets the current checkpoint ID.shutdown(org.apache.flink.api.common.JobStatus jobStatus) Shuts theCheckpointIDCounterservice.voidstart()Starts theCheckpointIDCounterservice down.
-
Constructor Details
-
ZooKeeperCheckpointIDCounter
public ZooKeeperCheckpointIDCounter(org.apache.flink.shaded.curator5.org.apache.curator.framework.CuratorFramework client, LastStateConnectionStateListener connectionStateListener) Creates aZooKeeperCheckpointIDCounterinstance.- Parameters:
client- Curator ZooKeeper client
-
-
Method Details
-
start
Description copied from interface:CheckpointIDCounterStarts theCheckpointIDCounterservice down.- Specified by:
startin interfaceCheckpointIDCounter- Throws:
Exception
-
shutdown
Description copied from interface:CheckpointIDCounterShuts theCheckpointIDCounterservice.The job status is forwarded and used to decide whether state should actually be discarded or kept.
- Specified by:
shutdownin interfaceCheckpointIDCounter- Parameters:
jobStatus- Job state on shut down- Returns:
- The
CompletableFutureholding the result of the shutdown operation.
-
getAndIncrement
Description copied from interface:CheckpointIDCounterAtomically increments the current checkpoint ID.- Specified by:
getAndIncrementin interfaceCheckpointIDCounter- Returns:
- The previous checkpoint ID
- Throws:
Exception
-
get
public long get()Description copied from interface:CheckpointIDCounterAtomically gets the current checkpoint ID.- Specified by:
getin interfaceCheckpointIDCounter- Returns:
- The current checkpoint ID
-
setCount
Description copied from interface:CheckpointIDCounterSets the current checkpoint ID.- Specified by:
setCountin interfaceCheckpointIDCounter- Parameters:
newId- The new ID- Throws:
Exception
-