Return-Path: X-Original-To: apmail-hadoop-hdfs-issues-archive@minotaur.apache.org Delivered-To: apmail-hadoop-hdfs-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 22D6F11068 for ; Fri, 1 Aug 2014 07:49:44 +0000 (UTC) Received: (qmail 38368 invoked by uid 500); 1 Aug 2014 07:49:38 -0000 Delivered-To: apmail-hadoop-hdfs-issues-archive@hadoop.apache.org Received: (qmail 38307 invoked by uid 500); 1 Aug 2014 07:49:38 -0000 Mailing-List: contact hdfs-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hdfs-issues@hadoop.apache.org Delivered-To: mailing list hdfs-issues@hadoop.apache.org Received: (qmail 38294 invoked by uid 99); 1 Aug 2014 07:49:38 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Aug 2014 07:49:38 +0000 Date: Fri, 1 Aug 2014 07:49:38 +0000 (UTC) From: "Yi Liu (JIRA)" To: hdfs-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HDFS-6786) Fix potential issue of cache refresh interval MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HDFS-6786?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14082041#comment-14082041 ] Yi Liu commented on HDFS-6786: ------------------------------ Thanks [~andrew.wang] and [~cmccabe], let's keep as what it was. > Fix potential issue of cache refresh interval > --------------------------------------------- > > Key: HDFS-6786 > URL: https://issues.apache.org/jira/browse/HDFS-6786 > Project: Hadoop HDFS > Issue Type: Bug > Components: caching > Affects Versions: 2.4.0 > Reporter: Yi Liu > Assignee: Yi Liu > > In {{CacheReplicationMonitor}}, following code is try to check whether needs to rescan every interval ms, if rescan takes n ms, then subtract n ms for the interval. But if the delta <=0, it breaks and start rescan, there will be potential issue: if user set the interval to a small value or rescan finished after a while exceeding the interval, then rescan will happen in loop. Furthermore, {{delta <= 0}} trigger the rescan should not be the intention, since if needs rescan, {{needsRescan}} will be set. > {code} > while (true) { > if (shutdown) { > LOG.info("Shutting down CacheReplicationMonitor"); > return; > } > if (needsRescan) { > LOG.info("Rescanning because of pending operations"); > break; > } > long delta = (startTimeMs + intervalMs) - curTimeMs; > if (delta <= 0) { > LOG.info("Rescanning after " + (curTimeMs - startTimeMs) + > " milliseconds"); > break; > } > doRescan.await(delta, TimeUnit.MILLISECONDS); > curTimeMs = Time.monotonicNow(); > } > {code} -- This message was sent by Atlassian JIRA (v6.2#6252)