Skip to content

Better error message when partition space is exhausted#15685

Merged
AmatyaAvadhanula merged 2 commits intoapache:masterfrom
AmatyaAvadhanula:partition_exhaustion_msg
Jan 16, 2024
Merged

Better error message when partition space is exhausted#15685
AmatyaAvadhanula merged 2 commits intoapache:masterfrom
AmatyaAvadhanula:partition_exhaustion_msg

Conversation

@AmatyaAvadhanula
Copy link
Copy Markdown
Contributor

Segment locking introduced a limitation where the partition id of a segment must lie within [0, 32767]. When the partitionId falls outside this range, a cryptic error fromKey > toKey can be thrown.
This PR is an attempt to improve the error message when the partition space is exhausted.

This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • a release note entry in the PR description.
  • added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
  • added or updated version, license, or notice information in licenses.yaml
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • added integration tests.
  • been tested in a test Druid cluster.

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));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

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();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@AmatyaAvadhanula
Copy link
Copy Markdown
Contributor Author

Merging since the failing UT is unrelated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants