surekhasaharan commented on a change in pull request #7494: API to drop data by
interval
URL: https://github.com/apache/incubator-druid/pull/7494#discussion_r278364375
##########
File path:
server/src/test/java/org/apache/druid/metadata/SQLMetadataSegmentManagerTest.java
##########
@@ -275,6 +276,212 @@ public void testRemoveDataSegment() throws IOException
Assert.assertTrue(manager.removeSegment(newSegment.getId()));
}
+ @Test
+ public void testDisableSegmentsWithSegmentIds() throws IOException
+ {
+ manager.start();
+ manager.poll();
+ Assert.assertTrue(manager.isStarted());
+
+ final String datasource = "wikipedia2";
+ final DataSegment segment1 = new DataSegment(
+ datasource,
+ Intervals.of("2017-10-15T00:00:00.000/2017-10-16T00:00:00.000"),
+ "2017-10-15T20:19:12.565Z",
+ ImmutableMap.of(
+ "type", "s3_zip",
+ "bucket", "test",
+ "key",
"wikipedia2/index/y=2017/m=10/d=15/2017-10-16T20:19:12.565Z/0/index.zip"
+ ),
+ ImmutableList.of("dim1", "dim2", "dim3"),
+ ImmutableList.of("count", "value"),
+ NoneShardSpec.instance(),
+ 0,
+ 1234L
+ );
+
+ final DataSegment segment2 = new DataSegment(
+ datasource,
+ Intervals.of("2017-10-15T00:00:00.000/2017-10-16T00:00:00.000"),
+ "2017-10-15T20:19:12.565Z",
+ ImmutableMap.of(
+ "type", "s3_zip",
+ "bucket", "test",
+ "key",
"wikipedia2/index/y=2017/m=10/d=15/2017-10-16T20:19:12.565Z/0/index.zip"
+ ),
+ ImmutableList.of("dim1", "dim2", "dim3"),
+ ImmutableList.of("count", "value"),
+ NoneShardSpec.instance(),
+ 0,
+ 1234L
+ );
+
+ publisher.publishSegment(segment1);
+ publisher.publishSegment(segment2);
+ final ImmutableList<String> segmentIds =
ImmutableList.of(segment1.getId().toString(), segment2.getId().toString());
+
+ Assert.assertEquals(segmentIds.size(), manager.disableSegments(datasource,
segmentIds));
+ }
+
+ @Test
+ public void testDisableSegmentsWithSegmentIdsInvalidDatasource() throws
IOException
+ {
+ manager.start();
+ manager.poll();
+ Assert.assertTrue(manager.isStarted());
+
+ final String datasource = "wikipedia2";
+ final DataSegment segment1 = new DataSegment(
+ datasource,
+ Intervals.of("2017-10-15T00:00:00.000/2017-10-16T00:00:00.000"),
+ "2017-10-15T20:19:12.565Z",
+ ImmutableMap.of(
+ "type", "s3_zip",
+ "bucket", "test",
+ "key",
"wikipedia2/index/y=2017/m=10/d=15/2017-10-16T20:19:12.565Z/0/index.zip"
+ ),
+ ImmutableList.of("dim1", "dim2", "dim3"),
+ ImmutableList.of("count", "value"),
+ NoneShardSpec.instance(),
+ 0,
+ 1234L
+ );
+
+ final DataSegment segment2 = new DataSegment(
+ datasource,
+ Intervals.of("2017-10-15T00:00:00.000/2017-10-16T00:00:00.000"),
+ "2017-10-15T20:19:12.565Z",
+ ImmutableMap.of(
+ "type", "s3_zip",
+ "bucket", "test",
+ "key",
"wikipedia2/index/y=2017/m=10/d=15/2017-10-16T20:19:12.565Z/0/index.zip"
+ ),
+ ImmutableList.of("dim1", "dim2", "dim3"),
+ ImmutableList.of("count", "value"),
+ NoneShardSpec.instance(),
+ 0,
+ 1234L
+ );
+
+ publisher.publishSegment(segment1);
+ publisher.publishSegment(segment2);
+ final ImmutableList<String> segmentIds =
ImmutableList.of(segment1.getId().toString(), segment2.getId().toString());
+ // none of the segments are in datasource
+ Assert.assertEquals(0, manager.disableSegments("wrongDataSource",
segmentIds));
+ }
+
+ @Test
+ public void testDisableSegmentsWithInterval() throws IOException
Review comment:
yes, added a test for that
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]