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 2021/10/26 09:10:19 UTC

[GitHub] [hive] lcspinter commented on a change in pull request #2743: HIVE-25642 Log a warning if multiple Compaction Worker versions are running compactions

lcspinter commented on a change in pull request #2743:
URL: https://github.com/apache/hive/pull/2743#discussion_r736302385



##########
File path: standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/conf/MetastoreConf.java
##########
@@ -571,6 +571,12 @@ public static ConfVars getMetaConf(String name) {
             "tables or partitions to be compacted once they are determined to need compaction.\n" +
             "It will also increase the background load on the Hadoop cluster as more MapReduce jobs\n" +
             "will be running in the background."),
+    COMPACTOR_WORKER_DETECT_MULTIPLE_VERSION_THRESHOLD("metastore.compactor.worker.detect_multiple_versions.threshold",

Review comment:
       Could you please use `.` instead of `_` in the config parameter name? 
   `metastore.compactor.worker.detect.multiple.versions.threshold`

##########
File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/metrics/AcidMetricService.java
##########
@@ -104,12 +110,43 @@ public void run() {
     }
   }
 
-  private void collectMetrics() throws MetaException {
-    ShowCompactResponse currentCompactions = txnHandler.showCompact(new ShowCompactRequest());
+  private void detectMultipleWorkerVersions(ShowCompactResponse currentCompactions) {
+    long workerVersionThresholdInHours = MetastoreConf.getLongVar(conf,
+        MetastoreConf.ConfVars.COMPACTOR_WORKER_DETECT_MULTIPLE_VERSION_THRESHOLD);
+    long since = System.currentTimeMillis() - hoursInMillis(workerVersionThresholdInHours);
+
+    List<String> versions = collectWorkerVersions(currentCompactions.getCompacts(), since);
+    if (versions.size() > 1) {
+      LOG.warn("Multiple Compaction Worker versions detected: {}", versions);
+    }
+  }
+
+  private void updateMetrics(ShowCompactResponse currentCompactions) throws MetaException {
     updateMetricsFromShowCompact(currentCompactions, conf);
     updateDBMetrics();
   }
 
+  @VisibleForTesting
+  public static long hoursInMillis(long hours) {

Review comment:
       You don't need this method, if you get the conf value using 
   `MetastoreConf.getTimeVar(conf, MetastoreConf.ConfVars.COMPACTOR_WORKER_DETECT_MULTIPLE_VERSION_THRESHOLD, TimeUnit.MILLISECONDS)`

##########
File path: standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/conf/MetastoreConf.java
##########
@@ -571,6 +571,12 @@ public static ConfVars getMetaConf(String name) {
             "tables or partitions to be compacted once they are determined to need compaction.\n" +
             "It will also increase the background load on the Hadoop cluster as more MapReduce jobs\n" +
             "will be running in the background."),
+    COMPACTOR_WORKER_DETECT_MULTIPLE_VERSION_THRESHOLD("metastore.compactor.worker.detect_multiple_versions.threshold",
+      "hive.metastore.compactor.worker.detect_versions.threshold", 24,

Review comment:
       You should define the default time unit. 




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