nizhikov commented on a change in pull request #6837: IGNITE-10223: affinity
list methods are added, tests are changed
URL: https://github.com/apache/ignite/pull/6837#discussion_r321997259
##########
File path:
modules/core/src/main/java/org/apache/ignite/cache/affinity/Affinity.java
##########
@@ -188,8 +192,20 @@
* always first.
* @throws IgniteException If there are no alive nodes for this cache.
*/
+ @Deprecated
public Collection<ClusterNode> mapKeyToPrimaryAndBackups(K key);
+ /**
+ * Gets primary and backup nodes for the key. Primary node is always
+ * first in the returned list.
+ *
+ * @param key Key to get affinity nodes for.
+ * @return List of primary and backup nodes for the key with primary node
+ * always first.
+ * @throws IgniteException If there are no alive nodes for this cache.
+ */
+ public List<ClusterNode> mapKeyToPrimaryAndBackupsList(K key);
Review comment:
We should have default implementation of this method to preserve backward
compatibility.
Something like:
```
Collection<ClusterNode> res = mapKeyToPrimaryAndBackups(key);
if (res instanceof List)
return (List<ClusterNode>)res;
else
return new ArrrayList(res);
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services