hemantk-12 commented on code in PR #6026:
URL: https://github.com/apache/ozone/pull/6026#discussion_r1457636608


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OMDBCheckpointServlet.java:
##########
@@ -252,13 +252,10 @@ public DBCheckpoint getCheckpoint(Path tmpdir, boolean 
flush)
       checkpoint = getDbStore().getCheckpoint(flush);
     } finally {
       // Unpause the compaction threads.
-      synchronized (getDbStore().getRocksDBCheckpointDiffer()) {
-        differ.decrementTarballRequestCount();
-        differ.notifyAll();
-        long elapsedTime = System.currentTimeMillis() - startTime;
-        LOG.info("Compaction pausing {} ended. Elapsed ms: {}",
-            pauseCounter, elapsedTime);
-      }
+      differ.decrementTarballRequestCount();
+      differ.notifyAll();

Review Comment:
   I remember that `notifyAll()` needs the object lock but I forgot the reason 
https://github.com/apache/ozone/pull/5070/files#r1264234029. Thanks for  
pointing to the doc.
   
   IDE raises "Synchronization on local variable 'differ'" warning if it is 
done like `synchronized (differ)`. That's the reason it was changed to 
`synchronized (getDbStore().getRocksDBCheckpointDiffer())`.
   
   BTW I don't think it matter if lock is taken like `synchronized (differ)` or 
`synchronized (getDbStore().getRocksDBCheckpointDiffer())`. It is still at 
instance level and can cause the deadlock if I'm not wrong.
   
   `differ.decrementTarballRequestCount()` and `LOG.info` don't need the lock. 
decrementTarballRequestCount updates AtomicInteger so lock is not needed.



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