NSAmelchev commented on a change in pull request #7358: IGNITE-12614 : Disallow 
silent deactivation of cluster to prevent in-mem data loss.
URL: https://github.com/apache/ignite/pull/7358#discussion_r375316632
 
 

 ##########
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/commandline/ClusterStateChangeCommand.java
 ##########
 @@ -102,4 +167,53 @@
     @Override public String name() {
         return SET_STATE.toCommandName();
     }
+
+    /** Searches for any non-persistent cache. */
+    private static class FindNotPersistentCachesJob extends ComputeJobAdapter {
+
+        @IgniteInstanceResource
+        private Ignite ignite;
+
+        /** */
+        @SuppressWarnings("unchecked")
+        @Override public Boolean execute() throws IgniteException {
+            //Find any node with disabled memory reusage on 
deactivation/activation.
+            boolean cacheDataCanBeLost = ignite.cluster().forPredicate(node->
+                
(Boolean)node.attributes().getOrDefault(ATTR_MEMORY_ERASURE_ON_DEACTIVATION, 
true))
+                .nodes().stream().findAny().isPresent();
+
+            if (cacheDataCanBeLost) {
+                //Find data region to set persistent flag.
+                for (String cacheName : ignite.cacheNames()) {
 
 Review comment:
   Lets use the same approach as for JMX

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to