@BeforeClass public void setUp() throws Exception { startZk(); startController(); ControllerRequestBuilderUtil.addFakeDataInstancesToAutoJoinHelixCluster(getHelixClusterName(), ZK_SERVER, 1, true); ControllerRequestBuilderUtil .addFakeBrokerInstancesToAutoJoinHelixCluster(getHelixClusterName(), ZK_SERVER, 1, true); while (_helixAdmin.getInstancesInClusterWithTag(getHelixClusterName(), "DefaultTenant_OFFLINE").size() == 0) { Thread.sleep(100); } Assert.assertEquals(_helixAdmin.getInstancesInClusterWithTag(getHelixClusterName(), "DefaultTenant_OFFLINE").size(), 1); Assert.assertEquals(_helixAdmin.getInstancesInClusterWithTag(getHelixClusterName(), "DefaultTenant_BROKER").size(), 1); }
@Test(dataProvider = "tableNameProvider") public void testNoAssignmentToDisabledInstances(String tableName, SegmentVersion version) throws Exception { List<String> instances = _helixAdmin.getInstancesInClusterWithTag(getHelixClusterName(), serverTenant); List<String> disabledInstances = new ArrayList<>(); // disable 6 instances assertEquals(instances.size(), 9); for (int i = 0; i < 6; i++) { _helixAdmin.enableInstance(getHelixClusterName(), instances.get(i), false); } // Thread.sleep(100000); for (int i = 0; i < 6; i++) { generateAndUploadRandomSegment(tableName + "_" + i, 10); } Map<String, Integer> segmentsPerInstance = getSegmentsPerInstance(tableName); // size is 3 since we disabled 6 instances assertEquals(segmentsPerInstance.size(), 3); for (Map.Entry<String, Integer> instanceEntry : segmentsPerInstance.entrySet()) { assertEquals(instanceEntry.getValue().intValue(), 6); } // re-enable instances since these tests are usually "setup once" and run multiple tests type for (int i = 0; i < 6; i++) { _helixAdmin.enableInstance(getHelixClusterName(), instances.get(i), true); } }
sendPostRequest(_controllerRequestURLBuilder.forTenantCreate(), payload); Assert.assertEquals( _helixAdmin.getInstancesInClusterWithTag(_helixClusterName, TagNameUtils.getBrokerTagForTenant(brokerTenant)) .size(), NUM_BROKERS_PER_TAG); Assert.assertEquals( _helixAdmin.getInstancesInClusterWithTag(_helixClusterName, CommonConstants.Helix.UNTAGGED_BROKER_INSTANCE) .size(), NUM_INSTANCES - i * NUM_BROKERS_PER_TAG); sendPutRequest(_controllerRequestURLBuilder.forTenantCreate(), payload); Assert.assertEquals( _helixAdmin.getInstancesInClusterWithTag(_helixClusterName, TagNameUtils.getBrokerTagForTenant(brokerTenant)) .size(), i); Assert.assertEquals( _helixAdmin.getInstancesInClusterWithTag(_helixClusterName, CommonConstants.Helix.UNTAGGED_BROKER_INSTANCE) .size(), NUM_INSTANCES - (NUM_BROKER_TAGS - 1) * NUM_BROKERS_PER_TAG - i); sendDeleteRequest(_controllerRequestURLBuilder.forBrokerTenantDelete(brokerTenant)); Assert.assertEquals( _helixAdmin.getInstancesInClusterWithTag(_helixClusterName, TagNameUtils.getBrokerTagForTenant(brokerTenant)) .size(), 0); Assert.assertEquals( _helixAdmin.getInstancesInClusterWithTag(_helixClusterName, CommonConstants.Helix.UNTAGGED_BROKER_INSTANCE) .size(), NUM_INSTANCES - (NUM_BROKER_TAGS - i) * NUM_BROKERS_PER_TAG);
@BeforeClass public void setUp() throws Exception { _zookeeperInstance = ZkStarter.startLocalZkServer(); _zkClient = new ZkClient(ZkStarter.DEFAULT_ZK_STR); final String instanceId = "localhost_helixController"; _pinotHelixResourceManager = new PinotHelixResourceManager(ZkStarter.DEFAULT_ZK_STR, HELIX_CLUSTER_NAME, instanceId, null, 10000L, true, /*isUpdateStateModel=*/ false, true); _pinotHelixResourceManager.start(); _helixAdmin = _pinotHelixResourceManager.getHelixAdmin(); ControllerRequestBuilderUtil .addFakeDataInstancesToAutoJoinHelixCluster(HELIX_CLUSTER_NAME, ZkStarter.DEFAULT_ZK_STR, 1, true); ControllerRequestBuilderUtil .addFakeBrokerInstancesToAutoJoinHelixCluster(HELIX_CLUSTER_NAME, ZkStarter.DEFAULT_ZK_STR, 1, true); Assert.assertEquals(_helixAdmin.getInstancesInClusterWithTag(HELIX_CLUSTER_NAME, "DefaultTenant_BROKER").size(), 1); Assert .assertEquals(_helixAdmin.getInstancesInClusterWithTag(HELIX_CLUSTER_NAME, "DefaultTenant_OFFLINE").size(), 1); Assert .assertEquals(_helixAdmin.getInstancesInClusterWithTag(HELIX_CLUSTER_NAME, "DefaultTenant_REALTIME").size(), 1); // Adding table TableConfig tableConfig = new TableConfig.Builder(CommonConstants.Helix.TableType.OFFLINE).setTableName(TABLE_NAME).build(); _pinotHelixResourceManager.addTable(tableConfig); }
sendPostRequest(_controllerRequestURLBuilder.forTenantCreate(), payload); Assert.assertEquals( _helixAdmin.getInstancesInClusterWithTag(_helixClusterName, TagNameUtils.getOfflineTagForTenant(serverTenant)) .size(), NUM_OFFLINE_SERVERS_PER_TAG); Assert.assertEquals(_helixAdmin .getInstancesInClusterWithTag(_helixClusterName, TagNameUtils.getRealtimeTagForTenant(serverTenant)).size(), NUM_REALTIME_SERVERS_PER_TAG); Assert.assertEquals( _helixAdmin.getInstancesInClusterWithTag(_helixClusterName, CommonConstants.Helix.UNTAGGED_SERVER_INSTANCE) .size(), NUM_INSTANCES - i * NUM_SERVERS_PER_TAG); sendPutRequest(_controllerRequestURLBuilder.forTenantCreate(), payload); Assert.assertEquals( _helixAdmin.getInstancesInClusterWithTag(_helixClusterName, TagNameUtils.getOfflineTagForTenant(serverTenant)) .size(), NUM_OFFLINE_SERVERS_PER_TAG + i); Assert.assertEquals(_helixAdmin .getInstancesInClusterWithTag(_helixClusterName, TagNameUtils.getRealtimeTagForTenant(serverTenant)).size(), NUM_REALTIME_SERVERS_PER_TAG + i); Assert.assertEquals( _helixAdmin.getInstancesInClusterWithTag(_helixClusterName, CommonConstants.Helix.UNTAGGED_SERVER_INSTANCE) .size(), NUM_INSTANCES - NUM_SERVER_TAGS * NUM_SERVERS_PER_TAG - i * 2); sendDeleteRequest(_controllerRequestURLBuilder.forServerTenantDelete(serverTenant)); Assert.assertEquals( _helixAdmin.getInstancesInClusterWithTag(_helixClusterName, TagNameUtils.getOfflineTagForTenant(serverTenant)) .size(), 0); Assert.assertEquals(_helixAdmin .getInstancesInClusterWithTag(_helixClusterName, TagNameUtils.getRealtimeTagForTenant(serverTenant)).size(), 0);
.addFakeBrokerInstancesToAutoJoinHelixCluster(HELIX_CLUSTER_NAME, ZK_SERVER, _numBrokerInstance, true); Thread.sleep(100); Assert.assertEquals(_helixAdmin.getInstancesInClusterWithTag(HELIX_CLUSTER_NAME, "DefaultTenant_OFFLINE").size(), _numServerInstance); Assert.assertEquals(_helixAdmin.getInstancesInClusterWithTag(HELIX_CLUSTER_NAME, "DefaultTenant_REALTIME").size(), _numServerInstance); Assert.assertEquals(_helixAdmin.getInstancesInClusterWithTag(HELIX_CLUSTER_NAME, "DefaultTenant_BROKER").size(), _numBrokerInstance);
IdealState idealState; Assert.assertEquals(_helixAdmin.getInstancesInClusterWithTag(HELIX_CLUSTER_NAME, "DefaultTenant_BROKER").size(), 6); idealState = _helixAdmin.getResourceIdealState(HELIX_CLUSTER_NAME, CommonConstants.Helix.BROKER_RESOURCE_INSTANCE); Assert.assertEquals(idealState.getInstanceSet(DINING_TABLE_NAME).size(), SEGMENT_COUNT); _pinotResourceManager.addTable(tableConfig); Assert.assertEquals(_helixAdmin.getInstancesInClusterWithTag(HELIX_CLUSTER_NAME, "DefaultTenant_BROKER").size(), 6); idealState = _helixAdmin.getResourceIdealState(HELIX_CLUSTER_NAME, CommonConstants.Helix.BROKER_RESOURCE_INSTANCE); Assert.assertEquals(idealState.getInstanceSet(COFFEE_TABLE_NAME).size(), SEGMENT_COUNT);
.getPartitionSet().size(), 0); Assert.assertEquals(_helixAdmin.getInstancesInClusterWithTag(_helixClusterName, TagNameUtils.getBrokerTagForTenant(TagNameUtils.DEFAULT_TENANT_NAME)).size(), 20); Assert.assertEquals(_helixAdmin.getInstancesInClusterWithTag(_helixClusterName, TagNameUtils.getRealtimeTagForTenant(TagNameUtils.DEFAULT_TENANT_NAME)).size(), 20); Assert.assertEquals(_helixAdmin.getInstancesInClusterWithTag(_helixClusterName, TagNameUtils.getOfflineTagForTenant(TagNameUtils.DEFAULT_TENANT_NAME)).size(), 20);
@BeforeClass public void setUp() throws Exception { startZk(); startController(); ControllerRequestBuilderUtil .addFakeBrokerInstancesToAutoJoinHelixCluster(getHelixClusterName(), ZkStarter.DEFAULT_ZK_STR, 5, true); ControllerRequestBuilderUtil .addFakeDataInstancesToAutoJoinHelixCluster(getHelixClusterName(), ZkStarter.DEFAULT_ZK_STR, 5, true); Assert.assertEquals(_helixAdmin.getInstancesInClusterWithTag(getHelixClusterName(), "DefaultTenant_BROKER").size(), 5); // Adding table TableConfig tableConfig = new TableConfig.Builder(CommonConstants.Helix.TableType.OFFLINE).setTableName(TABLE_NAME) .setSegmentAssignmentStrategy("RandomAssignmentStrategy").setNumReplicas(2).build(); _helixResourceManager.addTable(tableConfig); }
for (String instanceName : _helixAdmin.getInstancesInClusterWithTag(_helixClusterName, SERVER_TAG_NAME)) { sendPostRequest(_controllerRequestURLBuilder.forInstanceState(instanceName), "disable"); checkNumOnlineInstancesFromExternalView(OFFLINE_TABLE_NAME, --numEnabledInstances); for (String instanceName : _helixAdmin.getInstancesInClusterWithTag(_helixClusterName, SERVER_TAG_NAME)) { sendPostRequest(_controllerRequestURLBuilder.forInstanceState(instanceName), "ENABLE"); checkNumOnlineInstancesFromExternalView(OFFLINE_TABLE_NAME, ++numEnabledInstances); for (String instanceName : _helixAdmin.getInstancesInClusterWithTag(_helixClusterName, BROKER_TAG_NAME)) { sendPostRequest(_controllerRequestURLBuilder.forInstanceState(instanceName), "Disable"); checkNumOnlineInstancesFromExternalView(CommonConstants.Helix.BROKER_RESOURCE_INSTANCE, --numEnabledInstances); for (String instanceName : _helixAdmin.getInstancesInClusterWithTag(_helixClusterName, BROKER_TAG_NAME)) { sendPostRequest(_controllerRequestURLBuilder.forInstanceState(instanceName), "Enable"); checkNumOnlineInstancesFromExternalView(CommonConstants.Helix.BROKER_RESOURCE_INSTANCE, ++numEnabledInstances);
.addFakeDataInstancesToAutoJoinHelixCluster(HELIX_CLUSTER_NAME, ZkStarter.DEFAULT_ZK_STR, 1, true); while (_helixAdmin.getInstancesInClusterWithTag(HELIX_CLUSTER_NAME, "DefaultTenant_OFFLINE").size() == 0 || _helixAdmin.getInstancesInClusterWithTag(HELIX_CLUSTER_NAME, "DefaultTenant_BROKER").size() == 0) { Thread.sleep(100);
public List<String> getBlacklistedInstances() { return _helixAdmin.getInstancesInClusterWithTag(_helixClusterName, BLACKLIST_TAG); }
public List<String> getBlacklistedInstances() { return _helixAdmin.getInstancesInClusterWithTag(_helixClusterName, BLACKLIST_TAG); }
public static List<String> blacklistedInstances(HelixManager helixManager) { return helixManager.getClusterManagmentTool() .getInstancesInClusterWithTag(helixManager.getClusterName(), BLACKLIST_TAG); }
Sets.newHashSet(helixAdmin.getInstancesInClusterWithTag(clusterName, TAG)); Set<String> partitionSet = externalView.getPartitionSet(); if (partitionSet.size() != NUM_PARTITIONS) {
String instanceTag = cmd.getOptionValues(tag)[0]; instances = setupTool.getClusterManagementTool() .getInstancesInClusterWithTag(clusterName, instanceTag); } else { instances =
String instanceTag = cmd.getOptionValues(tag)[0]; instances = setupTool.getClusterManagementTool() .getInstancesInClusterWithTag(clusterName, instanceTag); } else { instances =
List<String> instances = _admin.getInstancesInClusterWithTag(CLUSTER_NAME, tag); IdealState idealState = createIdealState(TEST_DB, tag, instances, PARTITIONS, _replica, IdealState.RebalanceMode.CUSTOMIZED.toString(), List<String> instances = _admin.getInstancesInClusterWithTag(CLUSTER_NAME, group); for (String instance : instances) { _participants[i] =