-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Auto compaction based on parallel indexing #8570
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
8cdbc61
Auto compaction based on parallel indexing
jihoonson f77dfb7
javadoc and doc
jihoonson 9a60024
typo
jihoonson 2e0b7a8
update spell
jihoonson d7ceba6
addressing comments
jihoonson 459b0b0
Merge branch 'master' of github.com:apache/incubator-druid into paral…
jihoonson abce246
address comments
jihoonson ff81606
Merge branch 'master' of github.com:apache/incubator-druid into paral…
jihoonson a4f1a66
fix log
jihoonson cc50489
fix build
jihoonson fe131de
fix test
jihoonson 06d5c36
Merge branch 'master' of github.com:apache/incubator-druid into paral…
jihoonson dc3bcab
increase default max input segment bytes per task
jihoonson f68c3a4
fix test
jihoonson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
core/src/main/java/org/apache/druid/data/input/SegmentsSplitHintSpec.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| package org.apache.druid.data.input; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonCreator; | ||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
|
||
| import javax.annotation.Nullable; | ||
| import java.util.Objects; | ||
|
|
||
| /** | ||
| * {@link SplitHintSpec} for IngestSegmentFirehoseFactory. | ||
| */ | ||
| public class SegmentsSplitHintSpec implements SplitHintSpec | ||
| { | ||
| public static final String TYPE = "segments"; | ||
|
|
||
| private static final long DEFAULT_MAX_INPUT_SEGMENT_BYTES_PER_TASK = 500 * 1024 * 1024; | ||
|
|
||
| /** | ||
| * Maximum number of bytes of input segments to process in a single task. | ||
| * If a single segment is larger than this number, it will be processed by itself in a single task. | ||
| */ | ||
| private final long maxInputSegmentBytesPerTask; | ||
|
|
||
| @JsonCreator | ||
| public SegmentsSplitHintSpec( | ||
| @JsonProperty("maxInputSegmentBytesPerTask") @Nullable Long maxInputSegmentBytesPerTask | ||
| ) | ||
| { | ||
| this.maxInputSegmentBytesPerTask = maxInputSegmentBytesPerTask == null | ||
| ? DEFAULT_MAX_INPUT_SEGMENT_BYTES_PER_TASK | ||
| : maxInputSegmentBytesPerTask; | ||
| } | ||
|
|
||
| @JsonProperty | ||
| public long getMaxInputSegmentBytesPerTask() | ||
| { | ||
| return maxInputSegmentBytesPerTask; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object o) | ||
| { | ||
| if (this == o) { | ||
| return true; | ||
| } | ||
| if (o == null || getClass() != o.getClass()) { | ||
| return false; | ||
| } | ||
| SegmentsSplitHintSpec that = (SegmentsSplitHintSpec) o; | ||
| return maxInputSegmentBytesPerTask == that.maxInputSegmentBytesPerTask; | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() | ||
| { | ||
| return Objects.hash(maxInputSegmentBytesPerTask); | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() | ||
| { | ||
| return "SegmentsSplitHintSpec{" + | ||
| "maxInputSegmentBytesPerTask=" + maxInputSegmentBytesPerTask + | ||
| '}'; | ||
| } | ||
| } | ||
41 changes: 41 additions & 0 deletions
41
core/src/main/java/org/apache/druid/data/input/SplitHintSpec.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| package org.apache.druid.data.input; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonSubTypes; | ||
| import com.fasterxml.jackson.annotation.JsonSubTypes.Type; | ||
| import com.fasterxml.jackson.annotation.JsonTypeInfo; | ||
|
|
||
| /** | ||
| * In native parallel indexing, the supervisor task partitions input data into splits and assigns each of them | ||
| * to a single sub task. How to create splits could mainly depend on the input file format, but sometimes druid users | ||
| * want to give some hints to control the amount of data each sub task will read. SplitHintSpec can be used for this | ||
| * purpose. Implementations can ignore the given hint. | ||
| * | ||
| * @see FiniteFirehoseFactory#getSplits(SplitHintSpec) | ||
| * @see FiniteFirehoseFactory#getNumSplits(SplitHintSpec) | ||
| */ | ||
| @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type") | ||
| @JsonSubTypes(value = { | ||
| @Type(name = SegmentsSplitHintSpec.TYPE, value = SegmentsSplitHintSpec.class) | ||
| }) | ||
| public interface SplitHintSpec | ||
| { | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Do we have to handle -1 as null for new specs?
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.
This parameter was added in #7048 and it doesn't count -1 as null. IMO, handling -1 as null is a legacy behavior and new parameters shouldn't do that.