HDFS-12958. Ozone: remove setAllocatedBytes method in ContainerInfo. Contributed by Chen Liang.

This commit is contained in:
Nanda kumar 2017-12-24 18:54:11 +05:30 committed by Owen O'Malley
parent ce19f09bd0
commit 87b7774488
2 changed files with 10 additions and 6 deletions

View File

@ -100,10 +100,6 @@ public class ContainerInfo
return allocatedBytes; return allocatedBytes;
} }
public void setAllocatedBytes(long allocatedBytes) {
this.allocatedBytes = allocatedBytes;
}
public long getUsedBytes() { public long getUsedBytes() {
return usedBytes; return usedBytes;
} }

View File

@ -480,8 +480,16 @@ public class ContainerMapping implements Mapping {
OzoneProtos.SCMContainerInfo oldInfoProto = OzoneProtos.SCMContainerInfo oldInfoProto =
OzoneProtos.SCMContainerInfo.PARSER.parseFrom(containerBytes); OzoneProtos.SCMContainerInfo.PARSER.parseFrom(containerBytes);
ContainerInfo oldInfo = ContainerInfo.fromProtobuf(oldInfoProto); ContainerInfo oldInfo = ContainerInfo.fromProtobuf(oldInfoProto);
oldInfo.setAllocatedBytes(info.getAllocatedBytes()); ContainerInfo newInfo = new ContainerInfo.Builder()
containerStore.put(dbKey, oldInfo.getProtobuf().toByteArray()); .setAllocatedBytes(info.getAllocatedBytes())
.setContainerName(oldInfo.getContainerName())
.setNumberOfKeys(oldInfo.getNumberOfKeys())
.setOwner(oldInfo.getOwner())
.setPipeline(oldInfo.getPipeline())
.setState(oldInfo.getState())
.setUsedBytes(oldInfo.getUsedBytes())
.build();
containerStore.put(dbKey, newInfo.getProtobuf().toByteArray());
} else { } else {
LOG.debug("Container state manager has container {} but not found " + LOG.debug("Container state manager has container {} but not found " +
"in container store, a deleted container?", "in container store, a deleted container?",