hadoop-common-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yiqun Lin (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HADOOP-13210) MetricsSinkAdapter always reset retryDelay and retryCount
Date Fri, 27 May 2016 02:56:12 GMT
Yiqun Lin created HADOOP-13210:
----------------------------------

             Summary: MetricsSinkAdapter always reset retryDelay and retryCount
                 Key: HADOOP-13210
                 URL: https://issues.apache.org/jira/browse/HADOOP-13210
             Project: Hadoop Common
          Issue Type: Bug
          Components: metrics
            Reporter: Yiqun Lin


In {{MetricsSinkAdapter#publishMetricsFromQueue}}, it always reset the {{retryDelay}} and
{{retryCount}} in each loop.
{code}
  void publishMetricsFromQueue() {
    int retryDelay = firstRetryDelay;
    int n = retryCount;
    int minDelay = Math.min(500, retryDelay * 1000); // millis
    Random rng = new Random(System.nanoTime());
    while (!stopping) {
      try {
        queue.consumeAll(this);
        refreshQueueSizeGauge();
        retryDelay = firstRetryDelay;
        n = retryCount;
        inError = false;
      } catch (InterruptedException e) {
        LOG.info(name +" thread interrupted.");
      } catch (Exception e) {
        if (n > 0) {
          int retryWindow = Math.max(0, 1000 / 2 * retryDelay - minDelay);
          int awhile = rng.nextInt(retryWindow) + minDelay;
          if (!inError) {
            LOG.error("Got sink exception, retry in "+ awhile +"ms", e);
          }
          retryDelay *= retryBackoff;
          try { Thread.sleep(awhile); }
          catch (InterruptedException e2) {
            LOG.info(name +" thread interrupted while waiting for retry", e2);
          }
          --n;
        } else {
          if (!inError) {
            LOG.error("Got sink exception and over retry limit, "+
                      "suppressing further error messages", e);
          }
          queue.clear();
          refreshQueueSizeGauge();
          inError = true; // Don't keep complaining ad infinitum
        }
      }
    }
  }
{code}
It looks the change of these in catch block code will not comes into effect. I think we should
remove these two line because the values have been initalized before in {{publishMetricsFromQueue}}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: common-dev-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-dev-help@hadoop.apache.org


Mime
View raw message