Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions core/src/main/java/org/apache/druid/timeline/DataSegmentUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
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
Expand Down Expand Up @@ -108,6 +110,16 @@ public static String withInterval(final String dataSource, final String identifi
return segmentDesc.withInterval(newInterval).toString();
}

/**
* Creates a comma delimited list of segment identifiers
* @param segments
* @return
*/
public static String getIdentifiersString(Collection<DataSegment> segments)
{
return segments.stream().map(DataSegment::getIdentifier).collect(Collectors.joining(", "));
}

public static class SegmentIdentifierParts
{
private final String dataSource;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
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
Expand Down Expand Up @@ -84,7 +84,7 @@ public boolean isAudited()
public String toString()
{
return "SegmentInsertAction{" +
"segments=" + segments.stream().map(DataSegment::getIdentifier).collect(Collectors.joining(",")) +
"segments=" + DataSegmentUtils.getIdentifiersString(segments) +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
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;
Expand Down Expand Up @@ -114,7 +115,7 @@ public boolean isAudited()
public String toString()
{
return "SegmentMetadataUpdateAction{" +
"segments=" + segments.stream().map(DataSegment::getIdentifier).collect(Collectors.joining(",")) +
"segments=" + DataSegmentUtils.getIdentifiersString(segments) +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
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;
Expand Down Expand Up @@ -116,7 +117,7 @@ public boolean isAudited()
public String toString()
{
return "SegmentNukeAction{" +
"segments=" + segments.stream().map(DataSegment::getIdentifier).collect(Collectors.joining(",")) +
"segments=" + DataSegmentUtils.getIdentifiersString(segments) +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
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;
Expand Down Expand Up @@ -154,7 +155,7 @@ public boolean isAudited()
public String toString()
{
return "SegmentInsertAction{" +
"segments=" + segments.stream().map(DataSegment::getIdentifier).collect(Collectors.joining(",")) +
"segments=" + DataSegmentUtils.getIdentifiersString(segments) +
", startMetadata=" + startMetadata +
", endMetadata=" + endMetadata +
'}';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ public void close()
mergeBufferTotalSize += bufferAllocation.rhs;
ByteBufferUtils.free(bufferAllocation.lhs);
}
log.info("Freed [,%d] bytes of dictionary merging direct buffers", mergeBufferTotalSize);
log.info("Freed [%,d] bytes of dictionary merging direct buffers", mergeBufferTotalSize);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.apache.druid.server.coordinator.DataSourceCompactionConfig;
import org.apache.druid.server.coordinator.DruidCoordinatorRuntimeParams;
import org.apache.druid.timeline.DataSegment;
import org.apache.druid.timeline.DataSegmentUtils;
import org.apache.druid.timeline.VersionedIntervalTimeline;

import javax.annotation.Nullable;
Expand Down Expand Up @@ -163,7 +164,7 @@ private CoordinatorStats doRun(
LOG.info(
"Submitted a compactTask[%s] for segments[%s]",
taskId,
segmentsToCompact.stream().map(DataSegment::getIdentifier).collect(Collectors.joining(","))
DataSegmentUtils.getIdentifiersString(segmentsToCompact)
);
} else if (segmentsToCompact.size() == 1) {
throw new ISE("Found one segments[%s] to compact", segmentsToCompact);
Expand Down