Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-18013

Splitter sometimes creates different number of splits than requested

    XMLWordPrintableJSON

Details

    Description

      Splitter in some cases may produce one split more than requested. When it happens, it fails with assertion error when assertions are enabled.

      Test to reproduce the issue:

              Splitter splitter = getSplitter(Murmur3Partitioner.instance);
              long lt = 0;
              long rt = 31;
              Range<Token> range = new Range<>(getWrappedToken(Murmur3Partitioner.instance, BigInteger.valueOf(lt)),
                                               getWrappedToken(Murmur3Partitioner.instance, BigInteger.valueOf(rt)));
      
              for (int i = 1; i <= (rt - lt); i++)
              {
                  List<Token> splits = splitter.splitOwnedRanges(i, Arrays.asList(new Splitter.WeightedRange(1.0d, range)), false);
                  logger.info("{} splits of {} are: {}", i, range, splits);
                  Assertions.assertThat(splits).hasSize(i);
              }
      

      Attachments

        Activity

          People

            jlewandowski Jacek Lewandowski
            jlewandowski Jacek Lewandowski
            Jacek Lewandowski
            Marcus Eriksson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 10m
                10m