From 5622a4808a9a9116c411db9c24160f5ab5343413 Mon Sep 17 00:00:00 2001 From: Amatya Date: Mon, 15 Jan 2024 16:11:49 +0530 Subject: [PATCH 1/2] Better error message when partition space is exhausted --- .../timeline/partition/OvershadowableManager.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/processing/src/main/java/org/apache/druid/timeline/partition/OvershadowableManager.java b/processing/src/main/java/org/apache/druid/timeline/partition/OvershadowableManager.java index 8d010cf43b67..6a4f53791240 100644 --- a/processing/src/main/java/org/apache/druid/timeline/partition/OvershadowableManager.java +++ b/processing/src/main/java/org/apache/druid/timeline/partition/OvershadowableManager.java @@ -403,9 +403,9 @@ private Iterator>> stateMap ) { - final RootPartitionRange lowFench = new RootPartitionRange((short) 0, (short) 0); + final RootPartitionRange lowFence = new RootPartitionRange((short) 0, (short) 0); final RootPartitionRange highFence = new RootPartitionRange(partitionId, partitionId); - return stateMap.subMap(lowFench, false, highFence, false).descendingMap().entrySet().iterator(); + return stateMap.subMap(lowFence, false, highFence, false).descendingMap().entrySet().iterator(); } /** @@ -418,9 +418,12 @@ private Iterator>> 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(); } /** From 7e22d838b97b817511cc2ec0a511625798e4e160 Mon Sep 17 00:00:00 2001 From: Amatya Date: Tue, 16 Jan 2024 09:56:23 +0530 Subject: [PATCH 2/2] Improve error message --- .../druid/timeline/partition/OvershadowableManager.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/processing/src/main/java/org/apache/druid/timeline/partition/OvershadowableManager.java b/processing/src/main/java/org/apache/druid/timeline/partition/OvershadowableManager.java index 6a4f53791240..dbcf5658f017 100644 --- a/processing/src/main/java/org/apache/druid/timeline/partition/OvershadowableManager.java +++ b/processing/src/main/java/org/apache/druid/timeline/partition/OvershadowableManager.java @@ -421,9 +421,11 @@ private Iterator 0) { - throw new ISE("PartitionId[%d] must be in the range [0, 32767].", Short.toUnsignedInt(partitionId)); + throw new ISE("PartitionId[%d] must be in the range [0, 32767]. " + + "Try compacting the interval to reduce the segment count.", Short.toUnsignedInt(partitionId)); + } else { + return stateMap.subMap(lowFence, false, highFence, false).entrySet().iterator(); } - return stateMap.subMap(lowFence, false, highFence, false).entrySet().iterator(); } /**