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


##########
extensions-core/kafka-indexing-service/src/main/java/org/apache/druid/indexing/kafka/supervisor/KafkaSupervisorSpec.java:
##########
@@ -176,6 +177,35 @@ protected KafkaSupervisorSpec toggleSuspend(boolean 
suspend)
     );
   }
 
+  @Override
+  public void validateProposedSpecEvolution(SupervisorSpec that) throws 
IllegalArgumentException
+  {
+    if (!(that instanceof KafkaSupervisorSpec)) {
+      throw new IllegalArgumentException("Cannot evolve to " + that.getType() 
+ " from " + getType());
+    }
+    KafkaSupervisorSpec other = (KafkaSupervisorSpec) that;
+    if (this.getSource() == null || other.getSource() == null) {
+      // I don't think this is possible, but covering just in case.
+      throw new IllegalArgumentException(
+          "Cannot consider KafkaSupervisorSpec evolution when one or both of 
the specs have not provided either a "
+          + "topic OR topicPattern");
+    }
+
+    // Future enhancements could allow for topicPattern to be changed in a way 
where the new source is additive to the
+    // old source. If we did that now, there would be metadata issues due to 
{@link KafkaDataSourceMetadata}
+    // implementation details that aren't set up to handle evolution of 
metadata in this way.
+    if (!this.getSource().equals(other.getSource())) {

Review Comment:
   Thanks! I have left an alternative suggestion for this.



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