forked from apache/druid
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request apache#2382 from himanshug/broker_segment_tier_sel…
…ection at broker, if configured, only add segments from specific tiers to the timeline
- Loading branch information
Showing
6 changed files
with
123 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
server/src/main/java/io/druid/client/BrokerSegmentWatcherConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Licensed to Metamarkets Group Inc. (Metamarkets) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. Metamarkets licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package io.druid.client; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
import java.util.Set; | ||
|
||
/** | ||
*/ | ||
public class BrokerSegmentWatcherConfig | ||
{ | ||
@JsonProperty | ||
private Set<String> watchedTiers = null; | ||
|
||
public Set<String> getWatchedTiers() | ||
{ | ||
return watchedTiers; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
server/src/test/java/io/druid/client/BrokerSegmentWatcherConfigTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* Licensed to Metamarkets Group Inc. (Metamarkets) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. Metamarkets licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package io.druid.client; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.google.common.collect.ImmutableSet; | ||
import io.druid.segment.TestHelper; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
/** | ||
*/ | ||
public class BrokerSegmentWatcherConfigTest | ||
{ | ||
private static final ObjectMapper MAPPER = TestHelper.getObjectMapper(); | ||
|
||
@Test | ||
public void testSerde() throws Exception | ||
{ | ||
//defaults | ||
String json = "{}"; | ||
|
||
BrokerSegmentWatcherConfig config = MAPPER.readValue( | ||
MAPPER.writeValueAsString( | ||
MAPPER.readValue(json, BrokerSegmentWatcherConfig.class) | ||
), | ||
BrokerSegmentWatcherConfig.class | ||
); | ||
|
||
Assert.assertNull(config.getWatchedTiers()); | ||
|
||
//non-defaults | ||
json = "{ \"watchedTiers\": [\"t1\", \"t2\"] }"; | ||
|
||
config = MAPPER.readValue( | ||
MAPPER.writeValueAsString( | ||
MAPPER.readValue(json, BrokerSegmentWatcherConfig.class) | ||
), | ||
BrokerSegmentWatcherConfig.class | ||
); | ||
|
||
Assert.assertEquals(ImmutableSet.of("t1", "t2"), config.getWatchedTiers()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters