junkaixue commented on code in PR #2102:
URL: https://github.com/apache/helix/pull/2102#discussion_r876095110


##########
helix-core/src/main/java/org/apache/helix/controller/stages/MessageGenerationPhase.java:
##########
@@ -320,18 +320,18 @@ private Message 
generateCancellationMessageForPendingMessage(final String desire
     if (pendingMessage != null) {
       String pendingState = pendingMessage.getToState();
       if (nextState.equalsIgnoreCase(pendingState)) {
-        LogUtil.logInfo(logger, _eventId,
+        LogUtil.logDebug(logger, _eventId,

Review Comment:
   This is not a good idea to move to debug. This is very important log to 
determine whether we have state transition in the middle for debugging purpose.



##########
helix-core/src/main/java/org/apache/helix/task/assigner/ThreadCountBasedTaskAssigner.java:
##########
@@ -74,19 +75,16 @@ public Map<String, TaskAssignResult> 
assignTasks(Iterable<AssignableInstance> as
   public Map<String, TaskAssignResult> assignTasks(
       AssignableInstanceManager assignableInstanceManager, Collection<String> 
instances,
       Iterable<TaskConfig> tasks, String quotaType) {
-    Iterable<AssignableInstance> assignableInstances = new HashSet<>();
+    Set<AssignableInstance> assignableInstances = new HashSet<>();
     // Only add the AssignableInstances that are also in instances
     for (String instance : instances) {
-      ((HashSet<AssignableInstance>) assignableInstances)
-          .add(assignableInstanceManager.getAssignableInstance(instance));
+      
assignableInstances.add(assignableInstanceManager.getAssignableInstance(instance));
     }
 
     if (tasks == null || !tasks.iterator().hasNext()) {
-      logger.warn("No task to assign!");
       return Collections.emptyMap();
     }
-    if (assignableInstances == null || 
!assignableInstances.iterator().hasNext()) {
-      logger.warn("No instance to assign!");
+    if (assignableInstances.isEmpty()) {

Review Comment:
   What if it is null?



##########
helix-core/src/main/java/org/apache/helix/task/assigner/ThreadCountBasedTaskAssigner.java:
##########
@@ -74,19 +75,16 @@ public Map<String, TaskAssignResult> 
assignTasks(Iterable<AssignableInstance> as
   public Map<String, TaskAssignResult> assignTasks(
       AssignableInstanceManager assignableInstanceManager, Collection<String> 
instances,
       Iterable<TaskConfig> tasks, String quotaType) {
-    Iterable<AssignableInstance> assignableInstances = new HashSet<>();
+    Set<AssignableInstance> assignableInstances = new HashSet<>();
     // Only add the AssignableInstances that are also in instances
     for (String instance : instances) {
-      ((HashSet<AssignableInstance>) assignableInstances)
-          .add(assignableInstanceManager.getAssignableInstance(instance));
+      
assignableInstances.add(assignableInstanceManager.getAssignableInstance(instance));
     }
 
     if (tasks == null || !tasks.iterator().hasNext()) {
-      logger.warn("No task to assign!");
       return Collections.emptyMap();
     }
-    if (assignableInstances == null || 
!assignableInstances.iterator().hasNext()) {
-      logger.warn("No instance to assign!");
+    if (assignableInstances.isEmpty()) {

Review Comment:
   What if it is null?



##########
helix-core/src/main/java/org/apache/helix/task/assigner/ThreadCountBasedTaskAssigner.java:
##########
@@ -74,19 +75,16 @@ public Map<String, TaskAssignResult> 
assignTasks(Iterable<AssignableInstance> as
   public Map<String, TaskAssignResult> assignTasks(
       AssignableInstanceManager assignableInstanceManager, Collection<String> 
instances,
       Iterable<TaskConfig> tasks, String quotaType) {
-    Iterable<AssignableInstance> assignableInstances = new HashSet<>();
+    Set<AssignableInstance> assignableInstances = new HashSet<>();
     // Only add the AssignableInstances that are also in instances
     for (String instance : instances) {
-      ((HashSet<AssignableInstance>) assignableInstances)
-          .add(assignableInstanceManager.getAssignableInstance(instance));
+      
assignableInstances.add(assignableInstanceManager.getAssignableInstance(instance));
     }
 
     if (tasks == null || !tasks.iterator().hasNext()) {
-      logger.warn("No task to assign!");
       return Collections.emptyMap();
     }
-    if (assignableInstances == null || 
!assignableInstances.iterator().hasNext()) {
-      logger.warn("No instance to assign!");

Review Comment:
   If we remove this, how to determine all quota full or something?



##########
helix-core/src/main/java/org/apache/helix/task/assigner/ThreadCountBasedTaskAssigner.java:
##########
@@ -74,19 +75,16 @@ public Map<String, TaskAssignResult> 
assignTasks(Iterable<AssignableInstance> as
   public Map<String, TaskAssignResult> assignTasks(
       AssignableInstanceManager assignableInstanceManager, Collection<String> 
instances,
       Iterable<TaskConfig> tasks, String quotaType) {
-    Iterable<AssignableInstance> assignableInstances = new HashSet<>();
+    Set<AssignableInstance> assignableInstances = new HashSet<>();
     // Only add the AssignableInstances that are also in instances
     for (String instance : instances) {
-      ((HashSet<AssignableInstance>) assignableInstances)
-          .add(assignableInstanceManager.getAssignableInstance(instance));
+      
assignableInstances.add(assignableInstanceManager.getAssignableInstance(instance));
     }
 
     if (tasks == null || !tasks.iterator().hasNext()) {
-      logger.warn("No task to assign!");
       return Collections.emptyMap();
     }
-    if (assignableInstances == null || 
!assignableInstances.iterator().hasNext()) {
-      logger.warn("No instance to assign!");

Review Comment:
   If we remove this, how to determine all quota full or something?



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

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to