Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-5465

Replace the Hash function with a segment mapper

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Done
    • Major
    • 8.2.0.Beta1
    • 7.2.1.Final
    • Configuration, Core
    • None

    Description

      Currently, we allow the user to customize the mapping of keys to CH segments with a custom Hash function. But the Hash function doesn't give the user direct control over where a key is mapped, the ultimate location depends on the CH implementation. The CH implementation is also customizable, but it's much harder for the user to get right.

      We should replace the Hash with something like this:

      public interface SegmentMapper {
         public int getSegment(Object key, int numSegments);
      

      This should also be easier to implement than the Grouper interface we have now, when the user only needs co-location and doesn't need additional grouping features like cache.getGroup(name).

      I think this should also help internally, e.g. to replace the GroupingConsistentHash that needs to be re-created on every topology update with a constant SegmentMapper wrapper. It might also help to compute the segment of a key only once and save it in the context, instead of computing it every time we need to know the location of a key.

      Attachments

        Issue Links

          Activity

            People

              dberinde@redhat.com Dan Berindei (Inactive)
              dberinde@redhat.com Dan Berindei (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: