sumitagrawl commented on code in PR #9856:
URL: https://github.com/apache/ozone/pull/9856#discussion_r2965274836
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/health/EmptyContainerHandler.java:
##########
@@ -75,6 +76,40 @@ public boolean handle(ContainerCheckRequest request) {
containerInfo.containerID(), HddsProtos.LifeCycleEvent.DELETE);
}
return true;
+ } else if (isContainerEmptyAndQuasiClosed(containerInfo, replicas)) {
+ request.getReport().incrementAndSample(ContainerHealthState.EMPTY,
containerInfo);
+ if (!request.isReadOnly()) {
+ String originIds = replicas.stream()
+ .map(r -> r.getOriginDatanodeId().toString())
+ .collect(Collectors.joining(", "));
+ long maxReplicaBCSID = replicas.stream()
+ .filter(r -> r.getSequenceId() != null)
+ .mapToLong(ContainerReplica::getSequenceId)
+ .max()
+ .orElse(containerInfo.getSequenceId());
+
+ // Update container bcsId to max replica bcsId before deletion
+ // This ensures resurrection logic uses the correct bcsId for stale
replica detection
+ if (maxReplicaBCSID > containerInfo.getSequenceId()) {
+ LOG.info("Updating bcsId for empty QUASI_CLOSED container {} from {}
to {} before deletion",
+ containerInfo.containerID(), containerInfo.getSequenceId(),
maxReplicaBCSID);
+ containerInfo.updateSequenceId(maxReplicaBCSID);
+ }
+
+ LOG.info("Deleting empty QUASI_CLOSED container {} (container
BCSID={}, max replica BCSID={}) with {} " +
+ "replicas from originIds: [{}]. If resurrected, container will
transition to QUASI_CLOSED",
+ containerInfo.containerID(), containerInfo.getSequenceId(),
maxReplicaBCSID,
+ replicas.size(), originIds);
+ // Update the container's state - transition to CLOSED first, then
DELETE
+ // QUASI_CLOSED -> CLOSED requires FORCE_CLOSE event
+ replicationManager.updateContainerState(
+ containerInfo.containerID(),
HddsProtos.LifeCycleEvent.FORCE_CLOSE);
Review Comment:
Do we need force_close and then update state to DELETE? or direct delete
replica can be send ?
IMO, adding below in ContainerStateManagerImpl#newStateMachine() can help
directly move to deleting state from quasi_closed.
containerLifecycleSM.addTransition(QUASI_CLOSED, DELETING, DELETE);
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerManagerImpl.java:
##########
@@ -309,6 +309,22 @@ public void
transitionDeletingOrDeletedToClosedState(ContainerID containerID) th
}
}
+ @Override
+ public void transitionDeletingOrDeletedToTargetState(ContainerID
containerID, LifeCycleState targetState)
Review Comment:
transitionDeletingOrDeletedToClosedState() is no more useful, can be deleted
--
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]