use of org.apache.druid.server.coordinator.CoordinatorDynamicConfig in project druid by druid-io.
the class CoordinatorDynamicConfigTest method testHandleMissingPercentOfSegmentsToConsiderPerMove.
@Test
public void testHandleMissingPercentOfSegmentsToConsiderPerMove() throws Exception {
String jsonStr = "{\n" + " \"millisToWaitBeforeDeleting\": 1,\n" + " \"mergeBytesLimit\": 1,\n" + " \"mergeSegmentsLimit\" : 1,\n" + " \"maxSegmentsToMove\": 1,\n" + " \"replicantLifetime\": 1,\n" + " \"replicationThrottleLimit\": 1,\n" + " \"balancerComputeThreads\": 2, \n" + " \"emitBalancingStats\": true,\n" + " \"killDataSourceWhitelist\": [\"test1\",\"test2\"],\n" + " \"maxSegmentsInNodeLoadingQueue\": 1,\n" + " \"decommissioningNodes\": [\"host1\", \"host2\"],\n" + " \"decommissioningMaxPercentOfMaxSegmentsToMove\": 9,\n" + " \"pauseCoordination\": false\n" + "}\n";
CoordinatorDynamicConfig actual = mapper.readValue(mapper.writeValueAsString(mapper.readValue(jsonStr, CoordinatorDynamicConfig.class)), CoordinatorDynamicConfig.class);
ImmutableSet<String> decommissioning = ImmutableSet.of("host1", "host2");
ImmutableSet<String> whitelist = ImmutableSet.of("test1", "test2");
assertConfig(actual, 1, 1, 1, 1, 100, 1, 1, 2, true, whitelist, false, 1, decommissioning, 9, false, false, Integer.MAX_VALUE);
}
use of org.apache.druid.server.coordinator.CoordinatorDynamicConfig in project druid by druid-io.
the class CoordinatorDynamicConfigTest method testBuilderDefaults.
@Test
public void testBuilderDefaults() {
CoordinatorDynamicConfig defaultConfig = CoordinatorDynamicConfig.builder().build();
ImmutableSet<String> emptyList = ImmutableSet.of();
assertConfig(defaultConfig, 900000, 524288000, 100, 5, 100, 15, 10, 1, false, emptyList, true, EXPECTED_DEFAULT_MAX_SEGMENTS_IN_NODE_LOADING_QUEUE, emptyList, 70, false, false, Integer.MAX_VALUE);
}
use of org.apache.druid.server.coordinator.CoordinatorDynamicConfig in project druid by druid-io.
the class CoordinatorDynamicConfigTest method testUpdate.
@Test
public void testUpdate() {
CoordinatorDynamicConfig current = CoordinatorDynamicConfig.builder().withSpecificDataSourcesToKillUnusedSegmentsIn(ImmutableSet.of("x")).build();
Assert.assertEquals(current, new CoordinatorDynamicConfig.Builder(null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null).build(current));
}
use of org.apache.druid.server.coordinator.CoordinatorDynamicConfig in project druid by druid-io.
the class CoordinatorDynamicConfigTest method testDecommissioningParametersBackwardCompatibility.
@Test
public void testDecommissioningParametersBackwardCompatibility() throws Exception {
String jsonStr = "{\n" + " \"millisToWaitBeforeDeleting\": 1,\n" + " \"mergeBytesLimit\": 1,\n" + " \"mergeSegmentsLimit\" : 1,\n" + " \"maxSegmentsToMove\": 1,\n" + " \"replicantLifetime\": 1,\n" + " \"replicationThrottleLimit\": 1,\n" + " \"balancerComputeThreads\": 2, \n" + " \"emitBalancingStats\": true,\n" + " \"killDataSourceWhitelist\": [\"test1\",\"test2\"],\n" + " \"maxSegmentsInNodeLoadingQueue\": 1\n" + "}\n";
CoordinatorDynamicConfig actual = mapper.readValue(mapper.writeValueAsString(mapper.readValue(jsonStr, CoordinatorDynamicConfig.class)), CoordinatorDynamicConfig.class);
ImmutableSet<String> decommissioning = ImmutableSet.of();
ImmutableSet<String> whitelist = ImmutableSet.of("test1", "test2");
assertConfig(actual, 1, 1, 1, 1, 100, 1, 1, 2, true, whitelist, false, 1, decommissioning, 0, false, false, Integer.MAX_VALUE);
actual = CoordinatorDynamicConfig.builder().withDecommissioningNodes(ImmutableSet.of("host1")).build(actual);
assertConfig(actual, 1, 1, 1, 1, 100, 1, 1, 2, true, whitelist, false, 1, ImmutableSet.of("host1"), 0, false, false, Integer.MAX_VALUE);
actual = CoordinatorDynamicConfig.builder().withDecommissioningMaxPercentOfMaxSegmentsToMove(5).build(actual);
assertConfig(actual, 1, 1, 1, 1, 100, 1, 1, 2, true, whitelist, false, 1, ImmutableSet.of("host1"), 5, false, false, Integer.MAX_VALUE);
}
use of org.apache.druid.server.coordinator.CoordinatorDynamicConfig in project druid by druid-io.
the class CoordinatorDynamicConfigTest method testSerdeWithKillAllDataSources.
@Test
public void testSerdeWithKillAllDataSources() throws Exception {
String jsonStr = "{\n" + " \"millisToWaitBeforeDeleting\": 1,\n" + " \"mergeBytesLimit\": 1,\n" + " \"mergeSegmentsLimit\" : 1,\n" + " \"maxSegmentsToMove\": 1,\n" + " \"percentOfSegmentsToConsiderPerMove\": 1,\n" + " \"replicantLifetime\": 1,\n" + " \"replicationThrottleLimit\": 1,\n" + " \"balancerComputeThreads\": 2, \n" + " \"emitBalancingStats\": true,\n" + " \"killAllDataSources\": true,\n" + " \"maxSegmentsInNodeLoadingQueue\": 1\n" + "}\n";
CoordinatorDynamicConfig actual = mapper.readValue(mapper.writeValueAsString(mapper.readValue(jsonStr, CoordinatorDynamicConfig.class)), CoordinatorDynamicConfig.class);
assertConfig(actual, 1, 1, 1, 1, 1, 1, 1, 2, true, ImmutableSet.of(), true, 1, ImmutableSet.of(), 0, false, false, Integer.MAX_VALUE);
// killAllDataSources is a config in versions 0.22.x and older and is no longer used.
// This used to be an invalid config, but as of 0.23.0 the killAllDataSources flag no longer exsist,
// so this is a valid config
jsonStr = "{\n" + " \"killDataSourceWhitelist\": [\"test1\",\"test2\"],\n" + " \"killAllDataSources\": true,\n" + " \"percentOfSegmentsToConsiderPerMove\": 1\n" + "}\n";
actual = mapper.readValue(jsonStr, CoordinatorDynamicConfig.class);
Assert.assertFalse(actual.isKillUnusedSegmentsInAllDataSources());
Assert.assertEquals(2, actual.getSpecificDataSourcesToKillUnusedSegmentsIn().size());
}
Aggregations