[ https://issues.apache.org/jira/browse/HIVE-23668?focusedWorklogId=447987&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-447987 ]
ASF GitHub Bot logged work on HIVE-23668: ----------------------------------------- Author: ASF GitHub Bot Created on: 18/Jun/20 19:02 Start Date: 18/Jun/20 19:02 Worklog Time Spent: 10m Work Description: pkumarsinha commented on a change in pull request #1129: URL: https://github.com/apache/hive/pull/1129#discussion_r442437302 ########## File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ReplicationMetricsMaintTask.java ########## @@ -0,0 +1,80 @@ +/* + * 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.hadoop.hive.metastore; + +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.hive.metastore.conf.MetastoreConf; +import org.apache.hadoop.hive.metastore.conf.MetastoreConf.ConfVars; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.concurrent.TimeUnit; + +/** + * Metastore task to remove old replication metrics. + */ +public class ReplicationMetricsMaintTask implements MetastoreTaskThread { + private static final Logger LOG = LoggerFactory.getLogger(ReplicationMetricsMaintTask.class); + + private Configuration conf; + + @Override + public long initialDelay(TimeUnit unit) { + // no delay before the first execution; + // after an ungracefull shutdown it might take time to notice that in-flight scheduled queries are not running anymore + return 0; + } + + @Override + public long runFrequency(TimeUnit unit) { + return MetastoreConf.getTimeVar(conf, ConfVars.REPL_METRICS_CLEANUP_FREQUENCY, + TimeUnit.DAYS); + } + + @Override + public void setConf(Configuration configuration) { + conf = configuration; + } + + @Override + public Configuration getConf() { + return conf; + } + + @Override + public void run() { + try { + if (!MetastoreConf.getBoolVar(conf, ConfVars.SCHEDULED_QUERIES_ENABLED)) { + return; + } + RawStore ms = HiveMetaStore.HMSHandler.getMSForConf(conf); Review comment: nit: Can remove the empty lines. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 447987) Time Spent: 2h 20m (was: 2h 10m) > Clean up Task for Hive Metrics > ------------------------------ > > Key: HIVE-23668 > URL: https://issues.apache.org/jira/browse/HIVE-23668 > Project: Hive > Issue Type: Task > Reporter: Aasha Medhi > Assignee: Aasha Medhi > Priority: Major > Labels: pull-request-available > Attachments: HIVE-23668.01.patch, HIVE-23668.02.patch, > HIVE-23668.03.patch > > Time Spent: 2h 20m > Remaining Estimate: 0h > -- This message was sent by Atlassian Jira (v8.3.4#803005)