You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by GitBox <gi...@apache.org> on 2020/07/23 07:04:11 UTC

[GitHub] [geode] mkevo opened a new pull request #5397: GEODE-8293: fix decrementing activeCQCount

mkevo opened a new pull request #5397:
URL: https://github.com/apache/geode/pull/5397


   This counter increments correct, but when doing decrement it should decrement just one which is incremented.
   
   Thank you for submitting a contribution to Apache Geode.
   
   In order to streamline the review of the contribution we ask you
   to ensure the following steps have been taken:
   
   ### For all changes:
   - [x] Is there a JIRA ticket associated with this PR? Is it referenced in the commit message?
   
   - [x] Has your PR been rebased against the latest commit within the target branch (typically `develop`)?
   
   - [x] Is your initial contribution a single, squashed commit?
   
   - [x] Does `gradlew build` run cleanly?
   
   - [x] Have you written or updated unit tests to verify your changes?
   
   - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)?
   
   ### Note:
   Please ensure that once the PR is submitted, check Concourse for build issues and
   submit an update to your PR as soon as possible. If you need help, please send an
   email to dev@geode.apache.org.
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [geode] agingade commented on a change in pull request #5397: GEODE-8293: fix decrementing activeCQCount

Posted by GitBox <gi...@apache.org>.
agingade commented on a change in pull request #5397:
URL: https://github.com/apache/geode/pull/5397#discussion_r487137679



##########
File path: geode-cq/src/main/java/org/apache/geode/cache/query/cq/internal/ServerCQImpl.java
##########
@@ -367,10 +367,12 @@ public void close(boolean sendRequestToServer) throws CqClosedException, CqExcep
       this.removeFromCqMap();
 
       // Stat update.
