You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by sl...@apache.org on 2013/04/13 02:49:51 UTC
git commit: [HELIX-73] incorporating Vinayak's change on removing the
host_port naming constraint on instance names.
Updated Branches:
refs/heads/master a590a18ae -> 0ff62670f
[HELIX-73] incorporating Vinayak's change on removing the host_port
naming constraint on instance names.
Project: http://git-wip-us.apache.org/repos/asf/incubator-helix/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-helix/commit/0ff62670
Tree: http://git-wip-us.apache.org/repos/asf/incubator-helix/tree/0ff62670
Diff: http://git-wip-us.apache.org/repos/asf/incubator-helix/diff/0ff62670
Branch: refs/heads/master
Commit: 0ff62670fccea455b550f56f5162bdcf64dbe2e1
Parents: a590a18
Author: slu2011 <lu...@gmail.com>
Authored: Fri Apr 12 17:49:36 2013 -0700
Committer: slu2011 <lu...@gmail.com>
Committed: Fri Apr 12 17:49:36 2013 -0700
----------------------------------------------------------------------
.../org/apache/helix/model/InstanceConfig.java | 9 +--
.../java/org/apache/helix/tools/ClusterSetup.java | 76 ++------------
.../src/test/java/org/apache/helix/TestHelper.java | 2 +-
.../apache/helix/integration/TestAddClusterV2.java | 4 +-
.../TestAddNodeAfterControllerStart.java | 6 +-
.../helix/integration/TestAutoRebalance.java | 4 +-
.../TestAutoRebalancePartitionLimit.java | 4 +-
.../helix/integration/TestClusterStartsup.java | 2 +-
.../helix/integration/TestDistributedCMMain.java | 2 +-
.../org/apache/helix/integration/TestDriver.java | 2 +-
.../helix/integration/TestExpandCluster.java | 2 +-
.../helix/integration/TestNonOfflineInitState.java | 2 +-
.../integration/TestStateTransitionTimeout.java | 2 +-
.../helix/integration/ZkStandAloneCMTestBase.java | 2 +-
.../org/apache/helix/tools/TestClusterSetup.java | 40 +++-----
15 files changed, 43 insertions(+), 116 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/0ff62670/helix-core/src/main/java/org/apache/helix/model/InstanceConfig.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/model/InstanceConfig.java b/helix-core/src/main/java/org/apache/helix/model/InstanceConfig.java
index 6b4ed24..e719357 100644
--- a/helix-core/src/main/java/org/apache/helix/model/InstanceConfig.java
+++ b/helix-core/src/main/java/org/apache/helix/model/InstanceConfig.java
@@ -187,7 +187,7 @@ public class InstanceConfig extends HelixProperty
{
InstanceConfig that = (InstanceConfig) obj;
- if (this.getHostName().equals(that.getHostName()) && this.getPort().equals(that.getPort()))
+ if (this.getId().equals(that.getId()))
{
return true;
}
@@ -198,12 +198,7 @@ public class InstanceConfig extends HelixProperty
@Override
public int hashCode()
{
-
- StringBuffer sb = new StringBuffer();
- sb.append(this.getHostName());
- sb.append("_");
- sb.append(this.getPort());
- return sb.toString().hashCode();
+ return getId().hashCode();
}
public String getInstanceName()
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/0ff62670/helix-core/src/main/java/org/apache/helix/tools/ClusterSetup.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/tools/ClusterSetup.java b/helix-core/src/main/java/org/apache/helix/tools/ClusterSetup.java
index 6174c30..02efb3f 100644
--- a/helix-core/src/main/java/org/apache/helix/tools/ClusterSetup.java
+++ b/helix-core/src/main/java/org/apache/helix/tools/ClusterSetup.java
@@ -24,12 +24,8 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
@@ -40,15 +36,11 @@ import org.apache.commons.cli.OptionBuilder;
import org.apache.commons.cli.OptionGroup;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
-import org.apache.helix.model.ConfigScope;
-import org.apache.helix.model.builder.ConfigScopeBuilder;
-import org.apache.helix.model.builder.ConstraintItemBuilder;
-import org.apache.helix.model.builder.HelixConfigScopeBuilder;
import org.apache.helix.HelixAdmin;
-import org.apache.helix.HelixException;
-import org.apache.helix.ZNRecord;
import org.apache.helix.HelixConstants.StateModelToken;
+import org.apache.helix.HelixException;
import org.apache.helix.PropertyKey.Builder;
+import org.apache.helix.ZNRecord;
import org.apache.helix.manager.zk.ZKHelixAdmin;
import org.apache.helix.manager.zk.ZKHelixDataAccessor;
import org.apache.helix.manager.zk.ZNRecordSerializer;
@@ -59,13 +51,14 @@ import org.apache.helix.model.ClusterConstraints.ConstraintType;
import org.apache.helix.model.ConstraintItem;
import org.apache.helix.model.ExternalView;
import org.apache.helix.model.HelixConfigScope;
+import org.apache.helix.model.HelixConfigScope.ConfigScopeProperty;
import org.apache.helix.model.IdealState;
+import org.apache.helix.model.IdealState.IdealStateModeProperty;
import org.apache.helix.model.InstanceConfig;
import org.apache.helix.model.LiveInstance;
import org.apache.helix.model.StateModelDefinition;
-import org.apache.helix.model.HelixConfigScope.ConfigScopeProperty;
-import org.apache.helix.model.IdealState.IdealStateModeProperty;
-import org.apache.helix.store.PropertyJsonSerializer;
+import org.apache.helix.model.builder.ConstraintItemBuilder;
+import org.apache.helix.model.builder.HelixConfigScopeBuilder;
import org.apache.helix.util.HelixUtil;
import org.apache.helix.util.ZKClientPool;
import org.apache.log4j.Logger;
@@ -206,7 +199,6 @@ public class ClusterSetup
{
for (String InstanceInfo : InstanceInfoArray)
{
- // the storage Instance info must be hostname:port format.
if (InstanceInfo.length() > 0)
{
addInstanceToCluster(clusterName, InstanceInfo);
@@ -214,32 +206,9 @@ public class ClusterSetup
}
}
- public void addInstanceToCluster(String clusterName, String InstanceAddress)
+ public void addInstanceToCluster(String clusterName, String instanceId)
{
- // InstanceAddress must be in host:port format
- int lastPos = InstanceAddress.lastIndexOf("_");
- if (lastPos <= 0)
- {
- lastPos = InstanceAddress.lastIndexOf(":");
- }
- if (lastPos <= 0)
- {
- String error = "Invalid storage Instance info format: " + InstanceAddress;
- _logger.warn(error);
- throw new HelixException(error);
- }
- String host = InstanceAddress.substring(0, lastPos);
- String portStr = InstanceAddress.substring(lastPos + 1);
- int port = Integer.parseInt(portStr);
- addInstanceToCluster(clusterName, host, port);
- }
-
- public void addInstanceToCluster(String clusterName, String host, int port)
- {
- String instanceId = host + "_" + port;
InstanceConfig config = new InstanceConfig(instanceId);
- config.setHostName(host);
- config.setPort(Integer.toString(port));
config.setInstanceEnabled(true);
_admin.addInstance(clusterName, config);
}
@@ -248,7 +217,6 @@ public class ClusterSetup
{
for (String InstanceInfo : InstanceInfoArray)
{
- // the storage Instance info must be hostname:port format.
if (InstanceInfo.length() > 0)
{
dropInstanceFromCluster(clusterName, InstanceInfo);
@@ -256,30 +224,8 @@ public class ClusterSetup
}
}
- public void dropInstanceFromCluster(String clusterName, String InstanceAddress)
+ public void dropInstanceFromCluster(String clusterName, String instanceId)
{
- // InstanceAddress must be in host:port format
- int lastPos = InstanceAddress.lastIndexOf("_");
- if (lastPos <= 0)
- {
- lastPos = InstanceAddress.lastIndexOf(":");
- }
- if (lastPos <= 0)
- {
- String error = "Invalid storage Instance info format: " + InstanceAddress;
- _logger.warn(error);
- throw new HelixException(error);
- }
- String host = InstanceAddress.substring(0, lastPos);
- String portStr = InstanceAddress.substring(lastPos + 1);
- int port = Integer.parseInt(portStr);
- dropInstanceFromCluster(clusterName, host, port);
- }
-
- public void dropInstanceFromCluster(String clusterName, String host, int port)
- {
- String instanceId = host + "_" + port;
-
ZKHelixDataAccessor accessor =
new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_zkClient));
Builder keyBuilder = accessor.keyBuilder();
@@ -709,7 +655,7 @@ public class ClusterSetup
String storageInstanceInfoArray[] = new String[6];
for (int i = 0; i < storageInstanceInfoArray.length; i++)
{
- storageInstanceInfoArray[i] = "localhost:" + (8900 + i);
+ storageInstanceInfoArray[i] = "localhost_" + (8900 + i);
}
addInstancesToCluster(clusterName, storageInstanceInfoArray);
addResourceToCluster(clusterName, "TestDB", 10, "MasterSlave");
@@ -792,7 +738,7 @@ public class ClusterSetup
.create();
addInstanceOption.setArgs(2);
addInstanceOption.setRequired(false);
- addInstanceOption.setArgName("clusterName InstanceAddress(host:port)");
+ addInstanceOption.setArgName("clusterName InstanceId");
Option addResourceOption =
OptionBuilder.withLongOpt(addResource)
@@ -880,7 +826,7 @@ public class ClusterSetup
.create();
dropInstanceOption.setArgs(2);
dropInstanceOption.setRequired(false);
- dropInstanceOption.setArgName("clusterName InstanceAddress(host:port)");
+ dropInstanceOption.setArgName("clusterName InstanceId");
Option swapInstanceOption =
OptionBuilder.withLongOpt(swapInstance)
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/0ff62670/helix-core/src/test/java/org/apache/helix/TestHelper.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/TestHelper.java b/helix-core/src/test/java/org/apache/helix/TestHelper.java
index 55b08d5..59f296b 100644
--- a/helix-core/src/test/java/org/apache/helix/TestHelper.java
+++ b/helix-core/src/test/java/org/apache/helix/TestHelper.java
@@ -430,7 +430,7 @@ public class TestHelper
for (int i = 0; i < nodesNb; i++)
{
int port = startPort + i;
- setupTool.addInstanceToCluster(clusterName, participantNamePrefix + ":" + port);
+ setupTool.addInstanceToCluster(clusterName, participantNamePrefix + "_" + port);
}
for (int i = 0; i < resourceNb; i++)
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/0ff62670/helix-core/src/test/java/org/apache/helix/integration/TestAddClusterV2.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestAddClusterV2.java b/helix-core/src/test/java/org/apache/helix/integration/TestAddClusterV2.java
index 0a79337..b89ea36 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestAddClusterV2.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestAddClusterV2.java
@@ -82,7 +82,7 @@ public class TestAddClusterV2 extends ZkIntegrationTestBase
_setupTool.addCluster(CONTROLLER_CLUSTER, true);
for (int i = 0; i < NODE_NR; i++)
{
- String controllerName = CONTROLLER_PREFIX + ":" + i;
+ String controllerName = CONTROLLER_PREFIX + "_" + i;
_setupTool.addInstanceToCluster(CONTROLLER_CLUSTER, controllerName);
}
@@ -214,7 +214,7 @@ public class TestAddClusterV2 extends ZkIntegrationTestBase
setupTool.addResourceToCluster(clusterName, dbName, partitionNr, stateModel);
for (int i = 0; i < NODE_NR; i++)
{
- String instanceName = prefix + ":" + (startPort + i);
+ String instanceName = prefix + "_" + (startPort + i);
setupTool.addInstanceToCluster(clusterName, instanceName);
}
if(rebalance)
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/0ff62670/helix-core/src/test/java/org/apache/helix/integration/TestAddNodeAfterControllerStart.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestAddNodeAfterControllerStart.java b/helix-core/src/test/java/org/apache/helix/integration/TestAddNodeAfterControllerStart.java
index 9898d55..ad66c31 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestAddNodeAfterControllerStart.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestAddNodeAfterControllerStart.java
@@ -89,7 +89,7 @@ public class TestAddNodeAfterControllerStart extends ZkIntegrationTestBase
result = checkHandlers(controller.getHandlers(), msgPath);
Assert.assertTrue(result);
- _gSetupTool.addInstanceToCluster(clusterName, "localhost:12922");
+ _gSetupTool.addInstanceToCluster(clusterName, "localhost_12922");
_gSetupTool.rebalanceStorageCluster(clusterName, "TestDB0", 3);
participants[nodeNr - 1] =
@@ -154,7 +154,7 @@ public class TestAddNodeAfterControllerStart extends ZkIntegrationTestBase
for (int i = 0; i < nodeNr - 1; i++)
{
int port = 12918 + i;
- _gSetupTool.addInstanceToCluster(clusterName, "localhost:" + port);
+ _gSetupTool.addInstanceToCluster(clusterName, "localhost_" + port);
}
_gSetupTool.addResourceToCluster(clusterName, "TestDB0", 1, "LeaderStandby");
@@ -180,7 +180,7 @@ public class TestAddNodeAfterControllerStart extends ZkIntegrationTestBase
// System.out.println("numberOfListeners(" + msgPath + "): " + numberOfListeners);
Assert.assertEquals(numberOfListeners, 2); // 1 of participant, and 1 of controller
- _gSetupTool.addInstanceToCluster(clusterName, "localhost:12919");
+ _gSetupTool.addInstanceToCluster(clusterName, "localhost_12919");
_gSetupTool.rebalanceStorageCluster(clusterName, "TestDB0", 2);
participants[nodeNr - 1] =
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/0ff62670/helix-core/src/test/java/org/apache/helix/integration/TestAutoRebalance.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestAutoRebalance.java b/helix-core/src/test/java/org/apache/helix/integration/TestAutoRebalance.java
index bdb6019..7cf0477 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestAutoRebalance.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestAutoRebalance.java
@@ -77,7 +77,7 @@ public class TestAutoRebalance extends ZkStandAloneCMTestBaseWithPropertyServerC
for (int i = 0; i < NODE_NR; i++)
{
- String storageNodeName = PARTICIPANT_PREFIX + ":" + (START_PORT + i);
+ String storageNodeName = PARTICIPANT_PREFIX + "_" + (START_PORT + i);
_setupTool.addInstanceToCluster(CLUSTER_NAME, storageNodeName);
}
@@ -145,7 +145,7 @@ public class TestAutoRebalance extends ZkStandAloneCMTestBaseWithPropertyServerC
// add 2 nodes
for (int i = 0; i < 2; i++)
{
- String storageNodeName = PARTICIPANT_PREFIX + ":" + (1000 + i);
+ String storageNodeName = PARTICIPANT_PREFIX + "_" + (1000 + i);
_setupTool.addInstanceToCluster(CLUSTER_NAME, storageNodeName);
StartCMResult resultx =
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/0ff62670/helix-core/src/test/java/org/apache/helix/integration/TestAutoRebalancePartitionLimit.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestAutoRebalancePartitionLimit.java b/helix-core/src/test/java/org/apache/helix/integration/TestAutoRebalancePartitionLimit.java
index 21d8816..f26a867 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestAutoRebalancePartitionLimit.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestAutoRebalancePartitionLimit.java
@@ -71,7 +71,7 @@ private static final Logger LOG = Logger.getLogger(TestAutoRebalancePartitionLim
_setupTool.addResourceToCluster(CLUSTER_NAME, TEST_DB, 100, "OnlineOffline", IdealStateModeProperty.AUTO_REBALANCE+"", 0, 25);
for (int i = 0; i < NODE_NR; i++)
{
- String storageNodeName = PARTICIPANT_PREFIX + ":" + (START_PORT + i);
+ String storageNodeName = PARTICIPANT_PREFIX + "_" + (START_PORT + i);
_setupTool.addInstanceToCluster(CLUSTER_NAME, storageNodeName);
}
_setupTool.rebalanceStorageCluster(CLUSTER_NAME, TEST_DB, 1);
@@ -162,7 +162,7 @@ private static final Logger LOG = Logger.getLogger(TestAutoRebalancePartitionLim
// add 2 nodes
for (int i = 0; i < 2; i++)
{
- String storageNodeName = PARTICIPANT_PREFIX + ":" + (1000 + i);
+ String storageNodeName = PARTICIPANT_PREFIX + "_" + (1000 + i);
_setupTool.addInstanceToCluster(CLUSTER_NAME, storageNodeName);
StartCMResult resultx =
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/0ff62670/helix-core/src/test/java/org/apache/helix/integration/TestClusterStartsup.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestClusterStartsup.java b/helix-core/src/test/java/org/apache/helix/integration/TestClusterStartsup.java
index f717cd3..6caff9a 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestClusterStartsup.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestClusterStartsup.java
@@ -54,7 +54,7 @@ public class TestClusterStartsup extends ZkStandAloneCMTestBase
_setupTool.addResourceToCluster(CLUSTER_NAME, TEST_DB, 20, STATE_MODEL);
for (int i = 0; i < NODE_NR; i++)
{
- String storageNodeName = "localhost:" + (START_PORT + i);
+ String storageNodeName = "localhost_" + (START_PORT + i);
_setupTool.addInstanceToCluster(CLUSTER_NAME, storageNodeName);
}
_setupTool.rebalanceStorageCluster(CLUSTER_NAME, TEST_DB, 3);
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/0ff62670/helix-core/src/test/java/org/apache/helix/integration/TestDistributedCMMain.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestDistributedCMMain.java b/helix-core/src/test/java/org/apache/helix/integration/TestDistributedCMMain.java
index 967b094..7e25e7b 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestDistributedCMMain.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestDistributedCMMain.java
@@ -121,7 +121,7 @@ public class TestDistributedCMMain extends ZkIntegrationTestBase
ClusterSetup setupTool = new ClusterSetup(ZK_ADDR);
for (int i = 0; i < n; i++)
{
- String controller = "controller:" + (n + i);
+ String controller = "controller_" + (n + i);
setupTool.addInstanceToCluster(controllerClusterName, controller);
}
setupTool.rebalanceStorageCluster(controllerClusterName, clusterNamePrefix + "0", 6);
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/0ff62670/helix-core/src/test/java/org/apache/helix/integration/TestDriver.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestDriver.java b/helix-core/src/test/java/org/apache/helix/integration/TestDriver.java
index 5dd411f..74b3bdc 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestDriver.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestDriver.java
@@ -160,7 +160,7 @@ public class TestDriver
for (int i = 0; i < numInstances; i++)
{
int port = START_PORT + i;
- setupTool.addInstanceToCluster(clusterName, PARTICIPANT_PREFIX + ":" + port);
+ setupTool.addInstanceToCluster(clusterName, PARTICIPANT_PREFIX + "_" + port);
}
for (int i = 0; i < numResources; i++)
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/0ff62670/helix-core/src/test/java/org/apache/helix/integration/TestExpandCluster.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestExpandCluster.java b/helix-core/src/test/java/org/apache/helix/integration/TestExpandCluster.java
index 8356b54..56feb76 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestExpandCluster.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestExpandCluster.java
@@ -50,7 +50,7 @@ public class TestExpandCluster extends ZkStandAloneCMTestBase
for (int i = 0; i < 5; i++)
{
- String storageNodeName = PARTICIPANT_PREFIX + ":" + (27960 + i);
+ String storageNodeName = PARTICIPANT_PREFIX + "_" + (27960 + i);
_setupTool.addInstanceToCluster(CLUSTER_NAME, storageNodeName);
}
String command = "-zkSvr localhost:2183 -expandCluster " + CLUSTER_NAME;
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/0ff62670/helix-core/src/test/java/org/apache/helix/integration/TestNonOfflineInitState.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestNonOfflineInitState.java b/helix-core/src/test/java/org/apache/helix/integration/TestNonOfflineInitState.java
index 2203190..5a5ccd9 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestNonOfflineInitState.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestNonOfflineInitState.java
@@ -114,7 +114,7 @@ public class TestNonOfflineInitState extends ZkIntegrationTestBase
for (int i = 0; i < nodesNb; i++)
{
int port = startPort + i;
- setupTool.addInstanceToCluster(clusterName, participantNamePrefix + ":" + port);
+ setupTool.addInstanceToCluster(clusterName, participantNamePrefix + "_" + port);
}
for (int i = 0; i < resourceNb; i++)
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/0ff62670/helix-core/src/test/java/org/apache/helix/integration/TestStateTransitionTimeout.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestStateTransitionTimeout.java b/helix-core/src/test/java/org/apache/helix/integration/TestStateTransitionTimeout.java
index 0a786d7..dea2649 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestStateTransitionTimeout.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestStateTransitionTimeout.java
@@ -82,7 +82,7 @@ public class TestStateTransitionTimeout extends ZkStandAloneCMTestBase
for (int i = 0; i < NODE_NR; i++)
{
- String storageNodeName = PARTICIPANT_PREFIX + ":" + (START_PORT + i);
+ String storageNodeName = PARTICIPANT_PREFIX + "_" + (START_PORT + i);
_setupTool.addInstanceToCluster(CLUSTER_NAME, storageNodeName);
}
_setupTool.rebalanceStorageCluster(CLUSTER_NAME, TEST_DB, 3);
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/0ff62670/helix-core/src/test/java/org/apache/helix/integration/ZkStandAloneCMTestBase.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/ZkStandAloneCMTestBase.java b/helix-core/src/test/java/org/apache/helix/integration/ZkStandAloneCMTestBase.java
index 94970a4..13d966b 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/ZkStandAloneCMTestBase.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/ZkStandAloneCMTestBase.java
@@ -89,7 +89,7 @@ public class ZkStandAloneCMTestBase extends ZkIntegrationTestBase
_setupTool.addResourceToCluster(CLUSTER_NAME, TEST_DB, _PARTITIONS, STATE_MODEL);
for (int i = 0; i < NODE_NR; i++)
{
- String storageNodeName = PARTICIPANT_PREFIX + ":" + (START_PORT + i);
+ String storageNodeName = PARTICIPANT_PREFIX + "_" + (START_PORT + i);
_setupTool.addInstanceToCluster(CLUSTER_NAME, storageNodeName);
}
_setupTool.rebalanceStorageCluster(CLUSTER_NAME, TEST_DB, _replica);
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/0ff62670/helix-core/src/test/java/org/apache/helix/tools/TestClusterSetup.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/tools/TestClusterSetup.java b/helix-core/src/test/java/org/apache/helix/tools/TestClusterSetup.java
index 5322d66..01abc5e 100644
--- a/helix-core/src/test/java/org/apache/helix/tools/TestClusterSetup.java
+++ b/helix-core/src/test/java/org/apache/helix/tools/TestClusterSetup.java
@@ -55,27 +55,13 @@ public class TestClusterSetup extends ZkUnitTestBase
protected static final String CLUSTER_NAME = "TestClusterSetup";
protected static final String TEST_DB = "TestDB";
- protected static final String INSTANCE_PREFIX = "instance:";
+ protected static final String INSTANCE_PREFIX = "instance_";
protected static final String STATE_MODEL = "MasterSlave";
- protected static final String TEST_NODE = "testnode:1";
+ protected static final String TEST_NODE = "testnode_1";
ZkClient _zkClient;
ClusterSetup _clusterSetup;
- String instanceColonToUnderscoreFormat(String colonFormat)
- {
- int lastPos = colonFormat.lastIndexOf(":");
- if (lastPos <= 0)
- {
- String error = "Invalid storage Instance info format: " + colonFormat;
- LOG.warn(error);
- throw new HelixException(error);
- }
- String host = colonFormat.substring(0, lastPos);
- String portStr = colonFormat.substring(lastPos + 1);
- return host + "_" + portStr;
- }
-
private static String[] createArgs(String str)
{
String[] split = str.split("[ ]+");
@@ -129,14 +115,14 @@ public class TestClusterSetup extends ZkUnitTestBase
{
verifyInstance(_zkClient,
CLUSTER_NAME,
- instanceColonToUnderscoreFormat(instance),
+ instance,
true);
}
_clusterSetup.addInstanceToCluster(CLUSTER_NAME, nextInstanceAddress);
verifyInstance(_zkClient,
CLUSTER_NAME,
- instanceColonToUnderscoreFormat(nextInstanceAddress),
+ nextInstanceAddress,
true);
// re-add
boolean caughtException = false;
@@ -192,18 +178,18 @@ public class TestClusterSetup extends ZkUnitTestBase
// disable
_clusterSetup.getClusterManagementTool()
.enableInstance(CLUSTER_NAME,
- instanceColonToUnderscoreFormat(nextInstanceAddress),
+ nextInstanceAddress,
false);
verifyEnabled(_zkClient,
CLUSTER_NAME,
- instanceColonToUnderscoreFormat(nextInstanceAddress),
+ nextInstanceAddress,
false);
// drop
_clusterSetup.dropInstanceFromCluster(CLUSTER_NAME, nextInstanceAddress);
verifyInstance(_zkClient,
CLUSTER_NAME,
- instanceColonToUnderscoreFormat(nextInstanceAddress),
+ nextInstanceAddress,
false);
// re-drop
@@ -310,7 +296,7 @@ public class TestClusterSetup extends ZkUnitTestBase
+ CLUSTER_NAME + " " + TEST_NODE));
verifyInstance(_zkClient,
CLUSTER_NAME,
- instanceColonToUnderscoreFormat(TEST_NODE),
+ TEST_NODE,
true);
try
{
@@ -326,10 +312,10 @@ public class TestClusterSetup extends ZkUnitTestBase
// .processCommandLineArgs(createArgs("-zkSvr "+ZK_ADDR+" --addNode node-1"));
ClusterSetup.processCommandLineArgs(createArgs("-zkSvr " + ZK_ADDR
+ " --enableInstance " + CLUSTER_NAME + " "
- + instanceColonToUnderscoreFormat(TEST_NODE) + " true"));
+ + TEST_NODE + " true"));
verifyEnabled(_zkClient,
CLUSTER_NAME,
- instanceColonToUnderscoreFormat(TEST_NODE),
+ TEST_NODE,
true);
// TODO: verify list commands
@@ -357,10 +343,10 @@ public class TestClusterSetup extends ZkUnitTestBase
// .processCommandLineArgs(createArgs("-zkSvr "+ZK_ADDR+" --rebalance "+CLUSTER_NAME+" "+TEST_DB+" 1"));
ClusterSetup.processCommandLineArgs(createArgs("-zkSvr " + ZK_ADDR
+ " --enableInstance " + CLUSTER_NAME + " "
- + instanceColonToUnderscoreFormat(TEST_NODE) + " false"));
+ + TEST_NODE + " false"));
verifyEnabled(_zkClient,
CLUSTER_NAME,
- instanceColonToUnderscoreFormat(TEST_NODE),
+ TEST_NODE,
false);
ClusterSetup.processCommandLineArgs(createArgs("-zkSvr " + ZK_ADDR + " --dropNode "
+ CLUSTER_NAME + " " + TEST_NODE));
@@ -378,7 +364,7 @@ public class TestClusterSetup extends ZkUnitTestBase
// basic
_clusterSetup.addCluster(clusterName, true);
- _clusterSetup.addInstanceToCluster(clusterName, "localhost", 0);
+ _clusterSetup.addInstanceToCluster(clusterName, "localhost_0");
String scopeArgs = clusterName + ",localhost_0";
String keyValueMap = "key1=value1,key2=value2";
String keys = "key1,key2";