mirror of
https://github.com/apache/druid.git
synced 2025-02-09 03:24:55 +00:00
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)
|
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)) {
|
if (!inputSpec.validateSegments(lockGranularityInUse, latestSegments)) {
|
||||||
throw new ISE(
|
throw new ISE(
|
||||||
"Specified segments in the spec are different from the current used segments. "
|
"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());
|
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
|
@Test
|
||||||
public void testCreateIngestionSchema() throws IOException, SegmentLoadingException
|
public void testCreateIngestionSchema() throws IOException, SegmentLoadingException
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user