This is an automated email from the ASF dual-hosted git repository.
arp pushed a commit to branch ozone-0.5.0
in repository https://gitbox.apache.org/repos/asf/hadoop-ozone.git
The following commit(s) were added to refs/heads/ozone-0.5.0 by this push:
new 695c855 HDDS-3066. SCM crash during loading containers to DB. (#596)
695c855 is described below
commit 695c8559d0522f1b596996ce408bf9fa3f727313
Author: Bharat Viswanadham <[email protected]>
AuthorDate: Fri Feb 28 13:38:51 2020 -0800
HDDS-3066. SCM crash during loading containers to DB. (#596)
(cherry picked from commit b4419546499596543c2094a75263638f027faee6)
---
.../hdds/scm/container/SCMContainerManager.java | 39 +++++++++++++++++-----
1 file changed, 30 insertions(+), 9 deletions(-)
diff --git
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/SCMContainerManager.java
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/SCMContainerManager.java
index 9624ce0..3838b9d 100644
---
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/SCMContainerManager.java
+++
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/SCMContainerManager.java
@@ -30,6 +30,7 @@ import org.apache.hadoop.hdds.scm.pipeline.PipelineManager;
import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
import org.apache.hadoop.hdds.protocol.proto.HddsProtos.ReplicationFactor;
import org.apache.hadoop.hdds.protocol.proto.HddsProtos.ReplicationType;
+import org.apache.hadoop.hdds.scm.pipeline.PipelineNotFoundException;
import org.apache.hadoop.hdds.server.ServerUtils;
import org.apache.hadoop.ozone.OzoneConsts;
import org.apache.hadoop.hdds.utils.BatchOperation;
@@ -85,7 +86,8 @@ public class SCMContainerManager implements ContainerManager {
* @throws IOException on Failure.
*/
public SCMContainerManager(final Configuration conf,
- PipelineManager pipelineManager) throws IOException {
+ PipelineManager pipelineManager)
+ throws IOException {
final File containerDBPath = getContainerDBPath(conf);
final int cacheSize = conf.getInt(OZONE_SCM_DB_CACHE_SIZE_MB,
@@ -117,9 +119,17 @@ public class SCMContainerManager implements
ContainerManager {
ContainerInfoProto.PARSER.parseFrom(entry.getValue()));
Preconditions.checkNotNull(container);
containerStateManager.loadContainer(container);
- if (container.getState() == LifeCycleState.OPEN) {
- pipelineManager.addContainerToPipeline(container.getPipelineID(),
- ContainerID.valueof(container.getContainerID()));
+ try {
+ if (container.getState() == LifeCycleState.OPEN) {
+ pipelineManager.addContainerToPipeline(container.getPipelineID(),
+ ContainerID.valueof(container.getContainerID()));
+ }
+ } catch (PipelineNotFoundException ex) {
+ LOG.warn("Found a Container {} which is in {} state with pipeline {} "
+
+ "that does not exist. Closing Container.", container,
+ container.getState(), container.getPipelineID());
+ updateContainerState(container.containerID(),
+ HddsProtos.LifeCycleEvent.FINALIZE, true);
}
}
}
@@ -323,6 +333,15 @@ public class SCMContainerManager implements
ContainerManager {
ContainerID containerID, HddsProtos.LifeCycleEvent event)
throws IOException {
// Should we return the updated ContainerInfo instead of LifeCycleState?
+ return updateContainerState(containerID, event, false);
+ }
+
+
+ private HddsProtos.LifeCycleState updateContainerState(
+ ContainerID containerID, HddsProtos.LifeCycleEvent event,
+ boolean skipPipelineToContainerRemove)
+ throws IOException {
+ // Should we return the updated ContainerInfo instead of LifeCycleState?
lock.lock();
try {
final ContainerInfo container = containerStateManager
@@ -331,10 +350,13 @@ public class SCMContainerManager implements
ContainerManager {
containerStateManager.updateContainerState(containerID, event);
final LifeCycleState newState = container.getState();
- if (oldState == LifeCycleState.OPEN && newState != LifeCycleState.OPEN) {
- pipelineManager
- .removeContainerFromPipeline(container.getPipelineID(),
- containerID);
+ if (!skipPipelineToContainerRemove) {
+ if (oldState == LifeCycleState.OPEN &&
+ newState != LifeCycleState.OPEN) {
+ pipelineManager
+ .removeContainerFromPipeline(container.getPipelineID(),
+ containerID);
+ }
}
final byte[] dbKey = Longs.toByteArray(containerID.getId());
containerStore.put(dbKey, container.getProtobuf().toByteArray());
@@ -350,7 +372,6 @@ public class SCMContainerManager implements
ContainerManager {
}
}
-
/**
* Update deleteTransactionId according to deleteTransactionMap.
*
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]