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


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/ContainerSet.java:
##########
@@ -226,14 +259,30 @@ private boolean addContainer(Container<?> container, 
boolean overwrite) throws
     }
   }
 
-  private void updateContainerIdTable(long containerId, ContainerData 
containerData) throws StorageContainerException {
+  /**
+   * Records the replica that is being added in the witnessed container DB. 
The entry is written when:
+   * <ul>
+   *   <li>there is none: this is the first replica of the container on this 
datanode;</li>
+   *   <li>it is DELETED: this datanode deleted its replica, and now loads one 
from disk at startup or gets one through
+   *   repair. An ordinary create does not get here for a DELETED entry, 
KeyValueHandler refuses it;</li>
+   *   <li>it has no replica index: it was written in the older table 
format;</li>
+   *   <li>{@code replaceReplicaIndex} is set and the replica has another 
index than the entry: a repair replaces the
+   *   replica that this datanode held.</li>
+   * </ul>
+   * In all other cases the entry is kept as it is.
+   */
+  private void updateContainerIdTable(long containerId, ContainerData 
containerData, boolean replaceReplicaIndex)
+      throws StorageContainerException {
     if (null != containerMetadataStore) {
       try {
         ContainerID containerIdObj = ContainerID.valueOf(containerId);
         Table<ContainerID, ContainerCreateInfo> containerCreateInfoTable =
             containerMetadataStore.getContainerCreateInfoTable();
         ContainerCreateInfo containerCreateInfo = 
containerCreateInfoTable.get(containerIdObj);
-        if (containerCreateInfo == null || 
containerCreateInfo.getReplicaIndex() == INVALID_REPLICA_INDEX) {
+        if (containerCreateInfo == null
+            || containerCreateInfo.getState() == State.DELETED

Review Comment:
   Just checked history, This check is added to avoid update container Table if 
replica-index is missing or details is not present. This is used to give 
preference to EC replica already loaded last time.
   But with this change, it will always update current EC replica comming first 
time during startup. Next duplicate replica with different index can not be 
determined. Ref: HDDS-13174. EC duplicate replica handling for different index 
in datanodes



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