YARN-5873. RM crashes with NPE if generic application history is enabled. Contributed by Varun Saxena.

This commit is contained in:
Rohith Sharma K S 2016-11-15 10:56:28 +05:30
parent 04014c4c73
commit 296c5de0cf
1 changed files with 6 additions and 1 deletions

View File

@ -247,7 +247,9 @@ public class RMContainerImpl implements RMContainer, Comparable<RMContainer> {
YarnConfiguration YarnConfiguration
.DEFAULT_APPLICATION_HISTORY_SAVE_NON_AM_CONTAINER_META_INFO); .DEFAULT_APPLICATION_HISTORY_SAVE_NON_AM_CONTAINER_META_INFO);
rmContext.getRMApplicationHistoryWriter().containerStarted(this); if (container.getId() != null) {
rmContext.getRMApplicationHistoryWriter().containerStarted(this);
}
// If saveNonAMContainerMetaInfo is true, store system metrics for all // If saveNonAMContainerMetaInfo is true, store system metrics for all
// containers. If false, and if this container is marked as the AM, metrics // containers. If false, and if this container is marked as the AM, metrics
@ -892,6 +894,9 @@ public class RMContainerImpl implements RMContainer, Comparable<RMContainer> {
// container creation event to timeline service when id assigned. // container creation event to timeline service when id assigned.
container.setId(containerId); container.setId(containerId);
if (containerId != null) {
rmContext.getRMApplicationHistoryWriter().containerStarted(this);
}
// If saveNonAMContainerMetaInfo is true, store system metrics for all // If saveNonAMContainerMetaInfo is true, store system metrics for all
// containers. If false, and if this container is marked as the AM, metrics // containers. If false, and if this container is marked as the AM, metrics
// will still be published for this container, but that calculation happens // will still be published for this container, but that calculation happens