hemantk-12 opened a new pull request, #6443:
URL: https://github.com/apache/ozone/pull/6443

   ## What changes were proposed in this pull request?
   Currently when snapshot is purged, it is not removed from the 
snapshotInfoTable cache. Because of which it is possible that a purged snapshot 
is added by `SnapshotSetProperty` API.
   
   `KeyDeletingService` and `SnapshotDeletingService` are two background 
service which run in parallel.
   1). KeyDeletingService updates deep clean flag and exclusive size for a 
snapshot.
   2). SnapshotDeletingService purges a deleted snapshot.
   
   KeyDeletionService will try to mark a snapshot deep clean here: 
[code](https://github.com/apache/ozone/blob/2f2234c7b61714404399ada8f31b3fb4772b613a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/KeyDeletingService.java#L475)
   Since it is in a loop, it is possible when KeyDeletingService is going over 
all the snapshot. user deletes the snapshot, SnapshotDeletingService kicks in 
and purge the snapshot [code 
here](https://github.com/apache/ozone/blob/2f2234c7b61714404399ada8f31b3fb4772b613a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/SnapshotDeletingService.java#L457).
   Now when `OMSnapshotSetPropertyRequest` gets request to update deep clean 
for the same snapshot (purged by SnapshotDeletingService), it gets the value 
from cache because we don’t purge snapshot from cache on the purge path and 
wait for double buffer flush.
   Now there are two transaction in double buffer one for purge and other for 
updating deep clean.  Some time snapshot can be present in the cache and 
sometime it doesn’t. When it has snapshot in cache, it causes snapshot chain 
corruption because both of the transaction will succeed.
   
   In this change, we are invalidating the cache entry in 
`OMSnapshotPurgeRequest` so that other APIs don't see the snapshot.
   
   ## What is the link to the Apache JIRA
   HDDS-10524
   
   ## How was this patch tested?
   1. Wrote a 
[test](https://github.com/hemantk-12/ozone/blob/HDDS-10524-with-fix/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestSnapshotDeletingService.java#L577)
 to mimic the same behavior as in described in the details. This test was run 
against existing code and with fix. It failed all the time in the existing code 
and passed in fixed code.
       - Flaky test workflow run without fix: 
https://github.com/hemantk-12/ozone/actions/runs/8431100252/job/23088281011
       - Flaky test workflow run with fix: 
https://github.com/hemantk-12/ozone/actions/runs/8431105487/job/23088316218
   
   
   2. Also updated existing unit test to validate before and after snapshot 
purge transaction is committed.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to