sodonnel commented on code in PR #10109:
URL: https://github.com/apache/ozone/pull/10109#discussion_r3146306053


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueHandler.java:
##########
@@ -2296,6 +2296,15 @@ private void deleteInternal(Container container, boolean 
force)
     long startTime = clock.millis();
     container.writeLock();
     try {
+      // Re-fetch AFTER lock to verify the container is not having stale 
references while waiting for lock.
+      long containerId = container.getContainerData().getContainerID();
+      Container<?> current = containerSet.getContainer(containerId);
+      if (current == null || current != container) {
+        LOG.warn("Container {} reference is stale. Aborting delete." +
+            " SCM will retry with the current replica.", containerId);
+        return;

Review Comment:
   Also here, can we retry rather than just fail?



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