aho135 commented on code in PR #19372:
URL: https://github.com/apache/druid/pull/19372#discussion_r3165331522


##########
indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/supervisor/BoundedStreamConfig.java:
##########
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.indexing.seekablestream.supervisor;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+
+import java.util.Map;
+
+/**
+ * Configuration for bounded (one-time) stream processing with explicit 
start/end offsets.
+ *
+ * When configured, the supervisor will:
+ * 1. Create tasks starting at the specified startSequenceNumbers
+ * 2. Tasks will automatically stop when they reach endSequenceNumbers
+ * 3. Supervisor will not recreate tasks after they complete
+ * 4. Supervisor will auto-terminate when all tasks are done
+ *
+ * This is useful for:
+ * - Backfill processing
+ * - Historical reprocessing
+ * - One-time migration tasks
+ */
+public class BoundedStreamConfig
+{
+  private final Map<?, ?> startSequenceNumbers;  // Partition -> Start Offset
+  private final Map<?, ?> endSequenceNumbers;    // Partition -> End Offset
+
+  @JsonCreator
+  public BoundedStreamConfig(
+      @JsonProperty("startSequenceNumbers") Map<?, ?> startSequenceNumbers,
+      @JsonProperty("endSequenceNumbers") Map<?, ?> endSequenceNumbers
+  )
+  {
+    this.startSequenceNumbers = 
Preconditions.checkNotNull(startSequenceNumbers, "startSequenceNumbers");
+    this.endSequenceNumbers = Preconditions.checkNotNull(endSequenceNumbers, 
"endSequenceNumbers");
+
+    // Validation

Review Comment:
   The validation there isn't strict enough though because startOffset can 
equal endOffset. In that scenario the Supervisor spins up a task that consumes 
nothing and then shuts down. But since no data was consumed there is no 
metadata update so it gets stuck in a loop where it keeps spinning up tasks. I 
added additional validation to handle this scenario in this 
[commit](https://github.com/apache/druid/pull/19372/changes/c9181f025713915977dc7bdc237069d160189791)



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