-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Support segmentGranularity for auto-compaction #10843
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4dc9c5b
43df955
77d953c
064a43f
4182bd5
7c6d17a
7786851
ac12903
4994ca7
46e3416
9a0fb8b
5a22162
092868f
ace4281
5873318
a09deea
9ed2c61
020566a
4f031b6
2dfdcd4
ad11616
94ee532
343a07b
a506287
da018dc
5dd9e50
d9783b4
4405fc6
06060f9
e6e9030
578d433
7784f70
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -99,6 +99,7 @@ public void setup() | |
| null, | ||
| null, | ||
| null, | ||
| null, | ||
| null | ||
| ) | ||
| ); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -141,6 +141,8 @@ public class CompactionTask extends AbstractBatchIndexTask | |
| @Nullable | ||
| private final Granularity segmentGranularity; | ||
| @Nullable | ||
| private final GranularitySpec granularitySpec; | ||
| @Nullable | ||
| private final ParallelIndexTuningConfig tuningConfig; | ||
| @JsonIgnore | ||
| private final SegmentProvider segmentProvider; | ||
|
|
@@ -172,7 +174,8 @@ public CompactionTask( | |
| @JsonProperty("dimensions") @Nullable final DimensionsSpec dimensions, | ||
| @JsonProperty("dimensionsSpec") @Nullable final DimensionsSpec dimensionsSpec, | ||
| @JsonProperty("metricsSpec") @Nullable final AggregatorFactory[] metricsSpec, | ||
| @JsonProperty("segmentGranularity") @Nullable final Granularity segmentGranularity, | ||
| @JsonProperty("segmentGranularity") @Deprecated @Nullable final Granularity segmentGranularity, | ||
| @JsonProperty("granularitySpec") @Nullable final GranularitySpec granularitySpec, | ||
| @JsonProperty("tuningConfig") @Nullable final TuningConfig tuningConfig, | ||
| @JsonProperty("context") @Nullable final Map<String, Object> context, | ||
| @JacksonInject SegmentLoaderFactory segmentLoaderFactory, | ||
|
|
@@ -202,6 +205,16 @@ public CompactionTask( | |
| this.dimensionsSpec = dimensionsSpec == null ? dimensions : dimensionsSpec; | ||
| this.metricsSpec = metricsSpec; | ||
| this.segmentGranularity = segmentGranularity; | ||
| if (granularitySpec == null && segmentGranularity != null) { | ||
| this.granularitySpec = new UniformGranularitySpec( | ||
| segmentGranularity, | ||
| null, | ||
| null, | ||
| null | ||
| ); | ||
| } else { | ||
| this.granularitySpec = granularitySpec; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What happens if both segmentGranularity & granularitySpec are non-null?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. granularitySpec takes priority since segmentGranularity is deprecated.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if we have a consistent stance on this but I think several places throw an exception if both the deprecated and new property are specified (such as I don't feel strongly about it, so I'm just mentioning this in case you feel that's a better approach. |
||
| } | ||
| this.tuningConfig = tuningConfig != null ? getTuningConfig(tuningConfig) : null; | ||
| this.segmentProvider = new SegmentProvider(dataSource, this.ioConfig.getInputSpec()); | ||
| this.partitionConfigurationManager = new PartitionConfigurationManager(this.tuningConfig); | ||
|
|
@@ -288,7 +301,14 @@ public AggregatorFactory[] getMetricsSpec() | |
| @Override | ||
| public Granularity getSegmentGranularity() | ||
| { | ||
| return segmentGranularity; | ||
| return granularitySpec == null ? null : granularitySpec.getSegmentGranularity(); | ||
| } | ||
|
|
||
| @JsonProperty | ||
| @Nullable | ||
| public GranularitySpec getGranularitySpec() | ||
| { | ||
| return granularitySpec; | ||
| } | ||
|
|
||
| @Nullable | ||
|
|
@@ -348,7 +368,7 @@ public TaskStatus runTask(TaskToolbox toolbox) throws Exception | |
| partitionConfigurationManager, | ||
| dimensionsSpec, | ||
| metricsSpec, | ||
| segmentGranularity, | ||
| getSegmentGranularity(), | ||
| toolbox.getCoordinatorClient(), | ||
| segmentLoaderFactory, | ||
| retryPolicyFactory | ||
|
|
@@ -892,6 +912,8 @@ public static class Builder | |
| @Nullable | ||
| private Granularity segmentGranularity; | ||
| @Nullable | ||
| private GranularitySpec granularitySpec; | ||
| @Nullable | ||
| private TuningConfig tuningConfig; | ||
| @Nullable | ||
| private Map<String, Object> context; | ||
|
|
@@ -941,6 +963,12 @@ public Builder segmentGranularity(Granularity segmentGranularity) | |
| return this; | ||
| } | ||
|
|
||
| public Builder granularitySpec(GranularitySpec granularitySpec) | ||
| { | ||
| this.granularitySpec = granularitySpec; | ||
| return this; | ||
| } | ||
|
|
||
| public Builder tuningConfig(TuningConfig tuningConfig) | ||
| { | ||
| this.tuningConfig = tuningConfig; | ||
|
|
@@ -966,6 +994,7 @@ public CompactionTask build() | |
| dimensionsSpec, | ||
| metricsSpec, | ||
| segmentGranularity, | ||
| granularitySpec, | ||
| tuningConfig, | ||
| context, | ||
| segmentLoaderFactory, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove this since it is no longer used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is no longer used?