kfaraz commented on code in PR #18968:
URL: https://github.com/apache/druid/pull/18968#discussion_r2850846762


##########
server/src/main/java/org/apache/druid/server/compaction/CompactionCandidateSearchPolicy.java:
##########
@@ -48,74 +45,11 @@ public interface CompactionCandidateSearchPolicy
   int compareCandidates(CompactionCandidate candidateA, CompactionCandidate 
candidateB);
 
   /**
-   * Checks if the given {@link CompactionCandidate} is eligible for compaction
-   * in the current iteration. A policy may implement this method to skip
-   * compacting intervals or segments that do not fulfil some required 
criteria.
+   * Creates a {@link CompactionCandidate} after applying policy-specific 
checks to the proposed compaction candidate.
    *
-   * @return {@link Eligibility#OK} only if eligible.
-   */
-  Eligibility checkEligibilityForCompaction(
-      CompactionCandidate candidate,
-      CompactionTaskStatus latestTaskStatus
-  );
-
-  /**
-   * Describes the eligibility of an interval for compaction.
+   * @param candidate the proposed compaction
+   * @param eligibility initial eligibility from compaction config checks
+   * @return final compaction candidate
    */
-  class Eligibility
-  {
-    public static final Eligibility OK = new Eligibility(true, null);
-
-    private final boolean eligible;
-    private final String reason;
-
-    private Eligibility(boolean eligible, String reason)
-    {
-      this.eligible = eligible;
-      this.reason = reason;
-    }
-
-    public boolean isEligible()
-    {
-      return eligible;
-    }
-
-    public String getReason()
-    {
-      return reason;
-    }
-
-    public static Eligibility fail(String messageFormat, Object... args)
-    {
-      return new Eligibility(false, StringUtils.format(messageFormat, args));
-    }
-
-    @Override
-    public boolean equals(Object object)
-    {
-      if (this == object) {
-        return true;
-      }
-      if (object == null || getClass() != object.getClass()) {
-        return false;
-      }
-      Eligibility that = (Eligibility) object;
-      return eligible == that.eligible && Objects.equals(reason, that.reason);
-    }
-
-    @Override
-    public int hashCode()
-    {
-      return Objects.hash(eligible, reason);
-    }
-
-    @Override
-    public String toString()
-    {
-      return "Eligibility{" +
-             "eligible=" + eligible +
-             ", reason='" + reason + '\'' +
-             '}';
-    }
-  }
+  CompactionCandidate createCandidate(CompactionCandidate.ProposedCompaction 
candidate, CompactionStatus eligibility);

Review Comment:
   No we should continue to use the existing method in 
`CompactionCandidateSearchPolicy` i.e. `checkEligibility()`.
   
   Just add a new enum inside the `Eligibility` class.



-- 
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]

Reply via email to