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

   Generated-by: Claude Code (Opus 5.5)
   
   ## What changes were proposed in this pull request?
   
   `OMFileRequest.checkSubDirectoryExists` and `checkSubFileExists` open a 
RocksDB iterator (a point in time view) and skip a child row only if its delete 
tombstone is still in the table cache. The double buffer flush and the cache 
eviction run on their own thread, so a child delete can be flushed and its 
tombstone evicted after the iterator was opened. The iterator then still 
returns the row, the cache lookup returns null, and the child is counted as 
live.
   
   When this happens on one OM only, that OM answers `DIRECTORY_NOT_EMPTY` for 
a non recursive delete of an empty directory and keeps it, while the other OMs 
delete it. `directoryTable` and the bucket `usedNamespace` then diverge between 
OMs.
   
   This PR replaces the cache marker check with `Table.isExist(dbKey)`, which 
looks in the cache first and then reads the DB again. Flush commits to RocksDB 
before eviction and apply is single threaded, so "no cache entry and row absent 
now" means the child was deleted. HDDS-14600 added the cache marker check for 
the same symptom, and HDDS-8526 already rechecks the DB this way for bucket and 
volume emptiness.
   
   Performance: the extra point read happens only for a child row the iterator 
returns without a cache entry, and the loop returns at the first such row that 
still exists. Deleting an empty directory (the success path) does no extra 
read. A non recursive delete of a non empty directory, which fails with 
`DIRECTORY_NOT_EMPTY`, does one point read of a key the iterator has just read. 
This runs before the bucket lock is taken (HDDS-16289), so it does not lengthen 
the lock hold.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-16766
   
   ## How was this patch tested?
   
   `TestOMKeyDeleteRequestWithFSO#testDeleteParentAfterChildDeleted` is 
parameterized with a variant that spies the directory and file tables to delete 
the child row and evict its cache entry right after the emptiness check opens 
its iterator. Without the fix it fails with `expected: <OK> but was: 
<DIRECTORY_NOT_EMPTY>`; with the fix it passes. The related delete, purge and 
rename unit tests pass locally.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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