handle review comments for PR 2784

https://github.com/druid-io/druid/pull/2784#discussion_r59062021
This commit is contained in:
Nishant 2016-04-12 21:52:00 +05:30
parent 1bf1dd03a0
commit deb6ecf919
4 changed files with 11 additions and 52 deletions

View File

@ -296,7 +296,6 @@ In current Druid, multiple data segments may be announced under the same Znode.
|--------|-----------|-------| |--------|-----------|-------|
|`druid.announcer.segmentsPerNode`|Each Znode contains info for up to this many segments.|50| |`druid.announcer.segmentsPerNode`|Each Znode contains info for up to this many segments.|50|
|`druid.announcer.maxBytesPerNode`|Max byte size for Znode.|524288| |`druid.announcer.maxBytesPerNode`|Max byte size for Znode.|524288|
|`druid.announcer.skipDimensions`|Skip Dimension list from segment announcements. NOTE: Enabling this will also remove the dimensions list from coordinator and broker endpoints.|false| |`druid.announcer.skipDimensionsAndMetrics`|Skip Dimensions and Metrics list from segment announcements. NOTE: Enabling this will also remove the dimensions and metrics list from coordinator and broker endpoints.|false|
|`druid.announcer.skipMetrics`|Skip Metrics list from segment announcements. NOTE: Enabling this will also remove the metrics list from coordinator and broker endpoints.|false|
|`druid.announcer.skipLoadSpec`|Skip segment LoadSpec from segment announcements. NOTE: Enabling this will also remove the loadspec from coordinator and broker endpoints.|false| |`druid.announcer.skipLoadSpec`|Skip segment LoadSpec from segment announcements. NOTE: Enabling this will also remove the loadspec from coordinator and broker endpoints.|false|

View File

@ -85,11 +85,8 @@ public class BatchDataSegmentAnnouncer extends AbstractDataSegmentAnnouncer
public DataSegment apply(DataSegment input) public DataSegment apply(DataSegment input)
{ {
DataSegment rv = input; DataSegment rv = input;
if (config.isSkipDimensions()) { if (config.isSkipDimensionsAndMetrics()) {
rv = rv.withDimensions(null); rv = rv.withDimensions(null).withMetrics(null);
}
if (config.isSkipMetrics()) {
rv = rv.withMetrics(null);
} }
if (config.isSkipLoadSpec()) { if (config.isSkipLoadSpec()) {
rv = rv.withLoadSpec(null); rv = rv.withLoadSpec(null);

View File

@ -43,11 +43,7 @@ public class BatchDataSegmentAnnouncerConfig
// Skip dimension list from segment announcements // Skip dimension list from segment announcements
@JsonProperty @JsonProperty
private boolean skipDimensions = false; private boolean skipDimensionsAndMetrics = false;
// Skip metrics list from segment announcements
@JsonProperty
private boolean skipMetrics = false;
public int getSegmentsPerNode() public int getSegmentsPerNode()
{ {
@ -64,13 +60,9 @@ public class BatchDataSegmentAnnouncerConfig
return skipLoadSpec; return skipLoadSpec;
} }
public boolean isSkipDimensions() public boolean isSkipDimensionsAndMetrics()
{ {
return skipDimensions; return skipDimensionsAndMetrics;
} }
public boolean isSkipMetrics()
{
return skipMetrics;
}
} }

View File

@ -69,8 +69,7 @@ public class BatchDataSegmentAnnouncerTest
private Set<DataSegment> testSegments; private Set<DataSegment> testSegments;
private final AtomicInteger maxBytesPerNode = new AtomicInteger(512 * 1024); private final AtomicInteger maxBytesPerNode = new AtomicInteger(512 * 1024);
private Boolean skipDimensions; private Boolean skipDimensionsAndMetrics;
private Boolean skipMetrics;
private Boolean skipLoadSpec; private Boolean skipLoadSpec;
@ -98,8 +97,7 @@ public class BatchDataSegmentAnnouncerTest
announcer.start(); announcer.start();
segmentReader = new SegmentReader(cf, jsonMapper); segmentReader = new SegmentReader(cf, jsonMapper);
skipDimensions = false; skipDimensionsAndMetrics = false;
skipMetrics = false;
skipLoadSpec = false; skipLoadSpec = false;
segmentAnnouncer = new BatchDataSegmentAnnouncer( segmentAnnouncer = new BatchDataSegmentAnnouncer(
new DruidServerMetadata( new DruidServerMetadata(
@ -125,15 +123,9 @@ public class BatchDataSegmentAnnouncerTest
} }
@Override @Override
public boolean isSkipDimensions() public boolean isSkipDimensionsAndMetrics()
{ {
return skipDimensions; return skipDimensionsAndMetrics;
}
@Override
public boolean isSkipMetrics()
{
return skipMetrics;
} }
@Override @Override
@ -208,7 +200,7 @@ public class BatchDataSegmentAnnouncerTest
@Test @Test
public void testSkipDimensions() throws Exception public void testSkipDimensions() throws Exception
{ {
skipDimensions = true; skipDimensionsAndMetrics = true;
Iterator<DataSegment> segIter = testSegments.iterator(); Iterator<DataSegment> segIter = testSegments.iterator();
DataSegment firstSegment = segIter.next(); DataSegment firstSegment = segIter.next();
@ -220,27 +212,6 @@ public class BatchDataSegmentAnnouncerTest
DataSegment announcedSegment = Iterables.getOnlyElement(segmentReader.read(joiner.join(testSegmentsPath, zNode))); DataSegment announcedSegment = Iterables.getOnlyElement(segmentReader.read(joiner.join(testSegmentsPath, zNode)));
Assert.assertEquals(announcedSegment, firstSegment); Assert.assertEquals(announcedSegment, firstSegment);
Assert.assertTrue(announcedSegment.getDimensions().isEmpty()); Assert.assertTrue(announcedSegment.getDimensions().isEmpty());
}
segmentAnnouncer.unannounceSegment(firstSegment);
Assert.assertTrue(cf.getChildren().forPath(testSegmentsPath).isEmpty());
}
@Test
public void testSkipMetrics() throws Exception
{
skipMetrics = true;
Iterator<DataSegment> segIter = testSegments.iterator();
DataSegment firstSegment = segIter.next();
segmentAnnouncer.announceSegment(firstSegment);
List<String> zNodes = cf.getChildren().forPath(testSegmentsPath);
for (String zNode : zNodes) {
DataSegment announcedSegment = Iterables.getOnlyElement(segmentReader.read(joiner.join(testSegmentsPath, zNode)));
Assert.assertEquals(announcedSegment, firstSegment);
Assert.assertTrue(announcedSegment.getMetrics().isEmpty()); Assert.assertTrue(announcedSegment.getMetrics().isEmpty());
} }