{
LOG.info("Recovering from event"
+ ", eventType=" + eventType
+ ", event=" + event.toString());
assert recoveredDAGData.recoveredDAG != null;
VertexFinishedEvent vEvent = (VertexFinishedEvent) event;
Vertex v = recoveredDAGData.recoveredDAG.getVertex(vEvent.getVertexID());
v.restoreFromEvent(vEvent);
break;
}
case TASK_STARTED:
{
LOG.info("Recovering from event"
+ ", eventType=" + eventType
+ ", event=" + event.toString());
assert recoveredDAGData.recoveredDAG != null;
TaskStartedEvent tEvent = (TaskStartedEvent) event;
Task task = recoveredDAGData.recoveredDAG.getVertex(
tEvent.getTaskID().getVertexID()).getTask(tEvent.getTaskID());
task.restoreFromEvent(tEvent);
break;
}
case TASK_FINISHED:
{
LOG.info("Recovering from event"
+ ", eventType=" + eventType
+ ", event=" + event.toString());
assert recoveredDAGData.recoveredDAG != null;
TaskFinishedEvent tEvent = (TaskFinishedEvent) event;
Task task = recoveredDAGData.recoveredDAG.getVertex(
tEvent.getTaskID().getVertexID()).getTask(tEvent.getTaskID());
task.restoreFromEvent(tEvent);
break;
}
case TASK_ATTEMPT_STARTED:
{
LOG.info("Recovering from event"
+ ", eventType=" + eventType
+ ", event=" + event.toString());
assert recoveredDAGData.recoveredDAG != null;
TaskAttemptStartedEvent tEvent = (TaskAttemptStartedEvent) event;
Task task =
recoveredDAGData.recoveredDAG.getVertex(
tEvent.getTaskAttemptID().getTaskID().getVertexID())
.getTask(tEvent.getTaskAttemptID().getTaskID());
task.restoreFromEvent(tEvent);
break;
}
case TASK_ATTEMPT_FINISHED:
{
LOG.info("Recovering from event"
+ ", eventType=" + eventType
+ ", event=" + event.toString());
assert recoveredDAGData.recoveredDAG != null;
TaskAttemptFinishedEvent tEvent = (TaskAttemptFinishedEvent) event;
Task task =
recoveredDAGData.recoveredDAG.getVertex(
tEvent.getTaskAttemptID().getTaskID().getVertexID())
.getTask(tEvent.getTaskAttemptID().getTaskID());
task.restoreFromEvent(tEvent);
break;
}
case VERTEX_DATA_MOVEMENT_EVENTS_GENERATED:
{
LOG.info("Recovering from event"
+ ", eventType=" + eventType
+ ", event=" + event.toString());
assert recoveredDAGData.recoveredDAG != null;
VertexDataMovementEventsGeneratedEvent vEvent =
(VertexDataMovementEventsGeneratedEvent) event;
Vertex v = recoveredDAGData.recoveredDAG.getVertex(vEvent.getVertexID());
v.restoreFromEvent(vEvent);
break;
}
default:
throw new RuntimeException("Invalid data found, unknown event type "
+ eventType);
}
if (LOG.isDebugEnabled()) {
LOG.debug("[DAG RECOVERY]"
+ " dagId=" + lastInProgressDAG
+ ", eventType=" + eventType
+ ", event=" + event.toString());
}
newDAGRecoveryStream.writeInt(eventType.ordinal());
event.toProtoStream(newDAGRecoveryStream);
}
dagRecoveryStream.close();
newDAGRecoveryStream.hsync();
newDAGRecoveryStream.close();
if (!recoveredDAGData.isCompleted
&& !recoveredDAGData.nonRecoverable) {
if (lastInProgressDAGData.bufferedSummaryEvents != null
&& !lastInProgressDAGData.bufferedSummaryEvents.isEmpty()) {
for (HistoryEvent bufferedEvent : lastInProgressDAGData.bufferedSummaryEvents) {
assert recoveredDAGData.recoveredDAG != null;
switch (bufferedEvent.getEventType()) {
case VERTEX_GROUP_COMMIT_STARTED:
recoveredDAGData.recoveredDAG.restoreFromEvent(bufferedEvent);
break;
case VERTEX_GROUP_COMMIT_FINISHED:
recoveredDAGData.recoveredDAG.restoreFromEvent(bufferedEvent);
break;
case VERTEX_FINISHED:
VertexFinishedEvent vertexFinishedEvent =
(VertexFinishedEvent) bufferedEvent;
Vertex vertex = recoveredDAGData.recoveredDAG.getVertex(
vertexFinishedEvent.getVertexID());
if (vertex == null) {
recoveredDAGData.nonRecoverable = true;
recoveredDAGData.reason = "All state could not be recovered"
+ ", vertex completed but events not flushed"
+ ", vertexId=" + vertexFinishedEvent.getVertexID();
} else {
vertex.restoreFromEvent(vertexFinishedEvent);
}
break;
default: