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

Fix potential issue of cache refresh interval

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Not A Problem
    • 2.4.0
    • None
    • caching
    • 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();
                }
      

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: