adoroszlai commented on code in PR #6026:
URL: https://github.com/apache/ozone/pull/6026#discussion_r1460516963
##########
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:
> 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.
The reason for using `synchronized (differ)` is to ensure we have the lock
on the same instance on which we call `notifyAll`. I didn't mean it would
solve the deadlock.
Better solution for the IDE warning: move `notifyAll()` into
`RocksDBCheckpointDiffer#decrementTarballRequestCount`, and wrap it in a
`synchronized (this)` block there.
--
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]