[ https://issues.apache.org/jira/browse/HDFS-6786?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14080397#comment-14080397 ]
Yi Liu commented on HDFS-6786: ------------------------------ Thanks [~cmccabe], I found I had a misunderstanding about the interval so later I confirmed with you offline. :) I still have concern as the front part of the description: if there are a lot of HDFS catch, rescan will be expensive, right? (There are two much stuff in the rescan, {{cachedBlocks}} is very large). The default interval value is 30s, and it will subtract the rescan time and the time of ops if other threads jump into. A worse case is if user set the interval to a more smaller value, then the thread will fall into rescan loop? Rescan will hold FSN lock, won't that affect NN performance? > 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)