You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "kfaraz (via GitHub)" <gi...@apache.org> on 2024/07/16 04:53:38 UTC
[PR] Allow CompactionSegmentIterator to have custom priority (druid)
kfaraz opened a new pull request, #16737:
URL: https://github.com/apache/druid/pull/16737
### Description
`NewestSegmentFirstIterator` has a lot of code which may be commoned out if we want to implement other types
of compaction segment iterators. The changes in this PR create a common iterator which may be given any comparator
to prioritize between compactible segments.
### Changes
- Break `NewestSegmentFirstIterator` into two parts
- `DatasourceCompactibleSegmentIterator` - this contains all of the code originally in `NewestSegmentFirstIterator`
but now handles a single datasource and allows a priority to be specified
- `PriorityBasedCompactionSegmentIterator` - contains separate iterator for each datasource and combines the
results into a single queue to be used by a compaction search policy
- Update `NewestSegmentFirstPolicy` to use the above new classes
- Cleanup `CompactionStatistics` and `AutoCompactionSnapshot`
- Cleanup `CompactSegments`
### Main classes to review
- `DatasourceCompactibleSegmentIterator`
- `CompactSegments`
- `PriorityBasedCompactionSegmentIterator`
<hr>
This PR has:
- [ ] been self-reviewed.
- [ ] using the [concurrency checklist](https://github.com/apache/druid/blob/master/dev/code-review/concurrency.md) (Remove this item if the PR doesn't have any relation to concurrency.)
- [ ] added documentation for new or modified features or behaviors.
- [ ] a release note entry in the PR description.
- [ ] added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
- [ ] added or updated version, license, or notice information in [licenses.yaml](https://github.com/apache/druid/blob/master/dev/license.md)
- [ ] added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
- [ ] added unit tests or modified existing tests to cover new code paths, ensuring the threshold for [code coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md) is met.
- [ ] added integration tests.
- [ ] been tested in a test Druid cluster.
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Allow CompactionSegmentIterator to have custom priority (druid)
Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz merged PR #16737:
URL: https://github.com/apache/druid/pull/16737
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Allow CompactionSegmentIterator to have custom priority (druid)
Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on PR #16737:
URL: https://github.com/apache/druid/pull/16737#issuecomment-2231057480
Thanks for the reviews, @gargvishesh , @AmatyaAvadhanula !
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Allow CompactionSegmentIterator to have custom priority (druid)
Posted by "github-advanced-security[bot] (via GitHub)" <gi...@apache.org>.
github-advanced-security[bot] commented on code in PR #16737:
URL: https://github.com/apache/druid/pull/16737#discussion_r1678809399
##########
server/src/main/java/org/apache/druid/client/indexing/ClientCompactionTaskQueryTuningConfig.java:
##########
@@ -79,6 +80,17 @@
@Nullable
private final AppendableIndexSpec appendableIndexSpec;
+ public static ClientCompactionTaskQueryTuningConfig from(
+ DataSourceCompactionConfig compactionConfig
+ )
+ {
+ if (compactionConfig == null) {
+ return from(null, null, null);
+ } else {
+ return from(compactionConfig.getTuningConfig(), compactionConfig.getMaxRowsPerSegment(), null);
Review Comment:
## Deprecated method or constructor invocation
Invoking [DataSourceCompactionConfig.getMaxRowsPerSegment](1) should be avoided because it has been deprecated.
[Show more details](https://github.com/apache/druid/security/code-scanning/5394)
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Allow CompactionSegmentIterator to have custom priority (druid)
Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on code in PR #16737:
URL: https://github.com/apache/druid/pull/16737#discussion_r1679187435
##########
server/src/main/java/org/apache/druid/server/coordinator/compact/DatasourceCompactibleSegmentIterator.java:
##########
@@ -315,27 +291,12 @@ public List<DataSegment> next()
}
/**
- * Finds segments to compact together for the given datasource.
- *
- * @return An empty {@link SegmentsToCompact} if there are no eligible candidates.
+ * Finds segments to compact together for the given datasource and adds them to
+ * the priority queue.
*/
- private SegmentsToCompact findSegmentsToCompact(
- final String dataSourceName,
- final DataSourceCompactionConfig config
- )
+ private void findSegmentsToCompact(CompactibleSegmentIterator compactibleSegmentIterator)
Review Comment:
Added.
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Allow CompactionSegmentIterator to have custom priority (druid)
Posted by "gargvishesh (via GitHub)" <gi...@apache.org>.
gargvishesh commented on code in PR #16737:
URL: https://github.com/apache/druid/pull/16737#discussion_r1679144831
##########
server/src/main/java/org/apache/druid/server/coordinator/compact/DatasourceCompactibleSegmentIterator.java:
##########
@@ -315,27 +291,12 @@ public List<DataSegment> next()
}
/**
- * Finds segments to compact together for the given datasource.
- *
- * @return An empty {@link SegmentsToCompact} if there are no eligible candidates.
+ * Finds segments to compact together for the given datasource and adds them to
+ * the priority queue.
*/
- private SegmentsToCompact findSegmentsToCompact(
- final String dataSourceName,
- final DataSourceCompactionConfig config
- )
+ private void findSegmentsToCompact(CompactibleSegmentIterator compactibleSegmentIterator)
Review Comment:
```suggestion
private void findAndEnqueueSegmentsToCompact(CompactibleSegmentIterator compactibleSegmentIterator)
```
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Allow CompactionSegmentIterator to have custom priority (druid)
Posted by "github-advanced-security[bot] (via GitHub)" <gi...@apache.org>.
github-advanced-security[bot] commented on code in PR #16737:
URL: https://github.com/apache/druid/pull/16737#discussion_r1678809880
##########
server/src/main/java/org/apache/druid/client/indexing/ClientCompactionTaskQueryTuningConfig.java:
##########
@@ -79,6 +80,17 @@
@Nullable
private final AppendableIndexSpec appendableIndexSpec;
+ public static ClientCompactionTaskQueryTuningConfig from(
+ DataSourceCompactionConfig compactionConfig
+ )
+ {
+ if (compactionConfig == null) {
+ return from(null, null, null);
+ } else {
+ return from(compactionConfig.getTuningConfig(), compactionConfig.getMaxRowsPerSegment(), null);
Review Comment:
## Deprecated method or constructor invocation
Invoking [DataSourceCompactionConfig.getMaxRowsPerSegment](1) should be avoided because it has been deprecated.
[Show more details](https://github.com/apache/druid/security/code-scanning/7562)
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org