This jira is a spin-off of https://github.com/infinispan/infinispan/pull/2780, resulting from the feedback/comments provided by Will, Dan and Sanne.
ISPN-4470 tries to do is provide a RemoteCache.size() implementation. The first implementation simply computed the keySet() and got its size. This is clearly not optimal since you're bringing a load of keys to not use them at all.
The second solution used statistics of different nodes to calculate number of total keys in the cluster, and if statistics were disabled, fallback on keySet(). The problem here is that statistics don't take cache store contents into account but keySet() does, which would be confusing for the user. Having such size related statistics check persistent stores would affect performance of stats.
In the end, the best way to achieve this is by implementing a new size operation on Hot Rod that calculates the total number of keys without actually bringing keys back to clients. This new operation will be part of Hot Rod 2.0.