Repository: helix
Updated Branches:
  refs/heads/master d75d5fcdc -> 5033785c2


[HELIX-762] TASK: Change LOG mode from info to debug

In production, it was observed that some users were running thousands of tasks, 
and since AssignableInstance leaves a line of log for each task assigned or 
released, the amount of log that was being generated was too much, and it was 
too verbose.
Changelist:
1. Change the logging mode from info to debug in AssignableInstance and 
AssignableInstanceManager


Project: http://git-wip-us.apache.org/repos/asf/helix/repo
Commit: http://git-wip-us.apache.org/repos/asf/helix/commit/e7b960c2
Tree: http://git-wip-us.apache.org/repos/asf/helix/tree/e7b960c2
Diff: http://git-wip-us.apache.org/repos/asf/helix/diff/e7b960c2

Branch: refs/heads/master
Commit: e7b960c22896c08337292d20f674f20a7f1391d0
Parents: d75d5fc
Author: Hunter Lee <[email protected]>
Authored: Fri Oct 26 18:32:16 2018 -0700
Committer: Hunter Lee <[email protected]>
Committed: Fri Oct 26 18:33:25 2018 -0700

----------------------------------------------------------------------
 .../helix/task/AssignableInstanceManager.java   | 16 +++----
 .../helix/task/assigner/AssignableInstance.java | 44 ++++++++++----------
 2 files changed, 30 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/helix/blob/e7b960c2/helix-core/src/main/java/org/apache/helix/task/AssignableInstanceManager.java
----------------------------------------------------------------------
diff --git 
a/helix-core/src/main/java/org/apache/helix/task/AssignableInstanceManager.java 
b/helix-core/src/main/java/org/apache/helix/task/AssignableInstanceManager.java
index abe5f1c..2693005 100644
--- 
a/helix-core/src/main/java/org/apache/helix/task/AssignableInstanceManager.java
+++ 
b/helix-core/src/main/java/org/apache/helix/task/AssignableInstanceManager.java
@@ -80,7 +80,7 @@ public class AssignableInstanceManager {
       AssignableInstance assignableInstance =
           new AssignableInstance(clusterConfig, instanceConfig, liveInstance);
       _assignableInstanceMap.put(instanceConfig.getInstanceName(), 
assignableInstance);
-      LOG.info("AssignableInstance created for instance: {}", instanceName);
+      LOG.debug("AssignableInstance created for instance: {}", instanceName);
     }
 
     // Update task profiles by traversing all TaskContexts
