Details
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
- is related to
-
HADOOP-15726 Create utility to limit frequency of log statements
- Resolved
- links to