From commits-return-10538-apmail-kafka-commits-archive=kafka.apache.org@kafka.apache.org Thu Oct 11 00:22:38 2018 Return-Path: X-Original-To: apmail-kafka-commits-archive@www.apache.org Delivered-To: apmail-kafka-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4B37618BB4 for ; Thu, 11 Oct 2018 00:22:38 +0000 (UTC) Received: (qmail 87460 invoked by uid 500); 11 Oct 2018 00:22:38 -0000 Delivered-To: apmail-kafka-commits-archive@kafka.apache.org Received: (qmail 87422 invoked by uid 500); 11 Oct 2018 00:22:38 -0000 Mailing-List: contact commits-help@kafka.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@kafka.apache.org Delivered-To: mailing list commits@kafka.apache.org Received: (qmail 87413 invoked by uid 99); 11 Oct 2018 00:22:38 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Oct 2018 00:22:38 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 7340282EEC; Thu, 11 Oct 2018 00:22:37 +0000 (UTC) Date: Thu, 11 Oct 2018 00:22:36 +0000 To: "commits@kafka.apache.org" Subject: [kafka] branch trunk updated: MINOR: AbstractIndex.close should unmap (#5757) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <153921735604.7477.764727601486877047@gitbox.apache.org> From: ijuma@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: kafka X-Git-Refname: refs/heads/trunk X-Git-Reftype: branch X-Git-Oldrev: b63cd6370f53fe8e1e2201c29b03a3e75dbd3db8 X-Git-Newrev: 8d52b7ee0bf67100fa151fef87a2d0a26a915cbf X-Git-Rev: 8d52b7ee0bf67100fa151fef87a2d0a26a915cbf X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated 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 AuthorDate: Wed Oct 10 17:22:28 2018 -0700 MINOR: AbstractIndex.close should unmap (#5757) Reviewers: Dong Lin , Jun Rao --- 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() }