joshelser commented on code in PR #1431:
URL: https://github.com/apache/phoenix/pull/1431#discussion_r862109064


##########
phoenix-core/src/main/java/org/apache/phoenix/monitoring/MetricUtil.java:
##########
@@ -38,4 +46,22 @@ public static MetricsStopWatch getMetricsStopWatch(boolean 
isRequestMetricsEnabl
         return new MetricsStopWatch(true);
     }
 
+    // We need to cover the case when JmxCacheBuster has just stopped the 
HBase metrics
+    // system, and not accidentally overwrite the DefaultMetricsSystem 
singleton.
+    // See PHOENIX-6699
+    public static boolean isDefaultMetricsInitialized() {
+        try {
+            MetricsSystemImpl metrics = (MetricsSystemImpl) 
DefaultMetricsSystem.instance();
+            Field prefixField = 
MetricsSystemImpl.class.getDeclaredField("prefix");

Review Comment:
   > I don't think we have to worry about a race around prefix, AFAICT by the 
time the Phoenix classes are loaded, HBase has long initialized DefaultMetrics, 
and prefix has been set.
   
   Ah, ok, I wondered if I was completely worrying about a non-issue.
   
   > Of course, this, like many Metrics stuff, is a huge hack, we shouldn't 
need to use reflection to check if DefaultMetricsSystem has been initialized 
already.
   
   Yeah, that's life with hadoop metrics2 :)
   
   > Also, we could just to check if we are and RS/Master process, and skip the 
initialization, but I don't know a way to do that.
   
   Hrm, I think we could do that (let me see what I can dig up). What about 
Geoffrey's point about the server-side metrics stuff we do have in Phoenix?



-- 
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]

Reply via email to