helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hu...@apache.org
Subject [helix] branch master updated: Suggested fixes by iCR, OpenRefactory, Inc. (#528)
Date Sun, 17 Nov 2019 01:06:40 GMT
This is an automated email from the ASF dual-hosted git repository.

hulee pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/helix.git


The following commit(s) were added to refs/heads/master by this push:
     new 9d440c5  Suggested fixes by iCR, OpenRefactory, Inc. (#528)
9d440c5 is described below

commit 9d440c50d7e4ddb6bf00c8f5d66c5df322e82c53
Author: openrefactory <56681071+openrefactory@users.noreply.github.com>
AuthorDate: Sun Nov 17 07:06:33 2019 +0600

    Suggested fixes by iCR, OpenRefactory, Inc. (#528)
    
    Unchecked method return value fix in file: TestFullAutoNodeTagging.java, method:withinAverage
---
 .../src/main/java/org/apache/helix/task/AbstractTaskDispatcher.java   | 2 ++
 helix-core/src/main/java/org/apache/helix/tools/TestExecutor.java     | 1 +
 .../apache/helix/integration/rebalancer/TestFullAutoNodeTagging.java  | 3 +++
 .../main/java/org/apache/helix/taskexecution/TaskExecutionDemo.java   | 4 ++--
 4 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/helix-core/src/main/java/org/apache/helix/task/AbstractTaskDispatcher.java b/helix-core/src/main/java/org/apache/helix/task/AbstractTaskDispatcher.java
index 0a650cb..dd4f409 100644
--- a/helix-core/src/main/java/org/apache/helix/task/AbstractTaskDispatcher.java
+++ b/helix-core/src/main/java/org/apache/helix/task/AbstractTaskDispatcher.java
@@ -303,12 +303,14 @@ public abstract class AbstractTaskDispatcher {
 
             // Also release resources for these tasks
             assignableInstanceManager.release(instance, taskConfig, quotaType);
+            break;
           } else if (jobState == TaskState.IN_PROGRESS
               && (jobTgtState != TargetState.STOP && jobTgtState != TargetState.DELETE))
{
             // Job is in progress, implying that tasks are being re-tried, so set it to RUNNING
             paMap.put(pId,
                 new JobRebalancer.PartitionAssignment(instance, TaskPartitionState.RUNNING.name()));
             assignedPartitions.get(instance).add(pId);
+            break;
           }
         }
 
diff --git a/helix-core/src/main/java/org/apache/helix/tools/TestExecutor.java b/helix-core/src/main/java/org/apache/helix/tools/TestExecutor.java
index 6a757f3..df14af4 100644
--- a/helix-core/src/main/java/org/apache/helix/tools/TestExecutor.java
+++ b/helix-core/src/main/java/org/apache/helix/tools/TestExecutor.java
@@ -141,6 +141,7 @@ public class TestExecutor {
       break;
     case ZNODE:
       valueType = ZnodeModValueType.ZNODE_VALUE;
+      break;
     default:
       break;
     }
diff --git a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestFullAutoNodeTagging.java
b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestFullAutoNodeTagging.java
index e67c778..25068d9 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestFullAutoNodeTagging.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestFullAutoNodeTagging.java
@@ -459,6 +459,9 @@ public class TestFullAutoNodeTagging extends ZkUnitTestBase {
         upperBound = 2;
       }
       int average = computeAverage(countMap);
+      if (average == -1) {
+        return false;
+      }
       for (String participantName : countMap.keySet()) {
         int count = countMap.get(participantName);
         if (count < average - 1 || count > average + upperBound) {
diff --git a/recipes/task-execution/src/main/java/org/apache/helix/taskexecution/TaskExecutionDemo.java
b/recipes/task-execution/src/main/java/org/apache/helix/taskexecution/TaskExecutionDemo.java
index a2b2e08..01716d7 100644
--- a/recipes/task-execution/src/main/java/org/apache/helix/taskexecution/TaskExecutionDemo.java
+++ b/recipes/task-execution/src/main/java/org/apache/helix/taskexecution/TaskExecutionDemo.java
@@ -20,7 +20,7 @@ package org.apache.helix.taskexecution;
  */
 
 import java.io.File;
-import java.util.Random;
+import java.security.SecureRandom;
 import java.util.concurrent.Executor;
 import java.util.concurrent.Executors;
 
@@ -121,7 +121,7 @@ public class TaskExecutionDemo {
     float fraudProbability = 0.01f;
     float clickProbability = 0.01f;
     int numImps = NUM_IMP_EVENTS;
-    Random rand = new Random();
+    SecureRandom rand = new SecureRandom();
     String[] countries = {
         "US", "CANADA", "UK", "CHINA", "UNKNOWN"
     };


Mime
View raw message