Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-18567

LogThrottlingHelper: the dependent recorder is not triggered correctly

    XMLWordPrintableJSON

Details

    • Reviewed

    Description

      The current implementation of LogThrottlingHelper works well most of the time, but it missed out one case, which appears quite common in the production codes:

      • if the dependent recorder was not suppressed before the primary one is triggered on the next period, then the next logging of the dependent recorder will be unexpectedly suppressed.
          helper = new LogThrottlingHelper(LOG_PERIOD, "foo", timer);
      
          assertTrue(helper.record("foo", 0).shouldLog());
          assertTrue(helper.record("bar", 0).shouldLog());
      
          // Both should log once the period has elapsed
          // <pos1>
          assertTrue(helper.record("foo", LOG_PERIOD).shouldLog());
          assertTrue(helper.record("bar", LOG_PERIOD).shouldLog()); <--- This assertion will now fail
      

      Note if we call helper.record("bar", LOG_PERIOD * 2) in <pos1>, as the existing test cases do, it will work as expected.

      Attachments

        Issue Links

          Activity

            People

              chengbing.liu Chengbing Liu
              chengbing.liu Chengbing Liu
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: