showuon commented on code in PR #15568:
URL: https://github.com/apache/kafka/pull/15568#discussion_r1533191601


##########
core/src/main/scala/kafka/utils/FileLock.scala:
##########
@@ -65,8 +65,14 @@ class FileLock(val file: File) extends Logging {
   def unlock(): Unit = {
     this synchronized {
       trace(s"Releasing lock on ${file.getAbsolutePath}")
-      if (flock != null)
+      if (flock != null) {
         flock.release()
+        if (file.delete()) {
+          trace(s"Deleted ${file.getAbsolutePath}")
+        } else {
+          warn(s"Could not delete ${file.getAbsolutePath}")
+        }

Review Comment:
   IMO, it is confusing if we do file deletion in `unlock` method. Suppose we 
need unlock and then lock, it'll fail now, right? Maybe delete in `destroy`?



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to