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

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

shahrs87 commented on code in PR #1744:
URL: https://github.com/apache/phoenix/pull/1744#discussion_r1418022913


##########
phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java:
##########
@@ -3490,7 +3496,11 @@ private void 
invalidateServerMetadataCache(List<InvalidateServerMetadataCacheReq
             // This will incur an extra RPC to the master. This RPC is 
required since we want to
             // get current list of regionservers.
             Collection<ServerName> serverNames = admin.getRegionServers(true);
+            PhoenixStopWatch stopWatch = new PhoenixStopWatch().start();
             invalidateServerMetadataCacheWithRetries(admin, serverNames, 
requests, false);
+            metricsMetadataCachingSource
+                    
.addMetadataCacheInvalidationTotalTime(stopWatch.stop().elapsedMillis());
+            
metricsMetadataCachingSource.incrementMetadataCacheInvalidationSuccessCount();

Review Comment:
   Does this mean we will not update the total time incase the invalidation 
fails? I think we should. WDYT?
   @palashc 



##########
phoenix-core/src/main/java/org/apache/phoenix/coprocessor/metrics/MetricsMetadataCachingSource.java:
##########
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.phoenix.coprocessor.metrics;
+
+import org.apache.hadoop.hbase.metrics.BaseSource;
+
+/**
+ * Interface for metrics about Distributed Metadata Caching
+ */
+public interface MetricsMetadataCachingSource extends BaseSource {
+    // Metrics2 and JMX constants
+    String METRICS_NAME = "MetadataCaching";
+    String METRICS_CONTEXT = "phoenix";
+    String METRICS_DESCRIPTION = "Metrics about Distributed Metadata Caching";
+    String METRICS_JMX_CONTEXT = "RegionServer,sub=" + METRICS_NAME;
+
+    String METADATA_VALIDATION_CACHE_HIT = "metadataValidationCacheHits";
+    String METADATA_VALIDATION_CACHE_HIT_DESC
+            = "Number of cache hits in PhoenixRegionServerEndpoint "
+                + "when serving validate ddl timestamp requests.";
+
+    String METADATA_VALIDATION_CACHE_MISS = "metadataValidationCacheMisses";
+    String METADATA_VALIDATION_CACHE_MISS_DESC
+            = "Number of cache misses in PhoenixRegionServerEndpoint "
+                + "when serving validate ddl timestamp requests.";
+
+    String VALIDATE_DDL_TIMESTAMP_REQUESTS = "validateDDLTimestampRequests";

Review Comment:
   I think you missed the Last in validateLastDDLTimestampRequests



##########
phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java:
##########
@@ -3490,7 +3496,11 @@ private void 
invalidateServerMetadataCache(List<InvalidateServerMetadataCacheReq
             // This will incur an extra RPC to the master. This RPC is 
required since we want to
             // get current list of regionservers.
             Collection<ServerName> serverNames = admin.getRegionServers(true);
+            PhoenixStopWatch stopWatch = new PhoenixStopWatch().start();
             invalidateServerMetadataCacheWithRetries(admin, serverNames, 
requests, false);
+            metricsMetadataCachingSource
+                    
.addMetadataCacheInvalidationTotalTime(stopWatch.stop().elapsedMillis());
+            
metricsMetadataCachingSource.incrementMetadataCacheInvalidationSuccessCount();

Review Comment:
   We also need a metric for metadata cache invalidation failure count like we 
have for success count.





> Metrics for server-side metadata cache
> --------------------------------------
>
>                 Key: PHOENIX-7111
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-7111
>             Project: Phoenix
>          Issue Type: Sub-task
>            Reporter: Palash Chauhan
>            Assignee: Palash Chauhan
>            Priority: Major
>
> Add metrics for monitoring the new metadata caching design. 
>  # Time taken to invalidate cache on all region servers during a DDL operation
>  # Number of failed DDL operations due to failure in cache invalidation
>  # Number of validateLastDDLTimestamp requests per region-server
>  # Cache hits/misses per region-server when validating timestamps



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to