Skip to content

Commit

Permalink
Remove stale references to coordinator dynamic config killAllDataSour…
Browse files Browse the repository at this point in the history
…ces. (#16387)

This parameter has been removed for awhile now as of Druid 0.23.0
#12187.

The code was only used in tests to verify that serialization works.
Now remove all references to avoid any confusion.
  • Loading branch information
abhishekrb19 authored May 5, 2024
1 parent 588d442 commit 2a638d7
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,6 @@ public int getMaxKillTaskSlots()
return maxKillTaskSlots;
}

@JsonIgnore
public boolean isKillUnusedSegmentsInAllDataSources()
{
return specificDataSourcesToKillUnusedSegmentsIn.isEmpty();
}

@JsonProperty("killPendingSegmentsSkipList")
public Set<String> getDataSourcesToNotKillStalePendingSegmentsIn()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ public void testConstructorWithNullsShouldKillUnusedSegmentsInAllDataSources()
false,
null
);
Assert.assertTrue(config.isKillUnusedSegmentsInAllDataSources());
Assert.assertTrue(config.getSpecificDataSourcesToKillUnusedSegmentsIn().isEmpty());
}

Expand All @@ -290,7 +289,6 @@ public void testConstructorWithSpecificDataSourcesToKillShouldNotKillUnusedSegme
false,
null
);
Assert.assertFalse(config.isKillUnusedSegmentsInAllDataSources());
Assert.assertEquals(ImmutableSet.of("test1"), config.getSpecificDataSourcesToKillUnusedSegmentsIn());
}

Expand Down Expand Up @@ -468,60 +466,6 @@ public void testHandleMissingPercentOfSegmentsToConsiderPerMove() throws Excepti
);
}

@Test
public void testSerdeWithKillAllDataSources() 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"
+ " \"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,
2,
ImmutableSet.of(),
0.1,
Integer.MAX_VALUE,
true,
1,
ImmutableSet.of(),
false,
false
);

// 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"
+ "}\n";
actual = mapper.readValue(jsonStr, CoordinatorDynamicConfig.class);

Assert.assertFalse(actual.isKillUnusedSegmentsInAllDataSources());
Assert.assertEquals(2, actual.getSpecificDataSourcesToKillUnusedSegmentsIn().size());
}

@Test
public void testDeserializeWithoutMaxSegmentsInNodeLoadingQueue() throws Exception
{
Expand All @@ -532,8 +476,7 @@ public void testDeserializeWithoutMaxSegmentsInNodeLoadingQueue() throws Excepti
+ " \"maxSegmentsToMove\": 1,\n"
+ " \"replicantLifetime\": 1,\n"
+ " \"replicationThrottleLimit\": 1,\n"
+ " \"balancerComputeThreads\": 2, \n"
+ " \"killAllDataSources\": true\n"
+ " \"balancerComputeThreads\": 2\n"
+ "}\n";

CoordinatorDynamicConfig actual = mapper.readValue(
Expand Down Expand Up @@ -691,7 +634,6 @@ private void assertConfig(
expectedSpecificDataSourcesToKillUnusedSegmentsIn,
config.getSpecificDataSourcesToKillUnusedSegmentsIn()
);
Assert.assertEquals(expectedKillUnusedSegmentsInAllDataSources, config.isKillUnusedSegmentsInAllDataSources());
Assert.assertEquals(expectedKillTaskSlotRatio, config.getKillTaskSlotRatio(), 0.001);
Assert.assertEquals((int) expectedMaxKillTaskSlots, config.getMaxKillTaskSlots());
Assert.assertEquals(expectedMaxSegmentsInNodeLoadingQueue, config.getMaxSegmentsInNodeLoadingQueue());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import { getLink } from '../../links';
export interface CoordinatorDynamicConfig {
maxSegmentsToMove?: number;
balancerComputeThreads?: number;
killAllDataSources?: boolean;
killDataSourceWhitelist?: string[];
killTaskSlotRatio?: number;
maxKillTaskSlots?: number;
Expand Down

0 comments on commit 2a638d7

Please sign in to comment.