HDDS-305. Datanode StateContext#addContainerActionIfAbsent will add container action even if there already is a ContainerAction. Contributed by Nanda kumar.

This commit is contained in:
Nanda kumar 2018-07-31 17:27:51 +05:30
parent 3e06a5dcea
commit 7631e0adae
3 changed files with 3 additions and 17 deletions

View File

@ -168,19 +168,8 @@ private void sendCloseContainerActionIfNeeded(Container container) {
double containerUsedPercentage = 1.0f * containerData.getBytesUsed() /
StorageUnit.GB.toBytes(containerData.getMaxSizeGB());
if (containerUsedPercentage >= containerCloseThreshold) {
ContainerInfo containerInfo = ContainerInfo.newBuilder()
.setContainerID(containerData.getContainerID())
.setReadCount(containerData.getReadCount())
.setWriteCount(containerData.getWriteCount())
.setReadBytes(containerData.getReadBytes())
.setWriteBytes(containerData.getWriteBytes())
.setUsed(containerData.getBytesUsed())
.setState(HddsProtos.LifeCycleState.OPEN)
.build();
ContainerAction action = ContainerAction.newBuilder()
.setContainer(containerInfo)
.setContainerID(containerData.getContainerID())
.setAction(ContainerAction.Action.CLOSE)
.setReason(ContainerAction.Reason.CONTAINER_FULL)
.build();

View File

@ -157,7 +157,7 @@ message ContainerAction {
CONTAINER_FULL = 1;
}
required ContainerInfo container = 1;
required int64 containerID = 1;
required Action action = 2;
optional Reason reason = 3;
}

View File

@ -289,10 +289,7 @@ private HeartbeatEndpointTask getHeartbeatEndpointTask(
private ContainerAction getContainerAction() {
ContainerAction.Builder builder = ContainerAction.newBuilder();
ContainerInfo containerInfo = ContainerInfo.newBuilder()
.setContainerID(1L)
.build();
builder.setContainer(containerInfo)
builder.setContainerID(1L)
.setAction(ContainerAction.Action.CLOSE)
.setReason(ContainerAction.Reason.CONTAINER_FULL);
return builder.build();