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

ASF GitHub Bot commented on PHOENIX-6699:
-----------------------------------------

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


##########
phoenix-core/src/test/java/org/apache/phoenix/monitoring/MetricUtilTest.java:
##########
@@ -48,4 +52,17 @@ public void testGetMetricsStopWatchWithMetricsFalse() throws 
Exception {
                 LogLevel.OFF, WALL_CLOCK_TIME_MS);
         assertFalse(metricsStopWatch.getMetricsEnabled());
     }
+
+    @Test
+    //Check that MetricsSystemImpl has a String "prefix" field in the Hadoop 
version we test with
+    public void testInternalMetricsField() throws NoSuchFieldException,
+            SecurityException, IllegalArgumentException, 
IllegalAccessException {
+        MetricsSystemImpl metrics = (MetricsSystemImpl) 
DefaultMetricsSystem.instance();
+        Field prefixField = MetricsSystemImpl.class.getDeclaredField("prefix");
+        prefixField.setAccessible(true);
+        String oldValue = (String)prefixField.get(metrics);
+        prefixField.set(metrics, "dummy");
+        prefixField.set(metrics, oldValue);
+        prefixField.setAccessible(false);

Review Comment:
   isDefaultMetricsInitialized() already has a catch-all section to avoid 
failing if the API changes, so it cannot really be tested.





> Phoenix metrics overwriting DefaultMetricsSystem in RegionServers
> -----------------------------------------------------------------
>
>                 Key: PHOENIX-6699
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-6699
>             Project: Phoenix
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 5.2.0
>            Reporter: Istvan Toth
>            Assignee: Istvan Toth
>            Priority: Major
>
> There is a race condition in the Hbase and Phoenix metrics handling.
> Hbase metrics is supposed to run in the daemon processes, while Phoenix 
> metrics is supposed to -run on the phoenix client side.- create its own 
> DefaultMetrics object on the client side, and add its metrics to the HBase 
> DefaultMetrics object on the RS side.
> On an RS both HBase and Phoenix tries to register its metrics implementation 
> into DefaultMetricsSystem.
>  
> On the happy path, when Phoenix tries to register its metrics on the RS, it 
> won't have any effect, because HBase has already registered an active Metrics 
> implementation.
> However, JmxCacheBuster stops the Hbase metrics system for ~500ms every five 
> seconds, and if Phoenix tries to initialize its metrics in this period, then 
> it will succeed in initializing its Metrics object, and will overwrite 
> theDefaultMetricsSystem object initialized by HBase.
> This disables the HBase metrics system for the RS process.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to