Assume this is the existing ring formed from the cluster.
I am inserting a key say 'A' whose hash value is 10. (Just example)
Now, it would fall under partition 2, which is on Node0 based on the logic 10 % 4.
Data gets saved in Node0.
Now let us modify the cluster as follows:
Try to fetch the key say 'A' whose hash value is 10.
Partition id to check as per routing strategy is 4 based on the logic 10 % 6.
We would still get the value for key 'A' since partition 4 is pointing to Node0.
Insert another key say 'B' whose hash value is 13. (Just example)
Now, it would fall under partition 1, which is on Node1 based on the logic 13 % 6.
Data gets saved in Node1.
Now let us modify the cluster as follows:
Try to fetch the key say 'A' whose hash value is 10.
Partition id to check as per routing strategy is 2 based on the logic 10 % 8.
We would still get the value for key 'A' since partition 2 is pointing to Node0.
Try to fetch the key say 'B' whose hash value is 13.
Partition id to check as per routing strategy is 5 based on the logic 13 % 8.
We would still get the value for key 'B' since partition 5 is pointing to Node1.
My point here is, if we maintain the node order in the cluster by increasing the number of partitions, then we should ideally be able to increase the partition count.
In this case, we have to increase the partitions on multiples of 2 like N0 has to be followed by N1 and N1 has to be followed by N0 in the partition ring.
Am I missing something here due to which this logic would not work? Is there any other dependency due to Partitioning.
Please suggest.
Thanks,
-Nidhin