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


##########
server/src/main/java/org/apache/druid/indexing/overlord/IndexerMetadataStorageCoordinator.java:
##########
@@ -632,4 +632,21 @@ List<Interval> getUnusedSegmentIntervals(
    */
   boolean markSegmentAsUsed(SegmentId segmentId);
 
+  /**
+   * Validates the given supervisorId and given metadata to ensure
+   * that start/end metadata non-null implies supervisor ID is non-null.
+   */
+  static void validateDataSourceMetadata(
+      @Nullable final String supervisorId,
+      @Nullable final DataSourceMetadata startMetadata,
+      @Nullable final DataSourceMetadata endMetadata
+  )
+  {
+    if ((startMetadata == null && endMetadata != null) || (startMetadata != 
null && endMetadata == null)) {
+      throw new IllegalArgumentException("start/end metadata pair must be 
either null or non-null");

Review Comment:
   We should throw `InvalidInput.exception` instead as the exception is 
user-facing and would be sent back in an HTTP response.



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