mirror of https://github.com/apache/druid.git
Better error message for compaction task when it sees no segments for compaction (#10728)
This commit is contained in:
parent
769c21cc87
commit
ea2d51d61f
|
@ -832,6 +832,9 @@ public class CompactionTask extends AbstractBatchIndexTask
|
|||
|
||||
void checkSegments(LockGranularity lockGranularityInUse, List<DataSegment> latestSegments)
|
||||
{
|
||||
if (latestSegments.isEmpty()) {
|
||||
throw new ISE("No segments found for compaction. Please check that datasource name and interval are correct.");
|
||||
}
|
||||
if (!inputSpec.validateSegments(lockGranularityInUse, latestSegments)) {
|
||||
throw new ISE(
|
||||
"Specified segments in the spec are different from the current used segments. "
|
||||
|
|
|
@ -546,6 +546,21 @@ public class CompactionTaskTest
|
|||
Assert.assertEquals(expected.getContext(), actual.getContext());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSegmentProviderFindSegmentsWithEmptySegmentsThrowException()
|
||||
{
|
||||
final SegmentProvider provider = new SegmentProvider(
|
||||
"datasource",
|
||||
new CompactionIntervalSpec(Intervals.of("2021-01-01/P1D"), null)
|
||||
);
|
||||
|
||||
expectedException.expect(IllegalStateException.class);
|
||||
expectedException.expectMessage(
|
||||
"No segments found for compaction. Please check that datasource name and interval are correct."
|
||||
);
|
||||
provider.checkSegments(LockGranularity.TIME_CHUNK, ImmutableList.of());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateIngestionSchema() throws IOException, SegmentLoadingException
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue