YARN-8116. Nodemanager fails with NumberFormatException: For input string: . (Chandni Singh via wangda)
Change-Id: Idd30cfca59982d3fc6e47aa1b88f844a78fae94d
(cherry picked from commit 2bf9cc2c73
)
This commit is contained in:
parent
6d6f65f224
commit
f5dc7d1edf
|
@ -2191,7 +2191,8 @@ public class ContainerImpl implements Container {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void storeRetryContext() {
|
private void storeRetryContext() {
|
||||||
if (windowRetryContext.getRestartTimes() != null) {
|
if (windowRetryContext.getRestartTimes() != null &&
|
||||||
|
!windowRetryContext.getRestartTimes().isEmpty()) {
|
||||||
try {
|
try {
|
||||||
stateStore.storeContainerRestartTimes(containerId,
|
stateStore.storeContainerRestartTimes(containerId,
|
||||||
windowRetryContext.getRestartTimes());
|
windowRetryContext.getRestartTimes());
|
||||||
|
|
|
@ -347,8 +347,10 @@ public class NMLeveldbStateStoreService extends NMStateStoreService {
|
||||||
value.substring(1, value.length() - 1).split(", ");
|
value.substring(1, value.length() - 1).split(", ");
|
||||||
List<Long> restartTimes = new ArrayList<>();
|
List<Long> restartTimes = new ArrayList<>();
|
||||||
for (String restartTime : unparsedRestartTimes) {
|
for (String restartTime : unparsedRestartTimes) {
|
||||||
|
if (!restartTime.isEmpty()) {
|
||||||
restartTimes.add(Long.parseLong(restartTime));
|
restartTimes.add(Long.parseLong(restartTime));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
rcs.setRestartTimes(restartTimes);
|
rcs.setRestartTimes(restartTimes);
|
||||||
} else if (suffix.equals(CONTAINER_WORK_DIR_KEY_SUFFIX)) {
|
} else if (suffix.equals(CONTAINER_WORK_DIR_KEY_SUFFIX)) {
|
||||||
rcs.setWorkDir(asString(entry.getValue()));
|
rcs.setWorkDir(asString(entry.getValue()));
|
||||||
|
|
|
@ -1216,6 +1216,22 @@ public class TestNMLeveldbStateStoreService {
|
||||||
Assert.fail("Expected exception not thrown");
|
Assert.fail("Expected exception not thrown");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEmptyRestartTimes() throws IOException {
|
||||||
|
List<Long> restartTimes = new ArrayList<>();
|
||||||
|
ApplicationId appId = ApplicationId.newInstance(1234, 3);
|
||||||
|
ApplicationAttemptId appAttemptId = ApplicationAttemptId.newInstance(appId,
|
||||||
|
4);
|
||||||
|
ContainerId containerId = ContainerId.newContainerId(appAttemptId, 5);
|
||||||
|
storeMockContainer(containerId);
|
||||||
|
stateStore.storeContainerRestartTimes(containerId,
|
||||||
|
restartTimes);
|
||||||
|
restartStateStore();
|
||||||
|
RecoveredContainerState rcs = stateStore.loadContainersState().get(0);
|
||||||
|
List<Long> recoveredRestartTimes = rcs.getRestartTimes();
|
||||||
|
assertTrue(recoveredRestartTimes.isEmpty());
|
||||||
|
}
|
||||||
|
|
||||||
private StartContainerRequest storeMockContainer(ContainerId containerId)
|
private StartContainerRequest storeMockContainer(ContainerId containerId)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
// create a container request
|
// create a container request
|
||||||
|
|
Loading…
Reference in New Issue