@@ -89,7 +89,7 @@ public class AssignableInstanceManager {
       JobConfig jobConfig = jobConfigMap.get(jobName);
       JobContext jobContext = taskDataCache.getJobContext(jobName);
       if (jobConfig == null || jobContext == null) {
-        LOG.warn(
+        LOG.debug(
             "JobConfig or JobContext for this job is null. Skipping this job! 
Job name: {}, JobConfig: {}, JobContext: {}",
             jobName, jobConfig, jobContext);
         continue; // Ignore this job if either the config or context is null
@@ -115,7 +115,7 @@ public class AssignableInstanceManager {
             taskId = String.format("%s_%s", jobConfig.getJobId(), taskIndex);
           }
           if (assignedInstance == null) {
-            LOG.warn(
+            LOG.debug(
                 "This task's TaskContext does not have an assigned instance! 
Task will be ignored. "
                     + "Job: {}, TaskId: {}, TaskIndex: {}",
                 jobContext.getName(), taskId, taskIndex);
@@ -128,11 +128,11 @@ public class AssignableInstanceManager {
                 assignableInstance.restoreTaskAssignResult(taskId, taskConfig, 
quotaType);
             if (taskAssignResult.isSuccessful()) {
               _taskAssignResultMap.put(taskId, taskAssignResult);
-              LOG.info("TaskAssignResult restored for taskId: {}, assigned on 
instance: {}", taskId,
+              LOG.debug("TaskAssignResult restored for taskId: {}, assigned on 
instance: {}", taskId,
                   assignedInstance);
             }
           } else {
-            LOG.warn(
+            LOG.debug(
                 "While building AssignableInstance map, discovered that the 
instance a task is assigned to is no "
                     + "longer a LiveInstance! TaskAssignResult will not be 
created and no resource will be taken "
                     + "up for this task. Job: {}, TaskId: {}, TaskIndex: {}, 
Instance: {}",
@@ -179,7 +179,7 @@ public class AssignableInstanceManager {
         AssignableInstance assignableInstance =
             new AssignableInstance(clusterConfig, instanceConfig, 
liveInstance);
         _assignableInstanceMap.put(instanceName, assignableInstance);
-        LOG.info("AssignableInstance created for instance: {} during 
updateAssignableInstances",
+        LOG.debug("AssignableInstance created for instance: {} during 
updateAssignableInstances",
             instanceName);
       }
       // Remove because we've confirmed that this AssignableInstance is a 
LiveInstance as well
@@ -196,14 +196,14 @@ public class AssignableInstanceManager {
           if 
(_taskAssignResultMap.get(taskToRemove).getAssignableInstance().getInstanceName()
               .equals(instanceToBeRemoved.getInstanceName())) {
             _taskAssignResultMap.remove(taskToRemove); // TODO: Hunter: Move 
this if necessary
-            LOG.info(
+            LOG.debug(
                 "TaskAssignResult removed because its assigned instance is no 
longer live. TaskID: {}, instance: {}",
                 taskToRemove, instanceToBeRemoved.getInstanceName());
           }
         }
       }
       _assignableInstanceMap.remove(instanceToBeRemoved.getInstanceName());
-      LOG.info(
+      LOG.debug(
           "Non-live AssignableInstance removed for instance: {} during 
updateAssignableInstances",
           instanceToBeRemoved.getInstanceName());
     }

http://git-wip-us.apache.org/repos/asf/helix/blob/e7b960c2/helix-core/src/main/java/org/apache/helix/task/assigner/AssignableInstance.java
----------------------------------------------------------------------
diff --git 
a/helix-core/src/main/java/org/apache/helix/task/assigner/AssignableInstance.java
 
b/helix-core/src/main/java/org/apache/helix/task/assigner/AssignableInstance.java
index a1f2fd4..be38ab4 100644
--- 
a/helix-core/src/main/java/org/apache/helix/task/assigner/AssignableInstance.java
+++ 
b/helix-core/src/main/java/org/apache/helix/task/assigner/AssignableInstance.java
@@ -113,18 +113,18 @@ public class AssignableInstance {
       resourceCapacity = new HashMap<>();
       
resourceCapacity.put(LiveInstance.InstanceResourceType.TASK_EXEC_THREAD.name(),
           Integer.toString(TaskStateModelFactory.TASK_THREADPOOL_SIZE));
-      logger.info("No resource capacity provided in LiveInstance {}, assuming 
default capacity: {}",
+      logger.debug("No resource capacity provided in LiveInstance {}, assuming 
default capacity: {}",
           _instanceConfig.getInstanceName(), resourceCapacity);
     }
 
     if (typeQuotaRatio == null) {
       typeQuotaRatio = new HashMap<>();
       typeQuotaRatio.put(DEFAULT_QUOTA_TYPE, Integer.toString(1));
-      logger.info("No quota type ratio provided in LiveInstance {}, assuming 
default ratio: {}",
+      logger.debug("No quota type ratio provided in LiveInstance {}, assuming 
default ratio: {}",
           _instanceConfig.getInstanceName(), typeQuotaRatio);
     }
 
-    logger.info(
+    logger.debug(
         "Updating capacity for AssignableInstance {}. Resource Capacity: {}; 
Type Quota Ratio: {}",
         _instanceConfig.getInstanceName(), resourceCapacity, typeQuotaRatio);
 
@@ -135,7 +135,7 @@ public class AssignableInstance {
         int capacity = Integer.valueOf(resEntry.getValue());
 
         if (!_totalCapacity.containsKey(resourceType)) {
-          logger.info("Adding InstanceResourceType {}", resourceType);
+          logger.debug("Adding InstanceResourceType {}", resourceType);
           _usedCapacity.put(resourceType, new HashMap<String, Integer>());
         }
         tempTotalCapacity.put(resourceType, new HashMap<String, Integer>());
@@ -162,7 +162,7 @@ public class AssignableInstance {
 
           // Add quota for new quota type
           if (!_usedCapacity.get(resourceType).containsKey(quotaType)) {
-            logger.info("Adding QuotaType {} for resource {}", quotaType, 
resourceType);
+            logger.debug("Adding QuotaType {} for resource {}", quotaType, 
resourceType);
             _usedCapacity.get(resourceType).put(quotaType, 0);
           }
         }
@@ -177,13 +177,13 @@ public class AssignableInstance {
       // Purge used capacity for resource deleted
       _usedCapacity.keySet().retainAll(resourceCapacity.keySet());
 
-      logger.info(
+      logger.debug(
           "Finished updating capacity for AssignableInstance {}. Current 
capacity {}. Current usage: {}",
           _instanceConfig.getInstanceName(), _totalCapacity, _usedCapacity);
     } catch (Exception e) {
       // TODO: properly escalate error
       logger.error(
-          "Failed to update capacity for Assignableinstance {}, still using 
current capacity {}. Current usage: {}",
+          "Failed to update capacity for AssignableInstance {}, still using 
current capacity {}. Current usage: {}",
           _instanceConfig.getInstanceName(), _totalCapacity, _usedCapacity, e);
     }
   }
@@ -196,14 +196,14 @@ public class AssignableInstance {
    */
   public void updateConfigs(ClusterConfig clusterConfig, InstanceConfig 
instanceConfig,
       LiveInstance liveInstance) {
-    logger.info("Updating configs for AssignableInstance {}", 
_instanceConfig.getInstanceName());
+    logger.debug("Updating configs for AssignableInstance {}", 
_instanceConfig.getInstanceName());
     boolean refreshCapacity = false;
     if (clusterConfig != null && clusterConfig.getTaskQuotaRatioMap() != null) 
{
       if 
(!clusterConfig.getTaskQuotaRatioMap().equals(_clusterConfig.getTaskQuotaRatioMap()))
 {
         refreshCapacity = true;
       }
       _clusterConfig = clusterConfig;
-      logger.info("Updated cluster config");
+      logger.debug("Updated cluster config");
     }
 
     if (liveInstance != null) {
@@ -217,7 +217,7 @@ public class AssignableInstance {
           refreshCapacity = true;
         }
         _liveInstance = liveInstance;
-        logger.info("Updated live instance");
+        logger.debug("Updated live instance");
       }
     }
 
@@ -228,7 +228,7 @@ public class AssignableInstance {
             _instanceConfig.getInstanceName(), 
instanceConfig.getInstanceName());
       } else {
         _instanceConfig = instanceConfig;
-        logger.info("Updated instance config");
+        logger.debug("Updated instance config");
       }
     }
 
@@ -236,7 +236,7 @@ public class AssignableInstance {
       refreshTotalCapacity();
     }
 
-    logger.info("Updated configs for AssignableInstance {}", 
_instanceConfig.getInstanceName());
+    logger.debug("Updated configs for AssignableInstance {}", 
_instanceConfig.getInstanceName());
   }
 
   /**
@@ -256,7 +256,7 @@ public class AssignableInstance {
     }
 
     if (_currentAssignments.contains(task.getId())) {
-      logger.warn(
+      logger.debug(
           "Task: {} of quotaType: {} is already assigned to this instance. 
Instance name: {}",
           task.getId(), quotaType, getInstanceName());
 
@@ -272,7 +272,7 @@ public class AssignableInstance {
     // Fail when no such resource type
     if (!_totalCapacity.containsKey(resourceType)) {
 
-      logger.warn(
+      logger.debug(
           "AssignableInstance does not support the given resourceType: {}. 
Task: {}, quotaType: {}, Instance name: {}",
           resourceType, task.getId(), quotaType, getInstanceName());
 
@@ -288,7 +288,7 @@ public class AssignableInstance {
     }
     if (!_totalCapacity.get(resourceType).containsKey(quotaType)) {
 
-      logger.warn(
+      logger.debug(
           "AssignableInstance does not support the given quotaType: {}. Task: 
{}, quotaType: {}, Instance name: {}. Task will be assigned as DEFAULT type.",
           quotaType, task.getId(), quotaType, getInstanceName());
       quotaType = DEFAULT_QUOTA_TYPE;
@@ -301,8 +301,8 @@ public class AssignableInstance {
     // Fail with insufficient quota
     if (capacity <= usage) {
 
-      logger.warn(
-          "AssignableInstance does not have enough capacity for quotaType: {}. 
Task: {}, quotaType: {}, Instance name: {}. Current capacity: {} capacity 
needed to schedule: {}",
+      logger.debug(
+          "AssignableInstance does not have enough capacity for quotaType: {}. 
Task: {}, quotaType: {}, Instance name: {}. Total capacity: {} Current usage: 
{}",
           quotaType, task.getId(), quotaType, getInstanceName(), capacity, 
usage);
 
       return new TaskAssignResult(task, quotaType, this, false, 0,
@@ -366,11 +366,11 @@ public class AssignableInstance {
       }
     } else {
       // resourceType is not found. Leave a warning log and will not touch 
quota
-      logger.warn(
+      logger.debug(
           "Task's requested resource type is not supported. TaskConfig: %s; 
UsedCapacity: %s; ResourceType: %s",
           result.getTaskConfig(), _usedCapacity, resourceType);
     }
-    logger.info("Assigned task {} to instance {}", 
result.getTaskConfig().getId(),
+    logger.debug("Assigned task {} to instance {}", 
result.getTaskConfig().getId(),
         _instanceConfig.getInstanceName());
   }
 
@@ -385,12 +385,12 @@ public class AssignableInstance {
    */
   public synchronized void release(TaskConfig taskConfig, String quotaType) {
     if (!_currentAssignments.contains(taskConfig.getId())) {
-      logger.warn("Task {} is not assigned on instance {}", taskConfig.getId(),
+      logger.debug("Task {} is not assigned on instance {}", 
taskConfig.getId(),
           _instanceConfig.getInstanceName());
       return;
     }
     if (quotaType == null) {
-      logger.warn("Task {}'s quotaType is null. Trying to release as DEFAULT 
type.",
+      logger.debug("Task {}'s quotaType is null. Trying to release as DEFAULT 
type.",
           taskConfig.getId());
       quotaType = AssignableInstance.DEFAULT_QUOTA_TYPE;
     }
@@ -414,7 +414,7 @@ public class AssignableInstance {
     // If the resource type is not found, we just remove from 
currentAssignments since no adjustment
     // can be made
     _currentAssignments.remove(taskConfig.getId());
-    logger.info("Released task {} from instance {}", taskConfig.getId(),
+    logger.debug("Released task {} from instance {}", taskConfig.getId(),
         _instanceConfig.getInstanceName());
   }
 

Reply via email to