nizhikov commented on code in PR #10649:
URL: https://github.com/apache/ignite/pull/10649#discussion_r1166545804
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheKeyRequest.java:
##########
@@ -38,6 +45,39 @@ public abstract class ClientCacheKeyRequest extends
ClientCacheDataRequest imple
key = reader.readObjectDetached();
}
+ /** {@inheritDoc} */
+ @Override public final ClientResponse process(ClientConnectionContext ctx)
{
+ if (!isTransactional()) {
+ // Calculate affinity metrics.
+ DynamicCacheDescriptor desc = cacheDescriptor(ctx);
+ CacheConfiguration<?, ?> cfg = desc.cacheConfiguration();
+
+ if (cfg.getCacheMode() == CacheMode.PARTITIONED &&
cfg.isStatisticsEnabled()) {
+ String cacheName = desc.cacheName();
+
+ try {
+ GridKernalContext kctx = ctx.kernalContext();
+
+ if
(F.first(kctx.affinity().mapKeyToPrimaryAndBackups(cacheName, key,
null)).isLocal())
+ kctx.clientListener().metrics().onAffinityKeyHit();
+ else
+ kctx.clientListener().metrics().onAffinityKeyMiss();
+ }
+ catch (Exception ignored) {
+ // No-op.
+ }
+ }
+ }
+
+ // Process request in overriden method.
+ return process0(ctx);
+ }
+
+ /** */
+ protected ClientResponse process0(ClientConnectionContext ctx) {
+ return super.process(ctx);
Review Comment:
Do we really should call `super.process` here? Looks very suspicious and
fragile for me.
--
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]