-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HBASE-27966 HBase Master/RS JVM metrics populated incorrectly #5323
Conversation
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
Hi @apurtell could you please help review this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One comment , but how does this fix the issue?
Edit: I just saw the description in the jira. It might warrant a small comment in the javadoc for getInstance that we want to lazy initialize so that correct process name is in place?
@@ -24,10 +24,12 @@ | |||
@InterfaceAudience.Private | |||
public class MetricsIO { | |||
|
|||
private static MetricsIO instance; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably should be volatile. Below in your new method, you should do synchronization if it's null so it only gets instantiated once. Example: https://github.com/apache/hbase/blob/master/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcClientConfigHelper.java#L87
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably should be volatile. Below in your new method, you should do synchronization if it's null so it only gets instantiated once. Example: https://github.com/apache/hbase/blob/master/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcClientConfigHelper.java#L87
Update the logic as per suggestion.
Done, please review. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
private final MetricsIOSource source; | ||
private final MetricsIOWrapper wrapper; | ||
|
||
public MetricsIO(MetricsIOWrapper wrapper) { | ||
// visible for testing only |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could use the annotation @VisibleForTesting
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I initially thought to add same but checked code and found this is banned now. See
Line 2535 in f6c5dbe
<bannedImport>org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting</bannedImport> |
So added a comment "visible for testing only" as done at other places in code base. See https://github.com/search?q=repo%3Aapache%2Fhbase+%22visible+for+testing%22&type=code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could use RestrictedApi to restrict the place where we can call this method. It will cause a compilation error if called from other places in the error prone check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done with commit 0a7b561 and updated PR.
private final MetricsIOSource source; | ||
private final MetricsIOWrapper wrapper; | ||
|
||
public MetricsIO(MetricsIOWrapper wrapper) { | ||
// visible for testing only | ||
MetricsIO(MetricsIOWrapper wrapper) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
weird here, here is implementing a singleton, but there is still a public constructor...
is it used somewhere? if not, could we just delete it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it is being used in a test case, hence had to keep it and changed scope from public
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Thank you for the reviews @bbeaudreault and @Reidddddd. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry this fell off my radar. LGTM!
After checking the code, I think we should change the implementation for DefaultMetricsSystemInitializer? It should be called when we create HMaster or HRegionServer, not in BaseSourceImpl? Have you read the commit history about why we just add a call in the Constructor of BaseSourceImpl? It looks strange to initialize JvmMetrics with a metrics name instead of the actual process name. Thanks. |
Hi @Apache9 thanks for your input. I had put up an RCA at https://issues.apache.org/jira/browse/HBASE-27966?focusedCommentId=17741087&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-17741087. One of the proposed solution was to do following (let's call this approach 1) :
But based on discussion went ahead with a simpler fix, i.e. approach 2, which was as follow:
and hence I did not try to see the details of how to fix using approach 1. Could we work on approach 1 with another ticket after taking this as a stop-gap? Or do you want me to switch to approach 1 and revert the code changes done here? Please let me know how we should move ahead. I will work on following review comment:
based on what we decide here |
I think we should finally go with approach 1 but I'm also OK for having a quick fix. So if you have already tested the patch on your deployment and it does work, I'm OK with merging the current PR first. But let's open an issue for approach 1 first so we will not forget to do it. Thanks. |
@Apache9 Thanks for the quick response.
Yes this has been tested E2E in our deployment along with the dependent component i.e. ambari.
Sure let me create a JIRA for the same for follow up work. Also will update this PR with the review comments' fix as another commit here. |
Created https://issues.apache.org/jira/browse/HBASE-28026 for follow up work |
Addressed review comment and updated PR with commit 0a7b561 |
💔 -1 overall
This message was automatically generated. |
…hadoop.hbase.io.MetricsIO#MetricsIO(org.apache.hadoop.hbase.io.MetricsIOWrapper)
Over-wrote last commit to also take care of adding the file MetricIO.java itself into list of restricted paths, which was missed earlier. See diff. (My bad, used |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
…#5364) Signed-off-by: Bryan Beaudreault <[email protected]> Signed-off-by: Duo Zhang <[email protected]> Signed-off-by: Reid Chan <[email protected]>
…#5364) Signed-off-by: Bryan Beaudreault <[email protected]> Signed-off-by: Duo Zhang <[email protected]> Signed-off-by: Reid Chan <[email protected]> (cherry picked from commit 2713a3c)
…ncorrectly (apache#5323) (apache#5364) Signed-off-by: Bryan Beaudreault <[email protected]> Signed-off-by: Duo Zhang <[email protected]> Signed-off-by: Reid Chan <[email protected]>
Signed-off-by: Bryan Beaudreault <[email protected]> Signed-off-by: Duo Zhang <[email protected]> Signed-off-by: Reid Chan <[email protected]>
No description provided.