You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by hu...@apache.org on 2020/08/28 01:53:42 UTC
[helix] branch task_pool updated: Configurable Task Pool TaskDriver
helpers fix (#1327)
This is an automated email from the ASF dual-hosted git repository.
hulee pushed a commit to branch task_pool
in repository https://gitbox.apache.org/repos/asf/helix.git
The following commit(s) were added to refs/heads/task_pool by this push:
new a285e33 Configurable Task Pool TaskDriver helpers fix (#1327)
a285e33 is described below
commit a285e3388e84b8af84d946bf56dcabcc31a320a6
Author: Neal Sun <ne...@gmail.com>
AuthorDate: Thu Aug 27 18:53:33 2020 -0700
Configurable Task Pool TaskDriver helpers fix (#1327)
The setters were not actually setting the InstanceConfig/ClusterConfig. Fixed by setting them.
---
.../java/org/apache/helix/task/TaskDriver.java | 2 ++
.../java/org/apache/helix/task/TestTaskDriver.java | 38 +++++++++-------------
2 files changed, 17 insertions(+), 23 deletions(-)
diff --git a/helix-core/src/main/java/org/apache/helix/task/TaskDriver.java b/helix-core/src/main/java/org/apache/helix/task/TaskDriver.java
index ecce9c2..d1af5a3 100644
--- a/helix-core/src/main/java/org/apache/helix/task/TaskDriver.java
+++ b/helix-core/src/main/java/org/apache/helix/task/TaskDriver.java
@@ -1177,6 +1177,7 @@ public class TaskDriver {
public void setTargetTaskThreadPoolSize(String instanceName, int targetTaskThreadPoolSize) {
InstanceConfig instanceConfig = getInstanceConfig(instanceName);
instanceConfig.setTargetTaskThreadPoolSize(targetTaskThreadPoolSize);
+ _accessor.setProperty(_accessor.keyBuilder().instanceConfig(instanceName), instanceConfig);
}
private InstanceConfig getInstanceConfig(String instanceName) {
@@ -1211,6 +1212,7 @@ public class TaskDriver {
public void setGlobalTargetTaskThreadPoolSize(int globalTargetTaskThreadPoolSize) {
ClusterConfig clusterConfig = getClusterConfig();
clusterConfig.setGlobalTargetTaskThreadPoolSize(globalTargetTaskThreadPoolSize);
+ _accessor.setProperty(_accessor.keyBuilder().clusterConfig(), clusterConfig);
}
private ClusterConfig getClusterConfig() {
diff --git a/helix-core/src/test/java/org/apache/helix/task/TestTaskDriver.java b/helix-core/src/test/java/org/apache/helix/task/TestTaskDriver.java
index dd0ef3d..7d26b20 100644
--- a/helix-core/src/test/java/org/apache/helix/task/TestTaskDriver.java
+++ b/helix-core/src/test/java/org/apache/helix/task/TestTaskDriver.java
@@ -45,23 +45,6 @@ public class TestTaskDriver extends TaskTestBase {
}
@Test
- public void testGetTargetTaskThreadPoolSize() {
- String validInstanceName = _participants[0].getInstanceName();
- InstanceConfig instanceConfig =
- _configAccessor.getInstanceConfig(CLUSTER_NAME, validInstanceName);
- instanceConfig.setTargetTaskThreadPoolSize(TEST_THREAD_POOL_SIZE);
- _configAccessor.setInstanceConfig(CLUSTER_NAME, validInstanceName, instanceConfig);
-
- Assert.assertEquals(_taskDriver.getTargetTaskThreadPoolSize(validInstanceName),
- TEST_THREAD_POOL_SIZE);
- }
-
- @Test(dependsOnMethods = "testGetTargetTaskThreadPoolSize", expectedExceptions = IllegalArgumentException.class)
- public void testGetTargetTaskThreadPoolSizeWrongInstanceName() {
- _taskDriver.getTargetTaskThreadPoolSize(NON_EXISTENT_INSTANCE_NAME);
- }
-
- @Test(dependsOnMethods = "testGetTargetTaskThreadPoolSizeWrongInstanceName")
public void testSetTargetTaskThreadPoolSize() {
String validInstanceName = _participants[0].getInstanceName();
_taskDriver.setTargetTaskThreadPoolSize(validInstanceName, TEST_THREAD_POOL_SIZE);
@@ -77,15 +60,19 @@ public class TestTaskDriver extends TaskTestBase {
}
@Test(dependsOnMethods = "testSetTargetTaskThreadPoolSizeWrongInstanceName")
- public void testGetGlobalTargetTaskThreadPoolSize() {
- ClusterConfig clusterConfig = _configAccessor.getClusterConfig(CLUSTER_NAME);
- clusterConfig.setGlobalTargetTaskThreadPoolSize(TEST_THREAD_POOL_SIZE);
- _configAccessor.setClusterConfig(CLUSTER_NAME, clusterConfig);
+ public void testGetTargetTaskThreadPoolSize() {
+ String validInstanceName = _participants[0].getInstanceName();
- Assert.assertEquals(_taskDriver.getGlobalTargetTaskThreadPoolSize(), TEST_THREAD_POOL_SIZE);
+ Assert.assertEquals(_taskDriver.getTargetTaskThreadPoolSize(validInstanceName),
+ TEST_THREAD_POOL_SIZE);
}
- @Test(dependsOnMethods = "testGetGlobalTargetTaskThreadPoolSize")
+ @Test(dependsOnMethods = "testGetTargetTaskThreadPoolSize", expectedExceptions = IllegalArgumentException.class)
+ public void testGetTargetTaskThreadPoolSizeWrongInstanceName() {
+ _taskDriver.getTargetTaskThreadPoolSize(NON_EXISTENT_INSTANCE_NAME);
+ }
+
+ @Test(dependsOnMethods = "testGetTargetTaskThreadPoolSizeWrongInstanceName")
public void testSetGlobalTargetTaskThreadPoolSize() {
_taskDriver.setGlobalTargetTaskThreadPoolSize(TEST_THREAD_POOL_SIZE);
ClusterConfig clusterConfig = _configAccessor.getClusterConfig(CLUSTER_NAME);
@@ -94,6 +81,11 @@ public class TestTaskDriver extends TaskTestBase {
}
@Test(dependsOnMethods = "testSetGlobalTargetTaskThreadPoolSize")
+ public void testGetGlobalTargetTaskThreadPoolSize() {
+ Assert.assertEquals(_taskDriver.getGlobalTargetTaskThreadPoolSize(), TEST_THREAD_POOL_SIZE);
+ }
+
+ @Test(dependsOnMethods = "testGetGlobalTargetTaskThreadPoolSize")
public void testGetCurrentTaskThreadPoolSize() {
String validInstanceName = _participants[0].getInstanceName();