Yi Liu created HDFS-6786: ---------------------------- Summary: 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: 3.0.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)