ChengbingLiu opened a new pull request, #5215:
URL: https://github.com/apache/hadoop/pull/5215
### Description of PR
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)` at `<pos1>`, as the
existing test cases do, it will work as expected.
### How was this patch tested?
A test case is added.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]