priyeshkaratha opened a new pull request, #11815:
URL: https://github.com/apache/ozone/pull/11815

   ## What changes were proposed in this pull request?
   
   When `ozone.key.lifecycle.service.move.to.trash.enabled` is true, 
`KeyLifecycleService` moves expired keys and directories to 
`.Trash/<owner>/Current` in the bucket instead of deleting them. If the trash 
directory does not exist, `checkAndCreateTrashDirIfNeeded` creates it with a 
`CreateDirectory` request submitted as the bucket owner the task captured when 
it started.
   
   A lifecycle task can run for a long time on a large bucket. If the bucket is 
deleted and recreated (possibly by a different owner) while the task is 
running, the task still holds the old `OmBucketInfo`. It then creates the old 
owner's trash directory inside the new bucket, leaving an unexpected 
`.Trash/<old-owner>` tree owned by a user who may have no relation to the new 
bucket.
   
   This PR re-reads the bucket from the bucket table right before creating the 
trash directory and compares its object ID with the one the task started with. 
If the bucket no longer exists or its object ID changed, trash preparation 
fails:
   - for the owner's trash root, `moveToTrash` aborts processing of that bucket;
   - for a key's parent directory under trash, the key is skipped.
   
   ## What is the link to the Apache JIRA
   
   HDDS-17246
   
   ## How was this patch tested?
   
   Tested by added testcase.
   


-- 
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