kfaraz commented on code in PR #19205:
URL: https://github.com/apache/druid/pull/19205#discussion_r2990447688
##########
embedded-tests/src/test/java/org/apache/druid/testing/embedded/compact/CompactionSupervisorTest.java:
##########
@@ -1026,11 +1023,19 @@ private void runIngestionAtGranularity(
cluster.callApi().runTask(task, overlord);
}
- public static List<PartitionsSpec> getPartitionsSpec()
+ public static List<Object[]> getPolicyAndPartition()
Review Comment:
Since this is a junit5 test, you may use `Stream<Argument>` instead.
##########
server/src/main/java/org/apache/druid/server/compaction/CompactionCandidate.java:
##########
@@ -187,7 +192,13 @@ public CompactionStatus getCurrentStatus()
*/
public CompactionCandidate withCurrentStatus(CompactionStatus status)
{
- return new CompactionCandidate(segments, umbrellaInterval,
compactionInterval, numIntervals, status);
+ return new CompactionCandidate(
+ segments,
+ umbrellaInterval,
+ compactionInterval,
+ Math.toIntExact(compactionStatistics.getNumIntervals()),
Review Comment:
Instead of converting long to int here, update the type of `numIntervals` in
`CompactionStatistics` class to be int instead.
##########
server/src/main/java/org/apache/druid/server/compaction/CompactionStatus.java:
##########
@@ -185,6 +185,14 @@ public static CompactionStatus pending(
);
}
+ public static CompactionStatus complete(
+ CompactionStatistics compactionStatistics,
Review Comment:
```suggestion
CompactionStatistics compactedStats,
```
##########
server/src/main/java/org/apache/druid/server/compaction/MostFragmentedIntervalFirstPolicy.java:
##########
@@ -223,9 +251,27 @@ public Eligibility checkEligibilityForCompaction(
uncompactedBytesRatio,
minUncompactedBytesPercentForFullCompaction
);
- } else {
- return Eligibility.FULL;
}
+
+ // Check uncompacted rows ratio if total rows are available
+ final Long uncompactedRows = uncompacted.getTotalRows();
+ final Long compactedRows = candidate.getCompactedStats().getTotalRows();
+ if (uncompactedRows != null && compactedRows != null) {
+ if (uncompactedRows + compactedRows > 0) {
+ final double uncompactedRowsRatio = (double) uncompactedRows /
(uncompactedRows + compactedRows) * 100;
+ if (uncompactedRowsRatio < minUncompactedRowsPercentForFullCompaction)
{
+ return Eligibility.minor(
+ "Uncompacted rows ratio[%.2f] is below threshold[%d]",
+ uncompactedRowsRatio,
+ minUncompactedRowsPercentForFullCompaction
+ );
+ }
+ } else {
+ logger.error("Zero total rows in compaction candidate, something is
wrong");
Review Comment:
Include the datasource name and interval in this log line.
--
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]