abhishekrb19 commented on code in PR #15589:
URL: https://github.com/apache/druid/pull/15589#discussion_r1429207344
##########
indexing-service/src/main/java/org/apache/druid/indexing/common/actions/SegmentAllocationQueue.java:
##########
@@ -439,6 +440,11 @@ private int allocateSegmentsForBatch(AllocateRequestBatch
requestBatch, Set<Data
final List<Granularity> candidateGranularities
=
Granularity.granularitiesFinerThan(requestBatch.key.preferredSegmentGranularity);
for (Granularity granularity : candidateGranularities) {
+ // Do not try to allocate with WEEK granularity unless the preferred
granularity itself is WEEK
+ if
(!Granularities.WEEK.equals(requestBatch.key.preferredSegmentGranularity)
Review Comment:
Please see my comment re moving this logic inside
`Granularity.granularitiesFinerThan`. If we do that, we can skip this filtering
logic at every call site and won't introduce bugs.
##########
indexing-service/src/main/java/org/apache/druid/indexing/common/actions/SegmentAllocateAction.java:
##########
@@ -272,8 +273,12 @@ private SegmentIdWithShardSpec
tryAllocateFirstSegment(TaskActionToolbox toolbox
{
// No existing segments for this row, but there might still be nearby ones
that conflict with our preferred
// segment granularity. Try that first, and then progressively smaller
ones if it fails.
+ // Consider trying with WEEK granularity only if the preferred granularity
is WEEK
Review Comment:
Could we also update the class-level javadoc to note that `WEEK` granularity
won't be used even if it's a possibility, unless it's explicitly requested for:
https://github.com/apache/druid/blob/master/indexing-service/src/main/java/org/apache/druid/indexing/common/actions/SegmentAllocateAction.java#L56?
##########
indexing-service/src/main/java/org/apache/druid/indexing/common/actions/SegmentAllocateAction.java:
##########
@@ -272,8 +273,12 @@ private SegmentIdWithShardSpec
tryAllocateFirstSegment(TaskActionToolbox toolbox
{
// No existing segments for this row, but there might still be nearby ones
that conflict with our preferred
// segment granularity. Try that first, and then progressively smaller
ones if it fails.
+ // Consider trying with WEEK granularity only if the preferred granularity
is WEEK
final List<Interval> tryIntervals =
Granularity.granularitiesFinerThan(preferredSegmentGranularity)
Review Comment:
Should we have the logic inside `Granularity.granularitiesFinerThan()` --
i.e., unless `preferredSegmentGranularity == GranularityType.WEEK`, the
function won't add `GranularityType.WEEK` to the candidate list of
granularities? (similar to the existing `Granularity.ALL` condition)
--
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]