zymap commented on code in PR #4038:
URL: https://github.com/apache/bookkeeper/pull/4038#discussion_r1289448738


##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLoggerAllocator.java:
##########
@@ -127,10 +136,16 @@ BufferedLogChannel createNewLog(File dirForNextEntryLog) 
throws IOException {
 
     BufferedLogChannel createNewLogForCompaction(File dirForNextEntryLog) 
throws IOException {
         synchronized (createCompactionLogLock) {
-            return allocateNewLog(dirForNextEntryLog, COMPACTING_SUFFIX);
+            BufferedLogChannel bc = allocateNewLog(dirForNextEntryLog, 
COMPACTING_SUFFIX);
+            writingCompactingLogId = bc.getLogId();
+            return bc;
         }
     }
 
+    void clearCompactingLogId() {
+        writingCompactingLogId = -1;

Review Comment:
   Do we need to guard this by `synchronized (createCompactionLogLock)`?  It 
seems not possible to have race conditions, but I see the 
`createNewLogForCompaction(File dirForNextEntryLog)` is guarded.



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

Reply via email to