[ 
https://issues.apache.org/jira/browse/HADOOP-15726?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16607744#comment-16607744
 ] 

Erik Krogen commented on HADOOP-15726:
--------------------------------------

* Agreed that the name was not very good... I settled on 
{{LogThrottlingHelper}}.
* The {{Timer}} is needed for testing. That's why the constructor which accepts 
it is package-private. I marked it {{@VisibleForTesting}}.
* For the assertion to check {{values.length}}, this is done within 
{{LoggingAction#addValues()}}, which will throw an 
{{IllegalArgumentException}}. I think this is sufficient; let me know if you 
disagree.
* I think we can't clear the existing one since we have returned it to the 
caller. We don't know what they might do with it; I think it is simpler for the 
caller to be assured that it won't change after they receive it.
* I think your point about "time based primary" is valid. Previously I allowed 
the case where there was no primary, but I think I like it better that if you 
don't explicitly set a primary, then the first one becomes the primary. I made 
this change.

Attached v001 patch.

> Create utility to limit frequency of log statements
> ---------------------------------------------------
>
>                 Key: HADOOP-15726
>                 URL: https://issues.apache.org/jira/browse/HADOOP-15726
>             Project: Hadoop Common
>          Issue Type: Improvement
>          Components: common, util
>            Reporter: Erik Krogen
>            Assignee: Erik Krogen
>            Priority: Major
>         Attachments: HADOOP-15726.000.patch, HADOOP-15726.001.patch
>
>
> There is a common pattern of logging a behavior that is normally extraneous. 
> Under some circumstances, such a behavior becomes common, flooding the logs 
> and making it difficult to see what else is going on in the system. Under 
> such situations it is beneficial to limit how frequently the extraneous 
> behavior is logged, while capturing some summary information about the 
> suppressed log statements.
> This is currently implemented in {{FSNamesystemLock}} (in HDFS-10713). We 
> have additional use cases for this in HDFS-13791, so this is a good time to 
> create a common utility for different sites to share this logic.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to