Devesh Kumar Singh created HDDS-15038:
-----------------------------------------

             Summary: Change cleanupFailedImport() to delete chunks before 
metadata to avoid chunks-only residual state
                 Key: HDDS-15038
                 URL: https://issues.apache.org/jira/browse/HDDS-15038
             Project: Apache Ozone
          Issue Type: Task
          Components: Ozone Datanode
    Affects Versions: 2.1.0
            Reporter: Devesh Kumar Singh
            Assignee: Devesh Kumar Singh


*Description:*
  cleanupFailedImport() currently deletes the container metadata directory 
before deleting the chunks directory. If cleanup is interrupted or partially 
fails between those two steps, the resulting residual on-disk state can be 
chunks/ present with metadata/ missing.

  *Current behavior:*
  cleanupFailedImport() performs cleanup in this order:
  - remove container from DB if schema v3
  - delete metadata/
  - delete chunks/
  - delete parent container directory

*Why this is a problem:*
  A chunks-only residual state is the more dangerous partial state for later 
container handling because metadata-based delete / identification paths depend 
on the metadata path being present. Leaving metadata/ intact is not ideal 
either, but it is more diagnosable and more recoverable than leaving a 
chunks-only directory behind.

  This ticket is intended as a hardening fix. It does not claim to be the sole 
confirmed root cause of the reviewed case, but it reduces the likelihood of 
creating the most problematic partial residual state when import cleanup fails 
midway.

  *Proposed fix:*
  - reverse the directory cleanup order inside cleanupFailedImport()
  - delete chunks/ before metadata/
  - keep the final parent directory cleanup step unchanged

  Suggested target order:
  - remove container DB state if needed
  - delete chunks/
  - delete metadata/
  - delete parent container directory

  Acceptance criteria:
  - cleanupFailedImport() deletes chunks/ before metadata/
  - if cleanup fails midway, the remaining partial on-disk state preferentially 
preserves metadata rather than leaving chunks-only
  - add a focused test that injects cleanup failure between child-directory 
deletions and verifies the resulting residual layout



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to