I've got a question that is related to data repartitioning. Suppose there's a cache with a pre-defined affinity key. Assume I need to repartition data with a new affinity key. I'm wondering whether there is a way of shuffling partition data across all nodes by a new affinity key?
Asked
Active
Viewed 49 times
1 Answers
1
You need to repopulate the data in that case.
- First, it's a static configuration and can't be changed on the fly.
- The second, most likely you will need to clear meta-information for that particular type, i.e. clean
work/binary_meta
folder. - The last one - once you changed it, you won't be able to locate the data since most likely it will be stored in a different partition.
In other words, say, you had a cache key with two fields A and B: K(A,B) where A is your affinity key. Say, your Key(1,2)
was mapped to a partition 5
. In that case, to locate the value, Ignite will search for this partition 5 depending on which node hold the primary copy of it. Later you wanted to have B as the affinity key and re-configure the cache accordingly. In that case, Key(1,2)
might now be mapped to a partition 780
, meaning that Ignite will never search for a partition 5
and won't be able to locate the previous data.

Alexandr Shapkin
- 2,350
- 1
- 6
- 10
-
Thank you for the response. Am I right that there's a single way to do so is to create a new cache with a new affinity key? – Арсений Невский Feb 09 '22 at 09:16
-
Yes, alternatively you might adjust the current cache, just make sure there is no data inside. If persistence is enabled, then it's better to remove the data explicitly, if it's im-mem - the data will be gone after a restart. – Alexandr Shapkin Feb 09 '22 at 11:53
-
@АрсенийНевский I updated the answer, hope it makes the process cleaner. – Alexandr Shapkin Feb 09 '22 at 11:59