You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "sarvekshayr (via GitHub)" <gi...@apache.org> on 2026/03/02 06:05:15 UTC
[PR] HDDS-14684. Allow deletion of empty quasi-closed containers [ozone]
sarvekshayr opened a new pull request, #9856:
URL: https://github.com/apache/ozone/pull/9856
## What changes were proposed in this pull request?
We now support tracking a container again if a new replica shows up with a higher BCSID after all replicas were deleted [HDDS-14684](https://issues.apache.org/jira/browse/HDDS-14684). With this change, we delete empty quasi-closed containers from the system. Even if they were missing some blocks and a new replica shows up with those blocks, it would be tracked and replicated again.
Added empty QUASI_CLOSED container check and deletion in `EmptyContainerHandler`.
## What is the link to the Apache JIRA
[HDDS-14684](https://issues.apache.org/jira/browse/HDDS-14684)
## How was this patch tested?
Added integration test in `TestReplicationManagerIntegration#testEmptyQuasiClosedContainerDeletion`.
Existing test `TestContainerReportHandling#testDeletingOrDeletedContainerWhenNonEmptyReplicaIsReported` already verifies the logic if non empty replica is reported.
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-14684. Allow deletion of empty quasi-closed containers [ozone]
Posted by "sumitagrawl (via GitHub)" <gi...@apache.org>.
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-14684. Allow deletion of empty quasi-closed containers [ozone]
Posted by "sarvekshayr (via GitHub)" <gi...@apache.org>.
sarvekshayr commented on PR #9856:
URL: https://github.com/apache/ozone/pull/9856#issuecomment-4099426216
Thanks @sumitagrawl for the review.
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-14684. Allow deletion of empty quasi-closed containers [ozone]
Posted by "ivandika3 (via GitHub)" <gi...@apache.org>.
ivandika3 commented on code in PR #9856:
URL: https://github.com/apache/ozone/pull/9856#discussion_r3793559216
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerStateManager.java:
##########
@@ -172,15 +172,15 @@ void updateContainerStateWithSequenceId(HddsProtos.ContainerID id,
/**
- * Bypasses the container state machine to change a container's state from DELETING or DELETED to CLOSED. This API was
- * introduced to fix a bug (HDDS-11136), and should be used with care otherwise.
+ * Bypasses the container state machine to change a container's state from DELETING/DELETED to CLOSED/QUASI_CLOSED.
*
- * @see <a href="https://issues.apache.org/jira/browse/HDDS-11136">HDDS-11136</a>
* @param id id of the container to transition
+ * @param targetState the target state (must be CLOSED or QUASI_CLOSED)
* @throws IOException
*/
@Replicate
- void transitionDeletingOrDeletedToClosedState(HddsProtos.ContainerID id) throws IOException;
+ void transitionDeletingOrDeletedToTargetState(HddsProtos.ContainerID id, LifeCycleState targetState)
+ throws IOException;
Review Comment:
Note that changing Replicate might crash SCM.
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-14684. Allow deletion of empty quasi-closed containers [ozone]
Posted by "sarvekshayr (via GitHub)" <gi...@apache.org>.
sarvekshayr merged PR #9856:
URL: https://github.com/apache/ozone/pull/9856
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org