hadoop git commit: HDDS-228. Add the ReplicaMaps to ContainerStateManager. Contributed by Ajay Kumar.
Repository: hadoop Updated Branches: refs/heads/trunk a08812a1b -> 5ee90efed HDDS-228. Add the ReplicaMaps to ContainerStateManager. Contributed by Ajay Kumar. Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/5ee90efe Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/5ee90efe Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/5ee90efe Branch: refs/heads/trunk Commit: 5ee90efed385db4bf235816145b30a0f691fc91b Parents: a08812a Author: Anu Engineer Authored: Thu Jul 12 10:43:24 2018 -0700 Committer: Anu Engineer Committed: Thu Jul 12 10:43:24 2018 -0700 -- .../scm/container/ContainerStateManager.java| 34 .../scm/container/states/ContainerStateMap.java | 86 .../container/TestContainerStateManager.java| 79 ++ 3 files changed, 199 insertions(+) -- http://git-wip-us.apache.org/repos/asf/hadoop/blob/5ee90efe/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerStateManager.java -- diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerStateManager.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerStateManager.java index 870ab1d..223deac 100644 --- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerStateManager.java +++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerStateManager.java @@ -19,6 +19,7 @@ package org.apache.hadoop.hdds.scm.container; import com.google.common.base.Preconditions; import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.hdds.protocol.DatanodeDetails; import org.apache.hadoop.hdds.scm.ScmConfigKeys; import org.apache.hadoop.hdds.scm.container.common.helpers.ContainerWithPipeline; import org.apache.hadoop.hdds.scm.container.common.helpers.ContainerInfo; @@ -488,4 +489,37 @@ public class ContainerStateManager implements Closeable { public void close() throws IOException { } + /** + * Returns the latest list of DataNodes where replica for given containerId + * exist. Throws an SCMException if no entry is found for given containerId. + * + * @param containerID + * @return Set + */ + public Set getContainerReplicas(ContainerID containerID) + throws SCMException { +return containers.getContainerReplicas(containerID); + } + + /** + * Add a container Replica for given DataNode. + * + * @param containerID + * @param dn + */ + public void addContainerReplica(ContainerID containerID, DatanodeDetails dn) { +containers.addContainerReplica(containerID, dn); + } + + /** + * Remove a container Replica for given DataNode. + * + * @param containerID + * @param dn + * @return True of dataNode is removed successfully else false. + */ + public boolean removeContainerReplica(ContainerID containerID, + DatanodeDetails dn) throws SCMException { +return containers.removeContainerReplica(containerID, dn); + } } http://git-wip-us.apache.org/repos/asf/hadoop/blob/5ee90efe/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/states/ContainerStateMap.java -- diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/states/ContainerStateMap.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/states/ContainerStateMap.java index c23b1fd..1c92861 100644 --- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/states/ContainerStateMap.java +++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/states/ContainerStateMap.java @@ -18,13 +18,18 @@ package org.apache.hadoop.hdds.scm.container.states; +import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; +import java.util.HashSet; +import java.util.Set; +import org.apache.hadoop.hdds.protocol.DatanodeDetails; import org.apache.hadoop.hdds.scm.container.ContainerID; import org.apache.hadoop.hdds.scm.container.common.helpers.ContainerInfo; import org.apache.hadoop.hdds.scm.exceptions.SCMException; import org.apache.hadoop.hdds.protocol.proto.HddsProtos.LifeCycleState; import org.apache.hadoop.hdds.protocol.proto.HddsProtos.ReplicationFactor; import org.apache.hadoop.hdds.protocol.proto.HddsProtos.ReplicationType; +import org.apache.hadoop.hdds.scm.exceptions.SCMException.ResultCodes; import org.apache.hadoop.util.AutoCloseableLock; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -83,6 +88,8 @@ public class ContainerStateMap { private final ContainerAttribute typeMap; privat
[04/32] hadoop git commit: HDDS-228. Add the ReplicaMaps to ContainerStateManager. Contributed by Ajay Kumar.
HDDS-228. Add the ReplicaMaps to ContainerStateManager. Contributed by Ajay Kumar. Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/5ee90efe Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/5ee90efe Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/5ee90efe Branch: refs/heads/HDFS-12943 Commit: 5ee90efed385db4bf235816145b30a0f691fc91b Parents: a08812a Author: Anu Engineer Authored: Thu Jul 12 10:43:24 2018 -0700 Committer: Anu Engineer Committed: Thu Jul 12 10:43:24 2018 -0700 -- .../scm/container/ContainerStateManager.java| 34 .../scm/container/states/ContainerStateMap.java | 86 .../container/TestContainerStateManager.java| 79 ++ 3 files changed, 199 insertions(+) -- http://git-wip-us.apache.org/repos/asf/hadoop/blob/5ee90efe/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerStateManager.java -- diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerStateManager.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerStateManager.java index 870ab1d..223deac 100644 --- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerStateManager.java +++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerStateManager.java @@ -19,6 +19,7 @@ package org.apache.hadoop.hdds.scm.container; import com.google.common.base.Preconditions; import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.hdds.protocol.DatanodeDetails; import org.apache.hadoop.hdds.scm.ScmConfigKeys; import org.apache.hadoop.hdds.scm.container.common.helpers.ContainerWithPipeline; import org.apache.hadoop.hdds.scm.container.common.helpers.ContainerInfo; @@ -488,4 +489,37 @@ public class ContainerStateManager implements Closeable { public void close() throws IOException { } + /** + * Returns the latest list of DataNodes where replica for given containerId + * exist. Throws an SCMException if no entry is found for given containerId. + * + * @param containerID + * @return Set + */ + public Set getContainerReplicas(ContainerID containerID) + throws SCMException { +return containers.getContainerReplicas(containerID); + } + + /** + * Add a container Replica for given DataNode. + * + * @param containerID + * @param dn + */ + public void addContainerReplica(ContainerID containerID, DatanodeDetails dn) { +containers.addContainerReplica(containerID, dn); + } + + /** + * Remove a container Replica for given DataNode. + * + * @param containerID + * @param dn + * @return True of dataNode is removed successfully else false. + */ + public boolean removeContainerReplica(ContainerID containerID, + DatanodeDetails dn) throws SCMException { +return containers.removeContainerReplica(containerID, dn); + } } http://git-wip-us.apache.org/repos/asf/hadoop/blob/5ee90efe/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/states/ContainerStateMap.java -- diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/states/ContainerStateMap.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/states/ContainerStateMap.java index c23b1fd..1c92861 100644 --- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/states/ContainerStateMap.java +++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/states/ContainerStateMap.java @@ -18,13 +18,18 @@ package org.apache.hadoop.hdds.scm.container.states; +import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; +import java.util.HashSet; +import java.util.Set; +import org.apache.hadoop.hdds.protocol.DatanodeDetails; import org.apache.hadoop.hdds.scm.container.ContainerID; import org.apache.hadoop.hdds.scm.container.common.helpers.ContainerInfo; import org.apache.hadoop.hdds.scm.exceptions.SCMException; import org.apache.hadoop.hdds.protocol.proto.HddsProtos.LifeCycleState; import org.apache.hadoop.hdds.protocol.proto.HddsProtos.ReplicationFactor; import org.apache.hadoop.hdds.protocol.proto.HddsProtos.ReplicationType; +import org.apache.hadoop.hdds.scm.exceptions.SCMException.ResultCodes; import org.apache.hadoop.util.AutoCloseableLock; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -83,6 +88,8 @@ public class ContainerStateMap { private final ContainerAttribute typeMap; private final Map containerMap; + // Map to hold replicas of given container. +
[11/50] hadoop git commit: HDDS-228. Add the ReplicaMaps to ContainerStateManager. Contributed by Ajay Kumar.
HDDS-228. Add the ReplicaMaps to ContainerStateManager. Contributed by Ajay Kumar. Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/5ee90efe Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/5ee90efe Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/5ee90efe Branch: refs/heads/HDFS-13572 Commit: 5ee90efed385db4bf235816145b30a0f691fc91b Parents: a08812a Author: Anu Engineer Authored: Thu Jul 12 10:43:24 2018 -0700 Committer: Anu Engineer Committed: Thu Jul 12 10:43:24 2018 -0700 -- .../scm/container/ContainerStateManager.java| 34 .../scm/container/states/ContainerStateMap.java | 86 .../container/TestContainerStateManager.java| 79 ++ 3 files changed, 199 insertions(+) -- http://git-wip-us.apache.org/repos/asf/hadoop/blob/5ee90efe/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerStateManager.java -- diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerStateManager.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerStateManager.java index 870ab1d..223deac 100644 --- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerStateManager.java +++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerStateManager.java @@ -19,6 +19,7 @@ package org.apache.hadoop.hdds.scm.container; import com.google.common.base.Preconditions; import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.hdds.protocol.DatanodeDetails; import org.apache.hadoop.hdds.scm.ScmConfigKeys; import org.apache.hadoop.hdds.scm.container.common.helpers.ContainerWithPipeline; import org.apache.hadoop.hdds.scm.container.common.helpers.ContainerInfo; @@ -488,4 +489,37 @@ public class ContainerStateManager implements Closeable { public void close() throws IOException { } + /** + * Returns the latest list of DataNodes where replica for given containerId + * exist. Throws an SCMException if no entry is found for given containerId. + * + * @param containerID + * @return Set + */ + public Set getContainerReplicas(ContainerID containerID) + throws SCMException { +return containers.getContainerReplicas(containerID); + } + + /** + * Add a container Replica for given DataNode. + * + * @param containerID + * @param dn + */ + public void addContainerReplica(ContainerID containerID, DatanodeDetails dn) { +containers.addContainerReplica(containerID, dn); + } + + /** + * Remove a container Replica for given DataNode. + * + * @param containerID + * @param dn + * @return True of dataNode is removed successfully else false. + */ + public boolean removeContainerReplica(ContainerID containerID, + DatanodeDetails dn) throws SCMException { +return containers.removeContainerReplica(containerID, dn); + } } http://git-wip-us.apache.org/repos/asf/hadoop/blob/5ee90efe/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/states/ContainerStateMap.java -- diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/states/ContainerStateMap.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/states/ContainerStateMap.java index c23b1fd..1c92861 100644 --- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/states/ContainerStateMap.java +++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/states/ContainerStateMap.java @@ -18,13 +18,18 @@ package org.apache.hadoop.hdds.scm.container.states; +import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; +import java.util.HashSet; +import java.util.Set; +import org.apache.hadoop.hdds.protocol.DatanodeDetails; import org.apache.hadoop.hdds.scm.container.ContainerID; import org.apache.hadoop.hdds.scm.container.common.helpers.ContainerInfo; import org.apache.hadoop.hdds.scm.exceptions.SCMException; import org.apache.hadoop.hdds.protocol.proto.HddsProtos.LifeCycleState; import org.apache.hadoop.hdds.protocol.proto.HddsProtos.ReplicationFactor; import org.apache.hadoop.hdds.protocol.proto.HddsProtos.ReplicationType; +import org.apache.hadoop.hdds.scm.exceptions.SCMException.ResultCodes; import org.apache.hadoop.util.AutoCloseableLock; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -83,6 +88,8 @@ public class ContainerStateMap { private final ContainerAttribute typeMap; private final Map containerMap; + // Map to hold replicas of given container. +
[34/50] [abbrv] hadoop git commit: HDDS-228. Add the ReplicaMaps to ContainerStateManager. Contributed by Ajay Kumar.
HDDS-228. Add the ReplicaMaps to ContainerStateManager. Contributed by Ajay Kumar. Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/5ee90efe Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/5ee90efe Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/5ee90efe Branch: refs/heads/YARN-7402 Commit: 5ee90efed385db4bf235816145b30a0f691fc91b Parents: a08812a Author: Anu Engineer Authored: Thu Jul 12 10:43:24 2018 -0700 Committer: Anu Engineer Committed: Thu Jul 12 10:43:24 2018 -0700 -- .../scm/container/ContainerStateManager.java| 34 .../scm/container/states/ContainerStateMap.java | 86 .../container/TestContainerStateManager.java| 79 ++ 3 files changed, 199 insertions(+) -- http://git-wip-us.apache.org/repos/asf/hadoop/blob/5ee90efe/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerStateManager.java -- diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerStateManager.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerStateManager.java index 870ab1d..223deac 100644 --- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerStateManager.java +++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerStateManager.java @@ -19,6 +19,7 @@ package org.apache.hadoop.hdds.scm.container; import com.google.common.base.Preconditions; import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.hdds.protocol.DatanodeDetails; import org.apache.hadoop.hdds.scm.ScmConfigKeys; import org.apache.hadoop.hdds.scm.container.common.helpers.ContainerWithPipeline; import org.apache.hadoop.hdds.scm.container.common.helpers.ContainerInfo; @@ -488,4 +489,37 @@ public class ContainerStateManager implements Closeable { public void close() throws IOException { } + /** + * Returns the latest list of DataNodes where replica for given containerId + * exist. Throws an SCMException if no entry is found for given containerId. + * + * @param containerID + * @return Set + */ + public Set getContainerReplicas(ContainerID containerID) + throws SCMException { +return containers.getContainerReplicas(containerID); + } + + /** + * Add a container Replica for given DataNode. + * + * @param containerID + * @param dn + */ + public void addContainerReplica(ContainerID containerID, DatanodeDetails dn) { +containers.addContainerReplica(containerID, dn); + } + + /** + * Remove a container Replica for given DataNode. + * + * @param containerID + * @param dn + * @return True of dataNode is removed successfully else false. + */ + public boolean removeContainerReplica(ContainerID containerID, + DatanodeDetails dn) throws SCMException { +return containers.removeContainerReplica(containerID, dn); + } } http://git-wip-us.apache.org/repos/asf/hadoop/blob/5ee90efe/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/states/ContainerStateMap.java -- diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/states/ContainerStateMap.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/states/ContainerStateMap.java index c23b1fd..1c92861 100644 --- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/states/ContainerStateMap.java +++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/states/ContainerStateMap.java @@ -18,13 +18,18 @@ package org.apache.hadoop.hdds.scm.container.states; +import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; +import java.util.HashSet; +import java.util.Set; +import org.apache.hadoop.hdds.protocol.DatanodeDetails; import org.apache.hadoop.hdds.scm.container.ContainerID; import org.apache.hadoop.hdds.scm.container.common.helpers.ContainerInfo; import org.apache.hadoop.hdds.scm.exceptions.SCMException; import org.apache.hadoop.hdds.protocol.proto.HddsProtos.LifeCycleState; import org.apache.hadoop.hdds.protocol.proto.HddsProtos.ReplicationFactor; import org.apache.hadoop.hdds.protocol.proto.HddsProtos.ReplicationType; +import org.apache.hadoop.hdds.scm.exceptions.SCMException.ResultCodes; import org.apache.hadoop.util.AutoCloseableLock; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -83,6 +88,8 @@ public class ContainerStateMap { private final ContainerAttribute typeMap; private final Map containerMap; + // Map to hold replicas of given container. + p