-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Broker config druid.broker.segment.ignoredTiers
#11766
Changes from 5 commits
daa5550
2c99f7c
0c9c03b
0cf0dbd
a6f40d3
a94e562
523ea70
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,17 +106,34 @@ public BrokerServerView( | |
this.baseView = baseView; | ||
this.tierSelectorStrategy = tierSelectorStrategy; | ||
this.emitter = emitter; | ||
this.segmentWatcherConfig = segmentWatcherConfig; | ||
this.clients = new ConcurrentHashMap<>(); | ||
this.selectors = new HashMap<>(); | ||
this.timelines = new HashMap<>(); | ||
|
||
// Validate and set the segment watcher config | ||
this.segmentWatcherConfig = segmentWatcherConfig; | ||
if (segmentWatcherConfig.getWatchedTiers() != null | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i know this isn't new, but I wonder since we now doing some validation here if we should also explode if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you think it would make sense to add a |
||
&& segmentWatcherConfig.getIgnoredTiers() != null) { | ||
throw new ISE( | ||
"At most one of 'druid.broker.segment.watchedTiers' " | ||
+ "and 'druid.broker.segment.ignoredTiers' can be specified." | ||
); | ||
} | ||
|
||
this.segmentFilter = (Pair<DruidServerMetadata, DataSegment> metadataAndSegment) -> { | ||
// Include only watched tiers if specified | ||
if (segmentWatcherConfig.getWatchedTiers() != null | ||
&& !segmentWatcherConfig.getWatchedTiers().contains(metadataAndSegment.lhs.getTier())) { | ||
return false; | ||
} | ||
|
||
// Exclude ignored tiers if specified | ||
if (segmentWatcherConfig.getIgnoredTiers() != null | ||
&& segmentWatcherConfig.getIgnoredTiers().contains(metadataAndSegment.lhs.getTier())) { | ||
return false; | ||
} | ||
|
||
// Include only watched datasources if specified | ||
if (segmentWatcherConfig.getWatchedDataSources() != null | ||
&& !segmentWatcherConfig.getWatchedDataSources().contains(metadataAndSegment.rhs.getDataSource())) { | ||
return false; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,9 +45,10 @@ public void testSerde() throws Exception | |
); | ||
|
||
Assert.assertNull(config.getWatchedTiers()); | ||
Assert.assertNull(config.getIgnoredTiers()); | ||
|
||
//non-defaults | ||
json = "{ \"watchedTiers\": [\"t1\", \"t2\"], \"watchedDataSources\": [\"ds1\", \"ds2\"] }"; | ||
json = "{ \"watchedTiers\": [\"t1\", \"t2\"], \"watchedDataSources\": [\"ds1\", \"ds2\"], \"ignoredTiers\": [\"t3\", \"t4\"] }"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this test is sort of strange now that it is an invalid configuration, though technically it isn't enforced by the config itself so it isn't problematic here. maybe we should at least leave a comment that this config is illegal in practice? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, you are right, we should not use an invalid configuration here. Fixing. |
||
|
||
config = MAPPER.readValue( | ||
MAPPER.writeValueAsString( | ||
|
@@ -57,6 +58,7 @@ public void testSerde() throws Exception | |
); | ||
|
||
Assert.assertEquals(ImmutableSet.of("t1", "t2"), config.getWatchedTiers()); | ||
Assert.assertEquals(ImmutableSet.of("t3", "t4"), config.getIgnoredTiers()); | ||
Assert.assertEquals(ImmutableSet.of("ds1", "ds2"), config.getWatchedDataSources()); | ||
|
||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should
druid.broker.segment.watchedTiers
docs also be updated to indicate that it is mutually exclusive withignoredTiers
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think that would help remove any ambiguity.