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


##########
processing/src/main/java/org/apache/druid/timeline/partition/OvershadowableManager.java:
##########
@@ -418,9 +420,11 @@ private Iterator<Entry<RootPartitionRange, 
Short2ObjectSortedMap<AtomicUpdateGro
       TreeMap<RootPartitionRange, Short2ObjectSortedMap<AtomicUpdateGroup<T>>> 
stateMap
   )
   {
-    final RootPartitionRange lowFench = new RootPartitionRange(partitionId, 
partitionId);
+    // remediate submap `fromKey > toKey` issue when partitionId overflows
+    final short partitionIdLowFence = partitionId < 0 ? Short.MAX_VALUE : 
partitionId;

Review Comment:
   I think just checking the argument in the constructor of 
`RootPartitionRange` is enough. Since `RootPartitionRange` does not accept 
`startPartitionId` or `endPartitionId` less than 0, we will not have a case 
where `partitionId` passed to this method is less than 0.
   And even if it is, we should throw an exception rather than silently convert 
it to max value.



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