diff --git a/examples/quickstart/tutorial/rollup-index.json b/examples/quickstart/tutorial/rollup-index.json index 7c0b5815d2c..a978c2a76d2 100644 --- a/examples/quickstart/tutorial/rollup-index.json +++ b/examples/quickstart/tutorial/rollup-index.json @@ -20,7 +20,7 @@ ], "granularitySpec" : { "type" : "uniform", - "segmentGranularity" : "week", + "segmentGranularity" : "day", "queryGranularity" : "minute", "intervals" : ["2018-01-01/2018-01-03"], "rollup" : true diff --git a/examples/quickstart/tutorial/transform-index.json b/examples/quickstart/tutorial/transform-index.json index caebb9ff9c5..14c6b9ae6d4 100644 --- a/examples/quickstart/tutorial/transform-index.json +++ b/examples/quickstart/tutorial/transform-index.json @@ -20,7 +20,7 @@ ], "granularitySpec" : { "type" : "uniform", - "segmentGranularity" : "week", + "segmentGranularity" : "day", "queryGranularity" : "minute", "intervals" : ["2018-01-01/2018-01-03"], "rollup" : true diff --git a/examples/quickstart/tutorial/updates-append-index.json b/examples/quickstart/tutorial/updates-append-index.json index 9ba53a0b311..9cfb3b7d07a 100644 --- a/examples/quickstart/tutorial/updates-append-index.json +++ b/examples/quickstart/tutorial/updates-append-index.json @@ -18,7 +18,7 @@ ], "granularitySpec": { "type": "uniform", - "segmentGranularity": "week", + "segmentGranularity": "day", "queryGranularity": "minute", "intervals": ["2018-01-01/2018-01-03"], "rollup": true diff --git a/examples/quickstart/tutorial/updates-append-index2.json b/examples/quickstart/tutorial/updates-append-index2.json index 921b8cf0e2d..3f97ca31712 100644 --- a/examples/quickstart/tutorial/updates-append-index2.json +++ b/examples/quickstart/tutorial/updates-append-index2.json @@ -18,7 +18,7 @@ ], "granularitySpec" : { "type" : "uniform", - "segmentGranularity" : "week", + "segmentGranularity" : "day", "queryGranularity" : "minute", "intervals" : ["2018-01-01/2018-01-03"], "rollup" : true diff --git a/examples/quickstart/tutorial/updates-init-index.json b/examples/quickstart/tutorial/updates-init-index.json index ed4b349c6e0..52c0950e1d8 100644 --- a/examples/quickstart/tutorial/updates-init-index.json +++ b/examples/quickstart/tutorial/updates-init-index.json @@ -18,7 +18,7 @@ ], "granularitySpec" : { "type" : "uniform", - "segmentGranularity" : "week", + "segmentGranularity" : "day", "queryGranularity" : "minute", "intervals" : ["2018-01-01/2018-01-03"], "rollup" : true diff --git a/examples/quickstart/tutorial/updates-overwrite-index.json b/examples/quickstart/tutorial/updates-overwrite-index.json index b2545f04dd1..59e88bc9c6d 100644 --- a/examples/quickstart/tutorial/updates-overwrite-index.json +++ b/examples/quickstart/tutorial/updates-overwrite-index.json @@ -18,7 +18,7 @@ ], "granularitySpec" : { "type" : "uniform", - "segmentGranularity" : "week", + "segmentGranularity" : "day", "queryGranularity" : "minute", "intervals" : ["2018-01-01/2018-01-03"], "rollup" : true diff --git a/indexing-service/src/main/java/org/apache/druid/indexing/common/actions/SegmentAllocateAction.java b/indexing-service/src/main/java/org/apache/druid/indexing/common/actions/SegmentAllocateAction.java index f0fae4a8617..280f4199e7b 100644 --- a/indexing-service/src/main/java/org/apache/druid/indexing/common/actions/SegmentAllocateAction.java +++ b/indexing-service/src/main/java/org/apache/druid/indexing/common/actions/SegmentAllocateAction.java @@ -52,9 +52,13 @@ import java.util.concurrent.ThreadLocalRandom; import java.util.stream.Collectors; /** - * Allocates a pending segment for a given timestamp. The preferredSegmentGranularity is used if there are no prior - * segments for the given timestamp, or if the prior segments for the given timestamp are already at the - * preferredSegmentGranularity. Otherwise, the prior segments will take precedence. + * Allocates a pending segment for a given timestamp. + * If a visible chunk of used segments contains the interval with the query granularity containing the timestamp, + * the pending segment is allocated with its interval. + * Else, if the interval with the preferred segment granularity containing the timestamp has no overlap + * with the existing used segments, the preferred segment granularity is used. + * Else, find the coarsest segment granularity, containing the interval with the query granularity for the timestamp, + * that does not overlap with the existing used segments. This granularity is used for allocation if it exists. *
* This action implicitly acquires some task locks when it allocates segments. You do not have to acquire them * beforehand, although you *do* have to release them yourself. (Note that task locks are automatically released when @@ -62,6 +66,8 @@ import java.util.stream.Collectors; * * If this action cannot acquire an appropriate task lock, or if it cannot expand an existing segment set, it returns * null. + * + * Do NOT allocate WEEK granularity segments unless the preferred segment granularity is WEEK. */ public class SegmentAllocateAction implements TaskAction