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


##########
processing/src/main/java/org/apache/druid/timeline/partition/OvershadowableManager.java:
##########
@@ -418,9 +418,12 @@ private Iterator<Entry<RootPartitionRange, 
Short2ObjectSortedMap<AtomicUpdateGro
       TreeMap<RootPartitionRange, Short2ObjectSortedMap<AtomicUpdateGroup<T>>> 
stateMap
   )
   {
-    final RootPartitionRange lowFench = new RootPartitionRange(partitionId, 
partitionId);
+    final RootPartitionRange lowFence = new RootPartitionRange(partitionId, 
partitionId);
     final RootPartitionRange highFence = new 
RootPartitionRange(Short.MAX_VALUE, Short.MAX_VALUE);
-    return stateMap.subMap(lowFench, false, highFence, 
false).entrySet().iterator();
+    if (lowFence.compareTo(highFence) > 0) {
+      throw new ISE("PartitionId[%d] must be in the range [0, 32767].", 
Short.toUnsignedInt(partitionId));

Review Comment:
   The message might still not be very useful because the user cannot determine 
the root cause. Maybe indicate the fact that there are too many partitions 
(i.e. more than 32,767) in the interval causing overflow of the partition ID 
range.



##########
processing/src/main/java/org/apache/druid/timeline/partition/OvershadowableManager.java:
##########
@@ -418,9 +418,12 @@ private Iterator<Entry<RootPartitionRange, 
Short2ObjectSortedMap<AtomicUpdateGro
       TreeMap<RootPartitionRange, Short2ObjectSortedMap<AtomicUpdateGroup<T>>> 
stateMap
   )
   {
-    final RootPartitionRange lowFench = new RootPartitionRange(partitionId, 
partitionId);
+    final RootPartitionRange lowFence = new RootPartitionRange(partitionId, 
partitionId);
     final RootPartitionRange highFence = new 
RootPartitionRange(Short.MAX_VALUE, Short.MAX_VALUE);
-    return stateMap.subMap(lowFench, false, highFence, 
false).entrySet().iterator();
+    if (lowFence.compareTo(highFence) > 0) {
+      throw new ISE("PartitionId[%d] must be in the range [0, 32767].", 
Short.toUnsignedInt(partitionId));
+    }
+    return stateMap.subMap(lowFence, false, highFence, 
false).entrySet().iterator();

Review Comment:
   Nit: Cleaner to put this in the `else` of the preceding `if`.



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