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/09/15 09:48:57 UTC

[GitHub] [ignite] anton-vinogradov opened a new pull request #9409: IGNITE-15328 Consistency recovery command (Read Repair via control.ch) should support cancellation

anton-vinogradov opened a new pull request #9409:
URL: https://github.com/apache/ignite/pull/9409


   Thank you for submitting the pull request to the Apache Ignite.
   
   In order to streamline the review of the contribution 
   we ask you to ensure the following steps have been taken:
   
   ### The Contribution Checklist
   - [ ] There is a single JIRA ticket related to the pull request. 
   - [ ] The web-link to the pull request is attached to the JIRA ticket.
   - [ ] The JIRA ticket has the _Patch Available_ state.
   - [ ] The pull request body describes changes that have been made. 
   The description explains _WHAT_ and _WHY_ was made instead of _HOW_.
   - [ ] The pull request title is treated as the final commit message. 
   The following pattern must be used: `IGNITE-XXXX Change summary` where `XXXX` - number of JIRA issue.
   - [ ] A reviewer has been mentioned through the JIRA comments 
   (see [the Maintainers list](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute#HowtoContribute-ReviewProcessandMaintainers)) 
   - [ ] The pull request has been checked by the Teamcity Bot and 
   the `green visa` attached to the JIRA ticket (see [TC.Bot: Check PR](https://mtcga.gridgain.com/prs.html))
   
   ### Notes
   - [How to Contribute](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute)
   - [Coding abbreviation rules](https://cwiki.apache.org/confluence/display/IGNITE/Abbreviation+Rules)
   - [Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Coding+Guidelines)
   - [Apache Ignite Teamcity Bot](https://cwiki.apache.org/confluence/display/IGNITE/Apache+Ignite+Teamcity+Bot)
   
   If you need any help, please email dev@ignite.apache.org or ask anу advice on http://asf.slack.com _#ignite_ channel.
   


-- 
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



[GitHub] [ignite] anton-vinogradov commented on a change in pull request #9409: IGNITE-15328 Consistency recovery command (Read Repair via control.ch) should support cancellation

Posted by GitBox <gi...@apache.org>.
anton-vinogradov commented on a change in pull request #9409:
URL: https://github.com/apache/ignite/pull/9409#discussion_r710896744



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobProcessor.java
##########
@@ -715,6 +717,21 @@ public void masterLeaveLocal(IgniteUuid sesId) {
                 job.onMasterNodeLeft();
     }
 
+    /** Searches for jobs that satisfy the condition.

Review comment:
       Sure. Done.




-- 
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



[GitHub] [ignite] nizhikov commented on a change in pull request #9409: IGNITE-15328 Consistency recovery command (Read Repair via control.ch) should support cancellation

Posted by GitBox <gi...@apache.org>.
nizhikov commented on a change in pull request #9409:
URL: https://github.com/apache/ignite/pull/9409#discussion_r710852618



##########
File path: modules/control-utility/src/test/java/org/apache/ignite/util/KillCommandsCommandShTest.java
##########
@@ -195,4 +205,97 @@ public void testCancelUnknownContinuousQuery() {
 
         assertEquals(EXIT_CODE_OK, res);
     }
+
+    /** */
+    @Test
+    public void testCancelConsistencyMissedTask() {
+        int res = execute("--kill", "consistency");
+
+        assertEquals(EXIT_CODE_OK, res);
+    }
+
+    /** */
+    @Test
+    public void testCancelConsistencyTask() throws InterruptedException {
+        String consistencyCancheName = "consistencyCache";
+
+        CacheConfiguration<Integer, Integer> cfg = new CacheConfiguration<>();
+
+        cfg.setName(consistencyCancheName);
+        cfg.setBackups(SERVER_NODE_CNT - 1);
+
+        IgniteCache<Integer, Integer> cache = client.getOrCreateCache(cfg);
+
+        for (int i = 0; i < 10_000; i++)
+            cache.put(i, i);
+
+        CountDownLatch getLatch = new CountDownLatch(SERVER_NODE_CNT); // Each node should send a get request.
+
+        for (IgniteEx server : srvs) {
+            TestRecordingCommunicationSpi spi =
+                ((TestRecordingCommunicationSpi)server.configuration().getCommunicationSpi());
+
+            spi.blockMessages((node, message) -> {
+                if (message instanceof GridNearGetRequest) { // Get request caused by read repair operation.
+                    getLatch.countDown();
+
+                    return true; // Blocking to freeze '--consistency repair' operation.
+                }
+
+                return false;
+            });
+        }
+
+        CountDownLatch thLatch = new CountDownLatch(1);
+
+        new Thread(() -> {
+            try {
+                getLatch.await(); // Waiting for consistency repair start.
+            }
+            catch (InterruptedException e) {
+                fail();
+            }
+
+            IgnitePredicate<GridJobWorker> repairJobFilter =
+                worker -> worker.getJob() instanceof VisorConsistencyRepairTask.VisorConsistencyRepairJob;
+
+            for (IgniteEx node : srvs)
+                assertFalse(node.context().job().findJobs(repairJobFilter).isEmpty()); // Found.
+
+            int res = execute("--kill", "consistency");
+
+            assertEquals(EXIT_CODE_OK, res);
+
+            try {
+                assertTrue(GridTestUtils.waitForCondition(() -> {
+                    for (IgniteEx node : srvs)
+                        if (!node.context().job().findJobs(repairJobFilter).isEmpty())
+                            return false;
+
+                    return true;
+                }, 5000L)); // Missed.

Review comment:
       let's use `getTestTimeout()` instead of hardcoded timeout to deal with slow test environment.




-- 
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



[GitHub] [ignite] anton-vinogradov commented on a change in pull request #9409: IGNITE-15328 Consistency recovery command (Read Repair via control.ch) should support cancellation

Posted by GitBox <gi...@apache.org>.
anton-vinogradov commented on a change in pull request #9409:
URL: https://github.com/apache/ignite/pull/9409#discussion_r710899426



##########
File path: modules/control-utility/src/test/java/org/apache/ignite/util/KillCommandsCommandShTest.java
##########
@@ -195,4 +205,97 @@ public void testCancelUnknownContinuousQuery() {
 
         assertEquals(EXIT_CODE_OK, res);
     }
+
+    /** */
+    @Test
+    public void testCancelConsistencyMissedTask() {
+        int res = execute("--kill", "consistency");
+
+        assertEquals(EXIT_CODE_OK, res);
+    }
+
+    /** */
+    @Test
+    public void testCancelConsistencyTask() throws InterruptedException {
+        String consistencyCancheName = "consistencyCache";
+
+        CacheConfiguration<Integer, Integer> cfg = new CacheConfiguration<>();
+
+        cfg.setName(consistencyCancheName);
+        cfg.setBackups(SERVER_NODE_CNT - 1);
+
+        IgniteCache<Integer, Integer> cache = client.getOrCreateCache(cfg);
+
+        for (int i = 0; i < 10_000; i++)
+            cache.put(i, i);
+
+        CountDownLatch getLatch = new CountDownLatch(SERVER_NODE_CNT); // Each node should send a get request.
+
+        for (IgniteEx server : srvs) {
+            TestRecordingCommunicationSpi spi =
+                ((TestRecordingCommunicationSpi)server.configuration().getCommunicationSpi());
+
+            spi.blockMessages((node, message) -> {
+                if (message instanceof GridNearGetRequest) { // Get request caused by read repair operation.
+                    getLatch.countDown();
+
+                    return true; // Blocking to freeze '--consistency repair' operation.
+                }
+
+                return false;
+            });
+        }
+
+        CountDownLatch thLatch = new CountDownLatch(1);
+
+        new Thread(() -> {
+            try {
+                getLatch.await(); // Waiting for consistency repair start.
+            }
+            catch (InterruptedException e) {
+                fail();
+            }
+
+            IgnitePredicate<GridJobWorker> repairJobFilter =

Review comment:
       Looks overcomplicated to me.
   Simple collection filtering is more suited.




-- 
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



[GitHub] [ignite] nizhikov commented on a change in pull request #9409: IGNITE-15328 Consistency recovery command (Read Repair via control.ch) should support cancellation

Posted by GitBox <gi...@apache.org>.
nizhikov commented on a change in pull request #9409:
URL: https://github.com/apache/ignite/pull/9409#discussion_r710850053



##########
File path: modules/control-utility/src/test/java/org/apache/ignite/util/KillCommandsCommandShTest.java
##########
@@ -195,4 +205,97 @@ public void testCancelUnknownContinuousQuery() {
 
         assertEquals(EXIT_CODE_OK, res);
     }
+
+    /** */
+    @Test
+    public void testCancelConsistencyMissedTask() {
+        int res = execute("--kill", "consistency");
+
+        assertEquals(EXIT_CODE_OK, res);
+    }
+
+    /** */
+    @Test
+    public void testCancelConsistencyTask() throws InterruptedException {
+        String consistencyCancheName = "consistencyCache";
+
+        CacheConfiguration<Integer, Integer> cfg = new CacheConfiguration<>();
+
+        cfg.setName(consistencyCancheName);
+        cfg.setBackups(SERVER_NODE_CNT - 1);
+
+        IgniteCache<Integer, Integer> cache = client.getOrCreateCache(cfg);
+
+        for (int i = 0; i < 10_000; i++)
+            cache.put(i, i);
+
+        CountDownLatch getLatch = new CountDownLatch(SERVER_NODE_CNT); // Each node should send a get request.
+
+        for (IgniteEx server : srvs) {
+            TestRecordingCommunicationSpi spi =
+                ((TestRecordingCommunicationSpi)server.configuration().getCommunicationSpi());
+
+            spi.blockMessages((node, message) -> {
+                if (message instanceof GridNearGetRequest) { // Get request caused by read repair operation.
+                    getLatch.countDown();
+
+                    return true; // Blocking to freeze '--consistency repair' operation.
+                }
+
+                return false;
+            });
+        }
+
+        CountDownLatch thLatch = new CountDownLatch(1);
+
+        new Thread(() -> {
+            try {
+                getLatch.await(); // Waiting for consistency repair start.
+            }
+            catch (InterruptedException e) {
+                fail();
+            }
+
+            IgnitePredicate<GridJobWorker> repairJobFilter =

Review comment:
       Can we use existing system view instead of creating new method?




-- 
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



[GitHub] [ignite] nizhikov commented on a change in pull request #9409: IGNITE-15328 Consistency recovery command (Read Repair via control.ch) should support cancellation

Posted by GitBox <gi...@apache.org>.
nizhikov commented on a change in pull request #9409:
URL: https://github.com/apache/ignite/pull/9409#discussion_r710852618



##########
File path: modules/control-utility/src/test/java/org/apache/ignite/util/KillCommandsCommandShTest.java
##########
@@ -195,4 +205,97 @@ public void testCancelUnknownContinuousQuery() {
 
         assertEquals(EXIT_CODE_OK, res);
     }
+
+    /** */
+    @Test
+    public void testCancelConsistencyMissedTask() {
+        int res = execute("--kill", "consistency");
+
+        assertEquals(EXIT_CODE_OK, res);
+    }
+
+    /** */
+    @Test
+    public void testCancelConsistencyTask() throws InterruptedException {
+        String consistencyCancheName = "consistencyCache";
+
+        CacheConfiguration<Integer, Integer> cfg = new CacheConfiguration<>();
+
+        cfg.setName(consistencyCancheName);
+        cfg.setBackups(SERVER_NODE_CNT - 1);
+
+        IgniteCache<Integer, Integer> cache = client.getOrCreateCache(cfg);
+
+        for (int i = 0; i < 10_000; i++)
+            cache.put(i, i);
+
+        CountDownLatch getLatch = new CountDownLatch(SERVER_NODE_CNT); // Each node should send a get request.
+
+        for (IgniteEx server : srvs) {
+            TestRecordingCommunicationSpi spi =
+                ((TestRecordingCommunicationSpi)server.configuration().getCommunicationSpi());
+
+            spi.blockMessages((node, message) -> {
+                if (message instanceof GridNearGetRequest) { // Get request caused by read repair operation.
+                    getLatch.countDown();
+
+                    return true; // Blocking to freeze '--consistency repair' operation.
+                }
+
+                return false;
+            });
+        }
+
+        CountDownLatch thLatch = new CountDownLatch(1);
+
+        new Thread(() -> {
+            try {
+                getLatch.await(); // Waiting for consistency repair start.
+            }
+            catch (InterruptedException e) {
+                fail();
+            }
+
+            IgnitePredicate<GridJobWorker> repairJobFilter =
+                worker -> worker.getJob() instanceof VisorConsistencyRepairTask.VisorConsistencyRepairJob;
+
+            for (IgniteEx node : srvs)
+                assertFalse(node.context().job().findJobs(repairJobFilter).isEmpty()); // Found.
+
+            int res = execute("--kill", "consistency");
+
+            assertEquals(EXIT_CODE_OK, res);
+
+            try {
+                assertTrue(GridTestUtils.waitForCondition(() -> {
+                    for (IgniteEx node : srvs)
+                        if (!node.context().job().findJobs(repairJobFilter).isEmpty())
+                            return false;
+
+                    return true;
+                }, 5000L)); // Missed.

Review comment:
       let's use `getTestTimeout()` here to deal with slow test environment.




-- 
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



[GitHub] [ignite] nizhikov commented on a change in pull request #9409: IGNITE-15328 Consistency recovery command (Read Repair via control.ch) should support cancellation

Posted by GitBox <gi...@apache.org>.
nizhikov commented on a change in pull request #9409:
URL: https://github.com/apache/ignite/pull/9409#discussion_r710853234



##########
File path: modules/control-utility/src/test/java/org/apache/ignite/util/KillCommandsCommandShTest.java
##########
@@ -195,4 +205,97 @@ public void testCancelUnknownContinuousQuery() {
 
         assertEquals(EXIT_CODE_OK, res);
     }
+
+    /** */
+    @Test
+    public void testCancelConsistencyMissedTask() {
+        int res = execute("--kill", "consistency");
+
+        assertEquals(EXIT_CODE_OK, res);
+    }
+
+    /** */
+    @Test
+    public void testCancelConsistencyTask() throws InterruptedException {
+        String consistencyCancheName = "consistencyCache";
+
+        CacheConfiguration<Integer, Integer> cfg = new CacheConfiguration<>();
+
+        cfg.setName(consistencyCancheName);
+        cfg.setBackups(SERVER_NODE_CNT - 1);
+
+        IgniteCache<Integer, Integer> cache = client.getOrCreateCache(cfg);
+
+        for (int i = 0; i < 10_000; i++)
+            cache.put(i, i);
+
+        CountDownLatch getLatch = new CountDownLatch(SERVER_NODE_CNT); // Each node should send a get request.
+
+        for (IgniteEx server : srvs) {
+            TestRecordingCommunicationSpi spi =
+                ((TestRecordingCommunicationSpi)server.configuration().getCommunicationSpi());
+
+            spi.blockMessages((node, message) -> {
+                if (message instanceof GridNearGetRequest) { // Get request caused by read repair operation.
+                    getLatch.countDown();
+
+                    return true; // Blocking to freeze '--consistency repair' operation.
+                }
+
+                return false;
+            });
+        }
+
+        CountDownLatch thLatch = new CountDownLatch(1);
+
+        new Thread(() -> {
+            try {
+                getLatch.await(); // Waiting for consistency repair start.

Review comment:
       Please, use `getTestTimeout()` here to await latch with timeout.




-- 
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



[GitHub] [ignite] anton-vinogradov commented on a change in pull request #9409: IGNITE-15328 Consistency recovery command (Read Repair via control.ch) should support cancellation

Posted by GitBox <gi...@apache.org>.
anton-vinogradov commented on a change in pull request #9409:
URL: https://github.com/apache/ignite/pull/9409#discussion_r711031955



##########
File path: modules/control-utility/src/test/java/org/apache/ignite/util/KillCommandsCommandShTest.java
##########
@@ -195,4 +205,97 @@ public void testCancelUnknownContinuousQuery() {
 
         assertEquals(EXIT_CODE_OK, res);
     }
+
+    /** */
+    @Test
+    public void testCancelConsistencyMissedTask() {
+        int res = execute("--kill", "consistency");
+
+        assertEquals(EXIT_CODE_OK, res);
+    }
+
+    /** */
+    @Test
+    public void testCancelConsistencyTask() throws InterruptedException {
+        String consistencyCancheName = "consistencyCache";
+
+        CacheConfiguration<Integer, Integer> cfg = new CacheConfiguration<>();
+
+        cfg.setName(consistencyCancheName);
+        cfg.setBackups(SERVER_NODE_CNT - 1);
+
+        IgniteCache<Integer, Integer> cache = client.getOrCreateCache(cfg);
+
+        for (int i = 0; i < 10_000; i++)
+            cache.put(i, i);
+
+        CountDownLatch getLatch = new CountDownLatch(SERVER_NODE_CNT); // Each node should send a get request.
+
+        for (IgniteEx server : srvs) {
+            TestRecordingCommunicationSpi spi =
+                ((TestRecordingCommunicationSpi)server.configuration().getCommunicationSpi());
+
+            spi.blockMessages((node, message) -> {
+                if (message instanceof GridNearGetRequest) { // Get request caused by read repair operation.
+                    getLatch.countDown();
+
+                    return true; // Blocking to freeze '--consistency repair' operation.
+                }
+
+                return false;
+            });
+        }
+
+        CountDownLatch thLatch = new CountDownLatch(1);
+
+        new Thread(() -> {
+            try {
+                getLatch.await(); // Waiting for consistency repair start.
+            }
+            catch (InterruptedException e) {
+                fail();
+            }
+
+            IgnitePredicate<GridJobWorker> repairJobFilter =
+                worker -> worker.getJob() instanceof VisorConsistencyRepairTask.VisorConsistencyRepairJob;
+
+            for (IgniteEx node : srvs)
+                assertFalse(node.context().job().findJobs(repairJobFilter).isEmpty()); // Found.
+
+            int res = execute("--kill", "consistency");
+
+            assertEquals(EXIT_CODE_OK, res);
+
+            try {
+                assertTrue(GridTestUtils.waitForCondition(() -> {
+                    for (IgniteEx node : srvs)
+                        if (!node.context().job().findJobs(repairJobFilter).isEmpty())
+                            return false;
+
+                    return true;
+                }, 5000L)); // Missed.
+            }
+            catch (IgniteInterruptedCheckedException e) {
+                fail();
+            }
+
+            thLatch.countDown();
+        }).start();
+
+        injectTestSystemOut();
+
+        assertEquals(EXIT_CODE_UNEXPECTED_ERROR, execute("--consistency", "repair", consistencyCancheName, "0"));
+
+        assertContains(log, testOut.toString(), "Operation execution cancelled.");
+        assertContains(log, testOut.toString(), "violations were NOT found [processed=0]");
+
+        thLatch.await();

Review comment:
       This will be interrupted on test interruption if getTestTimeout() is exceeded.




-- 
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



[GitHub] [ignite] anton-vinogradov commented on a change in pull request #9409: IGNITE-15328 Consistency recovery command (Read Repair via control.ch) should support cancellation

Posted by GitBox <gi...@apache.org>.
anton-vinogradov commented on a change in pull request #9409:
URL: https://github.com/apache/ignite/pull/9409#discussion_r711022321



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/visor/consistency/VisorConsistencyCancelTask.java
##########
@@ -0,0 +1,82 @@
+/*
+ * 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.ignite.internal.visor.consistency;
+
+import java.util.List;
+import java.util.Set;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.compute.ComputeJobResult;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.processors.job.GridJobWorker;
+import org.apache.ignite.internal.visor.VisorJob;
+import org.apache.ignite.internal.visor.VisorMultiNodeTask;
+import org.apache.ignite.resources.IgniteInstanceResource;
+
+/**
+ * Cancels given consistency repairs on all cluster nodes.
+ */
+public class VisorConsistencyCancelTask extends VisorMultiNodeTask<Void, Void, Void> {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** {@inheritDoc} */
+    @Override protected VisorConsistencyCancelJob job(Void arg) {
+        return new VisorConsistencyCancelJob(arg, debug);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected Void reduce0(List<ComputeJobResult> results) {
+        // No-op, just awaiting all jobs done.
+        return null;
+    }
+
+    /**
+     * Job that cancels the tasks.
+     */
+    private static class VisorConsistencyCancelJob extends VisorJob<Void, Void> {
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        /**
+         * Auto-injected grid instance.
+         */
+        @IgniteInstanceResource
+        private transient IgniteEx ignite;
+
+        /**
+         * Default constructor.
+         */
+        protected VisorConsistencyCancelJob(Void arg, boolean debug) {
+            super(arg, debug);
+        }
+
+        /**
+         * {@inheritDoc}

Review comment:
       Done




-- 
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



[GitHub] [ignite] anton-vinogradov commented on a change in pull request #9409: IGNITE-15328 Consistency recovery command (Read Repair via control.ch) should support cancellation

Posted by GitBox <gi...@apache.org>.
anton-vinogradov commented on a change in pull request #9409:
URL: https://github.com/apache/ignite/pull/9409#discussion_r710901696



##########
File path: modules/control-utility/src/test/java/org/apache/ignite/util/KillCommandsCommandShTest.java
##########
@@ -195,4 +205,97 @@ public void testCancelUnknownContinuousQuery() {
 
         assertEquals(EXIT_CODE_OK, res);
     }
+
+    /** */
+    @Test
+    public void testCancelConsistencyMissedTask() {
+        int res = execute("--kill", "consistency");
+
+        assertEquals(EXIT_CODE_OK, res);
+    }
+
+    /** */
+    @Test
+    public void testCancelConsistencyTask() throws InterruptedException {
+        String consistencyCancheName = "consistencyCache";
+
+        CacheConfiguration<Integer, Integer> cfg = new CacheConfiguration<>();
+
+        cfg.setName(consistencyCancheName);
+        cfg.setBackups(SERVER_NODE_CNT - 1);
+
+        IgniteCache<Integer, Integer> cache = client.getOrCreateCache(cfg);
+
+        for (int i = 0; i < 10_000; i++)
+            cache.put(i, i);
+
+        CountDownLatch getLatch = new CountDownLatch(SERVER_NODE_CNT); // Each node should send a get request.
+
+        for (IgniteEx server : srvs) {
+            TestRecordingCommunicationSpi spi =
+                ((TestRecordingCommunicationSpi)server.configuration().getCommunicationSpi());
+
+            spi.blockMessages((node, message) -> {
+                if (message instanceof GridNearGetRequest) { // Get request caused by read repair operation.
+                    getLatch.countDown();
+
+                    return true; // Blocking to freeze '--consistency repair' operation.
+                }
+
+                return false;
+            });
+        }
+
+        CountDownLatch thLatch = new CountDownLatch(1);
+
+        new Thread(() -> {
+            try {
+                getLatch.await(); // Waiting for consistency repair start.
+            }
+            catch (InterruptedException e) {
+                fail();
+            }
+
+            IgnitePredicate<GridJobWorker> repairJobFilter =
+                worker -> worker.getJob() instanceof VisorConsistencyRepairTask.VisorConsistencyRepairJob;
+
+            for (IgniteEx node : srvs)
+                assertFalse(node.context().job().findJobs(repairJobFilter).isEmpty()); // Found.
+
+            int res = execute("--kill", "consistency");
+
+            assertEquals(EXIT_CODE_OK, res);
+
+            try {
+                assertTrue(GridTestUtils.waitForCondition(() -> {
+                    for (IgniteEx node : srvs)
+                        if (!node.context().job().findJobs(repairJobFilter).isEmpty())
+                            return false;
+
+                    return true;
+                }, 5000L)); // Missed.

Review comment:
       getTestTimeout() is a 5 minutes instead of 5 seconds I'm proposing.
   And again it's a timeout need to survive on GC pause or VM freeze, we'll never wait for it at the regular run.
   This code returns true at the first turn at 99.99999% runs.




-- 
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



[GitHub] [ignite] nizhikov commented on a change in pull request #9409: IGNITE-15328 Consistency recovery command (Read Repair via control.ch) should support cancellation

Posted by GitBox <gi...@apache.org>.
nizhikov commented on a change in pull request #9409:
URL: https://github.com/apache/ignite/pull/9409#discussion_r710852116



##########
File path: modules/control-utility/src/test/java/org/apache/ignite/util/KillCommandsCommandShTest.java
##########
@@ -195,4 +205,97 @@ public void testCancelUnknownContinuousQuery() {
 
         assertEquals(EXIT_CODE_OK, res);
     }
+
+    /** */
+    @Test
+    public void testCancelConsistencyMissedTask() {
+        int res = execute("--kill", "consistency");
+
+        assertEquals(EXIT_CODE_OK, res);
+    }
+
+    /** */
+    @Test
+    public void testCancelConsistencyTask() throws InterruptedException {
+        String consistencyCancheName = "consistencyCache";
+
+        CacheConfiguration<Integer, Integer> cfg = new CacheConfiguration<>();
+
+        cfg.setName(consistencyCancheName);
+        cfg.setBackups(SERVER_NODE_CNT - 1);
+
+        IgniteCache<Integer, Integer> cache = client.getOrCreateCache(cfg);
+
+        for (int i = 0; i < 10_000; i++)
+            cache.put(i, i);
+
+        CountDownLatch getLatch = new CountDownLatch(SERVER_NODE_CNT); // Each node should send a get request.
+
+        for (IgniteEx server : srvs) {
+            TestRecordingCommunicationSpi spi =
+                ((TestRecordingCommunicationSpi)server.configuration().getCommunicationSpi());
+
+            spi.blockMessages((node, message) -> {
+                if (message instanceof GridNearGetRequest) { // Get request caused by read repair operation.
+                    getLatch.countDown();
+
+                    return true; // Blocking to freeze '--consistency repair' operation.
+                }
+
+                return false;
+            });
+        }
+
+        CountDownLatch thLatch = new CountDownLatch(1);
+
+        new Thread(() -> {
+            try {
+                getLatch.await(); // Waiting for consistency repair start.
+            }
+            catch (InterruptedException e) {
+                fail();
+            }
+
+            IgnitePredicate<GridJobWorker> repairJobFilter =

Review comment:
       You can use `g.context().systemView().view(CACHE_GRPS_VIEW)` or `JmxExporterSpiTest#systemView` also to query system view content without SQL.




-- 
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



[GitHub] [ignite] nizhikov commented on a change in pull request #9409: IGNITE-15328 Consistency recovery command (Read Repair via control.ch) should support cancellation

Posted by GitBox <gi...@apache.org>.
nizhikov commented on a change in pull request #9409:
URL: https://github.com/apache/ignite/pull/9409#discussion_r710850053



##########
File path: modules/control-utility/src/test/java/org/apache/ignite/util/KillCommandsCommandShTest.java
##########
@@ -195,4 +205,97 @@ public void testCancelUnknownContinuousQuery() {
 
         assertEquals(EXIT_CODE_OK, res);
     }
+
+    /** */
+    @Test
+    public void testCancelConsistencyMissedTask() {
+        int res = execute("--kill", "consistency");
+
+        assertEquals(EXIT_CODE_OK, res);
+    }
+
+    /** */
+    @Test
+    public void testCancelConsistencyTask() throws InterruptedException {
+        String consistencyCancheName = "consistencyCache";
+
+        CacheConfiguration<Integer, Integer> cfg = new CacheConfiguration<>();
+
+        cfg.setName(consistencyCancheName);
+        cfg.setBackups(SERVER_NODE_CNT - 1);
+
+        IgniteCache<Integer, Integer> cache = client.getOrCreateCache(cfg);
+
+        for (int i = 0; i < 10_000; i++)
+            cache.put(i, i);
+
+        CountDownLatch getLatch = new CountDownLatch(SERVER_NODE_CNT); // Each node should send a get request.
+
+        for (IgniteEx server : srvs) {
+            TestRecordingCommunicationSpi spi =
+                ((TestRecordingCommunicationSpi)server.configuration().getCommunicationSpi());
+
+            spi.blockMessages((node, message) -> {
+                if (message instanceof GridNearGetRequest) { // Get request caused by read repair operation.
+                    getLatch.countDown();
+
+                    return true; // Blocking to freeze '--consistency repair' operation.
+                }
+
+                return false;
+            });
+        }
+
+        CountDownLatch thLatch = new CountDownLatch(1);
+
+        new Thread(() -> {
+            try {
+                getLatch.await(); // Waiting for consistency repair start.
+            }
+            catch (InterruptedException e) {
+                fail();
+            }
+
+            IgnitePredicate<GridJobWorker> repairJobFilter =

Review comment:
       Can we use existing system view instead of creating new method?
   `SELECT * FROM SYS.JOB WHERE CLASS_NAME = ?`




-- 
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



[GitHub] [ignite] anton-vinogradov commented on a change in pull request #9409: IGNITE-15328 Consistency recovery command (Read Repair via control.ch) should support cancellation

Posted by GitBox <gi...@apache.org>.
anton-vinogradov commented on a change in pull request #9409:
URL: https://github.com/apache/ignite/pull/9409#discussion_r711021559



##########
File path: modules/control-utility/src/test/java/org/apache/ignite/util/KillCommandsCommandShTest.java
##########
@@ -195,4 +205,97 @@ public void testCancelUnknownContinuousQuery() {
 
         assertEquals(EXIT_CODE_OK, res);
     }
+
+    /** */
+    @Test
+    public void testCancelConsistencyMissedTask() {
+        int res = execute("--kill", "consistency");
+
+        assertEquals(EXIT_CODE_OK, res);
+    }
+
+    /** */
+    @Test
+    public void testCancelConsistencyTask() throws InterruptedException {
+        String consistencyCancheName = "consistencyCache";
+
+        CacheConfiguration<Integer, Integer> cfg = new CacheConfiguration<>();
+
+        cfg.setName(consistencyCancheName);
+        cfg.setBackups(SERVER_NODE_CNT - 1);
+
+        IgniteCache<Integer, Integer> cache = client.getOrCreateCache(cfg);
+
+        for (int i = 0; i < 10_000; i++)
+            cache.put(i, i);
+
+        CountDownLatch getLatch = new CountDownLatch(SERVER_NODE_CNT); // Each node should send a get request.
+
+        for (IgniteEx server : srvs) {
+            TestRecordingCommunicationSpi spi =
+                ((TestRecordingCommunicationSpi)server.configuration().getCommunicationSpi());
+
+            spi.blockMessages((node, message) -> {
+                if (message instanceof GridNearGetRequest) { // Get request caused by read repair operation.
+                    getLatch.countDown();
+
+                    return true; // Blocking to freeze '--consistency repair' operation.
+                }
+
+                return false;
+            });
+        }
+
+        CountDownLatch thLatch = new CountDownLatch(1);
+
+        new Thread(() -> {
+            try {
+                getLatch.await(); // Waiting for consistency repair start.
+            }
+            catch (InterruptedException e) {
+                fail();
+            }
+
+            IgnitePredicate<GridJobWorker> repairJobFilter =

Review comment:
       Replaced with ignite.context().systemView().view(JOBS_VIEW)




-- 
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



[GitHub] [ignite] anton-vinogradov commented on a change in pull request #9409: IGNITE-15328 Consistency recovery command (Read Repair via control.ch) should support cancellation

Posted by GitBox <gi...@apache.org>.
anton-vinogradov commented on a change in pull request #9409:
URL: https://github.com/apache/ignite/pull/9409#discussion_r710901696



##########
File path: modules/control-utility/src/test/java/org/apache/ignite/util/KillCommandsCommandShTest.java
##########
@@ -195,4 +205,97 @@ public void testCancelUnknownContinuousQuery() {
 
         assertEquals(EXIT_CODE_OK, res);
     }
+
+    /** */
+    @Test
+    public void testCancelConsistencyMissedTask() {
+        int res = execute("--kill", "consistency");
+
+        assertEquals(EXIT_CODE_OK, res);
+    }
+
+    /** */
+    @Test
+    public void testCancelConsistencyTask() throws InterruptedException {
+        String consistencyCancheName = "consistencyCache";
+
+        CacheConfiguration<Integer, Integer> cfg = new CacheConfiguration<>();
+
+        cfg.setName(consistencyCancheName);
+        cfg.setBackups(SERVER_NODE_CNT - 1);
+
+        IgniteCache<Integer, Integer> cache = client.getOrCreateCache(cfg);
+
+        for (int i = 0; i < 10_000; i++)
+            cache.put(i, i);
+
+        CountDownLatch getLatch = new CountDownLatch(SERVER_NODE_CNT); // Each node should send a get request.
+
+        for (IgniteEx server : srvs) {
+            TestRecordingCommunicationSpi spi =
+                ((TestRecordingCommunicationSpi)server.configuration().getCommunicationSpi());
+
+            spi.blockMessages((node, message) -> {
+                if (message instanceof GridNearGetRequest) { // Get request caused by read repair operation.
+                    getLatch.countDown();
+
+                    return true; // Blocking to freeze '--consistency repair' operation.
+                }
+
+                return false;
+            });
+        }
+
+        CountDownLatch thLatch = new CountDownLatch(1);
+
+        new Thread(() -> {
+            try {
+                getLatch.await(); // Waiting for consistency repair start.
+            }
+            catch (InterruptedException e) {
+                fail();
+            }
+
+            IgnitePredicate<GridJobWorker> repairJobFilter =
+                worker -> worker.getJob() instanceof VisorConsistencyRepairTask.VisorConsistencyRepairJob;
+
+            for (IgniteEx node : srvs)
+                assertFalse(node.context().job().findJobs(repairJobFilter).isEmpty()); // Found.
+
+            int res = execute("--kill", "consistency");
+
+            assertEquals(EXIT_CODE_OK, res);
+
+            try {
+                assertTrue(GridTestUtils.waitForCondition(() -> {
+                    for (IgniteEx node : srvs)
+                        if (!node.context().job().findJobs(repairJobFilter).isEmpty())
+                            return false;
+
+                    return true;
+                }, 5000L)); // Missed.

Review comment:
       getTestTimeout() is a 5 minutes instead of 5 seconds I'm proposing.
   And again it's a timeout need to survive on GC pause or VM freeze, we'll never wait for it at the regular run.




-- 
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



[GitHub] [ignite] nizhikov commented on a change in pull request #9409: IGNITE-15328 Consistency recovery command (Read Repair via control.ch) should support cancellation

Posted by GitBox <gi...@apache.org>.
nizhikov commented on a change in pull request #9409:
URL: https://github.com/apache/ignite/pull/9409#discussion_r710856714



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/visor/consistency/VisorConsistencyCancelTask.java
##########
@@ -0,0 +1,82 @@
+/*
+ * 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.ignite.internal.visor.consistency;
+
+import java.util.List;
+import java.util.Set;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.compute.ComputeJobResult;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.processors.job.GridJobWorker;
+import org.apache.ignite.internal.visor.VisorJob;
+import org.apache.ignite.internal.visor.VisorMultiNodeTask;
+import org.apache.ignite.resources.IgniteInstanceResource;
+
+/**
+ * Cancels given consistency repairs on all cluster nodes.
+ */
+public class VisorConsistencyCancelTask extends VisorMultiNodeTask<Void, Void, Void> {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** {@inheritDoc} */
+    @Override protected VisorConsistencyCancelJob job(Void arg) {
+        return new VisorConsistencyCancelJob(arg, debug);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected Void reduce0(List<ComputeJobResult> results) {
+        // No-op, just awaiting all jobs done.
+        return null;
+    }
+
+    /**
+     * Job that cancels the tasks.
+     */
+    private static class VisorConsistencyCancelJob extends VisorJob<Void, Void> {
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        /**
+         * Auto-injected grid instance.
+         */
+        @IgniteInstanceResource
+        private transient IgniteEx ignite;
+
+        /**
+         * Default constructor.
+         */
+        protected VisorConsistencyCancelJob(Void arg, boolean debug) {
+            super(arg, debug);
+        }
+
+        /**
+         * {@inheritDoc}

Review comment:
       Can this comment be one-liner?




-- 
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



[GitHub] [ignite] nizhikov commented on a change in pull request #9409: IGNITE-15328 Consistency recovery command (Read Repair via control.ch) should support cancellation

Posted by GitBox <gi...@apache.org>.
nizhikov commented on a change in pull request #9409:
URL: https://github.com/apache/ignite/pull/9409#discussion_r710855158



##########
File path: modules/control-utility/src/test/java/org/apache/ignite/util/KillCommandsCommandShTest.java
##########
@@ -195,4 +205,97 @@ public void testCancelUnknownContinuousQuery() {
 
         assertEquals(EXIT_CODE_OK, res);
     }
+
+    /** */
+    @Test
+    public void testCancelConsistencyMissedTask() {
+        int res = execute("--kill", "consistency");
+
+        assertEquals(EXIT_CODE_OK, res);
+    }
+
+    /** */
+    @Test
+    public void testCancelConsistencyTask() throws InterruptedException {
+        String consistencyCancheName = "consistencyCache";
+
+        CacheConfiguration<Integer, Integer> cfg = new CacheConfiguration<>();
+
+        cfg.setName(consistencyCancheName);
+        cfg.setBackups(SERVER_NODE_CNT - 1);
+
+        IgniteCache<Integer, Integer> cache = client.getOrCreateCache(cfg);
+
+        for (int i = 0; i < 10_000; i++)
+            cache.put(i, i);
+
+        CountDownLatch getLatch = new CountDownLatch(SERVER_NODE_CNT); // Each node should send a get request.
+
+        for (IgniteEx server : srvs) {
+            TestRecordingCommunicationSpi spi =
+                ((TestRecordingCommunicationSpi)server.configuration().getCommunicationSpi());
+
+            spi.blockMessages((node, message) -> {
+                if (message instanceof GridNearGetRequest) { // Get request caused by read repair operation.
+                    getLatch.countDown();
+
+                    return true; // Blocking to freeze '--consistency repair' operation.
+                }
+
+                return false;
+            });
+        }
+
+        CountDownLatch thLatch = new CountDownLatch(1);
+
+        new Thread(() -> {
+            try {
+                getLatch.await(); // Waiting for consistency repair start.
+            }
+            catch (InterruptedException e) {
+                fail();
+            }
+
+            IgnitePredicate<GridJobWorker> repairJobFilter =
+                worker -> worker.getJob() instanceof VisorConsistencyRepairTask.VisorConsistencyRepairJob;
+
+            for (IgniteEx node : srvs)
+                assertFalse(node.context().job().findJobs(repairJobFilter).isEmpty()); // Found.
+
+            int res = execute("--kill", "consistency");
+
+            assertEquals(EXIT_CODE_OK, res);
+
+            try {
+                assertTrue(GridTestUtils.waitForCondition(() -> {
+                    for (IgniteEx node : srvs)
+                        if (!node.context().job().findJobs(repairJobFilter).isEmpty())
+                            return false;
+
+                    return true;
+                }, 5000L)); // Missed.
+            }
+            catch (IgniteInterruptedCheckedException e) {
+                fail();
+            }
+
+            thLatch.countDown();
+        }).start();
+
+        injectTestSystemOut();
+
+        assertEquals(EXIT_CODE_UNEXPECTED_ERROR, execute("--consistency", "repair", consistencyCancheName, "0"));
+
+        assertContains(log, testOut.toString(), "Operation execution cancelled.");
+        assertContains(log, testOut.toString(), "violations were NOT found [processed=0]");
+
+        thLatch.await();

Review comment:
       Please, use `getTestTimeout()` here to await latch with timeout.
   
   




-- 
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



[GitHub] [ignite] anton-vinogradov merged pull request #9409: IGNITE-15328 Consistency recovery command (Read Repair via control.ch) should support cancellation

Posted by GitBox <gi...@apache.org>.
anton-vinogradov merged pull request #9409:
URL: https://github.com/apache/ignite/pull/9409


   


-- 
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



[GitHub] [ignite] nizhikov commented on a change in pull request #9409: IGNITE-15328 Consistency recovery command (Read Repair via control.ch) should support cancellation

Posted by GitBox <gi...@apache.org>.
nizhikov commented on a change in pull request #9409:
URL: https://github.com/apache/ignite/pull/9409#discussion_r710849230



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobProcessor.java
##########
@@ -715,6 +717,21 @@ public void masterLeaveLocal(IgniteUuid sesId) {
                 job.onMasterNodeLeft();
     }
 
+    /** Searches for jobs that satisfy the condition.

Review comment:
       It seems comment should be placed on the new line.




-- 
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



[GitHub] [ignite] nizhikov commented on a change in pull request #9409: IGNITE-15328 Consistency recovery command (Read Repair via control.ch) should support cancellation

Posted by GitBox <gi...@apache.org>.
nizhikov commented on a change in pull request #9409:
URL: https://github.com/apache/ignite/pull/9409#discussion_r710846744



##########
File path: modules/control-utility/src/main/java/org/apache/ignite/internal/commandline/query/KillSubcommand.java
##########
@@ -54,4 +54,7 @@
 
     /** Kill snapshot operation. */
     SNAPSHOT,
+
+    /** Kill consistency tasks. */
+    CONSISTENCY,

Review comment:
       comma should be removed




-- 
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



[GitHub] [ignite] anton-vinogradov commented on a change in pull request #9409: IGNITE-15328 Consistency recovery command (Read Repair via control.ch) should support cancellation

Posted by GitBox <gi...@apache.org>.
anton-vinogradov commented on a change in pull request #9409:
URL: https://github.com/apache/ignite/pull/9409#discussion_r710904171



##########
File path: modules/control-utility/src/test/java/org/apache/ignite/util/KillCommandsCommandShTest.java
##########
@@ -195,4 +205,97 @@ public void testCancelUnknownContinuousQuery() {
 
         assertEquals(EXIT_CODE_OK, res);
     }
+
+    /** */
+    @Test
+    public void testCancelConsistencyMissedTask() {
+        int res = execute("--kill", "consistency");
+
+        assertEquals(EXIT_CODE_OK, res);
+    }
+
+    /** */
+    @Test
+    public void testCancelConsistencyTask() throws InterruptedException {
+        String consistencyCancheName = "consistencyCache";
+
+        CacheConfiguration<Integer, Integer> cfg = new CacheConfiguration<>();
+
+        cfg.setName(consistencyCancheName);
+        cfg.setBackups(SERVER_NODE_CNT - 1);
+
+        IgniteCache<Integer, Integer> cache = client.getOrCreateCache(cfg);
+
+        for (int i = 0; i < 10_000; i++)
+            cache.put(i, i);
+
+        CountDownLatch getLatch = new CountDownLatch(SERVER_NODE_CNT); // Each node should send a get request.
+
+        for (IgniteEx server : srvs) {
+            TestRecordingCommunicationSpi spi =
+                ((TestRecordingCommunicationSpi)server.configuration().getCommunicationSpi());
+
+            spi.blockMessages((node, message) -> {
+                if (message instanceof GridNearGetRequest) { // Get request caused by read repair operation.
+                    getLatch.countDown();
+
+                    return true; // Blocking to freeze '--consistency repair' operation.
+                }
+
+                return false;
+            });
+        }
+
+        CountDownLatch thLatch = new CountDownLatch(1);
+
+        new Thread(() -> {
+            try {
+                getLatch.await(); // Waiting for consistency repair start.

Review comment:
       Good catch. Fixed.




-- 
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



[GitHub] [ignite] anton-vinogradov commented on a change in pull request #9409: IGNITE-15328 Consistency recovery command (Read Repair via control.ch) should support cancellation

Posted by GitBox <gi...@apache.org>.
anton-vinogradov commented on a change in pull request #9409:
URL: https://github.com/apache/ignite/pull/9409#discussion_r710896250



##########
File path: modules/control-utility/src/main/java/org/apache/ignite/internal/commandline/query/KillSubcommand.java
##########
@@ -54,4 +54,7 @@
 
     /** Kill snapshot operation. */
     SNAPSHOT,
+
+    /** Kill consistency tasks. */
+    CONSISTENCY,

Review comment:
       It may be removed.
   As you can see it was present before my commit.
   Let's keek as is (auto-extendable, without need to update old lines on extending)




-- 
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