You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2022/02/03 14:35:53 UTC

[GitHub] [hive] vcsomor opened a new pull request #2995: IVE-25926 Move all logging from AcidMetricService to AcidMetricLogger

vcsomor opened a new pull request #2995:
URL: https://github.com/apache/hive/pull/2995


   The common logic required by the `AcidMetricLogger` and the `AcidMetricService` had been extracted to a package-private component `AcidMetricData`.
   This change enabled to move the logging from AcidMetricService to AcidMetricLogger.
   
   Added methods:
   - logMultipleWorkerVersions
   - logFailedCompactionsPercentage
   - logOldestInitiatorAge
   
   Tests added.
   


-- 
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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] klcopp merged pull request #2995: HIVE-25926 Move all logging from AcidMetricService to AcidMetricLogger

Posted by GitBox <gi...@apache.org>.
klcopp merged pull request #2995:
URL: https://github.com/apache/hive/pull/2995


   


-- 
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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] vcsomor commented on a change in pull request #2995: HIVE-25926 Move all logging from AcidMetricService to AcidMetricLogger

Posted by GitBox <gi...@apache.org>.
vcsomor commented on a change in pull request #2995:
URL: https://github.com/apache/hive/pull/2995#discussion_r799259349



##########
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:
       good catch




-- 
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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] vcsomor commented on a change in pull request #2995: HIVE-25926 Move all logging from AcidMetricService to AcidMetricLogger

Posted by GitBox <gi...@apache.org>.
vcsomor commented on a change in pull request #2995:
URL: https://github.com/apache/hive/pull/2995#discussion_r799253835



##########
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:
       :) This is theardest... Correctly name Classes and variables.. I'm Fine with your suggestion `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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] klcopp commented on a change in pull request #2995: HIVE-25926 Move all logging from AcidMetricService to AcidMetricLogger

Posted by GitBox <gi...@apache.org>.
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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org