sodonnel commented on code in PR #10109:
URL: https://github.com/apache/ozone/pull/10109#discussion_r3147305298
##########
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:
RM will not resend the delete for 10 minutes, as it doesn't know if the task
has been queued or failed.
We shouldn't fail tasks for re-tryable reasons within the DN. If another
thread has the ability to modify the object between when we get it and we lock
it, then should we not always just get it again after locking and then we know
for sure nothing can have changed it, and proceed with the second copy? Why
even do a compare of first == second?
--
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]