ashutosh-bapat commented on a change in pull request #668: HIVE-21841 : Add 
configuration to specify the hostname of HMS leader …to run housekeeping tasks 
in.
URL: https://github.com/apache/hive/pull/668#discussion_r294638599
 
 

 ##########
 File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
 ##########
 @@ -609,22 +609,10 @@ public void init() throws MetaException {
         partitionValidationPattern = null;
       }
 
-      // We only initialize once the tasks that need to be run periodically
-      if (alwaysThreadsInitialized.compareAndSet(false, true)) {
-        ThreadPool.initialize(conf);
-        Collection<String> taskNames =
-            MetastoreConf.getStringCollection(conf, 
ConfVars.TASK_THREADS_ALWAYS);
-        for (String taskName : taskNames) {
-          MetastoreTaskThread task =
-              JavaUtils.newInstance(JavaUtils.getClass(taskName, 
MetastoreTaskThread.class));
-          task.setConf(conf);
-          long freq = task.runFrequency(TimeUnit.MILLISECONDS);
-          // For backwards compatibility, since some threads used to be hard 
coded but only run if
-          // frequency was > 0
-          if (freq > 0) {
-            ThreadPool.getPool().scheduleAtFixedRate(task, freq, freq, 
TimeUnit.MILLISECONDS);
-          }
-        }
+      // We only initialize once the tasks that need to be run periodically. 
For remote metastore
+      // these threads are started along with the other housekeeping threads 
only in the leader HMS.
+      if (!isMetaStoreRemote()) {
 
 Review comment:
   If config is not set, it will be empty, and so the HMS will be leader, so 
the tasks will be run. If the config is set to some other host, the "always 
threads" won't be started since it's not a leader. But in an embedded metastore 
where this config is set, we shouldn't start the threads since the leader is 
going to run those. I have made this change and uploaded a new patch.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to