luchnikovbsk commented on code in PR #10591:
URL: https://github.com/apache/ignite/pull/10591#discussion_r1164064390
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheKeyRequest.java:
##########
@@ -40,10 +42,31 @@ public abstract class ClientCacheKeyRequest extends
ClientCacheDataRequest imple
/**
* Gets the key.
- *
+ * @param ctx ClientConnectionContext
* @return Key.
*/
- public Object key() {
+ public Object key(ClientConnectionContext ctx) {
+ calcAwarenessMetrics(ctx);
+
return key;
}
+
+ /** Calculation of awarenes metrics. */
+ protected void calcAwarenessMetrics(ClientConnectionContext ctx) {
+ String cacheName = cacheDescriptor(ctx).cacheName();
+
+ try {
+ Affinity<Object> aff =
ctx.kernalContext().affinity().affinityProxy(cacheName);
+
+ if (aff.isPrimary(ctx.kernalContext().discovery().localNode(),
key))
Review Comment:
ok
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheRequest.java:
##########
@@ -169,4 +171,31 @@ public static DynamicCacheDescriptor
cacheDescriptor(ClientConnectionContext ctx
protected int cacheId() {
return cacheId;
}
+
+ /**
+ * isAwareness
+ *
+ * @return true if awareness.
+ */
+ protected boolean isAwareness(ClientConnectionContext ctx, String
cacheName, Integer part) {
+ boolean awareness = false;
+
+ if (part != null) {
+ try {
+ Affinity<Object> aff =
ctx.kernalContext().affinity().affinityProxy(cacheName);
+
+ int[] primaryParts =
aff.primaryPartitions(ctx.kernalContext().discovery().localNode());
+
+ if (Arrays.stream(primaryParts).anyMatch(part::equals))
+ awareness = true;
Review Comment:
ok
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]