public class MysqlDagStateStore extends Object implements DagStateStore
DagStateStore using MySQL as a backup, leverage MysqlStateStore.
It implements interfaces of DagStateStore but delegating responsibilities to methods provided
in MysqlStateStore.
It also implements conversion between Dag to State.
The schema of this will simply be:
| storeName | tableName | State |
where storeName represents FlowId, a combination of FlowGroup and FlowName, and tableName represents FlowExecutionId.
State is a pocket for serialized Dag object.| Modifier and Type | Field and Description |
|---|---|
static String |
CONFIG_PREFIX |
static String |
DAG_KEY_IN_STATE |
| Constructor and Description |
|---|
MysqlDagStateStore(com.typesafe.config.Config config,
Map<URI,TopologySpec> topologySpecMap) |
| Modifier and Type | Method and Description |
|---|---|
void |
cleanUp(Dag<JobExecutionPlan> dag)
Delete the
Dag from the backing store, typically upon completion of execution. |
protected StateStore<State> |
createStateStore(com.typesafe.config.Config config)
Creating an instance of StateStore.
|
List<Dag<JobExecutionPlan>> |
getDags()
Load all currently running
Dags from the underlying store. |
void |
writeCheckpoint(Dag<JobExecutionPlan> dag)
Persist the
Dag to the backing store. |
public static final String CONFIG_PREFIX
public static final String DAG_KEY_IN_STATE
public MysqlDagStateStore(com.typesafe.config.Config config,
Map<URI,TopologySpec> topologySpecMap)
protected StateStore<State> createStateStore(com.typesafe.config.Config config)
public void writeCheckpoint(Dag<JobExecutionPlan> dag) throws IOException
DagStateStoreDag to the backing store.
This is not an actual checkpoint but more like a Write-ahead log, where uncommitted job will be persisted
and be picked up again when leader transition happens.writeCheckpoint in interface DagStateStoredag - The dag submitted to DagManagerIOExceptionpublic void cleanUp(Dag<JobExecutionPlan> dag) throws IOException
DagStateStoreDag from the backing store, typically upon completion of execution.cleanUp in interface DagStateStoredag - The dag completed/cancelled from execution on SpecExecutor.IOExceptionpublic List<Dag<JobExecutionPlan>> getDags() throws IOException
DagStateStoreDags from the underlying store. Typically, invoked when a new DagManager
takes over or on restart of service.getDags in interface DagStateStoreList of currently running Dags.IOException