I wish to set affinity key for my ignite cache. Since I use binary object builder to load data into the cache, so the value type of my cache is generic: <Long, Object>. The Schema is defined using QueryEntity.
I tried to use
cacheCfg.setKeyConfiguration(new CacheKeyConfiguration("Object", "FunctionName"));
to set affinity key, where FunctionName is the column is the target field.
I have 2 server nodes, and in the test, I just load 16 records, with 14 of them being FunctionName = a, and 4 of them being FunctionName = b
But when I tested the records amount for each server node, it seems like the data are not separated by this field. It should be 14 on one server node, and 4 on the other. But the tested output is 7 on one node and 9 on the other.
I'm not sure if the generic Object can be set as an affinity key using above method, but you can try to use AffinityKey<K> class, documentation has an example.