You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2022/02/14 14:13:00 UTC

[jira] [Updated] (HDDS-6313) Remove replicas when a container is deleted

     [ https://issues.apache.org/jira/browse/HDDS-6313?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

ASF GitHub Bot updated HDDS-6313:
---------------------------------
    Labels: pull-request-available  (was: )

> Remove replicas when a container is deleted
> -------------------------------------------
>
>                 Key: HDDS-6313
>                 URL: https://issues.apache.org/jira/browse/HDDS-6313
>             Project: Apache Ozone
>          Issue Type: Bug
>            Reporter: Stephen O'Donnell
>            Assignee: Stephen O'Donnell
>            Priority: Major
>              Labels: pull-request-available
>
> In ContainerStateMap, there are several maps to hold various details, eg:
>   private final Map<ContainerID, ContainerInfo> containerMap;
>   private final Map<ContainerID, Set<ContainerReplica>> replicaMap;
> When we add a new container, we add an entry to both of these sets. When a container is removed, we don’t see to remove from replicaMap (see below). There doesn’t seem to be any way to remove the replicas later once the containerMap entry is gone, so removing the container is leaking the replicas.
>  
> {code:java}
>   public void removeContainer(final ContainerID id) {
>     Preconditions.checkNotNull(id, "ContainerID cannot be null");
>     if (contains(id)) {
>       // Should we revert back to the original state if any of the below
>       // remove operation fails?
>       final ContainerInfo info = containerMap.remove(id);
>       lifeCycleStateMap.remove(info.getState(), id);
>       ownerMap.remove(info.getOwner(), id);
>       repConfigMap.remove(info.getReplicationConfig(), id);
>       typeMap.remove(info.getReplicationType(), id);
>       // Flush the cache of this container type.
>       flushCache(info);
>       LOG.trace("Container {} removed from ContainerStateMap.", id);
>     }
>   } {code}
> You cannot remove the replicas anyway later, as the methods check if the container exists first, which it no longer will, eg:
> {code:java}
> public void removeContainerReplica(final ContainerID containerID,
>     final ContainerReplica replica) {
>   Preconditions.checkNotNull(containerID);
>   Preconditions.checkNotNull(replica);
>   if (contains(containerID)) {
>     replicaMap.get(containerID).remove(replica);
>   }
> } {code}
> Note that deleting a container seems to be a rare operation (eg delete it manually from the CLI). Empty containers are currently marked as deleted, but as far as I can tell, they are not actually removed from SCM.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org