smengcl commented on PR #10987:
URL: https://github.com/apache/ozone/pull/10987#issuecomment-5246778129

   > if step 2 is synchronous call, is it possible to check if the thread has a 
read lock before obtaining write lock and upgrade read to write lock instead of 
waiting for write lock?
   
   @yandrey321 Thanks for the suggestion. Yes the purge call is synchronous on 
`OMDoubleBufferFlushThread`, however the read lock is held by a separate 
KeyDeletingService worker. The KDS and purge operations may also target 
different snapshot UUIDs that map to the same lock stripe, so the flush thread 
has no read lock to upgrade.
   
   ReentrantReadWriteLock does not support safe read-to-write upgrades either. 
This patch instead releases the KDS snapshot DB handles before waiting for the 
OM request, breaking the cross-thread cycle. I have clarified the sequence in 
the PR description.


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