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

new partitioner for rowkey pairs (P1, P2) targeting hierarchical data



    • Type: Improvement
    • Status: Resolved
    • Priority: Low
    • Resolution: Won't Fix
    • Fix Version/s: None
    • Component/s: None
    • Labels:


      This new partitioner is submitted here both for validation and for proposal to other Cassandra users (may be this partitioner has its place within Cassandra core, or into some 'contrib' directory).

      This new partitioner is a variant of RandomPartitioner with special token computation for composite rowkeys of size 2.

      The use case of this partitioner is about rowkeys of hierarchical data, that is, rowkeys like (directory id, file id).
      This partitioner computes tokens so that rows with same "directory id" have a great chance to be on the same node: the goal is that, when Cassandra is asked about multiple file ids for the same directory id, a limited number of nodes should be asked.

      So, in case of a composite rowkey of size 2 like (P1, P2), the partitioner computes the token as follows: <code>merge(getHighBits(md5(P1)), getLowBits(md5(P2)))</code>.
      In case of a rowkey that is NOT a pair, the partitioner returns the same value than RandomPartitioner.

      This partitioner is expected to be used with Cassandra 1.1 or above.
      Cassandra stores in sstables the pair (token, rowkey). Since v1.1, during a compaction phase, Cassandra does not sort anymore on token only, but
      sort on the pair (token, rowkey). So, if a custom partitioner produces token collisions (that is, multiple rowkeys with the same token), it won't be a pb with v1.1 because, in order to retrieve a row, Cassandra is going to compare the full pair (token, rowkey).
      As the percent of row collisions for this partitioner is unknown, it's expected to be used with Cassandra 1.1 or above.


        1. RandomPartitioner4Pair.java
          5 kB
          Dominique De Vito



            • Assignee:
              dmdevito Dominique De Vito
            • Votes:
              0 Vote for this issue
              2 Start watching this issue


              • Created: