mukul1987 commented on a change in pull request #1211: HDDS-1888. Add
containers to node2container map in SCM as soon as a container is created.
URL: https://github.com/apache/hadoop/pull/1211#discussion_r311561367
##########
File path:
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/states/NodeStateMap.java
##########
@@ -224,6 +224,23 @@ public NodeState getNodeState(UUID uuid) throws
NodeNotFoundException {
}
}
+ /**
+ * Adds the given container to the specified datanode.
+ *
+ * @param uuid - datanode uuid
+ * @param containerId - containerID
+ * @throws NodeNotFoundException - if datanode is not known. For new datanode
+ * use addDatanodeInContainerMap call.
+ */
+ public void addContainer(final UUID uuid,
+ final ContainerID containerId)
+ throws NodeNotFoundException {
+ if (!nodeToContainer.containsKey(uuid)) {
+ throw new NodeNotFoundException("Node UUID: " + uuid);
+ }
+ nodeToContainer.get(uuid).add(containerId);
Review comment:
the check and get calls can race with the remove call.
Also looking into the code, there is no remove call, we should remove the dn
once it is dead ?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]