-      if (stateBeforeClosing == CqStateImpl.RUNNING) {
-        cqService.stats().decCqsActive();
-      } else if (stateBeforeClosing == CqStateImpl.STOPPED) {
-        cqService.stats().decCqsStopped();
+      if (!cqName.equals(serverCqName)) {

Review comment:
       Sorry for late response...
   
   The CQs are registered based on the subscription-redundancy. Servers on which they are registered should be treating them as activeCQCounts. 
   When the CQs are closed. They all will get closed, decrementing the active CQCount.
   Can you try this with java client test...And see it is the behavior.
   >> one on which cq is register and others on which it will process registerCq. 
   Are you seeing CQs that are only getting registered but not processed? that seems to be wrong...Are I am missing something.
   
   
   
   
   
   




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [geode] agingade commented on a change in pull request #5397: GEODE-8293: fix decrementing activeCQCount

Posted by GitBox <gi...@apache.org>.
agingade commented on a change in pull request #5397:
URL: https://github.com/apache/geode/pull/5397#discussion_r487137679



##########
File path: geode-cq/src/main/java/org/apache/geode/cache/query/cq/internal/ServerCQImpl.java
##########
@@ -367,10 +367,12 @@ public void close(boolean sendRequestToServer) throws CqClosedException, CqExcep
       this.removeFromCqMap();
 
       // Stat update.
-      if (stateBeforeClosing == CqStateImpl.RUNNING) {
-        cqService.stats().decCqsActive();
-      } else if (stateBeforeClosing == CqStateImpl.STOPPED) {
-        cqService.stats().decCqsStopped();
+      if (!cqName.equals(serverCqName)) {

Review comment:
       Sorry for late response...
   
   The CQs are registered based on the subscription-redundancy. Servers on which they are registered should be treating them as activeCQCounts. 
   When the CQs are closed. They all will get closed, decrementing the active CQCount.
   Can you try this with java client test...And see it is the behavior.
   >> one on which cq is register and others on which it will process registerCq. 
   Are you seeing CQs that are only getting registered but not processed? that seems to be wrong...Are I am missing something.
   
   
   
   
   
   

##########
File path: geode-cq/src/main/java/org/apache/geode/cache/query/cq/internal/ServerCQImpl.java
##########
@@ -367,10 +367,12 @@ public void close(boolean sendRequestToServer) throws CqClosedException, CqExcep
       this.removeFromCqMap();
 
       // Stat update.
-      if (stateBeforeClosing == CqStateImpl.RUNNING) {
-        cqService.stats().decCqsActive();
-      } else if (stateBeforeClosing == CqStateImpl.STOPPED) {
-        cqService.stats().decCqsStopped();
+      if (!cqName.equals(serverCqName)) {

Review comment:
       Again, sorry for delayed response. If needed you can always send a direct email to me.

##########
File path: geode-cq/src/main/java/org/apache/geode/cache/query/cq/internal/ServerCQImpl.java
##########
@@ -367,10 +367,12 @@ public void close(boolean sendRequestToServer) throws CqClosedException, CqExcep
       this.removeFromCqMap();
 
       // Stat update.
-      if (stateBeforeClosing == CqStateImpl.RUNNING) {
-        cqService.stats().decCqsActive();
-      } else if (stateBeforeClosing == CqStateImpl.STOPPED) {
-        cqService.stats().decCqsStopped();
+      if (!cqName.equals(serverCqName)) {

Review comment:
       Sorry for late response...
   
   The CQs are registered based on the subscription-redundancy. Servers on which they are registered should be treating them as activeCQCounts. 
   When the CQs are closed. They all will get closed, decrementing the active CQCount.
   Can you try this with java client test...And see it is the behavior.
   >> one on which cq is register and others on which it will process registerCq. 
   Are you seeing CQs that are only getting registered but not processed? that seems to be wrong...Are I am missing something.
   
   
   
   
   
   

##########
File path: geode-cq/src/main/java/org/apache/geode/cache/query/cq/internal/ServerCQImpl.java
##########
@@ -367,10 +367,12 @@ public void close(boolean sendRequestToServer) throws CqClosedException, CqExcep
       this.removeFromCqMap();
 
       // Stat update.
-      if (stateBeforeClosing == CqStateImpl.RUNNING) {
-        cqService.stats().decCqsActive();
-      } else if (stateBeforeClosing == CqStateImpl.STOPPED) {
-        cqService.stats().decCqsStopped();
+      if (!cqName.equals(serverCqName)) {

Review comment:
       Again, sorry for delayed response. If needed you can always send a direct email to me.

##########
File path: geode-cq/src/main/java/org/apache/geode/cache/query/cq/internal/ServerCQImpl.java
##########
@@ -367,10 +367,12 @@ public void close(boolean sendRequestToServer) throws CqClosedException, CqExcep
       this.removeFromCqMap();
 
       // Stat update.
-      if (stateBeforeClosing == CqStateImpl.RUNNING) {
-        cqService.stats().decCqsActive();
-      } else if (stateBeforeClosing == CqStateImpl.STOPPED) {
-        cqService.stats().decCqsStopped();
+      if (!cqName.equals(serverCqName)) {

Review comment:
       Sorry for late response...
   
   The CQs are registered based on the subscription-redundancy. Servers on which they are registered should be treating them as activeCQCounts. 
   When the CQs are closed. They all will get closed, decrementing the active CQCount.
   Can you try this with java client test...And see it is the behavior.
   >> one on which cq is register and others on which it will process registerCq. 
   Are you seeing CQs that are only getting registered but not processed? that seems to be wrong...Are I am missing something.
   
   
   
   
   
   

##########
File path: geode-cq/src/main/java/org/apache/geode/cache/query/cq/internal/ServerCQImpl.java
##########
@@ -367,10 +367,12 @@ public void close(boolean sendRequestToServer) throws CqClosedException, CqExcep
       this.removeFromCqMap();
 
       // Stat update.
-      if (stateBeforeClosing == CqStateImpl.RUNNING) {
-        cqService.stats().decCqsActive();
-      } else if (stateBeforeClosing == CqStateImpl.STOPPED) {
-        cqService.stats().decCqsStopped();
+      if (!cqName.equals(serverCqName)) {

Review comment:
       Again, sorry for delayed response. If needed you can always send a direct email to me.

##########
File path: geode-cq/src/main/java/org/apache/geode/cache/query/cq/internal/ServerCQImpl.java
##########
@@ -367,10 +367,12 @@ public void close(boolean sendRequestToServer) throws CqClosedException, CqExcep
       this.removeFromCqMap();
 
       // Stat update.
-      if (stateBeforeClosing == CqStateImpl.RUNNING) {
-        cqService.stats().decCqsActive();
-      } else if (stateBeforeClosing == CqStateImpl.STOPPED) {
-        cqService.stats().decCqsStopped();
+      if (!cqName.equals(serverCqName)) {

Review comment:
       Sorry for late response...
   
   The CQs are registered based on the subscription-redundancy. Servers on which they are registered should be treating them as activeCQCounts. 
   When the CQs are closed. They all will get closed, decrementing the active CQCount.
   Can you try this with java client test...And see it is the behavior.
   >> one on which cq is register and others on which it will process registerCq. 
   Are you seeing CQs that are only getting registered but not processed? that seems to be wrong...Are I am missing something.
   
   
   
   
   
   

##########
File path: geode-cq/src/main/java/org/apache/geode/cache/query/cq/internal/ServerCQImpl.java
##########
@@ -367,10 +367,12 @@ public void close(boolean sendRequestToServer) throws CqClosedException, CqExcep
       this.removeFromCqMap();
 
       // Stat update.
-      if (stateBeforeClosing == CqStateImpl.RUNNING) {
-        cqService.stats().decCqsActive();
-      } else if (stateBeforeClosing == CqStateImpl.STOPPED) {
-        cqService.stats().decCqsStopped();
+      if (!cqName.equals(serverCqName)) {

Review comment:
       Again, sorry for delayed response. If needed you can always send a direct email to me.

##########
File path: geode-cq/src/main/java/org/apache/geode/cache/query/cq/internal/ServerCQImpl.java
##########
@@ -367,10 +367,12 @@ public void close(boolean sendRequestToServer) throws CqClosedException, CqExcep
       this.removeFromCqMap();
 
       // Stat update.
-      if (stateBeforeClosing == CqStateImpl.RUNNING) {
-        cqService.stats().decCqsActive();
-      } else if (stateBeforeClosing == CqStateImpl.STOPPED) {
-        cqService.stats().decCqsStopped();
+      if (!cqName.equals(serverCqName)) {

Review comment:
       Sorry for late response...
   
   The CQs are registered based on the subscription-redundancy. Servers on which they are registered should be treating them as activeCQCounts. 
   When the CQs are closed. They all will get closed, decrementing the active CQCount.
   Can you try this with java client test...And see it is the behavior.
   >> one on which cq is register and others on which it will process registerCq. 
   Are you seeing CQs that are only getting registered but not processed? that seems to be wrong...Are I am missing something.
   
   
   
   
   
   

##########
File path: geode-cq/src/main/java/org/apache/geode/cache/query/cq/internal/ServerCQImpl.java
##########
@@ -367,10 +367,12 @@ public void close(boolean sendRequestToServer) throws CqClosedException, CqExcep
       this.removeFromCqMap();
 
       // Stat update.
-      if (stateBeforeClosing == CqStateImpl.RUNNING) {
-        cqService.stats().decCqsActive();
-      } else if (stateBeforeClosing == CqStateImpl.STOPPED) {
-        cqService.stats().decCqsStopped();
+      if (!cqName.equals(serverCqName)) {

Review comment:
       Again, sorry for delayed response. If needed you can always send a direct email to me.

##########
File path: geode-cq/src/main/java/org/apache/geode/cache/query/cq/internal/ServerCQImpl.java
##########
@@ -367,10 +367,12 @@ public void close(boolean sendRequestToServer) throws CqClosedException, CqExcep
       this.removeFromCqMap();
 
       // Stat update.
-      if (stateBeforeClosing == CqStateImpl.RUNNING) {
-        cqService.stats().decCqsActive();
-      } else if (stateBeforeClosing == CqStateImpl.STOPPED) {
-        cqService.stats().decCqsStopped();
+      if (!cqName.equals(serverCqName)) {

Review comment:
       Sorry for late response...
   
   The CQs are registered based on the subscription-redundancy. Servers on which they are registered should be treating them as activeCQCounts. 
   When the CQs are closed. They all will get closed, decrementing the active CQCount.
   Can you try this with java client test...And see it is the behavior.
   >> one on which cq is register and others on which it will process registerCq. 
   Are you seeing CQs that are only getting registered but not processed? that seems to be wrong...Are I am missing something.
   
   
   
   
   
   

##########
File path: geode-cq/src/main/java/org/apache/geode/cache/query/cq/internal/ServerCQImpl.java
##########
@@ -367,10 +367,12 @@ public void close(boolean sendRequestToServer) throws CqClosedException, CqExcep
       this.removeFromCqMap();
 
       // Stat update.
-      if (stateBeforeClosing == CqStateImpl.RUNNING) {
-        cqService.stats().decCqsActive();
-      } else if (stateBeforeClosing == CqStateImpl.STOPPED) {
-        cqService.stats().decCqsStopped();
+      if (!cqName.equals(serverCqName)) {

Review comment:
       Again, sorry for delayed response. If needed you can always send a direct email to me.

##########
File path: geode-cq/src/main/java/org/apache/geode/cache/query/cq/internal/ServerCQImpl.java
##########
@@ -367,10 +367,12 @@ public void close(boolean sendRequestToServer) throws CqClosedException, CqExcep
       this.removeFromCqMap();
 
       // Stat update.
-      if (stateBeforeClosing == CqStateImpl.RUNNING) {
-        cqService.stats().decCqsActive();
-      } else if (stateBeforeClosing == CqStateImpl.STOPPED) {
-        cqService.stats().decCqsStopped();
+      if (!cqName.equals(serverCqName)) {

Review comment:
       Sorry for late response...
   
   The CQs are registered based on the subscription-redundancy. Servers on which they are registered should be treating them as activeCQCounts. 
   When the CQs are closed. They all will get closed, decrementing the active CQCount.
   Can you try this with java client test...And see it is the behavior.
   >> one on which cq is register and others on which it will process registerCq. 
   Are you seeing CQs that are only getting registered but not processed? that seems to be wrong...Are I am missing something.
   
   
   
   
   
   

##########
File path: geode-cq/src/main/java/org/apache/geode/cache/query/cq/internal/ServerCQImpl.java
##########
@@ -367,10 +367,12 @@ public void close(boolean sendRequestToServer) throws CqClosedException, CqExcep
       this.removeFromCqMap();
 
       // Stat update.
-      if (stateBeforeClosing == CqStateImpl.RUNNING) {
-        cqService.stats().decCqsActive();
-      } else if (stateBeforeClosing == CqStateImpl.STOPPED) {
-        cqService.stats().decCqsStopped();
+      if (!cqName.equals(serverCqName)) {

Review comment:
       Again, sorry for delayed response. If needed you can always send a direct email to me.

##########
File path: geode-cq/src/main/java/org/apache/geode/cache/query/cq/internal/ServerCQImpl.java
##########
@@ -367,10 +367,12 @@ public void close(boolean sendRequestToServer) throws CqClosedException, CqExcep
       this.removeFromCqMap();
 
       // Stat update.
-      if (stateBeforeClosing == CqStateImpl.RUNNING) {
-        cqService.stats().decCqsActive();
-      } else if (stateBeforeClosing == CqStateImpl.STOPPED) {
-        cqService.stats().decCqsStopped();
+      if (!cqName.equals(serverCqName)) {

Review comment:
       Sorry for late response...
   
   The CQs are registered based on the subscription-redundancy. Servers on which they are registered should be treating them as activeCQCounts. 
   When the CQs are closed. They all will get closed, decrementing the active CQCount.
   Can you try this with java client test...And see it is the behavior.
   >> one on which cq is register and others on which it will process registerCq. 
   Are you seeing CQs that are only getting registered but not processed? that seems to be wrong...Are I am missing something.
   
   
   
   
   
   

##########
File path: geode-cq/src/main/java/org/apache/geode/cache/query/cq/internal/ServerCQImpl.java
##########
@@ -367,10 +367,12 @@ public void close(boolean sendRequestToServer) throws CqClosedException, CqExcep
       this.removeFromCqMap();
 
       // Stat update.
-      if (stateBeforeClosing == CqStateImpl.RUNNING) {
-        cqService.stats().decCqsActive();
-      } else if (stateBeforeClosing == CqStateImpl.STOPPED) {
-        cqService.stats().decCqsStopped();
+      if (!cqName.equals(serverCqName)) {

Review comment:
       Again, sorry for delayed response. If needed you can always send a direct email to 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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode] agingade commented on a change in pull request #5397: GEODE-8293: fix decrementing activeCQCount

Posted by GitBox <gi...@apache.org>.
agingade commented on a change in pull request #5397:
URL: https://github.com/apache/geode/pull/5397#discussion_r487137679



##########
File path: geode-cq/src/main/java/org/apache/geode/cache/query/cq/internal/ServerCQImpl.java
##########
@@ -367,10 +367,12 @@ public void close(boolean sendRequestToServer) throws CqClosedException, CqExcep
       this.removeFromCqMap();
 
       // Stat update.
-      if (stateBeforeClosing == CqStateImpl.RUNNING) {
-        cqService.stats().decCqsActive();
-      } else if (stateBeforeClosing == CqStateImpl.STOPPED) {
-        cqService.stats().decCqsStopped();
+      if (!cqName.equals(serverCqName)) {

Review comment:
       Sorry for late response...
   
   The CQs are registered based on the subscription-redundancy. Servers on which they are registered should be treating them as activeCQCounts. 
   When the CQs are closed. They all will get closed, decrementing the active CQCount.
   Can you try this with java client test...And see it is the behavior.
   >> one on which cq is register and others on which it will process registerCq. 
   Are you seeing CQs that are only getting registered but not processed? that seems to be wrong...Are I am missing something.
   
   
   
   
   
   

##########
File path: geode-cq/src/main/java/org/apache/geode/cache/query/cq/internal/ServerCQImpl.java
##########
@@ -367,10 +367,12 @@ public void close(boolean sendRequestToServer) throws CqClosedException, CqExcep
       this.removeFromCqMap();
 
       // Stat update.
-      if (stateBeforeClosing == CqStateImpl.RUNNING) {
-        cqService.stats().decCqsActive();
-      } else if (stateBeforeClosing == CqStateImpl.STOPPED) {
-        cqService.stats().decCqsStopped();
+      if (!cqName.equals(serverCqName)) {

Review comment:
       Again, sorry for delayed response. If needed you can always send a direct email to 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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode] mkevo commented on a change in pull request #5397: GEODE-8293: fix decrementing activeCQCount

Posted by GitBox <gi...@apache.org>.
mkevo commented on a change in pull request #5397:
URL: https://github.com/apache/geode/pull/5397#discussion_r474481140



##########
File path: geode-cq/src/main/java/org/apache/geode/cache/query/cq/internal/ServerCQImpl.java
##########
@@ -367,10 +367,12 @@ public void close(boolean sendRequestToServer) throws CqClosedException, CqExcep
       this.removeFromCqMap();
 
       // Stat update.
-      if (stateBeforeClosing == CqStateImpl.RUNNING) {
-        cqService.stats().decCqsActive();
-      } else if (stateBeforeClosing == CqStateImpl.STOPPED) {
-        cqService.stats().decCqsStopped();
+      if (!cqName.equals(serverCqName)) {

Review comment:
       Hi @agingade , any comments or other ideas to resolve this? :-)




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [geode] mkevo closed pull request #5397: GEODE-8293: fix decrementing activeCQCount

Posted by GitBox <gi...@apache.org>.
mkevo closed pull request #5397:
URL: https://github.com/apache/geode/pull/5397


   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [geode] mkevo commented on a change in pull request #5397: GEODE-8293: fix decrementing activeCQCount

Posted by GitBox <gi...@apache.org>.
mkevo commented on a change in pull request #5397:
URL: https://github.com/apache/geode/pull/5397#discussion_r464297701



##########
File path: geode-cq/src/main/java/org/apache/geode/cache/query/cq/internal/ServerCQImpl.java
##########
@@ -367,10 +367,12 @@ public void close(boolean sendRequestToServer) throws CqClosedException, CqExcep
       this.removeFromCqMap();
 
       // Stat update.
-      if (stateBeforeClosing == CqStateImpl.RUNNING) {
-        cqService.stats().decCqsActive();
-      } else if (stateBeforeClosing == CqStateImpl.STOPPED) {
-        cqService.stats().decCqsStopped();
+      if (!cqName.equals(serverCqName)) {

Review comment:
       I need somehow to makes difference between servers, one on which cq is register and others on which it will process registerCq. The server on which cq is registered doing also incrementing active activeCqCount, but while closing or stopping it decrements on all, but with this check it will decrement just on the one server where it is incremented. I'm not sure if this is a good check but it works, and I asked on dev list for a help to differentiate on which decrement is needed, but It is concluded that this is a bug but without any idea how to differentiate it.




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [geode] agingade commented on a change in pull request #5397: GEODE-8293: fix decrementing activeCQCount

Posted by GitBox <gi...@apache.org>.
agingade commented on a change in pull request #5397:
URL: https://github.com/apache/geode/pull/5397#discussion_r487138399



##########
File path: geode-cq/src/main/java/org/apache/geode/cache/query/cq/internal/ServerCQImpl.java
##########
@@ -367,10 +367,12 @@ public void close(boolean sendRequestToServer) throws CqClosedException, CqExcep
       this.removeFromCqMap();
 
       // Stat update.
-      if (stateBeforeClosing == CqStateImpl.RUNNING) {
-        cqService.stats().decCqsActive();
-      } else if (stateBeforeClosing == CqStateImpl.STOPPED) {
-        cqService.stats().decCqsStopped();
+      if (!cqName.equals(serverCqName)) {

Review comment:
       Again, sorry for delayed response. If needed you can always send a direct email to 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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode] mkevo commented on pull request #5397: GEODE-8293: fix decrementing activeCQCount

Posted by GitBox <gi...@apache.org>.
mkevo commented on pull request #5397:
URL: https://github.com/apache/geode/pull/5397#issuecomment-707647387


   The new solution will be added by new PR.


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [geode] agingade commented on a change in pull request #5397: GEODE-8293: fix decrementing activeCQCount

Posted by GitBox <gi...@apache.org>.
agingade commented on a change in pull request #5397:
URL: https://github.com/apache/geode/pull/5397#discussion_r459664869



##########
File path: geode-cq/src/distributedTest/java/org/apache/geode/cache/query/cq/CQMetricsDUnitTest.java
##########
@@ -0,0 +1,155 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.cache.query.cq;
+
+
+import static org.apache.geode.test.awaitility.GeodeAwaitility.await;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.io.Serializable;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.geode.cache.Cache;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.client.ClientCache;
+import org.apache.geode.cache.client.ClientCacheFactory;
+import org.apache.geode.cache.client.ClientRegionShortcut;
+import org.apache.geode.cache.query.CqAttributes;
+import org.apache.geode.cache.query.CqAttributesFactory;
+import org.apache.geode.cache.query.CqEvent;
+import org.apache.geode.cache.query.CqListener;
+import org.apache.geode.cache.query.QueryService;
+import org.apache.geode.cache.query.data.Portfolio;
+import org.apache.geode.management.DistributedSystemMXBean;
+import org.apache.geode.management.ManagementService;
+import org.apache.geode.test.dunit.rules.ClusterStartupRule;
+import org.apache.geode.test.dunit.rules.MemberVM;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
+
+public class CQMetricsDUnitTest {

Review comment:
       The functionality here is related to accessing stat using mbean; these tests are under "management" package. There is one test "CacheServerManagementTest", can this be added here. Or move this test to management package.

##########
File path: geode-cq/src/main/java/org/apache/geode/cache/query/cq/internal/ServerCQImpl.java
##########
@@ -367,10 +367,12 @@ public void close(boolean sendRequestToServer) throws CqClosedException, CqExcep
       this.removeFromCqMap();
 
       // Stat update.
-      if (stateBeforeClosing == CqStateImpl.RUNNING) {
-        cqService.stats().decCqsActive();
-      } else if (stateBeforeClosing == CqStateImpl.STOPPED) {
-        cqService.stats().decCqsStopped();
+      if (!cqName.equals(serverCqName)) {

Review comment:
       How is this change addressing the issue. The CqName and serverCqName is not same on the server side CQ representation. As this class represent server side, when the CQ execution (close) comes here the cqName should not be the same, isn't the case, here...Please help us to understand the context/stack where you are seeing this check is needed.  




----------------------------------------------------------------
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:
users@infra.apache.org