Hadoop HDFS
  1. Hadoop HDFS
  2. HDFS-6786

Fix potential issue of cache refresh interval

    Details

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

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

        Activity

        No work has yet been logged on this issue.

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development