HDDS-971. ContainerDataConstructor throws exception on QUASI_CLOSED and UNHEALTHY container state. Contributed by Lokesh Jain.

This commit is contained in:
Bharat Viswanadham 2019-01-16 17:43:30 -08:00
parent 54b11de2c0
commit 96ea464aaa
2 changed files with 4 additions and 17 deletions

View File

@ -256,21 +256,8 @@ public Object construct(Node node) {
kvData.setMetadata(meta); kvData.setMetadata(meta);
kvData.setChecksum((String) nodes.get(OzoneConsts.CHECKSUM)); kvData.setChecksum((String) nodes.get(OzoneConsts.CHECKSUM));
String state = (String) nodes.get(OzoneConsts.STATE); String state = (String) nodes.get(OzoneConsts.STATE);
switch (state) { kvData
case "OPEN": .setState(ContainerProtos.ContainerDataProto.State.valueOf(state));
kvData.setState(ContainerProtos.ContainerDataProto.State.OPEN);
break;
case "CLOSING":
kvData.setState(ContainerProtos.ContainerDataProto.State.CLOSING);
break;
case "CLOSED":
kvData.setState(ContainerProtos.ContainerDataProto.State.CLOSED);
break;
default:
throw new IllegalStateException("Unexpected " +
"ContainerLifeCycleState " + state + " for the containerId " +
nodes.get(OzoneConsts.CONTAINER_ID));
}
return kvData; return kvData;
} }
} }

View File

@ -96,8 +96,8 @@ public void run() {
try { try {
readVolume(hddsVolumeDir); readVolume(hddsVolumeDir);
} catch (RuntimeException ex) { } catch (RuntimeException ex) {
LOG.info("Caught an Run time exception during reading container files" + LOG.error("Caught a Run time exception during reading container files" +
" from Volume {}", hddsVolumeDir); " from Volume {} {}", hddsVolumeDir, ex);
} }
} }