tibrewalpratik17 commented on code in PR #17126:
URL: https://github.com/apache/pinot/pull/17126#discussion_r2546105364
##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/minion/generator/BaseTaskGenerator.java:
##########
@@ -217,4 +220,52 @@ public Map<String, String> getBaseTaskConfigs(TableConfig
tableConfig, List<Stri
MinionConstants.SEGMENT_NAME_SEPARATOR));
return baseConfigs;
}
+
+ /**
+ * Selects random items from a sorted list using reservoir sampling for
efficiency.
+ * This method is useful for segment selection with randomization to avoid
contention.
+ *
+ * @param sortedItems List of items paired with their priority values (e.g.,
invalid record count)
+ * @param maxItems Maximum number of items to select
+ * @param randomizationFactor Factor to expand candidate pool (e.g., 2.0 =
select from top 2x items)
+ * @param <T> Type of items to select
+ * @return List of randomly selected items
+ */
+ public static <T> List<T> selectRandomItems(List<Pair<T, Long>> sortedItems,
Review Comment:
This method can be moved to TaskGeneratorUtils
--
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]