]
Pedro Ruivo updated ISPN-5465:
------------------------------
Fix Version/s: 8.1.0.Final
(was: 8.0.0.Final)
Replace the Hash function with a segment mapper
-----------------------------------------------
Key: ISPN-5465
URL:
https://issues.jboss.org/browse/ISPN-5465
Project: Infinispan
Issue Type: Feature Request
Components: Configuration, Core
Affects Versions: 7.2.1.Final
Reporter: Dan Berindei
Assignee: Dan Berindei
Fix For: 8.1.0.Final
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:
{code:java}
public interface SegmentMapper {
public int getSegment(Object key, int numSegments);
{code}
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.