use of edu.snu.mist.formats.avro.QueryCheckpoint in project mist by snuspl.
the class DefaultCheckpointManagerImpl method recoverGroup.
@Override
public void recoverGroup(final String groupId) throws IOException {
Map<String, QueryCheckpoint> queryCheckpointMap;
final List<AvroDag> dagList;
final QueryManager queryManager = queryManagerFuture.get();
try {
// Load the checkpointed states and the query lists.
queryCheckpointMap = checkpointStore.loadSavedGroupState(groupId).getQueryCheckpointMap();
// Load the queries.
} catch (final FileNotFoundException ie) {
LOG.log(Level.WARNING, "Checkpoint is not found for group {0}.", new Object[] { groupId });
// Insert an empty map to prevent null point exception.
queryCheckpointMap = new HashMap<>();
}
final List<String> queryIdListInGroup = checkpointStore.loadSaveGroupQueryInfo(groupId);
dagList = checkpointStore.loadSavedQueries(queryIdListInGroup);
for (final AvroDag avroDag : dagList) {
// Get the checkpoint for each dag. If there is no checkpoint for the query, it returns null.
final QueryCheckpoint queryCheckpoint = queryCheckpointMap.get(avroDag.getQueryId());
// Recover each query in the group.
queryManager.createQueryWithCheckpoint(avroDag, queryCheckpoint);
}
}
Aggregations