Wei-Chiu Chuang created HDDS-18010:
--------------------------------------

             Summary: Snapshot defrag fails while pathPreviousSnapshotId still 
points at a deleted snapshot
                 Key: HDDS-18010
                 URL: https://issues.apache.org/jira/browse/HDDS-18010
             Project: Apache Ozone
          Issue Type: Bug
            Reporter: Wei-Chiu Chuang


h3. What goes wrong

After a large bulk snapshot purge, the *first still-active snapshot* on a 
bucket path can fail defrag on every interval. The OM logs repeat 
{{FILE_NOT_FOUND}} / "Snapshot ... is no longer active" while other snapshots 
in the same bucket continue to defrag.

h3. Why

* {{SnapshotDefragService.checkAndDefragSnapshot}} uses 
{{pathPreviousSnapshotId}} on {{SnapshotInfo}} as the incremental base.
* Snapshot purge rewrites that pointer *slowly*, one deleted snapshot at a time.
* Until purge catches up, {{pathPreviousSnapshotId}} may still reference a 
snapshot in {{SNAPSHOT_DELETED}} status.
* Defrag then calls {{OmSnapshotManager.getActiveSnapshot}} on that deleted 
name and fails.

Example (Cloudera CDPD-129719): keep snapshot 1, delete snapshots 2–1000, 
create 1001–2000. Defrag of snapshot 1001 fails until purge moves 
{{pathPreviousSnapshotId}} back to an active predecessor (snapshot 1).

h3. Fix

Walk {{pathPreviousSnapshotId}} along the path chain until an *active* snapshot 
is found (or there is no path-previous, in which case run full defrag). Use 
that snapshot for the checkpoint base and incremental diff.

h3. Testing

Unit test 
{{TestSnapshotDefragService#testCheckAndDefragUsesActivePathPreviousWhenImmediatePreviousIsDeleted}}
 — fails on master without the fix, passes with it.




--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

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

Reply via email to