Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-6786

Fix potential issue of cache refresh interval

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Not A Problem
    • Affects Version/s: 2.4.0
    • Fix Version/s: None
    • Component/s: caching
    • Labels:
      None
    • Target Version/s:

      Description

      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.

               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();
                }
      

        Attachments

          Activity

            People

            • Assignee:
              hitliuyi Yi Liu
              Reporter:
              hitliuyi Yi Liu
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: