kfaraz commented on code in PR #12465:
URL: https://github.com/apache/druid/pull/12465#discussion_r875514860
##########
core/src/main/java/org/apache/druid/timeline/SegmentId.java:
##########
@@ -80,6 +79,12 @@ public final class SegmentId implements Comparable<SegmentId>
*/
private static final Interner<String> STRING_INTERNER =
Interners.newWeakInterner();
+ /**
+ * Store Intervals since creating them each time before returning is an
expensive operation
Review Comment:
Thanks for adding this!
##########
server/src/main/java/org/apache/druid/server/coordinator/CachingCostBalancerStrategy.java:
##########
@@ -70,10 +70,19 @@ protected double computeCost(DataSegment proposalSegment,
ServerHolder server, b
return cost * (server.getMaxSize() / server.getAvailableSize());
}
- private ClusterCostCache costCacheForLoadingSegments(ServerHolder server)
+ private double costCacheForLoadingSegments(ServerHolder server, DataSegment
proposalSegment)
Review Comment:
Nit: Rename to `computeCostForLoadingSegmentOnServer`
##########
core/src/main/java/org/apache/druid/timeline/SegmentId.java:
##########
@@ -278,9 +276,7 @@ public static SegmentId dummy(String dataSource, int
partitionNum)
private SegmentId(String dataSource, Interval interval, String version, int
partitionNum)
{
this.dataSource =
STRING_INTERNER.intern(Objects.requireNonNull(dataSource));
- this.intervalStartMillis = interval.getStartMillis();
- this.intervalEndMillis = interval.getEndMillis();
- this.intervalChronology = interval.getChronology();
+ this.interval = INTERVAL_INTERNER.intern(interval);
Review Comment:
Can interval ever be null here?
If not, we can add `Objects.requireNonNull` similar to the datasource
validation in the previous line.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]