I think *show metrics --categories=query* is showing you the query stats from DistributedSystemMXBean (see ShowMetricsCommand#writeSystemWideMetricValues). DistributedSystemMXBean aggregates values across all members in the cluster, so I would have expected activeCQCount to initially show a value of 2 after you create a ServerCQImpl in 2 servers. Then after closing the CQ, it should drop to a value of 0.
When you create a CQ on a Server, it should be reflected asynchronously on the CacheServerMXBean in that Server. Each Server has its own CacheServerMXBean. Over on the Locator (JMX Manager), the DistributedSystemMXBean aggregates the count of active CQs in ServerClusterStatsMonitor by invoking DistributedSystemBridge#updateCacheServer when the CacheServerMXBean state is federated to the Locator (JMX Manager). Based on what I see in code and in the description on GEODE-8293, I think you might want to see if increment has a problem instead of decrement. I don't see anything that would limit the activeCQCount to only count the CQs on primaries. So, I would expect redundancy=1 to result in a value of 2. Does anyone else have different info about this? On Tue, Jun 30, 2020 at 5:31 AM Mario Kevo <mario.k...@est.tech> wrote: > Hi geode-dev, > > I have a question about CQ( > https://issues.apache.org/jira/browse/GEODE-8293). > If we run CQ it register cq on one of the > servers(setPoolSubscriptionRedundancy is 1) and increment activeCQCount. > As I understand then it processInputBuffer to another server and there is > deserialization of the message. In case if opType is REGISTER_CQ or > SET_CQ_STATE it will call readCq from CqServiceProvider, at the end calls > empty contructor ServerCQImpl which is used for deserialization. > > The problem is when we close CQ then it has ServerCqImpl reference on both > servers, close them, and decrement on both of them. In that case we have > negative value of activeCQCount in show metrics command. > > Does anyone knows how to get in close method which is the primary and only > decrement on it? > Any advice is welcome! > > BR, > Mario >