You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Mansi Khara (Jira)" <ji...@apache.org> on 2026/08/17 20:39:00 UTC
[jira] [Assigned] (CASSANALYTICS-180) TokenPartitioner fails to detect range gap in reader
[ https://issues.apache.org/jira/browse/CASSANALYTICS-180?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mansi Khara reassigned CASSANALYTICS-180:
-----------------------------------------
Assignee: Mansi Khara
> TokenPartitioner fails to detect range gap in reader
> -----------------------------------------------------
>
> Key: CASSANALYTICS-180
> URL: https://issues.apache.org/jira/browse/CASSANALYTICS-180
> Project: Apache Cassandra Analytics
> Issue Type: Bug
> Components: Reader
> Reporter: Yifan Cai
> Assignee: Mansi Khara
> Priority: Normal
>
> Found the minor bug when inspecting the code. The implementation filters out the non-empty ranges wrongly when detecting gaps in the range split.
> Below is the test to prove the bug.
> It is a minor bug because no correctness is affected; the range split step is mathematically gap-free today.
> It is still worth fixing because the check itself is broken and won't catch any future regression that reintroduces a coverage gap.
>
>
> {code:java}
> @Test
> public void testValidateCompleteRangeCoverageFailsToDetectGap()
> {
> Partitioner partitioner = Partitioner.Murmur3Partitioner;
> List<Range<BigInteger>> subRangesWithGap = Arrays.asList(
> Range.openClosed(partitioner.minToken(), partitioner.minToken().add(BigInteger.ONE)),
> Range.openClosed(partitioner.minToken().add(BigInteger.ONE).add(BigInteger.TEN), partitioner.maxToken()));
> // leaves (minToken()+1, minToken()+11] uncovered -- a real, non-empty gap
> RangeSet<BigInteger> missingRangeSet = TreeRangeSet.create();
> missingRangeSet.add(Range.closed(partitioner.minToken(), partitioner.maxToken()));
> subRangesWithGap.forEach(missingRangeSet::remove);
> // This mirrors TokenPartitioner#validateCompleteRangeCoverage exactly
> List<Range<BigInteger>> missingRanges = missingRangeSet.asRanges().stream()
> .filter(Range::isEmpty)
> .collect(Collectors.toList());
> // BUG: missingRanges is empty here even though a real gap exists,
> // because the filter keeps only degenerate zero-width ranges instead of dropping them.
> assertThat(missingRanges).isEmpty(); // passes -- but it should have caught the gap and failed
> }
> {code}
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org