[ 
https://issues.apache.org/jira/browse/HIVE-25926?focusedWorklogId=720704&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-720704
 ]

ASF GitHub Bot logged work on HIVE-25926:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 04/Feb/22 08:27
            Start Date: 04/Feb/22 08:27
    Worklog Time Spent: 10m 
      Work Description: klcopp commented on a change in pull request #2995:
URL: https://github.com/apache/hive/pull/2995#discussion_r799240530



##########
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/metrics/AcidMetricLogger.java
##########
@@ -89,6 +102,42 @@ private void logDeltaMetrics() throws MetaException {
         AcidMetricService.getDeltaCountKey(d.getDbName(), d.getTblName(), 
d.getPartitionName()), d.getMetricValue())));
   }
 
+  private void logOldestInitiatorAge(AcidMetricData acidMetricData) {
+    int oldestInitiatorAge = (int) ((System.currentTimeMillis() - 
acidMetricData.getOldestEnqueueTime()) / 1000L);
+    String oldestInitiatorMessage = "Found compaction entry in compaction 
queue with an age of {} seconds. " +
+        "Consider increasing the number of worker threads.";
+    long oldestInitiatedWarningThreshold = MetastoreConf.getTimeVar(conf,
+        
MetastoreConf.ConfVars.COMPACTOR_OLDEST_INITIATED_COMPACTION_TIME_THRESHOLD_WARNING,
+        TimeUnit.SECONDS);
+    long oldestInitiatedErrorThreshold = MetastoreConf.getTimeVar(conf,
+        
MetastoreConf.ConfVars.COMPACTOR_OLDEST_INITIATED_COMPACTION_TIME_THRESHOLD_ERROR,
+        TimeUnit.SECONDS);
+    if (oldestInitiatorAge >= oldestInitiatedErrorThreshold) {
+      LOG.error(oldestInitiatorMessage, oldestInitiatorAge);
+    } else if (oldestInitiatorAge >= oldestInitiatedWarningThreshold) {
+      LOG.warn(oldestInitiatorMessage, oldestInitiatorAge);
+    }
+  }
+
+  private void logMultipleWorkerVersions(AcidMetricData acidMetricData) {
+    long workerVersionThresholdInMillis = MetastoreConf.getTimeVar(conf,
+        
MetastoreConf.ConfVars.COMPACTOR_WORKER_DETECT_MULTIPLE_VERSION_THRESHOLD, 
TimeUnit.MILLISECONDS);

Review comment:
       Might want to update the description of this config in MetastoreConf, it 
mentions metastore.acidmetrics.thread.on.

##########
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/metrics/AcidMetricData.java
##########
@@ -0,0 +1,210 @@
+/*
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.hadoop.hive.metastore.metrics;
+
+import com.google.common.collect.ImmutableList;
+import org.apache.hadoop.hive.metastore.api.ShowCompactResponseElement;
+import org.apache.hadoop.hive.metastore.txn.TxnStore;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+import static 
org.apache.hadoop.hive.metastore.HiveMetaStoreClient.MANUALLY_INITIATED_COMPACTION;
+import static org.apache.hadoop.hive.metastore.utils.MetaStoreUtils.NO_VAL;
+import static 
org.apache.hadoop.hive.metastore.utils.MetaStoreUtils.getHostFromId;
+import static 
org.apache.hadoop.hive.metastore.utils.MetaStoreUtils.getThreadIdFromId;
+
+final class AcidMetricData {

Review comment:
       I'm not sure about this name, (also because getDbMetrics() gets a 
MetricsInfo object, and someone in the future is going to confuse them) .. 
since all info is gotten from the compaction queue/completed compactions, what 
do you think about naming it CompactionMetricData?




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


Issue Time Tracking
-------------------

            Worklog Id:     (was: 720704)
    Remaining Estimate: 0h
            Time Spent: 10m

> Move all logging from AcidMetricService to AcidMetricLogger
> -----------------------------------------------------------
>
>                 Key: HIVE-25926
>                 URL: https://issues.apache.org/jira/browse/HIVE-25926
>             Project: Hive
>          Issue Type: Bug
>          Components: Metastore
>    Affects Versions: 4.0.0
>            Reporter: Viktor Csomor
>            Assignee: Viktor Csomor
>            Priority: Minor
>              Labels: pull-request-available
>             Fix For: 4.0.0
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Some logging is left over in AcidMetricService (which used to both log 
> errors/warnings and emit metrics, and now just emits metrics). Logging should 
> be in the AcidMetricLogger as much as possible. Stragglers left over in 
> AcidMetricService:
>  * compaction_oldest_enqueue_age_in_sec
>  * COMPACTOR_FAILED_COMPACTION_RATIO_THRESHOLD logging
>  * Multiple Compaction Worker versions (in method: 
> detectMultipleWorkerVersions)



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to