You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2021/08/31 12:09:37 UTC

[GitHub] [ignite] Berkof commented on a change in pull request #9314: IGNITE-15281 add cluster state check into statistics manager.

Berkof commented on a change in pull request #9314:
URL: https://github.com/apache/ignite/pull/9314#discussion_r699259322



##########
File path: modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/stat/StatisticsGatherer.java
##########
@@ -272,11 +272,18 @@ public void stop() {
         if (log.isTraceEnabled())
             log.trace(String.format("Statistics gathering stopping %d task...", gatheringInProgress.size()));
 
-        gatheringInProgress.values().forEach(ctx -> ctx.futureGather().cancel(true));
-
-        gatheringInProgress.clear();
+        cancelAllTasks();
 
         if (log.isDebugEnabled())
             log.debug("Statistics gathering stopped.");
     }
+
+    /**
+     * Cancel all currently running statistics gathering tasks.
+     */
+    public void cancelAllTasks() {
+        gatheringInProgress.values().forEach(ctx -> ctx.futureGather().cancel(true));
+
+        gatheringInProgress.clear();
+    }

Review comment:
       It won't totally fix the possibility of failure cause we can change state during processObsolescence execution. But I move state check directly into it to improve readability and lower this chance a bit.
   




-- 
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: notifications-unsubscribe@ignite.apache.org

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