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


##########
indexing-service/src/main/java/org/apache/druid/indexing/overlord/supervisor/SupervisorManager.java:
##########
@@ -277,10 +286,20 @@ public boolean resetSupervisor(String id, @Nullable 
DataSourceMetadata resetData
       return false;
     }
 
+    if (!(supervisor.lhs instanceof StreamSupervisor)) {
+      throw new UOE(
+          "Reset operation is not supported by the supervisor[%s] of 
type[%s].",
+          id,
+          supervisor.rhs.getType()
+      );
+    }
+
+    final StreamSupervisor streamSupervisor = (StreamSupervisor) 
supervisor.lhs;

Review Comment:
   This logic can be captured in a method and reused, something like:
   
   ```
   private SeekableStreamSupervisor requireStreamSupervisor(String 
supervisorId, String operation)
   {
       Pair supervisor = supervisors.get(id);
       if (supervisor instanceof SeekableStreamSupervisor) {
           // cast and return
       } else {
          // throw DruidException with right message about operation
       }
   }
   ```



##########
indexing-service/src/main/java/org/apache/druid/indexing/overlord/supervisor/SupervisorManager.java:
##########
@@ -142,7 +143,15 @@ public boolean handoffTaskGroupsEarly(String id, 
List<Integer> taskGroupIds)
     if (supervisor == null || supervisor.lhs == null) {
       return false;
     }
-    supervisor.lhs.handoffTaskGroupsEarly(taskGroupIds);
+    if (!(supervisor.lhs instanceof StreamSupervisor)) {
+      throw new UOE(

Review Comment:
   Throw DruidException instead?



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