HDDS-343. Containers are stuck in closing state in scm. Contributed by Elek, Marton.

This commit is contained in:
Nanda kumar 2018-09-03 20:14:45 +05:30
parent 211034a6c2
commit 567b5558d5

View File

@ -22,6 +22,7 @@
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.conf.StorageUnit;
import org.apache.hadoop.hdds.protocol.DatanodeDetails;
import org.apache.hadoop.hdds.protocol.proto.HddsProtos.LifeCycleEvent;
import org.apache.hadoop.hdds.protocol.proto.HddsProtos.LifeCycleState;
import org.apache.hadoop.hdds.protocol.proto.HddsProtos.SCMContainerInfo;
import org.apache.hadoop.hdds.scm.block.PendingDeleteStatusList;
@ -532,6 +533,18 @@ public void processContainerReports(DatanodeDetails datanodeDetails,
HddsProtos.SCMContainerInfo knownState =
HddsProtos.SCMContainerInfo.PARSER.parseFrom(containerBytes);
if (knownState.getState() == LifeCycleState.CLOSING
&& contInfo.getState() == LifeCycleState.CLOSED) {
updateContainerState(contInfo.getContainerID(),
LifeCycleEvent.CLOSE);
//reread the container
knownState =
HddsProtos.SCMContainerInfo.PARSER
.parseFrom(containerStore.get(dbKey));
}
HddsProtos.SCMContainerInfo newState =
reconcileState(contInfo, knownState, datanodeDetails);