kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ij...@apache.org
Subject [kafka] branch trunk updated: MINOR: AbstractIndex.close should unmap (#5757)
Date Thu, 11 Oct 2018 00:22:36 GMT
This is an automated email from the ASF dual-hosted git repository.

ijuma pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 8d52b7e  MINOR: AbstractIndex.close should unmap (#5757)
8d52b7e is described below

commit 8d52b7ee0bf67100fa151fef87a2d0a26a915cbf
Author: Ismael Juma <ismael@juma.me.uk>
AuthorDate: Wed Oct 10 17:22:28 2018 -0700

    MINOR: AbstractIndex.close should unmap (#5757)
    
    Reviewers: Dong Lin <lindong28@gmail.com>, Jun Rao <junrao@gmail.com>
---
 core/src/main/scala/kafka/log/AbstractIndex.scala | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/core/src/main/scala/kafka/log/AbstractIndex.scala b/core/src/main/scala/kafka/log/AbstractIndex.scala
index ec9d55f..bf5cc25 100644
--- a/core/src/main/scala/kafka/log/AbstractIndex.scala
+++ b/core/src/main/scala/kafka/log/AbstractIndex.scala
@@ -223,13 +223,7 @@ abstract class AbstractIndex[K, V](@volatile var file: File, val baseOffset:
Lon
    *         not exist
    */
   def deleteIfExists(): Boolean = {
-    inLock(lock) {
-      // On JVM, a memory mapping is typically unmapped by garbage collector.
-      // However, in some cases it can pause application threads(STW) for a long moment reading
metadata from a physical disk.
-      // To prevent this, we forcefully cleanup memory mapping within proper execution which
never affects API responsiveness.
-      // See https://issues.apache.org/jira/browse/KAFKA-4614 for the details.
-      safeForceUnmap()
-    }
+    closeHandler()
     Files.deleteIfExists(file.toPath)
   }
 
@@ -251,9 +245,14 @@ abstract class AbstractIndex[K, V](@volatile var file: File, val baseOffset:
Lon
   /** Close the index */
   def close() {
     trimToValidSize()
+    closeHandler()
   }
 
   def closeHandler(): Unit = {
+    // On JVM, a memory mapping is typically unmapped by garbage collector.
+    // However, in some cases it can pause application threads(STW) for a long moment reading
metadata from a physical disk.
+    // To prevent this, we forcefully cleanup memory mapping within proper execution which
never affects API responsiveness.
+    // See https://issues.apache.org/jira/browse/KAFKA-4614 for the details.
     inLock(lock) {
       safeForceUnmap()
     }


Mime
View raw message