swamirishi commented on code in PR #7402:
URL: https://github.com/apache/ozone/pull/7402#discussion_r1844646765


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/ContainerSet.java:
##########
@@ -85,22 +98,41 @@ public void setRecoveringTimeout(long recoveringTimeout) {
     this.recoveringTimeout = recoveringTimeout;
   }
 
+  public boolean addContainer(Container<?> container) throws 
StorageContainerException {
+    return addContainer(container, false);
+  }
+
   /**
    * Add Container to container map.
    * @param container container to be added
    * @return If container is added to containerMap returns true, otherwise
    * false
    */
-  public boolean addContainer(Container<?> container) throws
+  public boolean addContainer(Container<?> container, boolean 
overwriteMissingContainers) throws
       StorageContainerException {
     Preconditions.checkNotNull(container, "container cannot be null");
 
     long containerId = container.getContainerData().getContainerID();
+    State containerState = container.getContainerData().getState();
+    if (!overwriteMissingContainers && 
missingContainerSet.contains(containerId)) {
+      throw new StorageContainerException(String.format("Container with 
container Id %d is missing in the DN " +

Review Comment:
   There is a function which doesn't overwrite containers. We should be 
performing this check on every container add. In KeyValueHandler we are having 
to do it there because the creation of KeyValueContainerData creates the 
required directory structure in the data volume. So we are having to provide 
this check. But whenever we are adding to data structure from other paths we 
have to ensure the container is not missing by default unless we explicity 
intend to overwrite the missing container.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to