umamaheswararao commented on code in PR #12139:
URL: https://github.com/apache/ozone/pull/12139#discussion_r4743931094


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/ContainerSet.java:
##########
@@ -148,6 +148,31 @@ public void ensureContainerNotMissing(long containerId, 
State state) throws Stor
     }
   }
 
+  /**
+   * Fails if the witnessed container DB has an entry for the container: it 
was already created on this datanode,
+   * possibly deleted since, and must not be created again by an ordinary 
create.
+   * @param containerId ID of the container to be created
+   * @throws StorageContainerException with {@code CLOSED_CONTAINER_IO} if 
there is an entry, or with
+   *                                   {@code IO_EXCEPTION} if the entry 
cannot be read
+   */
+  public void ensureContainerNotWitnessed(long containerId) throws 
StorageContainerException {

Review Comment:
   Yes, agree. Every state need not be maintained. What it needs is to prevent 
container to be created which happens with OPEN. 
   RECOVERING is an another state we do for creating container and it will have 
write chunk calls. Do we have enough metadata as part of recovering write chunk 
to prevent recreating the container in open state?
   If write chunk call has additional metadata to indicate the write chunk 
type, then it can prevent regular open containers or RECOVERING container also 
can simply update in witnessDB?
   Creating of RECOVERING container can be idempotent as that will be the first 
action before recovering. Creating OPEN containers via write chunk should be 
strictly prevented if there is an evidence of prior creation.



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