xiangfu0 commented on code in PR #18501:
URL: https://github.com/apache/pinot/pull/18501#discussion_r3281051841
##########
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:
This breaker is described as per-partition, but the guard is actually
table-wide: `anyBackfillInFlight` becomes true whenever *any* backfill topic
exists for the table. After that, every unrelated `(topic, partition)` trigger
increments its own collision counter and can auto-pause its source topic even
though there was no collision on that partition. The check needs to prove that
the active backfill matches the same source topic/partition, not just that the
table has some backfill running.
--
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]