diff --git a/core/src/main/java/org/apache/druid/timeline/DataSegmentUtils.java b/core/src/main/java/org/apache/druid/timeline/DataSegmentUtils.java index 7966991a531..150e09b0854 100644 --- a/core/src/main/java/org/apache/druid/timeline/DataSegmentUtils.java +++ b/core/src/main/java/org/apache/druid/timeline/DataSegmentUtils.java @@ -28,7 +28,9 @@ import org.apache.druid.java.util.common.logger.Logger; import org.joda.time.DateTime; import org.joda.time.Interval; +import java.util.Collection; import java.util.Objects; +import java.util.stream.Collectors; @PublicApi public class DataSegmentUtils @@ -108,6 +110,16 @@ public class DataSegmentUtils return segmentDesc.withInterval(newInterval).toString(); } + /** + * Creates a comma delimited list of segment identifiers + * @param segments + * @return + */ + public static String getIdentifiersString(Collection segments) + { + return segments.stream().map(DataSegment::getIdentifier).collect(Collectors.joining(", ")); + } + public static class SegmentIdentifierParts { private final String dataSource; diff --git a/indexing-service/src/main/java/org/apache/druid/indexing/common/actions/SegmentInsertAction.java b/indexing-service/src/main/java/org/apache/druid/indexing/common/actions/SegmentInsertAction.java index 42f74e59737..68a30b679af 100644 --- a/indexing-service/src/main/java/org/apache/druid/indexing/common/actions/SegmentInsertAction.java +++ b/indexing-service/src/main/java/org/apache/druid/indexing/common/actions/SegmentInsertAction.java @@ -25,9 +25,9 @@ import com.fasterxml.jackson.core.type.TypeReference; import com.google.common.collect.ImmutableSet; import org.apache.druid.indexing.common.task.Task; import org.apache.druid.timeline.DataSegment; +import org.apache.druid.timeline.DataSegmentUtils; import java.util.Set; -import java.util.stream.Collectors; /** * Insert segments into metadata storage. The segment versions must all be less than or equal to a lock held by @@ -84,7 +84,7 @@ public class SegmentInsertAction implements TaskAction> public String toString() { return "SegmentInsertAction{" + - "segments=" + segments.stream().map(DataSegment::getIdentifier).collect(Collectors.joining(",")) + + "segments=" + DataSegmentUtils.getIdentifiersString(segments) + '}'; } } diff --git a/indexing-service/src/main/java/org/apache/druid/indexing/common/actions/SegmentMetadataUpdateAction.java b/indexing-service/src/main/java/org/apache/druid/indexing/common/actions/SegmentMetadataUpdateAction.java index 4bb70a533d8..761c7586a7a 100644 --- a/indexing-service/src/main/java/org/apache/druid/indexing/common/actions/SegmentMetadataUpdateAction.java +++ b/indexing-service/src/main/java/org/apache/druid/indexing/common/actions/SegmentMetadataUpdateAction.java @@ -31,6 +31,7 @@ import org.apache.druid.java.util.common.ISE; import org.apache.druid.java.util.emitter.service.ServiceMetricEvent; import org.apache.druid.query.DruidMetrics; import org.apache.druid.timeline.DataSegment; +import org.apache.druid.timeline.DataSegmentUtils; import org.joda.time.Interval; import java.util.List; @@ -114,7 +115,7 @@ public class SegmentMetadataUpdateAction implements TaskAction public String toString() { return "SegmentMetadataUpdateAction{" + - "segments=" + segments.stream().map(DataSegment::getIdentifier).collect(Collectors.joining(",")) + + "segments=" + DataSegmentUtils.getIdentifiersString(segments) + '}'; } } diff --git a/indexing-service/src/main/java/org/apache/druid/indexing/common/actions/SegmentNukeAction.java b/indexing-service/src/main/java/org/apache/druid/indexing/common/actions/SegmentNukeAction.java index db632a78507..31a65d0f357 100644 --- a/indexing-service/src/main/java/org/apache/druid/indexing/common/actions/SegmentNukeAction.java +++ b/indexing-service/src/main/java/org/apache/druid/indexing/common/actions/SegmentNukeAction.java @@ -31,6 +31,7 @@ import org.apache.druid.java.util.common.ISE; import org.apache.druid.java.util.emitter.service.ServiceMetricEvent; import org.apache.druid.query.DruidMetrics; import org.apache.druid.timeline.DataSegment; +import org.apache.druid.timeline.DataSegmentUtils; import org.joda.time.Interval; import java.util.List; @@ -116,7 +117,7 @@ public class SegmentNukeAction implements TaskAction public String toString() { return "SegmentNukeAction{" + - "segments=" + segments.stream().map(DataSegment::getIdentifier).collect(Collectors.joining(",")) + + "segments=" + DataSegmentUtils.getIdentifiersString(segments) + '}'; } } diff --git a/indexing-service/src/main/java/org/apache/druid/indexing/common/actions/SegmentTransactionalInsertAction.java b/indexing-service/src/main/java/org/apache/druid/indexing/common/actions/SegmentTransactionalInsertAction.java index 3d733f90eff..01e3db7e0f3 100644 --- a/indexing-service/src/main/java/org/apache/druid/indexing/common/actions/SegmentTransactionalInsertAction.java +++ b/indexing-service/src/main/java/org/apache/druid/indexing/common/actions/SegmentTransactionalInsertAction.java @@ -31,6 +31,7 @@ import org.apache.druid.indexing.overlord.SegmentPublishResult; import org.apache.druid.java.util.emitter.service.ServiceMetricEvent; import org.apache.druid.query.DruidMetrics; import org.apache.druid.timeline.DataSegment; +import org.apache.druid.timeline.DataSegmentUtils; import java.util.Set; import java.util.stream.Collectors; @@ -154,7 +155,7 @@ public class SegmentTransactionalInsertAction implements TaskAction