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
1 changed files with 13 additions and 0 deletions

View File

@ -22,6 +22,7 @@ import com.google.common.primitives.Longs;
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 class ContainerMapping implements Mapping {
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);