[
https://issues.apache.org/jira/browse/HDDS-6449?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17506629#comment-17506629
]
Ethan Rose commented on HDDS-6449:
----------------------------------
One idea is to use a designated "trash" directory on each volume. The
datanode's delete steps would then look like this:
writeLock()
1. The container directory is renamed from its current location to the
trash directory.
- Since this atomic at the filesystem level (one trash dir per volume),
an error leaves the container intact and able to retry deletion.
2. The container is removed from the in-memory container set.
writeUnlock()
3. ICR is sent to SCM indicating the container has been deleted.
- If datanode deletes successfully but SCM never gets the ICR, SCM will
retry the delete command periodically until the datanode sends an FCR
indicating it no longer has the container. This is the same as the existing
logic.
- The datanode has removed the container from its in memory set, so
retrying delete will not accomplish anything here. However, SCM must retry
anyways since it does not know if the datanode actaully got the delete.
- The datanode does not have info on the container anymore to
resend an ICR and update SCM.
- With the default FCR interval of 60 minutes
(HddsConfigKeys#HDDS_CONTAINER_REPORT_INTERVAL_DEFAULT) and the default SCM
delete retry interval of 30 minutes
(ReplicationManager#ReplicationManagerConfiguration#eventTimeout), I think this
existing behavior is ok.
4. The container's contents are removed recursively from the trash
directory.
- If there is an error during this step, we have to choose how to
handle it.
- I think we can ignore it and just do best effort to clear out this
directory on datanode restart.
> Failed container delete can leave artifacts on disk
> ---------------------------------------------------
>
> Key: HDDS-6449
> URL: https://issues.apache.org/jira/browse/HDDS-6449
> Project: Apache Ozone
> Issue Type: Bug
> Components: Ozone Datanode
> Affects Versions: 1.0.0, 1.1.0, 1.2.0
> Reporter: Ethan Rose
> Priority: Major
>
> When SCM issues a delete command to a datanode, the datanode does the
> following steps:
> writeLock()
> 1. The container is removed from the in memory container set.
> writeUnlock()
> 2. The container metadata directory recursively deleted.
> 3. The container chunks directory recursively deleted.
> 4. The datanode sets the container's in memory state to DELETED
> - This is purely for the ICR as the container is not present in the
> container set anymore.
> 5. Datanode sends incremental container report to SCM with the new state.
> - The container has been removed from the in-memory set at this
> point, so once the ICR is sent the container is unreachable.
> In HDDS-6441, A failure in step 2 removed the .container file and
> db.checkpoints directory (unused) from the metadata directory, and the rest
> of the steps were not done after the IO exception was thrown during the
> delete. This caused an error to be logged when the partial state was read on
> datanode restart.
> This current method of deleting containers provides no way to recover from or
> retry a failed delete, because the container is removed from the in-memory
> set as the first step. This Jira aims to change the datanode delete steps so
> that if a delete fails, the existing SCM container delete retry logic or the
> datanode itself can eventually get the lingering state off the disk.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]