YARN-4831. Recovered containers will be killed after NM stateful restart. Contributed by Siqi Li

This commit is contained in:
Jason Lowe 2016-10-27 20:41:43 +00:00
parent 31ff42b510
commit 7e3c327d31

View File

@ -1506,16 +1506,20 @@ public void transition(ContainerImpl container, ContainerEvent event) {
static class KillOnNewTransition extends ContainerDoneTransition { static class KillOnNewTransition extends ContainerDoneTransition {
@Override @Override
public void transition(ContainerImpl container, ContainerEvent event) { public void transition(ContainerImpl container, ContainerEvent event) {
ContainerKillEvent killEvent = (ContainerKillEvent) event; if (container.recoveredStatus == RecoveredContainerStatus.COMPLETED) {
container.exitCode = killEvent.getContainerExitStatus(); container.sendFinishedEvents();
container.addDiagnostics(killEvent.getDiagnostic(), "\n"); } else {
container.addDiagnostics("Container is killed before being launched.\n"); ContainerKillEvent killEvent = (ContainerKillEvent) event;
container.metrics.killedContainer(); container.exitCode = killEvent.getContainerExitStatus();
NMAuditLogger.logSuccess(container.user, container.addDiagnostics(killEvent.getDiagnostic(), "\n");
AuditConstants.FINISH_KILLED_CONTAINER, "ContainerImpl", container.addDiagnostics("Container is killed before being launched.\n");
container.containerId.getApplicationAttemptId().getApplicationId(), container.metrics.killedContainer();
container.containerId); NMAuditLogger.logSuccess(container.user,
super.transition(container, event); AuditConstants.FINISH_KILLED_CONTAINER, "ContainerImpl",
container.containerId.getApplicationAttemptId().getApplicationId(),
container.containerId);
super.transition(container, event);
}
} }
} }