rseetham commented on code in PR #18501:
URL: https://github.com/apache/pinot/pull/18501#discussion_r3283874821
##########
pinot-controller/src/main/java/org/apache/pinot/controller/validation/RealtimeOffsetAutoResetManager.java:
##########
@@ -105,36 +112,81 @@ protected void processTable(String tableNameWithType,
RealtimeOffsetAutoResetMan
return;
}
+ // Skip triggering if the controller is already handling the maximum
number of concurrent backfills
+ int maxConcurrent =
_controllerConf.getMaxConcurrentBackfillsPerController();
+ if (context._shouldTriggerBackfillJobs && maxConcurrent > 0
+ && _tableBackfillTopics.size() >= maxConcurrent) {
+ LOGGER.warn("Skipping backfill trigger for table {} — max concurrent
backfills ({}) reached",
+ tableNameWithType, maxConcurrent);
+ _controllerMetrics.addMeteredTableValue(tableNameWithType,
+ ControllerMeter.OFFSET_AUTO_RESET_BACKFILL_SKIPPED_MAX_CONCURRENT,
1L);
+ context._shouldTriggerBackfillJobs = false;
+ }
+
if (context._shouldTriggerBackfillJobs) {
_tableTopicsUnderBackfill.putIfAbsent(tableNameWithType,
ConcurrentHashMap.newKeySet());
String topicName =
context._backfillJobProperties.get(Constants.RESET_OFFSET_TOPIC_NAME);
+ String partitionStr =
context._backfillJobProperties.get(Constants.RESET_OFFSET_TOPIC_PARTITION);
_tableTopicsUnderBackfill.get(tableNameWithType).add(topicName);
+ // Per-partition in-flight guard: _tableBackfillTopics contains the
backfill Kafka topic names
+ // (not the main topic names), so any non-empty set indicates a backfill
is already in flight.
+ // Track collisions per (table, topic, partition); auto-pause if
collisions exceed the threshold.
+ String partitionKey = tableNameWithType + ":" + topicName + ":" +
partitionStr;
+ Set<String> activeBackfillTopics =
_tableBackfillTopics.get(tableNameWithType);
+ boolean anyBackfillInFlight = activeBackfillTopics != null &&
!activeBackfillTopics.isEmpty();
Review Comment:
I made this more complicated than it needs to be. I only need to check
collisions per partition, so I removed that check altogether now. Thanks for
pointing it out.
--
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]