Gargi-jais11 commented on code in PR #10109:
URL: https://github.com/apache/ozone/pull/10109#discussion_r3146891061
##########
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:
Similarly for `KeyValueHandler.deleteInternal`: When the stale check fires
and the method returns without error, SCM does not receive an exception from
the DN. On DN's next heartbeat, it reports the container replica still present
(now at the new volume). SCM's `RatisOverReplicationHandler` (or
DeletingContainerHandler) sees the replica still exists and re-queues the
delete. ReplicationManager's over-replication queue is processed every **30 s
(hdds.scm.replication.over.replicated.interval),** so a fresh
`DeleteContainerCommand` is re-sent within that window, this time targeting the
correct, post-move Container object. Again, the retry is free. So simple return
is better than retyring inside the this delete task.
--
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]