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 2020/09/09 19:54:40 UTC

[GitHub] [ignite] anton-vinogradov opened a new pull request #8232: Cellular switch test

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


   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.

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



[GitHub] [ignite] anton-vinogradov commented on a change in pull request #8232: IGNITE-13433 Benchmark confirms operation's latency drop decrease on Cellular switch comparing to PME-free switch

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



##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -38,33 +41,54 @@ def __init__(self, context, config, java_class_name, params="", timeout_sec=60,
         self.servicejava_class_name = servicejava_class_name
         self.java_class_name = java_class_name
         self.timeout_sec = timeout_sec
-        self.stop_timeout_sec = 10
+        self.params = params
 
     def start(self):
         super().start()
 
         self.logger.info("Waiting for Ignite aware Application (%s) to start..." % self.java_class_name)
 
         self.await_event("Topology snapshot", self.timeout_sec, from_the_beginning=True)
-        self.await_event("IGNITE_APPLICATION_INITIALIZED\\|IGNITE_APPLICATION_BROKEN", self.timeout_sec,
-                         from_the_beginning=True)
 
-        try:
-            self.await_event("IGNITE_APPLICATION_INITIALIZED", 1, from_the_beginning=True)
-        except Exception:
-            raise Exception("Java application execution failed. %s" % self.extract_result("ERROR")) from None
+        self.__check_status("IGNITE_APPLICATION_INITIALIZED", timeout=self.timeout_sec)
 
-    # pylint: disable=W0221
-    def stop_node(self, node, clean_shutdown=True, timeout_sec=20):
-        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(node.account)))
-        node.account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown, allow_fail=True)
+    def stop_async(self, clean_shutdown=True):
+        """
+        Stops node in async way.
+        """
+        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(self.nodes[0].account)))
+        self.nodes[0].account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown,
+                                                  allow_fail=True)
 
-        stopped = self.wait_node(node, timeout_sec=self.stop_timeout_sec)
+    def await_stopped(self, timeout_sec=10):
+        """
+        Awaits node stop finish.
+        """
+        stopped = self.wait_node(self.nodes[0], timeout_sec=timeout_sec)
         assert stopped, "Node %s: did not stop within the specified timeout of %s seconds" % \
-                        (str(node.account), str(self.stop_timeout_sec))
+                        (str(self.nodes[0].account), str(timeout_sec))
 
-        self.await_event("IGNITE_APPLICATION_FINISHED\\|IGNITE_APPLICATION_BROKEN", from_the_beginning=True,
-                         timeout_sec=timeout_sec)
+        self.__check_status("IGNITE_APPLICATION_FINISHED", timeout=timeout_sec)
+
+    # pylint: disable=W0221
+    def stop_node(self, node, clean_shutdown=True, timeout_sec=10):
+        assert node == self.nodes[0]
+        self.stop_async(clean_shutdown)
+        self.await_stopped(timeout_sec)
+
+    def __check_status(self, desired, timeout=1):
+        self.await_event("%s\\|IGNITE_APPLICATION_BROKEN" % desired, timeout, from_the_beginning=True)
+
+        try:
+            self.await_event("IGNITE_APPLICATION_BROKEN", 1, from_the_beginning=True)

Review comment:
       I tried to set 0 during development and this caused error-less behaviour where they were expected.
   Seems 0 unacceptable here.




----------------------------------------------------------------
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] [ignite] timoninmaxim commented on a change in pull request #8232: IGNITE-13433 Benchmark confirms operation's latency drop decrease on Cellular switch comparing to PME-free switch

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



##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -38,33 +41,54 @@ def __init__(self, context, config, java_class_name, params="", timeout_sec=60,
         self.servicejava_class_name = servicejava_class_name
         self.java_class_name = java_class_name
         self.timeout_sec = timeout_sec
-        self.stop_timeout_sec = 10
+        self.params = params
 
     def start(self):
         super().start()
 
         self.logger.info("Waiting for Ignite aware Application (%s) to start..." % self.java_class_name)
 
         self.await_event("Topology snapshot", self.timeout_sec, from_the_beginning=True)
-        self.await_event("IGNITE_APPLICATION_INITIALIZED\\|IGNITE_APPLICATION_BROKEN", self.timeout_sec,
-                         from_the_beginning=True)
 
-        try:
-            self.await_event("IGNITE_APPLICATION_INITIALIZED", 1, from_the_beginning=True)
-        except Exception:
-            raise Exception("Java application execution failed. %s" % self.extract_result("ERROR")) from None
+        self.__check_status("IGNITE_APPLICATION_INITIALIZED", timeout=self.timeout_sec)
 
-    # pylint: disable=W0221
-    def stop_node(self, node, clean_shutdown=True, timeout_sec=20):
-        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(node.account)))
-        node.account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown, allow_fail=True)
+    def stop_async(self, clean_shutdown=True):
+        """
+        Stops node in async way.
+        """
+        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(self.nodes[0].account)))
+        self.nodes[0].account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown,
+                                                  allow_fail=True)
 
-        stopped = self.wait_node(node, timeout_sec=self.stop_timeout_sec)
+    def await_stopped(self, timeout_sec=10):
+        """
+        Awaits node stop finish.
+        """
+        stopped = self.wait_node(self.nodes[0], timeout_sec=timeout_sec)
         assert stopped, "Node %s: did not stop within the specified timeout of %s seconds" % \
-                        (str(node.account), str(self.stop_timeout_sec))
+                        (str(self.nodes[0].account), str(timeout_sec))
 
-        self.await_event("IGNITE_APPLICATION_FINISHED\\|IGNITE_APPLICATION_BROKEN", from_the_beginning=True,
-                         timeout_sec=timeout_sec)
+        self.__check_status("IGNITE_APPLICATION_FINISHED", timeout=timeout_sec)
+
+    # pylint: disable=W0221
+    def stop_node(self, node, clean_shutdown=True, timeout_sec=10):
+        assert node == self.nodes[0]
+        self.stop_async(clean_shutdown)
+        self.await_stopped(timeout_sec)
+
+    def __check_status(self, desired, timeout=1):
+        self.await_event("%s\\|IGNITE_APPLICATION_BROKEN" % desired, timeout, from_the_beginning=True)
+
+        try:
+            self.await_event("IGNITE_APPLICATION_BROKEN", 1, from_the_beginning=True)

Review comment:
       I mean there should be return immediately. As I see this line just checks that previous wait finishes due to error. 




----------------------------------------------------------------
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] [ignite] timoninmaxim commented on a change in pull request #8232: IGNITE-13433 Benchmark confirms operation's latency drop decrease on Cellular switch comparing to PME-free switch

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



##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -38,33 +41,54 @@ def __init__(self, context, config, java_class_name, params="", timeout_sec=60,
         self.servicejava_class_name = servicejava_class_name
         self.java_class_name = java_class_name
         self.timeout_sec = timeout_sec
-        self.stop_timeout_sec = 10
+        self.params = params
 
     def start(self):
         super().start()
 
         self.logger.info("Waiting for Ignite aware Application (%s) to start..." % self.java_class_name)
 
         self.await_event("Topology snapshot", self.timeout_sec, from_the_beginning=True)
-        self.await_event("IGNITE_APPLICATION_INITIALIZED\\|IGNITE_APPLICATION_BROKEN", self.timeout_sec,
-                         from_the_beginning=True)
 
-        try:
-            self.await_event("IGNITE_APPLICATION_INITIALIZED", 1, from_the_beginning=True)
-        except Exception:
-            raise Exception("Java application execution failed. %s" % self.extract_result("ERROR")) from None
+        self.__check_status("IGNITE_APPLICATION_INITIALIZED", timeout=self.timeout_sec)
 
-    # pylint: disable=W0221
-    def stop_node(self, node, clean_shutdown=True, timeout_sec=20):
-        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(node.account)))
-        node.account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown, allow_fail=True)
+    def stop_async(self, clean_shutdown=True):
+        """
+        Stops node in async way.
+        """
+        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(self.nodes[0].account)))
+        self.nodes[0].account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown,
+                                                  allow_fail=True)
 
-        stopped = self.wait_node(node, timeout_sec=self.stop_timeout_sec)
+    def await_stopped(self, timeout_sec=10):
+        """
+        Awaits node stop finish.
+        """
+        stopped = self.wait_node(self.nodes[0], timeout_sec=timeout_sec)
         assert stopped, "Node %s: did not stop within the specified timeout of %s seconds" % \
-                        (str(node.account), str(self.stop_timeout_sec))
+                        (str(self.nodes[0].account), str(timeout_sec))
 
-        self.await_event("IGNITE_APPLICATION_FINISHED\\|IGNITE_APPLICATION_BROKEN", from_the_beginning=True,
-                         timeout_sec=timeout_sec)
+        self.__check_status("IGNITE_APPLICATION_FINISHED", timeout=timeout_sec)
+
+    # pylint: disable=W0221
+    def stop_node(self, node, clean_shutdown=True, timeout_sec=10):
+        assert node == self.nodes[0]
+        self.stop_async(clean_shutdown)
+        self.await_stopped(timeout_sec)
+
+    def __check_status(self, desired, timeout=1):
+        self.await_event("%s\\|IGNITE_APPLICATION_BROKEN" % desired, timeout, from_the_beginning=True)
+
+        try:
+            self.await_event("IGNITE_APPLICATION_BROKEN", 1, from_the_beginning=True)

Review comment:
       Can we replace 1 with 0?

##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -38,33 +41,54 @@ def __init__(self, context, config, java_class_name, params="", timeout_sec=60,
         self.servicejava_class_name = servicejava_class_name
         self.java_class_name = java_class_name
         self.timeout_sec = timeout_sec
-        self.stop_timeout_sec = 10
+        self.params = params

Review comment:
       How is it used?

##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -38,33 +41,54 @@ def __init__(self, context, config, java_class_name, params="", timeout_sec=60,
         self.servicejava_class_name = servicejava_class_name
         self.java_class_name = java_class_name
         self.timeout_sec = timeout_sec
-        self.stop_timeout_sec = 10
+        self.params = params
 
     def start(self):
         super().start()
 
         self.logger.info("Waiting for Ignite aware Application (%s) to start..." % self.java_class_name)
 
         self.await_event("Topology snapshot", self.timeout_sec, from_the_beginning=True)
-        self.await_event("IGNITE_APPLICATION_INITIALIZED\\|IGNITE_APPLICATION_BROKEN", self.timeout_sec,
-                         from_the_beginning=True)
 
-        try:
-            self.await_event("IGNITE_APPLICATION_INITIALIZED", 1, from_the_beginning=True)
-        except Exception:
-            raise Exception("Java application execution failed. %s" % self.extract_result("ERROR")) from None
+        self.__check_status("IGNITE_APPLICATION_INITIALIZED", timeout=self.timeout_sec)
 
-    # pylint: disable=W0221
-    def stop_node(self, node, clean_shutdown=True, timeout_sec=20):
-        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(node.account)))
-        node.account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown, allow_fail=True)
+    def stop_async(self, clean_shutdown=True):
+        """
+        Stops node in async way.
+        """
+        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(self.nodes[0].account)))
+        self.nodes[0].account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown,
+                                                  allow_fail=True)
 
-        stopped = self.wait_node(node, timeout_sec=self.stop_timeout_sec)
+    def await_stopped(self, timeout_sec=10):
+        """
+        Awaits node stop finish.
+        """
+        stopped = self.wait_node(self.nodes[0], timeout_sec=timeout_sec)
         assert stopped, "Node %s: did not stop within the specified timeout of %s seconds" % \
-                        (str(node.account), str(self.stop_timeout_sec))
+                        (str(self.nodes[0].account), str(timeout_sec))
 
-        self.await_event("IGNITE_APPLICATION_FINISHED\\|IGNITE_APPLICATION_BROKEN", from_the_beginning=True,
-                         timeout_sec=timeout_sec)
+        self.__check_status("IGNITE_APPLICATION_FINISHED", timeout=timeout_sec)
+
+    # pylint: disable=W0221
+    def stop_node(self, node, clean_shutdown=True, timeout_sec=10):
+        assert node == self.nodes[0]
+        self.stop_async(clean_shutdown)
+        self.await_stopped(timeout_sec)
+
+    def __check_status(self, desired, timeout=1):
+        self.await_event("%s\\|IGNITE_APPLICATION_BROKEN" % desired, timeout, from_the_beginning=True)
+
+        try:
+            self.await_event("IGNITE_APPLICATION_BROKEN", 1, from_the_beginning=True)
+            raise Exception("Java application execution failed. %s" % self.extract_result("ERROR"))
+        except TimeoutError:
+            pass
+
+        try:
+            self.await_event(desired, 1, from_the_beginning=True)
+        except Exception:
+            raise Exception("Java application execution falied.") from None

Review comment:
       falied -> failed

##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/cellular_affinity_test/PreparedTxStreamer.java
##########
@@ -0,0 +1,102 @@
+/*
+ * 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.ducktest.tests.cellular_affinity_test;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+import org.apache.ignite.internal.processors.cache.transactions.TransactionProxyImpl;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.transactions.Transaction;
+
+/**
+ *
+ */
+public class PreparedTxStreamer extends IgniteAwareApplication {
+    /**
+     * {@inheritDoc}
+     */
+    @Override protected void run(JsonNode jsonNode) throws Exception {
+        final String cacheName = jsonNode.get("cacheName").asText();
+        final String attr = jsonNode.get("attr").asText();
+        final String cell = jsonNode.get("cell").asText();
+        final int txCnt = jsonNode.get("txCnt").asInt();
+
+        markInitialized();
+
+        waitForActivation();
+
+        IgniteCache<Integer, Integer> cache = ignite.getOrCreateCache(cacheName);
+
+        log.info("Starting Prepared Txs...");
+
+        Affinity<Integer> aff = ignite.affinity(cacheName);
+
+        int cnt = 0;
+        int i = -1; // Negative keys to have no intersection with load.
+
+        while (cnt != txCnt && !terminated()) {
+            Collection<ClusterNode> nodes = aff.mapKeyToPrimaryAndBackups(i);
+
+            Map<Object, Long> stat = nodes.stream().collect(
+                Collectors.groupingBy(n -> n.attributes().get(attr), Collectors.counting()));
+
+            assert 1 == stat.keySet().size() :
+                "Partition should be located on nodes from only one cell " +
+                    "[key=" + i + ", nodes=" + nodes.size() + ", stat=" + stat + "]";
+
+            if (stat.containsKey(cell)) {
+                cnt++;
+
+                Transaction tx = ignite.transactions().txStart();
+
+                cache.put(i, i);
+
+                try {
+                    ((TransactionProxyImpl<?, ?>)tx).tx().prepare(true);
+                }
+                catch (IgniteCheckedException e) {

Review comment:
       `IgniteAwareApplication::start` already catch any exception and mark app as broken

##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/cellular_affinity_test/PreparedTxStreamer.java
##########
@@ -0,0 +1,102 @@
+/*
+ * 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.ducktest.tests.cellular_affinity_test;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+import org.apache.ignite.internal.processors.cache.transactions.TransactionProxyImpl;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.transactions.Transaction;
+
+/**
+ *

Review comment:
       Could you please provide a short brief of the class

##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/cellular_affinity_test/TxStreamer.java
##########
@@ -0,0 +1,114 @@
+/*
+ * 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.ducktest.tests.cellular_affinity_test;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ *

Review comment:
       Could you please provide a short brief of the class

##########
File path: modules/ducktests/tests/ignitetest/services/utils/ignite_spec.py
##########
@@ -147,6 +146,8 @@ def __init__(self, modules, **kwargs):
         libs.append("log4j")
         libs = list(map(lambda m: self.path.module(m) + "/*", libs))
 
+        libs.append(IgnitePath(DEV_BRANCH).module("ducktests") + "/*")

Review comment:
       Why do you add ducktests to NodeSpec?




----------------------------------------------------------------
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] [ignite] timoninmaxim commented on a change in pull request #8232: IGNITE-13433 Benchmark confirms operation's latency drop decrease on Cellular switch comparing to PME-free switch

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



##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -38,33 +41,54 @@ def __init__(self, context, config, java_class_name, params="", timeout_sec=60,
         self.servicejava_class_name = servicejava_class_name
         self.java_class_name = java_class_name
         self.timeout_sec = timeout_sec
-        self.stop_timeout_sec = 10
+        self.params = params
 
     def start(self):
         super().start()
 
         self.logger.info("Waiting for Ignite aware Application (%s) to start..." % self.java_class_name)
 
         self.await_event("Topology snapshot", self.timeout_sec, from_the_beginning=True)
-        self.await_event("IGNITE_APPLICATION_INITIALIZED\\|IGNITE_APPLICATION_BROKEN", self.timeout_sec,
-                         from_the_beginning=True)
 
-        try:
-            self.await_event("IGNITE_APPLICATION_INITIALIZED", 1, from_the_beginning=True)
-        except Exception:
-            raise Exception("Java application execution failed. %s" % self.extract_result("ERROR")) from None
+        self.__check_status("IGNITE_APPLICATION_INITIALIZED", timeout=self.timeout_sec)
 
-    # pylint: disable=W0221
-    def stop_node(self, node, clean_shutdown=True, timeout_sec=20):
-        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(node.account)))
-        node.account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown, allow_fail=True)
+    def stop_async(self, clean_shutdown=True):
+        """
+        Stops node in async way.
+        """
+        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(self.nodes[0].account)))
+        self.nodes[0].account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown,
+                                                  allow_fail=True)
 
-        stopped = self.wait_node(node, timeout_sec=self.stop_timeout_sec)
+    def await_stopped(self, timeout_sec=10):
+        """
+        Awaits node stop finish.
+        """
+        stopped = self.wait_node(self.nodes[0], timeout_sec=timeout_sec)
         assert stopped, "Node %s: did not stop within the specified timeout of %s seconds" % \
-                        (str(node.account), str(self.stop_timeout_sec))
+                        (str(self.nodes[0].account), str(timeout_sec))
 
-        self.await_event("IGNITE_APPLICATION_FINISHED\\|IGNITE_APPLICATION_BROKEN", from_the_beginning=True,
-                         timeout_sec=timeout_sec)
+        self.__check_status("IGNITE_APPLICATION_FINISHED", timeout=timeout_sec)
+
+    # pylint: disable=W0221
+    def stop_node(self, node, clean_shutdown=True, timeout_sec=10):
+        assert node == self.nodes[0]
+        self.stop_async(clean_shutdown)
+        self.await_stopped(timeout_sec)
+
+    def __check_status(self, desired, timeout=1):
+        self.await_event("%s\\|IGNITE_APPLICATION_BROKEN" % desired, timeout, from_the_beginning=True)
+
+        try:
+            self.await_event("IGNITE_APPLICATION_BROKEN", 1, from_the_beginning=True)

Review comment:
       Can we replace 1 with 0?

##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -38,33 +41,54 @@ def __init__(self, context, config, java_class_name, params="", timeout_sec=60,
         self.servicejava_class_name = servicejava_class_name
         self.java_class_name = java_class_name
         self.timeout_sec = timeout_sec
-        self.stop_timeout_sec = 10
+        self.params = params

Review comment:
       How is it used?

##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -38,33 +41,54 @@ def __init__(self, context, config, java_class_name, params="", timeout_sec=60,
         self.servicejava_class_name = servicejava_class_name
         self.java_class_name = java_class_name
         self.timeout_sec = timeout_sec
-        self.stop_timeout_sec = 10
+        self.params = params
 
     def start(self):
         super().start()
 
         self.logger.info("Waiting for Ignite aware Application (%s) to start..." % self.java_class_name)
 
         self.await_event("Topology snapshot", self.timeout_sec, from_the_beginning=True)
-        self.await_event("IGNITE_APPLICATION_INITIALIZED\\|IGNITE_APPLICATION_BROKEN", self.timeout_sec,
-                         from_the_beginning=True)
 
-        try:
-            self.await_event("IGNITE_APPLICATION_INITIALIZED", 1, from_the_beginning=True)
-        except Exception:
-            raise Exception("Java application execution failed. %s" % self.extract_result("ERROR")) from None
+        self.__check_status("IGNITE_APPLICATION_INITIALIZED", timeout=self.timeout_sec)
 
-    # pylint: disable=W0221
-    def stop_node(self, node, clean_shutdown=True, timeout_sec=20):
-        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(node.account)))
-        node.account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown, allow_fail=True)
+    def stop_async(self, clean_shutdown=True):
+        """
+        Stops node in async way.
+        """
+        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(self.nodes[0].account)))
+        self.nodes[0].account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown,
+                                                  allow_fail=True)
 
-        stopped = self.wait_node(node, timeout_sec=self.stop_timeout_sec)
+    def await_stopped(self, timeout_sec=10):
+        """
+        Awaits node stop finish.
+        """
+        stopped = self.wait_node(self.nodes[0], timeout_sec=timeout_sec)
         assert stopped, "Node %s: did not stop within the specified timeout of %s seconds" % \
-                        (str(node.account), str(self.stop_timeout_sec))
+                        (str(self.nodes[0].account), str(timeout_sec))
 
-        self.await_event("IGNITE_APPLICATION_FINISHED\\|IGNITE_APPLICATION_BROKEN", from_the_beginning=True,
-                         timeout_sec=timeout_sec)
+        self.__check_status("IGNITE_APPLICATION_FINISHED", timeout=timeout_sec)
+
+    # pylint: disable=W0221
+    def stop_node(self, node, clean_shutdown=True, timeout_sec=10):
+        assert node == self.nodes[0]
+        self.stop_async(clean_shutdown)
+        self.await_stopped(timeout_sec)
+
+    def __check_status(self, desired, timeout=1):
+        self.await_event("%s\\|IGNITE_APPLICATION_BROKEN" % desired, timeout, from_the_beginning=True)
+
+        try:
+            self.await_event("IGNITE_APPLICATION_BROKEN", 1, from_the_beginning=True)
+            raise Exception("Java application execution failed. %s" % self.extract_result("ERROR"))
+        except TimeoutError:
+            pass
+
+        try:
+            self.await_event(desired, 1, from_the_beginning=True)
+        except Exception:
+            raise Exception("Java application execution falied.") from None

Review comment:
       falied -> failed

##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/cellular_affinity_test/PreparedTxStreamer.java
##########
@@ -0,0 +1,102 @@
+/*
+ * 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.ducktest.tests.cellular_affinity_test;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+import org.apache.ignite.internal.processors.cache.transactions.TransactionProxyImpl;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.transactions.Transaction;
+
+/**
+ *
+ */
+public class PreparedTxStreamer extends IgniteAwareApplication {
+    /**
+     * {@inheritDoc}
+     */
+    @Override protected void run(JsonNode jsonNode) throws Exception {
+        final String cacheName = jsonNode.get("cacheName").asText();
+        final String attr = jsonNode.get("attr").asText();
+        final String cell = jsonNode.get("cell").asText();
+        final int txCnt = jsonNode.get("txCnt").asInt();
+
+        markInitialized();
+
+        waitForActivation();
+
+        IgniteCache<Integer, Integer> cache = ignite.getOrCreateCache(cacheName);
+
+        log.info("Starting Prepared Txs...");
+
+        Affinity<Integer> aff = ignite.affinity(cacheName);
+
+        int cnt = 0;
+        int i = -1; // Negative keys to have no intersection with load.
+
+        while (cnt != txCnt && !terminated()) {
+            Collection<ClusterNode> nodes = aff.mapKeyToPrimaryAndBackups(i);
+
+            Map<Object, Long> stat = nodes.stream().collect(
+                Collectors.groupingBy(n -> n.attributes().get(attr), Collectors.counting()));
+
+            assert 1 == stat.keySet().size() :
+                "Partition should be located on nodes from only one cell " +
+                    "[key=" + i + ", nodes=" + nodes.size() + ", stat=" + stat + "]";
+
+            if (stat.containsKey(cell)) {
+                cnt++;
+
+                Transaction tx = ignite.transactions().txStart();
+
+                cache.put(i, i);
+
+                try {
+                    ((TransactionProxyImpl<?, ?>)tx).tx().prepare(true);
+                }
+                catch (IgniteCheckedException e) {

Review comment:
       `IgniteAwareApplication::start` already catch any exception and mark app as broken

##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/cellular_affinity_test/PreparedTxStreamer.java
##########
@@ -0,0 +1,102 @@
+/*
+ * 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.ducktest.tests.cellular_affinity_test;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+import org.apache.ignite.internal.processors.cache.transactions.TransactionProxyImpl;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.transactions.Transaction;
+
+/**
+ *

Review comment:
       Could you please provide a short brief of the class

##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/cellular_affinity_test/TxStreamer.java
##########
@@ -0,0 +1,114 @@
+/*
+ * 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.ducktest.tests.cellular_affinity_test;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ *

Review comment:
       Could you please provide a short brief of the class

##########
File path: modules/ducktests/tests/ignitetest/services/utils/ignite_spec.py
##########
@@ -147,6 +146,8 @@ def __init__(self, modules, **kwargs):
         libs.append("log4j")
         libs = list(map(lambda m: self.path.module(m) + "/*", libs))
 
+        libs.append(IgnitePath(DEV_BRANCH).module("ducktests") + "/*")

Review comment:
       Why do you add ducktests to NodeSpec?

##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -38,33 +41,54 @@ def __init__(self, context, config, java_class_name, params="", timeout_sec=60,
         self.servicejava_class_name = servicejava_class_name
         self.java_class_name = java_class_name
         self.timeout_sec = timeout_sec
-        self.stop_timeout_sec = 10
+        self.params = params
 
     def start(self):
         super().start()
 
         self.logger.info("Waiting for Ignite aware Application (%s) to start..." % self.java_class_name)
 
         self.await_event("Topology snapshot", self.timeout_sec, from_the_beginning=True)
-        self.await_event("IGNITE_APPLICATION_INITIALIZED\\|IGNITE_APPLICATION_BROKEN", self.timeout_sec,
-                         from_the_beginning=True)
 
-        try:
-            self.await_event("IGNITE_APPLICATION_INITIALIZED", 1, from_the_beginning=True)
-        except Exception:
-            raise Exception("Java application execution failed. %s" % self.extract_result("ERROR")) from None
+        self.__check_status("IGNITE_APPLICATION_INITIALIZED", timeout=self.timeout_sec)
 
-    # pylint: disable=W0221
-    def stop_node(self, node, clean_shutdown=True, timeout_sec=20):
-        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(node.account)))
-        node.account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown, allow_fail=True)
+    def stop_async(self, clean_shutdown=True):
+        """
+        Stops node in async way.
+        """
+        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(self.nodes[0].account)))
+        self.nodes[0].account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown,
+                                                  allow_fail=True)
 
-        stopped = self.wait_node(node, timeout_sec=self.stop_timeout_sec)
+    def await_stopped(self, timeout_sec=10):
+        """
+        Awaits node stop finish.
+        """
+        stopped = self.wait_node(self.nodes[0], timeout_sec=timeout_sec)
         assert stopped, "Node %s: did not stop within the specified timeout of %s seconds" % \
-                        (str(node.account), str(self.stop_timeout_sec))
+                        (str(self.nodes[0].account), str(timeout_sec))
 
-        self.await_event("IGNITE_APPLICATION_FINISHED\\|IGNITE_APPLICATION_BROKEN", from_the_beginning=True,
-                         timeout_sec=timeout_sec)
+        self.__check_status("IGNITE_APPLICATION_FINISHED", timeout=timeout_sec)
+
+    # pylint: disable=W0221
+    def stop_node(self, node, clean_shutdown=True, timeout_sec=10):
+        assert node == self.nodes[0]
+        self.stop_async(clean_shutdown)
+        self.await_stopped(timeout_sec)
+
+    def __check_status(self, desired, timeout=1):
+        self.await_event("%s\\|IGNITE_APPLICATION_BROKEN" % desired, timeout, from_the_beginning=True)
+
+        try:
+            self.await_event("IGNITE_APPLICATION_BROKEN", 1, from_the_beginning=True)

Review comment:
       Can we replace 1 with 0?

##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -38,33 +41,54 @@ def __init__(self, context, config, java_class_name, params="", timeout_sec=60,
         self.servicejava_class_name = servicejava_class_name
         self.java_class_name = java_class_name
         self.timeout_sec = timeout_sec
-        self.stop_timeout_sec = 10
+        self.params = params

Review comment:
       How is it used?

##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -38,33 +41,54 @@ def __init__(self, context, config, java_class_name, params="", timeout_sec=60,
         self.servicejava_class_name = servicejava_class_name
         self.java_class_name = java_class_name
         self.timeout_sec = timeout_sec
-        self.stop_timeout_sec = 10
+        self.params = params
 
     def start(self):
         super().start()
 
         self.logger.info("Waiting for Ignite aware Application (%s) to start..." % self.java_class_name)
 
         self.await_event("Topology snapshot", self.timeout_sec, from_the_beginning=True)
-        self.await_event("IGNITE_APPLICATION_INITIALIZED\\|IGNITE_APPLICATION_BROKEN", self.timeout_sec,
-                         from_the_beginning=True)
 
-        try:
-            self.await_event("IGNITE_APPLICATION_INITIALIZED", 1, from_the_beginning=True)
-        except Exception:
-            raise Exception("Java application execution failed. %s" % self.extract_result("ERROR")) from None
+        self.__check_status("IGNITE_APPLICATION_INITIALIZED", timeout=self.timeout_sec)
 
-    # pylint: disable=W0221
-    def stop_node(self, node, clean_shutdown=True, timeout_sec=20):
-        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(node.account)))
-        node.account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown, allow_fail=True)
+    def stop_async(self, clean_shutdown=True):
+        """
+        Stops node in async way.
+        """
+        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(self.nodes[0].account)))
+        self.nodes[0].account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown,
+                                                  allow_fail=True)
 
-        stopped = self.wait_node(node, timeout_sec=self.stop_timeout_sec)
+    def await_stopped(self, timeout_sec=10):
+        """
+        Awaits node stop finish.
+        """
+        stopped = self.wait_node(self.nodes[0], timeout_sec=timeout_sec)
         assert stopped, "Node %s: did not stop within the specified timeout of %s seconds" % \
-                        (str(node.account), str(self.stop_timeout_sec))
+                        (str(self.nodes[0].account), str(timeout_sec))
 
-        self.await_event("IGNITE_APPLICATION_FINISHED\\|IGNITE_APPLICATION_BROKEN", from_the_beginning=True,
-                         timeout_sec=timeout_sec)
+        self.__check_status("IGNITE_APPLICATION_FINISHED", timeout=timeout_sec)
+
+    # pylint: disable=W0221
+    def stop_node(self, node, clean_shutdown=True, timeout_sec=10):
+        assert node == self.nodes[0]
+        self.stop_async(clean_shutdown)
+        self.await_stopped(timeout_sec)
+
+    def __check_status(self, desired, timeout=1):
+        self.await_event("%s\\|IGNITE_APPLICATION_BROKEN" % desired, timeout, from_the_beginning=True)
+
+        try:
+            self.await_event("IGNITE_APPLICATION_BROKEN", 1, from_the_beginning=True)
+            raise Exception("Java application execution failed. %s" % self.extract_result("ERROR"))
+        except TimeoutError:
+            pass
+
+        try:
+            self.await_event(desired, 1, from_the_beginning=True)
+        except Exception:
+            raise Exception("Java application execution falied.") from None

Review comment:
       falied -> failed

##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/cellular_affinity_test/PreparedTxStreamer.java
##########
@@ -0,0 +1,102 @@
+/*
+ * 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.ducktest.tests.cellular_affinity_test;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+import org.apache.ignite.internal.processors.cache.transactions.TransactionProxyImpl;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.transactions.Transaction;
+
+/**
+ *
+ */
+public class PreparedTxStreamer extends IgniteAwareApplication {
+    /**
+     * {@inheritDoc}
+     */
+    @Override protected void run(JsonNode jsonNode) throws Exception {
+        final String cacheName = jsonNode.get("cacheName").asText();
+        final String attr = jsonNode.get("attr").asText();
+        final String cell = jsonNode.get("cell").asText();
+        final int txCnt = jsonNode.get("txCnt").asInt();
+
+        markInitialized();
+
+        waitForActivation();
+
+        IgniteCache<Integer, Integer> cache = ignite.getOrCreateCache(cacheName);
+
+        log.info("Starting Prepared Txs...");
+
+        Affinity<Integer> aff = ignite.affinity(cacheName);
+
+        int cnt = 0;
+        int i = -1; // Negative keys to have no intersection with load.
+
+        while (cnt != txCnt && !terminated()) {
+            Collection<ClusterNode> nodes = aff.mapKeyToPrimaryAndBackups(i);
+
+            Map<Object, Long> stat = nodes.stream().collect(
+                Collectors.groupingBy(n -> n.attributes().get(attr), Collectors.counting()));
+
+            assert 1 == stat.keySet().size() :
+                "Partition should be located on nodes from only one cell " +
+                    "[key=" + i + ", nodes=" + nodes.size() + ", stat=" + stat + "]";
+
+            if (stat.containsKey(cell)) {
+                cnt++;
+
+                Transaction tx = ignite.transactions().txStart();
+
+                cache.put(i, i);
+
+                try {
+                    ((TransactionProxyImpl<?, ?>)tx).tx().prepare(true);
+                }
+                catch (IgniteCheckedException e) {

Review comment:
       `IgniteAwareApplication::start` already catch any exception and mark app as broken

##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/cellular_affinity_test/PreparedTxStreamer.java
##########
@@ -0,0 +1,102 @@
+/*
+ * 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.ducktest.tests.cellular_affinity_test;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+import org.apache.ignite.internal.processors.cache.transactions.TransactionProxyImpl;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.transactions.Transaction;
+
+/**
+ *

Review comment:
       Could you please provide a short brief of the class

##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/cellular_affinity_test/TxStreamer.java
##########
@@ -0,0 +1,114 @@
+/*
+ * 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.ducktest.tests.cellular_affinity_test;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ *

Review comment:
       Could you please provide a short brief of the class

##########
File path: modules/ducktests/tests/ignitetest/services/utils/ignite_spec.py
##########
@@ -147,6 +146,8 @@ def __init__(self, modules, **kwargs):
         libs.append("log4j")
         libs = list(map(lambda m: self.path.module(m) + "/*", libs))
 
+        libs.append(IgnitePath(DEV_BRANCH).module("ducktests") + "/*")

Review comment:
       Why do you add ducktests to NodeSpec?

##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -38,33 +41,54 @@ def __init__(self, context, config, java_class_name, params="", timeout_sec=60,
         self.servicejava_class_name = servicejava_class_name
         self.java_class_name = java_class_name
         self.timeout_sec = timeout_sec
-        self.stop_timeout_sec = 10
+        self.params = params
 
     def start(self):
         super().start()
 
         self.logger.info("Waiting for Ignite aware Application (%s) to start..." % self.java_class_name)
 
         self.await_event("Topology snapshot", self.timeout_sec, from_the_beginning=True)
-        self.await_event("IGNITE_APPLICATION_INITIALIZED\\|IGNITE_APPLICATION_BROKEN", self.timeout_sec,
-                         from_the_beginning=True)
 
-        try:
-            self.await_event("IGNITE_APPLICATION_INITIALIZED", 1, from_the_beginning=True)
-        except Exception:
-            raise Exception("Java application execution failed. %s" % self.extract_result("ERROR")) from None
+        self.__check_status("IGNITE_APPLICATION_INITIALIZED", timeout=self.timeout_sec)
 
-    # pylint: disable=W0221
-    def stop_node(self, node, clean_shutdown=True, timeout_sec=20):
-        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(node.account)))
-        node.account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown, allow_fail=True)
+    def stop_async(self, clean_shutdown=True):
+        """
+        Stops node in async way.
+        """
+        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(self.nodes[0].account)))
+        self.nodes[0].account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown,
+                                                  allow_fail=True)
 
-        stopped = self.wait_node(node, timeout_sec=self.stop_timeout_sec)
+    def await_stopped(self, timeout_sec=10):
+        """
+        Awaits node stop finish.
+        """
+        stopped = self.wait_node(self.nodes[0], timeout_sec=timeout_sec)
         assert stopped, "Node %s: did not stop within the specified timeout of %s seconds" % \
-                        (str(node.account), str(self.stop_timeout_sec))
+                        (str(self.nodes[0].account), str(timeout_sec))
 
-        self.await_event("IGNITE_APPLICATION_FINISHED\\|IGNITE_APPLICATION_BROKEN", from_the_beginning=True,
-                         timeout_sec=timeout_sec)
+        self.__check_status("IGNITE_APPLICATION_FINISHED", timeout=timeout_sec)
+
+    # pylint: disable=W0221
+    def stop_node(self, node, clean_shutdown=True, timeout_sec=10):
+        assert node == self.nodes[0]
+        self.stop_async(clean_shutdown)
+        self.await_stopped(timeout_sec)
+
+    def __check_status(self, desired, timeout=1):
+        self.await_event("%s\\|IGNITE_APPLICATION_BROKEN" % desired, timeout, from_the_beginning=True)
+
+        try:
+            self.await_event("IGNITE_APPLICATION_BROKEN", 1, from_the_beginning=True)

Review comment:
       Can we replace 1 with 0?

##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -38,33 +41,54 @@ def __init__(self, context, config, java_class_name, params="", timeout_sec=60,
         self.servicejava_class_name = servicejava_class_name
         self.java_class_name = java_class_name
         self.timeout_sec = timeout_sec
-        self.stop_timeout_sec = 10
+        self.params = params

Review comment:
       How is it used?

##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -38,33 +41,54 @@ def __init__(self, context, config, java_class_name, params="", timeout_sec=60,
         self.servicejava_class_name = servicejava_class_name
         self.java_class_name = java_class_name
         self.timeout_sec = timeout_sec
-        self.stop_timeout_sec = 10
+        self.params = params
 
     def start(self):
         super().start()
 
         self.logger.info("Waiting for Ignite aware Application (%s) to start..." % self.java_class_name)
 
         self.await_event("Topology snapshot", self.timeout_sec, from_the_beginning=True)
-        self.await_event("IGNITE_APPLICATION_INITIALIZED\\|IGNITE_APPLICATION_BROKEN", self.timeout_sec,
-                         from_the_beginning=True)
 
-        try:
-            self.await_event("IGNITE_APPLICATION_INITIALIZED", 1, from_the_beginning=True)
-        except Exception:
-            raise Exception("Java application execution failed. %s" % self.extract_result("ERROR")) from None
+        self.__check_status("IGNITE_APPLICATION_INITIALIZED", timeout=self.timeout_sec)
 
-    # pylint: disable=W0221
-    def stop_node(self, node, clean_shutdown=True, timeout_sec=20):
-        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(node.account)))
-        node.account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown, allow_fail=True)
+    def stop_async(self, clean_shutdown=True):
+        """
+        Stops node in async way.
+        """
+        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(self.nodes[0].account)))
+        self.nodes[0].account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown,
+                                                  allow_fail=True)
 
-        stopped = self.wait_node(node, timeout_sec=self.stop_timeout_sec)
+    def await_stopped(self, timeout_sec=10):
+        """
+        Awaits node stop finish.
+        """
+        stopped = self.wait_node(self.nodes[0], timeout_sec=timeout_sec)
         assert stopped, "Node %s: did not stop within the specified timeout of %s seconds" % \
-                        (str(node.account), str(self.stop_timeout_sec))
+                        (str(self.nodes[0].account), str(timeout_sec))
 
-        self.await_event("IGNITE_APPLICATION_FINISHED\\|IGNITE_APPLICATION_BROKEN", from_the_beginning=True,
-                         timeout_sec=timeout_sec)
+        self.__check_status("IGNITE_APPLICATION_FINISHED", timeout=timeout_sec)
+
+    # pylint: disable=W0221
+    def stop_node(self, node, clean_shutdown=True, timeout_sec=10):
+        assert node == self.nodes[0]
+        self.stop_async(clean_shutdown)
+        self.await_stopped(timeout_sec)
+
+    def __check_status(self, desired, timeout=1):
+        self.await_event("%s\\|IGNITE_APPLICATION_BROKEN" % desired, timeout, from_the_beginning=True)
+
+        try:
+            self.await_event("IGNITE_APPLICATION_BROKEN", 1, from_the_beginning=True)
+            raise Exception("Java application execution failed. %s" % self.extract_result("ERROR"))
+        except TimeoutError:
+            pass
+
+        try:
+            self.await_event(desired, 1, from_the_beginning=True)
+        except Exception:
+            raise Exception("Java application execution falied.") from None

Review comment:
       falied -> failed

##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/cellular_affinity_test/PreparedTxStreamer.java
##########
@@ -0,0 +1,102 @@
+/*
+ * 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.ducktest.tests.cellular_affinity_test;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+import org.apache.ignite.internal.processors.cache.transactions.TransactionProxyImpl;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.transactions.Transaction;
+
+/**
+ *
+ */
+public class PreparedTxStreamer extends IgniteAwareApplication {
+    /**
+     * {@inheritDoc}
+     */
+    @Override protected void run(JsonNode jsonNode) throws Exception {
+        final String cacheName = jsonNode.get("cacheName").asText();
+        final String attr = jsonNode.get("attr").asText();
+        final String cell = jsonNode.get("cell").asText();
+        final int txCnt = jsonNode.get("txCnt").asInt();
+
+        markInitialized();
+
+        waitForActivation();
+
+        IgniteCache<Integer, Integer> cache = ignite.getOrCreateCache(cacheName);
+
+        log.info("Starting Prepared Txs...");
+
+        Affinity<Integer> aff = ignite.affinity(cacheName);
+
+        int cnt = 0;
+        int i = -1; // Negative keys to have no intersection with load.
+
+        while (cnt != txCnt && !terminated()) {
+            Collection<ClusterNode> nodes = aff.mapKeyToPrimaryAndBackups(i);
+
+            Map<Object, Long> stat = nodes.stream().collect(
+                Collectors.groupingBy(n -> n.attributes().get(attr), Collectors.counting()));
+
+            assert 1 == stat.keySet().size() :
+                "Partition should be located on nodes from only one cell " +
+                    "[key=" + i + ", nodes=" + nodes.size() + ", stat=" + stat + "]";
+
+            if (stat.containsKey(cell)) {
+                cnt++;
+
+                Transaction tx = ignite.transactions().txStart();
+
+                cache.put(i, i);
+
+                try {
+                    ((TransactionProxyImpl<?, ?>)tx).tx().prepare(true);
+                }
+                catch (IgniteCheckedException e) {

Review comment:
       `IgniteAwareApplication::start` already catch any exception and mark app as broken

##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/cellular_affinity_test/PreparedTxStreamer.java
##########
@@ -0,0 +1,102 @@
+/*
+ * 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.ducktest.tests.cellular_affinity_test;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+import org.apache.ignite.internal.processors.cache.transactions.TransactionProxyImpl;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.transactions.Transaction;
+
+/**
+ *

Review comment:
       Could you please provide a short brief of the class

##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/cellular_affinity_test/TxStreamer.java
##########
@@ -0,0 +1,114 @@
+/*
+ * 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.ducktest.tests.cellular_affinity_test;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ *

Review comment:
       Could you please provide a short brief of the class

##########
File path: modules/ducktests/tests/ignitetest/services/utils/ignite_spec.py
##########
@@ -147,6 +146,8 @@ def __init__(self, modules, **kwargs):
         libs.append("log4j")
         libs = list(map(lambda m: self.path.module(m) + "/*", libs))
 
+        libs.append(IgnitePath(DEV_BRANCH).module("ducktests") + "/*")

Review comment:
       Why do you add ducktests to NodeSpec?




----------------------------------------------------------------
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] [ignite] timoninmaxim commented on a change in pull request #8232: IGNITE-13433 Benchmark confirms operation's latency drop decrease on Cellular switch comparing to PME-free switch

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



##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -38,33 +41,54 @@ def __init__(self, context, config, java_class_name, params="", timeout_sec=60,
         self.servicejava_class_name = servicejava_class_name
         self.java_class_name = java_class_name
         self.timeout_sec = timeout_sec
-        self.stop_timeout_sec = 10
+        self.params = params
 
     def start(self):
         super().start()
 
         self.logger.info("Waiting for Ignite aware Application (%s) to start..." % self.java_class_name)
 
         self.await_event("Topology snapshot", self.timeout_sec, from_the_beginning=True)
-        self.await_event("IGNITE_APPLICATION_INITIALIZED\\|IGNITE_APPLICATION_BROKEN", self.timeout_sec,
-                         from_the_beginning=True)
 
-        try:
-            self.await_event("IGNITE_APPLICATION_INITIALIZED", 1, from_the_beginning=True)
-        except Exception:
-            raise Exception("Java application execution failed. %s" % self.extract_result("ERROR")) from None
+        self.__check_status("IGNITE_APPLICATION_INITIALIZED", timeout=self.timeout_sec)
 
-    # pylint: disable=W0221
-    def stop_node(self, node, clean_shutdown=True, timeout_sec=20):
-        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(node.account)))
-        node.account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown, allow_fail=True)
+    def stop_async(self, clean_shutdown=True):
+        """
+        Stops node in async way.
+        """
+        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(self.nodes[0].account)))
+        self.nodes[0].account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown,
+                                                  allow_fail=True)
 
-        stopped = self.wait_node(node, timeout_sec=self.stop_timeout_sec)
+    def await_stopped(self, timeout_sec=10):
+        """
+        Awaits node stop finish.
+        """
+        stopped = self.wait_node(self.nodes[0], timeout_sec=timeout_sec)
         assert stopped, "Node %s: did not stop within the specified timeout of %s seconds" % \
-                        (str(node.account), str(self.stop_timeout_sec))
+                        (str(self.nodes[0].account), str(timeout_sec))
 
-        self.await_event("IGNITE_APPLICATION_FINISHED\\|IGNITE_APPLICATION_BROKEN", from_the_beginning=True,
-                         timeout_sec=timeout_sec)
+        self.__check_status("IGNITE_APPLICATION_FINISHED", timeout=timeout_sec)
+
+    # pylint: disable=W0221
+    def stop_node(self, node, clean_shutdown=True, timeout_sec=10):
+        assert node == self.nodes[0]
+        self.stop_async(clean_shutdown)
+        self.await_stopped(timeout_sec)
+
+    def __check_status(self, desired, timeout=1):
+        self.await_event("%s\\|IGNITE_APPLICATION_BROKEN" % desired, timeout, from_the_beginning=True)
+
+        try:
+            self.await_event("IGNITE_APPLICATION_BROKEN", 1, from_the_beginning=True)

Review comment:
       Can we replace 1 with 0?

##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -38,33 +41,54 @@ def __init__(self, context, config, java_class_name, params="", timeout_sec=60,
         self.servicejava_class_name = servicejava_class_name
         self.java_class_name = java_class_name
         self.timeout_sec = timeout_sec
-        self.stop_timeout_sec = 10
+        self.params = params

Review comment:
       How is it used?

##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -38,33 +41,54 @@ def __init__(self, context, config, java_class_name, params="", timeout_sec=60,
         self.servicejava_class_name = servicejava_class_name
         self.java_class_name = java_class_name
         self.timeout_sec = timeout_sec
-        self.stop_timeout_sec = 10
+        self.params = params
 
     def start(self):
         super().start()
 
         self.logger.info("Waiting for Ignite aware Application (%s) to start..." % self.java_class_name)
 
         self.await_event("Topology snapshot", self.timeout_sec, from_the_beginning=True)
-        self.await_event("IGNITE_APPLICATION_INITIALIZED\\|IGNITE_APPLICATION_BROKEN", self.timeout_sec,
-                         from_the_beginning=True)
 
-        try:
-            self.await_event("IGNITE_APPLICATION_INITIALIZED", 1, from_the_beginning=True)
-        except Exception:
-            raise Exception("Java application execution failed. %s" % self.extract_result("ERROR")) from None
+        self.__check_status("IGNITE_APPLICATION_INITIALIZED", timeout=self.timeout_sec)
 
-    # pylint: disable=W0221
-    def stop_node(self, node, clean_shutdown=True, timeout_sec=20):
-        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(node.account)))
-        node.account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown, allow_fail=True)
+    def stop_async(self, clean_shutdown=True):
+        """
+        Stops node in async way.
+        """
+        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(self.nodes[0].account)))
+        self.nodes[0].account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown,
+                                                  allow_fail=True)
 
-        stopped = self.wait_node(node, timeout_sec=self.stop_timeout_sec)
+    def await_stopped(self, timeout_sec=10):
+        """
+        Awaits node stop finish.
+        """
+        stopped = self.wait_node(self.nodes[0], timeout_sec=timeout_sec)
         assert stopped, "Node %s: did not stop within the specified timeout of %s seconds" % \
-                        (str(node.account), str(self.stop_timeout_sec))
+                        (str(self.nodes[0].account), str(timeout_sec))
 
-        self.await_event("IGNITE_APPLICATION_FINISHED\\|IGNITE_APPLICATION_BROKEN", from_the_beginning=True,
-                         timeout_sec=timeout_sec)
+        self.__check_status("IGNITE_APPLICATION_FINISHED", timeout=timeout_sec)
+
+    # pylint: disable=W0221
+    def stop_node(self, node, clean_shutdown=True, timeout_sec=10):
+        assert node == self.nodes[0]
+        self.stop_async(clean_shutdown)
+        self.await_stopped(timeout_sec)
+
+    def __check_status(self, desired, timeout=1):
+        self.await_event("%s\\|IGNITE_APPLICATION_BROKEN" % desired, timeout, from_the_beginning=True)
+
+        try:
+            self.await_event("IGNITE_APPLICATION_BROKEN", 1, from_the_beginning=True)
+            raise Exception("Java application execution failed. %s" % self.extract_result("ERROR"))
+        except TimeoutError:
+            pass
+
+        try:
+            self.await_event(desired, 1, from_the_beginning=True)
+        except Exception:
+            raise Exception("Java application execution falied.") from None

Review comment:
       falied -> failed

##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/cellular_affinity_test/PreparedTxStreamer.java
##########
@@ -0,0 +1,102 @@
+/*
+ * 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.ducktest.tests.cellular_affinity_test;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+import org.apache.ignite.internal.processors.cache.transactions.TransactionProxyImpl;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.transactions.Transaction;
+
+/**
+ *
+ */
+public class PreparedTxStreamer extends IgniteAwareApplication {
+    /**
+     * {@inheritDoc}
+     */
+    @Override protected void run(JsonNode jsonNode) throws Exception {
+        final String cacheName = jsonNode.get("cacheName").asText();
+        final String attr = jsonNode.get("attr").asText();
+        final String cell = jsonNode.get("cell").asText();
+        final int txCnt = jsonNode.get("txCnt").asInt();
+
+        markInitialized();
+
+        waitForActivation();
+
+        IgniteCache<Integer, Integer> cache = ignite.getOrCreateCache(cacheName);
+
+        log.info("Starting Prepared Txs...");
+
+        Affinity<Integer> aff = ignite.affinity(cacheName);
+
+        int cnt = 0;
+        int i = -1; // Negative keys to have no intersection with load.
+
+        while (cnt != txCnt && !terminated()) {
+            Collection<ClusterNode> nodes = aff.mapKeyToPrimaryAndBackups(i);
+
+            Map<Object, Long> stat = nodes.stream().collect(
+                Collectors.groupingBy(n -> n.attributes().get(attr), Collectors.counting()));
+
+            assert 1 == stat.keySet().size() :
+                "Partition should be located on nodes from only one cell " +
+                    "[key=" + i + ", nodes=" + nodes.size() + ", stat=" + stat + "]";
+
+            if (stat.containsKey(cell)) {
+                cnt++;
+
+                Transaction tx = ignite.transactions().txStart();
+
+                cache.put(i, i);
+
+                try {
+                    ((TransactionProxyImpl<?, ?>)tx).tx().prepare(true);
+                }
+                catch (IgniteCheckedException e) {

Review comment:
       `IgniteAwareApplication::start` already catch any exception and mark app as broken

##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/cellular_affinity_test/PreparedTxStreamer.java
##########
@@ -0,0 +1,102 @@
+/*
+ * 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.ducktest.tests.cellular_affinity_test;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+import org.apache.ignite.internal.processors.cache.transactions.TransactionProxyImpl;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.transactions.Transaction;
+
+/**
+ *

Review comment:
       Could you please provide a short brief of the class

##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/cellular_affinity_test/TxStreamer.java
##########
@@ -0,0 +1,114 @@
+/*
+ * 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.ducktest.tests.cellular_affinity_test;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ *

Review comment:
       Could you please provide a short brief of the class

##########
File path: modules/ducktests/tests/ignitetest/services/utils/ignite_spec.py
##########
@@ -147,6 +146,8 @@ def __init__(self, modules, **kwargs):
         libs.append("log4j")
         libs = list(map(lambda m: self.path.module(m) + "/*", libs))
 
+        libs.append(IgnitePath(DEV_BRANCH).module("ducktests") + "/*")

Review comment:
       Why do you add ducktests to NodeSpec?




----------------------------------------------------------------
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] [ignite] anton-vinogradov commented on a change in pull request #8232: IGNITE-13433 Benchmark confirms operation's latency drop decrease on Cellular switch comparing to PME-free switch

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



##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/cellular_affinity_test/PreparedTxStreamer.java
##########
@@ -0,0 +1,102 @@
+/*
+ * 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.ducktest.tests.cellular_affinity_test;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+import org.apache.ignite.internal.processors.cache.transactions.TransactionProxyImpl;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.transactions.Transaction;
+
+/**
+ *

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.

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



[GitHub] [ignite] anton-vinogradov commented on a change in pull request #8232: IGNITE-13433 Benchmark confirms operation's latency drop decrease on Cellular switch comparing to PME-free switch

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



##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/cellular_affinity_test/PreparedTxStreamer.java
##########
@@ -0,0 +1,102 @@
+/*
+ * 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.ducktest.tests.cellular_affinity_test;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+import org.apache.ignite.internal.processors.cache.transactions.TransactionProxyImpl;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.transactions.Transaction;
+
+/**
+ *
+ */
+public class PreparedTxStreamer extends IgniteAwareApplication {
+    /**
+     * {@inheritDoc}
+     */
+    @Override protected void run(JsonNode jsonNode) throws Exception {
+        final String cacheName = jsonNode.get("cacheName").asText();
+        final String attr = jsonNode.get("attr").asText();
+        final String cell = jsonNode.get("cell").asText();
+        final int txCnt = jsonNode.get("txCnt").asInt();
+
+        markInitialized();
+
+        waitForActivation();
+
+        IgniteCache<Integer, Integer> cache = ignite.getOrCreateCache(cacheName);
+
+        log.info("Starting Prepared Txs...");
+
+        Affinity<Integer> aff = ignite.affinity(cacheName);
+
+        int cnt = 0;
+        int i = -1; // Negative keys to have no intersection with load.
+
+        while (cnt != txCnt && !terminated()) {
+            Collection<ClusterNode> nodes = aff.mapKeyToPrimaryAndBackups(i);
+
+            Map<Object, Long> stat = nodes.stream().collect(
+                Collectors.groupingBy(n -> n.attributes().get(attr), Collectors.counting()));
+
+            assert 1 == stat.keySet().size() :
+                "Partition should be located on nodes from only one cell " +
+                    "[key=" + i + ", nodes=" + nodes.size() + ", stat=" + stat + "]";
+
+            if (stat.containsKey(cell)) {
+                cnt++;
+
+                Transaction tx = ignite.transactions().txStart();
+
+                cache.put(i, i);
+
+                try {
+                    ((TransactionProxyImpl<?, ?>)tx).tx().prepare(true);
+                }
+                catch (IgniteCheckedException e) {

Review comment:
       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.

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



[GitHub] [ignite] anton-vinogradov commented on a change in pull request #8232: IGNITE-13433 Benchmark confirms operation's latency drop decrease on Cellular switch comparing to PME-free switch

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



##########
File path: modules/ducktests/tests/ignitetest/services/utils/ignite_spec.py
##########
@@ -147,6 +146,8 @@ def __init__(self, modules, **kwargs):
         libs.append("log4j")
         libs = list(map(lambda m: self.path.module(m) + "/*", libs))
 
+        libs.append(IgnitePath(DEV_BRANCH).module("ducktests") + "/*")

Review comment:
       Seems, we have to plan some refactoring here (at specs), can we postpone this to refactoring?




----------------------------------------------------------------
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] [ignite] timoninmaxim commented on a change in pull request #8232: IGNITE-13433 Benchmark confirms operation's latency drop decrease on Cellular switch comparing to PME-free switch

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



##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -38,33 +41,54 @@ def __init__(self, context, config, java_class_name, params="", timeout_sec=60,
         self.servicejava_class_name = servicejava_class_name
         self.java_class_name = java_class_name
         self.timeout_sec = timeout_sec
-        self.stop_timeout_sec = 10
+        self.params = params

Review comment:
       ok




----------------------------------------------------------------
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] [ignite] timoninmaxim commented on a change in pull request #8232: IGNITE-13433 Benchmark confirms operation's latency drop decrease on Cellular switch comparing to PME-free switch

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



##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -38,33 +41,54 @@ def __init__(self, context, config, java_class_name, params="", timeout_sec=60,
         self.servicejava_class_name = servicejava_class_name
         self.java_class_name = java_class_name
         self.timeout_sec = timeout_sec
-        self.stop_timeout_sec = 10
+        self.params = params
 
     def start(self):
         super().start()
 
         self.logger.info("Waiting for Ignite aware Application (%s) to start..." % self.java_class_name)
 
         self.await_event("Topology snapshot", self.timeout_sec, from_the_beginning=True)
-        self.await_event("IGNITE_APPLICATION_INITIALIZED\\|IGNITE_APPLICATION_BROKEN", self.timeout_sec,
-                         from_the_beginning=True)
 
-        try:
-            self.await_event("IGNITE_APPLICATION_INITIALIZED", 1, from_the_beginning=True)
-        except Exception:
-            raise Exception("Java application execution failed. %s" % self.extract_result("ERROR")) from None
+        self.__check_status("IGNITE_APPLICATION_INITIALIZED", timeout=self.timeout_sec)
 
-    # pylint: disable=W0221
-    def stop_node(self, node, clean_shutdown=True, timeout_sec=20):
-        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(node.account)))
-        node.account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown, allow_fail=True)
+    def stop_async(self, clean_shutdown=True):
+        """
+        Stops node in async way.
+        """
+        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(self.nodes[0].account)))
+        self.nodes[0].account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown,
+                                                  allow_fail=True)
 
-        stopped = self.wait_node(node, timeout_sec=self.stop_timeout_sec)
+    def await_stopped(self, timeout_sec=10):
+        """
+        Awaits node stop finish.
+        """
+        stopped = self.wait_node(self.nodes[0], timeout_sec=timeout_sec)
         assert stopped, "Node %s: did not stop within the specified timeout of %s seconds" % \
-                        (str(node.account), str(self.stop_timeout_sec))
+                        (str(self.nodes[0].account), str(timeout_sec))
 
-        self.await_event("IGNITE_APPLICATION_FINISHED\\|IGNITE_APPLICATION_BROKEN", from_the_beginning=True,
-                         timeout_sec=timeout_sec)
+        self.__check_status("IGNITE_APPLICATION_FINISHED", timeout=timeout_sec)
+
+    # pylint: disable=W0221
+    def stop_node(self, node, clean_shutdown=True, timeout_sec=10):
+        assert node == self.nodes[0]
+        self.stop_async(clean_shutdown)
+        self.await_stopped(timeout_sec)
+
+    def __check_status(self, desired, timeout=1):
+        self.await_event("%s\\|IGNITE_APPLICATION_BROKEN" % desired, timeout, from_the_beginning=True)
+
+        try:
+            self.await_event("IGNITE_APPLICATION_BROKEN", 1, from_the_beginning=True)

Review comment:
       I mean there should be return immediately if log contains the specified line. As I see this line just checks that previous wait finishes due to error. 




----------------------------------------------------------------
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] [ignite] anton-vinogradov commented on a change in pull request #8232: IGNITE-13433 Benchmark confirms operation's latency drop decrease on Cellular switch comparing to PME-free switch

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



##########
File path: modules/ducktests/tests/ignitetest/services/utils/ignite_spec.py
##########
@@ -147,6 +146,8 @@ def __init__(self, modules, **kwargs):
         libs.append("log4j")
         libs = list(map(lambda m: self.path.module(m) + "/*", libs))
 
+        libs.append(IgnitePath(DEV_BRANCH).module("ducktests") + "/*")

Review comment:
       At this test, we have a special node filter (see CellularAffinityBackupFilter.java) and we have to deploy it to all server node's classpath.




----------------------------------------------------------------
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] [ignite] anton-vinogradov commented on a change in pull request #8232: IGNITE-13433 Benchmark confirms operation's latency drop decrease on Cellular switch comparing to PME-free switch

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



##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/cellular_affinity_test/TxStreamer.java
##########
@@ -0,0 +1,114 @@
+/*
+ * 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.ducktest.tests.cellular_affinity_test;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ *

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.

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



[GitHub] [ignite] anton-vinogradov commented on a change in pull request #8232: IGNITE-13433 Benchmark confirms operation's latency drop decrease on Cellular switch comparing to PME-free switch

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



##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -38,33 +41,54 @@ def __init__(self, context, config, java_class_name, params="", timeout_sec=60,
         self.servicejava_class_name = servicejava_class_name
         self.java_class_name = java_class_name
         self.timeout_sec = timeout_sec
-        self.stop_timeout_sec = 10
+        self.params = params
 
     def start(self):
         super().start()
 
         self.logger.info("Waiting for Ignite aware Application (%s) to start..." % self.java_class_name)
 
         self.await_event("Topology snapshot", self.timeout_sec, from_the_beginning=True)
-        self.await_event("IGNITE_APPLICATION_INITIALIZED\\|IGNITE_APPLICATION_BROKEN", self.timeout_sec,
-                         from_the_beginning=True)
 
-        try:
-            self.await_event("IGNITE_APPLICATION_INITIALIZED", 1, from_the_beginning=True)
-        except Exception:
-            raise Exception("Java application execution failed. %s" % self.extract_result("ERROR")) from None
+        self.__check_status("IGNITE_APPLICATION_INITIALIZED", timeout=self.timeout_sec)
 
-    # pylint: disable=W0221
-    def stop_node(self, node, clean_shutdown=True, timeout_sec=20):
-        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(node.account)))
-        node.account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown, allow_fail=True)
+    def stop_async(self, clean_shutdown=True):
+        """
+        Stops node in async way.
+        """
+        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(self.nodes[0].account)))
+        self.nodes[0].account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown,
+                                                  allow_fail=True)
 
-        stopped = self.wait_node(node, timeout_sec=self.stop_timeout_sec)
+    def await_stopped(self, timeout_sec=10):
+        """
+        Awaits node stop finish.
+        """
+        stopped = self.wait_node(self.nodes[0], timeout_sec=timeout_sec)
         assert stopped, "Node %s: did not stop within the specified timeout of %s seconds" % \
-                        (str(node.account), str(self.stop_timeout_sec))
+                        (str(self.nodes[0].account), str(timeout_sec))
 
-        self.await_event("IGNITE_APPLICATION_FINISHED\\|IGNITE_APPLICATION_BROKEN", from_the_beginning=True,
-                         timeout_sec=timeout_sec)
+        self.__check_status("IGNITE_APPLICATION_FINISHED", timeout=timeout_sec)
+
+    # pylint: disable=W0221
+    def stop_node(self, node, clean_shutdown=True, timeout_sec=10):
+        assert node == self.nodes[0]
+        self.stop_async(clean_shutdown)
+        self.await_stopped(timeout_sec)
+
+    def __check_status(self, desired, timeout=1):
+        self.await_event("%s\\|IGNITE_APPLICATION_BROKEN" % desired, timeout, from_the_beginning=True)
+
+        try:
+            self.await_event("IGNITE_APPLICATION_BROKEN", 1, from_the_beginning=True)
+            raise Exception("Java application execution failed. %s" % self.extract_result("ERROR"))
+        except TimeoutError:
+            pass
+
+        try:
+            self.await_event(desired, 1, from_the_beginning=True)
+        except Exception:
+            raise Exception("Java application execution falied.") from None

Review comment:
       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.

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



[GitHub] [ignite] anton-vinogradov commented on a change in pull request #8232: IGNITE-13433 Benchmark confirms operation's latency drop decrease on Cellular switch comparing to PME-free switch

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



##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/cellular_affinity_test/CellularTxStreamer.java
##########
@@ -0,0 +1,114 @@
+/*
+ * 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.ducktest.tests.cellular_affinity_test;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ * Streams transactions to specified cell.
+ */
+public class CellularTxStreamer extends IgniteAwareApplication {
+    /**
+     * {@inheritDoc}
+     */
+    @Override public void run(JsonNode jsonNode) throws Exception {
+        String cacheName = jsonNode.get("cacheName").asText();
+        int warmup = jsonNode.get("warmup").asInt();
+        String cell = jsonNode.get("cell").asText();
+        String attr = jsonNode.get("attr").asText();
+
+        markInitialized();
+
+        waitForActivation();
+
+        IgniteCache<Integer, Integer> cache = ignite.getOrCreateCache(cacheName);
+
+        long[] max = new long[20];
+
+        Arrays.fill(max, -1);
+
+        int key = 10_000_000;
+
+        int cnt = 0;
+
+        long initTime = 0;
+
+        boolean record = false;
+
+        Affinity<Integer> aff = ignite.affinity(cacheName);
+
+        while (!terminated()) {
+            key++;
+
+            Collection<ClusterNode> nodes = aff.mapKeyToPrimaryAndBackups(key);
+
+            Map<Object, Long> stat = nodes.stream().collect(
+                Collectors.groupingBy(n -> n.attributes().get(attr), Collectors.counting()));
+
+            if (!stat.containsKey(cell))
+                continue;
+
+            cnt++;
+
+            long start = System.currentTimeMillis();
+
+            cache.put(key, key);
+
+            long finish = System.currentTimeMillis();
+
+            long time = finish - start;
+
+            if (!record && cnt > warmup) {
+                record = true;
+
+                initTime = System.currentTimeMillis();
+
+                log.info("Warmup finished");
+            }
+
+            if (record) {
+                for (int i = 0; i < max.length; i++) {

Review comment:
       Discussed privately, the array is ok.




----------------------------------------------------------------
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] [ignite] anton-vinogradov commented on a change in pull request #8232: IGNITE-13433 Benchmark confirms operation's latency drop decrease on Cellular switch comparing to PME-free switch

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



##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/cellular_affinity_test/CellularTxStreamer.java
##########
@@ -0,0 +1,114 @@
+/*
+ * 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.ducktest.tests.cellular_affinity_test;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ * Streams transactions to specified cell.
+ */
+public class CellularTxStreamer extends IgniteAwareApplication {
+    /**
+     * {@inheritDoc}
+     */
+    @Override public void run(JsonNode jsonNode) throws Exception {
+        String cacheName = jsonNode.get("cacheName").asText();
+        int warmup = jsonNode.get("warmup").asInt();
+        String cell = jsonNode.get("cell").asText();
+        String attr = jsonNode.get("attr").asText();
+
+        markInitialized();
+
+        waitForActivation();
+
+        IgniteCache<Integer, Integer> cache = ignite.getOrCreateCache(cacheName);
+
+        long[] max = new long[20];
+
+        Arrays.fill(max, -1);
+
+        int key = 10_000_000;

Review comment:
       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.

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



[GitHub] [ignite] ivandasch commented on a change in pull request #8232: IGNITE-13433 Benchmark confirms operation's latency drop decrease on Cellular switch comparing to PME-free switch

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



##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/cellular_affinity_test/CellularTxStreamer.java
##########
@@ -0,0 +1,114 @@
+/*
+ * 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.ducktest.tests.cellular_affinity_test;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ * Streams transactions to specified cell.
+ */
+public class CellularTxStreamer extends IgniteAwareApplication {
+    /**
+     * {@inheritDoc}
+     */
+    @Override public void run(JsonNode jsonNode) throws Exception {
+        String cacheName = jsonNode.get("cacheName").asText();
+        int warmup = jsonNode.get("warmup").asInt();
+        String cell = jsonNode.get("cell").asText();
+        String attr = jsonNode.get("attr").asText();
+
+        markInitialized();
+
+        waitForActivation();
+
+        IgniteCache<Integer, Integer> cache = ignite.getOrCreateCache(cacheName);
+
+        long[] max = new long[20];
+
+        Arrays.fill(max, -1);
+
+        int key = 10_000_000;

Review comment:
       Why 10_000_000? You never use this fact in the code.




----------------------------------------------------------------
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] [ignite] anton-vinogradov commented on a change in pull request #8232: IGNITE-13433 Benchmark confirms operation's latency drop decrease on Cellular switch comparing to PME-free switch

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



##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -38,33 +41,54 @@ def __init__(self, context, config, java_class_name, params="", timeout_sec=60,
         self.servicejava_class_name = servicejava_class_name
         self.java_class_name = java_class_name
         self.timeout_sec = timeout_sec
-        self.stop_timeout_sec = 10
+        self.params = params
 
     def start(self):
         super().start()
 
         self.logger.info("Waiting for Ignite aware Application (%s) to start..." % self.java_class_name)
 
         self.await_event("Topology snapshot", self.timeout_sec, from_the_beginning=True)
-        self.await_event("IGNITE_APPLICATION_INITIALIZED\\|IGNITE_APPLICATION_BROKEN", self.timeout_sec,
-                         from_the_beginning=True)
 
-        try:
-            self.await_event("IGNITE_APPLICATION_INITIALIZED", 1, from_the_beginning=True)
-        except Exception:
-            raise Exception("Java application execution failed. %s" % self.extract_result("ERROR")) from None
+        self.__check_status("IGNITE_APPLICATION_INITIALIZED", timeout=self.timeout_sec)
 
-    # pylint: disable=W0221
-    def stop_node(self, node, clean_shutdown=True, timeout_sec=20):
-        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(node.account)))
-        node.account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown, allow_fail=True)
+    def stop_async(self, clean_shutdown=True):
+        """
+        Stops node in async way.
+        """
+        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(self.nodes[0].account)))
+        self.nodes[0].account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown,
+                                                  allow_fail=True)
 
-        stopped = self.wait_node(node, timeout_sec=self.stop_timeout_sec)
+    def await_stopped(self, timeout_sec=10):
+        """
+        Awaits node stop finish.
+        """
+        stopped = self.wait_node(self.nodes[0], timeout_sec=timeout_sec)
         assert stopped, "Node %s: did not stop within the specified timeout of %s seconds" % \
-                        (str(node.account), str(self.stop_timeout_sec))
+                        (str(self.nodes[0].account), str(timeout_sec))
 
-        self.await_event("IGNITE_APPLICATION_FINISHED\\|IGNITE_APPLICATION_BROKEN", from_the_beginning=True,
-                         timeout_sec=timeout_sec)
+        self.__check_status("IGNITE_APPLICATION_FINISHED", timeout=timeout_sec)
+
+    # pylint: disable=W0221
+    def stop_node(self, node, clean_shutdown=True, timeout_sec=10):
+        assert node == self.nodes[0]
+        self.stop_async(clean_shutdown)
+        self.await_stopped(timeout_sec)
+
+    def __check_status(self, desired, timeout=1):
+        self.await_event("%s\\|IGNITE_APPLICATION_BROKEN" % desired, timeout, from_the_beginning=True)
+
+        try:
+            self.await_event("IGNITE_APPLICATION_BROKEN", 1, from_the_beginning=True)

Review comment:
       0 cause (may cause?) no-op wait and cause no exception if the statement missed.




----------------------------------------------------------------
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] [ignite] anton-vinogradov merged pull request #8232: IGNITE-13433 Benchmark confirms operation's latency drop decrease on Cellular switch comparing to PME-free switch

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


   


----------------------------------------------------------------
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] [ignite] timoninmaxim commented on a change in pull request #8232: IGNITE-13433 Benchmark confirms operation's latency drop decrease on Cellular switch comparing to PME-free switch

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



##########
File path: modules/ducktests/tests/ignitetest/services/utils/ignite_spec.py
##########
@@ -147,6 +146,8 @@ def __init__(self, modules, **kwargs):
         libs.append("log4j")
         libs = list(map(lambda m: self.path.module(m) + "/*", libs))
 
+        libs.append(IgnitePath(DEV_BRANCH).module("ducktests") + "/*")

Review comment:
       There is a code duplication - the same in ApplicationSpec. Could you please move this code to function?




----------------------------------------------------------------
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] [ignite] ivandasch commented on a change in pull request #8232: IGNITE-13433 Benchmark confirms operation's latency drop decrease on Cellular switch comparing to PME-free switch

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



##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/cellular_affinity_test/CellularTxStreamer.java
##########
@@ -0,0 +1,114 @@
+/*
+ * 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.ducktest.tests.cellular_affinity_test;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ * Streams transactions to specified cell.
+ */
+public class CellularTxStreamer extends IgniteAwareApplication {
+    /**
+     * {@inheritDoc}
+     */
+    @Override public void run(JsonNode jsonNode) throws Exception {
+        String cacheName = jsonNode.get("cacheName").asText();
+        int warmup = jsonNode.get("warmup").asInt();
+        String cell = jsonNode.get("cell").asText();
+        String attr = jsonNode.get("attr").asText();
+
+        markInitialized();
+
+        waitForActivation();
+
+        IgniteCache<Integer, Integer> cache = ignite.getOrCreateCache(cacheName);
+
+        long[] max = new long[20];
+
+        Arrays.fill(max, -1);
+
+        int key = 10_000_000;
+
+        int cnt = 0;
+
+        long initTime = 0;
+
+        boolean record = false;
+
+        Affinity<Integer> aff = ignite.affinity(cacheName);
+
+        while (!terminated()) {
+            key++;
+
+            Collection<ClusterNode> nodes = aff.mapKeyToPrimaryAndBackups(key);
+
+            Map<Object, Long> stat = nodes.stream().collect(
+                Collectors.groupingBy(n -> n.attributes().get(attr), Collectors.counting()));
+
+            if (!stat.containsKey(cell))
+                continue;
+
+            cnt++;
+
+            long start = System.currentTimeMillis();
+
+            cache.put(key, key);
+
+            long finish = System.currentTimeMillis();
+
+            long time = finish - start;
+
+            if (!record && cnt > warmup) {
+                record = true;
+
+                initTime = System.currentTimeMillis();
+
+                log.info("Warmup finished");
+            }
+
+            if (record) {
+                for (int i = 0; i < max.length; i++) {

Review comment:
       Use PriorityQueue (binary heap) here




----------------------------------------------------------------
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] [ignite] anton-vinogradov commented on a change in pull request #8232: IGNITE-13433 Benchmark confirms operation's latency drop decrease on Cellular switch comparing to PME-free switch

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



##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -38,33 +41,54 @@ def __init__(self, context, config, java_class_name, params="", timeout_sec=60,
         self.servicejava_class_name = servicejava_class_name
         self.java_class_name = java_class_name
         self.timeout_sec = timeout_sec
-        self.stop_timeout_sec = 10
+        self.params = params

Review comment:
       It is used to gain start params of the application.
   see cellular_affinity_test.py:155 for example.




----------------------------------------------------------------
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] [ignite] timoninmaxim commented on a change in pull request #8232: IGNITE-13433 Benchmark confirms operation's latency drop decrease on Cellular switch comparing to PME-free switch

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



##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -38,33 +41,54 @@ def __init__(self, context, config, java_class_name, params="", timeout_sec=60,
         self.servicejava_class_name = servicejava_class_name
         self.java_class_name = java_class_name
         self.timeout_sec = timeout_sec
-        self.stop_timeout_sec = 10
+        self.params = params
 
     def start(self):
         super().start()
 
         self.logger.info("Waiting for Ignite aware Application (%s) to start..." % self.java_class_name)
 
         self.await_event("Topology snapshot", self.timeout_sec, from_the_beginning=True)
-        self.await_event("IGNITE_APPLICATION_INITIALIZED\\|IGNITE_APPLICATION_BROKEN", self.timeout_sec,
-                         from_the_beginning=True)
 
-        try:
-            self.await_event("IGNITE_APPLICATION_INITIALIZED", 1, from_the_beginning=True)
-        except Exception:
-            raise Exception("Java application execution failed. %s" % self.extract_result("ERROR")) from None
+        self.__check_status("IGNITE_APPLICATION_INITIALIZED", timeout=self.timeout_sec)
 
-    # pylint: disable=W0221
-    def stop_node(self, node, clean_shutdown=True, timeout_sec=20):
-        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(node.account)))
-        node.account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown, allow_fail=True)
+    def stop_async(self, clean_shutdown=True):
+        """
+        Stops node in async way.
+        """
+        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(self.nodes[0].account)))
+        self.nodes[0].account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown,
+                                                  allow_fail=True)
 
-        stopped = self.wait_node(node, timeout_sec=self.stop_timeout_sec)
+    def await_stopped(self, timeout_sec=10):
+        """
+        Awaits node stop finish.
+        """
+        stopped = self.wait_node(self.nodes[0], timeout_sec=timeout_sec)
         assert stopped, "Node %s: did not stop within the specified timeout of %s seconds" % \
-                        (str(node.account), str(self.stop_timeout_sec))
+                        (str(self.nodes[0].account), str(timeout_sec))
 
-        self.await_event("IGNITE_APPLICATION_FINISHED\\|IGNITE_APPLICATION_BROKEN", from_the_beginning=True,
-                         timeout_sec=timeout_sec)
+        self.__check_status("IGNITE_APPLICATION_FINISHED", timeout=timeout_sec)
+
+    # pylint: disable=W0221
+    def stop_node(self, node, clean_shutdown=True, timeout_sec=10):
+        assert node == self.nodes[0]
+        self.stop_async(clean_shutdown)
+        self.await_stopped(timeout_sec)
+
+    def __check_status(self, desired, timeout=1):
+        self.await_event("%s\\|IGNITE_APPLICATION_BROKEN" % desired, timeout, from_the_beginning=True)
+
+        try:
+            self.await_event("IGNITE_APPLICATION_BROKEN", 1, from_the_beginning=True)

Review comment:
       Can we replace 1 with 0?

##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -38,33 +41,54 @@ def __init__(self, context, config, java_class_name, params="", timeout_sec=60,
         self.servicejava_class_name = servicejava_class_name
         self.java_class_name = java_class_name
         self.timeout_sec = timeout_sec
-        self.stop_timeout_sec = 10
+        self.params = params

Review comment:
       How is it used?

##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -38,33 +41,54 @@ def __init__(self, context, config, java_class_name, params="", timeout_sec=60,
         self.servicejava_class_name = servicejava_class_name
         self.java_class_name = java_class_name
         self.timeout_sec = timeout_sec
-        self.stop_timeout_sec = 10
+        self.params = params
 
     def start(self):
         super().start()
 
         self.logger.info("Waiting for Ignite aware Application (%s) to start..." % self.java_class_name)
 
         self.await_event("Topology snapshot", self.timeout_sec, from_the_beginning=True)
-        self.await_event("IGNITE_APPLICATION_INITIALIZED\\|IGNITE_APPLICATION_BROKEN", self.timeout_sec,
-                         from_the_beginning=True)
 
-        try:
-            self.await_event("IGNITE_APPLICATION_INITIALIZED", 1, from_the_beginning=True)
-        except Exception:
-            raise Exception("Java application execution failed. %s" % self.extract_result("ERROR")) from None
+        self.__check_status("IGNITE_APPLICATION_INITIALIZED", timeout=self.timeout_sec)
 
-    # pylint: disable=W0221
-    def stop_node(self, node, clean_shutdown=True, timeout_sec=20):
-        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(node.account)))
-        node.account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown, allow_fail=True)
+    def stop_async(self, clean_shutdown=True):
+        """
+        Stops node in async way.
+        """
+        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(self.nodes[0].account)))
+        self.nodes[0].account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown,
+                                                  allow_fail=True)
 
-        stopped = self.wait_node(node, timeout_sec=self.stop_timeout_sec)
+    def await_stopped(self, timeout_sec=10):
+        """
+        Awaits node stop finish.
+        """
+        stopped = self.wait_node(self.nodes[0], timeout_sec=timeout_sec)
         assert stopped, "Node %s: did not stop within the specified timeout of %s seconds" % \
-                        (str(node.account), str(self.stop_timeout_sec))
+                        (str(self.nodes[0].account), str(timeout_sec))
 
-        self.await_event("IGNITE_APPLICATION_FINISHED\\|IGNITE_APPLICATION_BROKEN", from_the_beginning=True,
-                         timeout_sec=timeout_sec)
+        self.__check_status("IGNITE_APPLICATION_FINISHED", timeout=timeout_sec)
+
+    # pylint: disable=W0221
+    def stop_node(self, node, clean_shutdown=True, timeout_sec=10):
+        assert node == self.nodes[0]
+        self.stop_async(clean_shutdown)
+        self.await_stopped(timeout_sec)
+
+    def __check_status(self, desired, timeout=1):
+        self.await_event("%s\\|IGNITE_APPLICATION_BROKEN" % desired, timeout, from_the_beginning=True)
+
+        try:
+            self.await_event("IGNITE_APPLICATION_BROKEN", 1, from_the_beginning=True)
+            raise Exception("Java application execution failed. %s" % self.extract_result("ERROR"))
+        except TimeoutError:
+            pass
+
+        try:
+            self.await_event(desired, 1, from_the_beginning=True)
+        except Exception:
+            raise Exception("Java application execution falied.") from None

Review comment:
       falied -> failed

##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/cellular_affinity_test/PreparedTxStreamer.java
##########
@@ -0,0 +1,102 @@
+/*
+ * 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.ducktest.tests.cellular_affinity_test;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+import org.apache.ignite.internal.processors.cache.transactions.TransactionProxyImpl;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.transactions.Transaction;
+
+/**
+ *
+ */
+public class PreparedTxStreamer extends IgniteAwareApplication {
+    /**
+     * {@inheritDoc}
+     */
+    @Override protected void run(JsonNode jsonNode) throws Exception {
+        final String cacheName = jsonNode.get("cacheName").asText();
+        final String attr = jsonNode.get("attr").asText();
+        final String cell = jsonNode.get("cell").asText();
+        final int txCnt = jsonNode.get("txCnt").asInt();
+
+        markInitialized();
+
+        waitForActivation();
+
+        IgniteCache<Integer, Integer> cache = ignite.getOrCreateCache(cacheName);
+
+        log.info("Starting Prepared Txs...");
+
+        Affinity<Integer> aff = ignite.affinity(cacheName);
+
+        int cnt = 0;
+        int i = -1; // Negative keys to have no intersection with load.
+
+        while (cnt != txCnt && !terminated()) {
+            Collection<ClusterNode> nodes = aff.mapKeyToPrimaryAndBackups(i);
+
+            Map<Object, Long> stat = nodes.stream().collect(
+                Collectors.groupingBy(n -> n.attributes().get(attr), Collectors.counting()));
+
+            assert 1 == stat.keySet().size() :
+                "Partition should be located on nodes from only one cell " +
+                    "[key=" + i + ", nodes=" + nodes.size() + ", stat=" + stat + "]";
+
+            if (stat.containsKey(cell)) {
+                cnt++;
+
+                Transaction tx = ignite.transactions().txStart();
+
+                cache.put(i, i);
+
+                try {
+                    ((TransactionProxyImpl<?, ?>)tx).tx().prepare(true);
+                }
+                catch (IgniteCheckedException e) {

Review comment:
       `IgniteAwareApplication::start` already catch any exception and mark app as broken

##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/cellular_affinity_test/PreparedTxStreamer.java
##########
@@ -0,0 +1,102 @@
+/*
+ * 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.ducktest.tests.cellular_affinity_test;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+import org.apache.ignite.internal.processors.cache.transactions.TransactionProxyImpl;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.transactions.Transaction;
+
+/**
+ *

Review comment:
       Could you please provide a short brief of the class

##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/cellular_affinity_test/TxStreamer.java
##########
@@ -0,0 +1,114 @@
+/*
+ * 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.ducktest.tests.cellular_affinity_test;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ *

Review comment:
       Could you please provide a short brief of the class

##########
File path: modules/ducktests/tests/ignitetest/services/utils/ignite_spec.py
##########
@@ -147,6 +146,8 @@ def __init__(self, modules, **kwargs):
         libs.append("log4j")
         libs = list(map(lambda m: self.path.module(m) + "/*", libs))
 
+        libs.append(IgnitePath(DEV_BRANCH).module("ducktests") + "/*")

Review comment:
       Why do you add ducktests to NodeSpec?

##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -38,33 +41,54 @@ def __init__(self, context, config, java_class_name, params="", timeout_sec=60,
         self.servicejava_class_name = servicejava_class_name
         self.java_class_name = java_class_name
         self.timeout_sec = timeout_sec
-        self.stop_timeout_sec = 10
+        self.params = params
 
     def start(self):
         super().start()
 
         self.logger.info("Waiting for Ignite aware Application (%s) to start..." % self.java_class_name)
 
         self.await_event("Topology snapshot", self.timeout_sec, from_the_beginning=True)
-        self.await_event("IGNITE_APPLICATION_INITIALIZED\\|IGNITE_APPLICATION_BROKEN", self.timeout_sec,
-                         from_the_beginning=True)
 
-        try:
-            self.await_event("IGNITE_APPLICATION_INITIALIZED", 1, from_the_beginning=True)
-        except Exception:
-            raise Exception("Java application execution failed. %s" % self.extract_result("ERROR")) from None
+        self.__check_status("IGNITE_APPLICATION_INITIALIZED", timeout=self.timeout_sec)
 
-    # pylint: disable=W0221
-    def stop_node(self, node, clean_shutdown=True, timeout_sec=20):
-        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(node.account)))
-        node.account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown, allow_fail=True)
+    def stop_async(self, clean_shutdown=True):
+        """
+        Stops node in async way.
+        """
+        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(self.nodes[0].account)))
+        self.nodes[0].account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown,
+                                                  allow_fail=True)
 
-        stopped = self.wait_node(node, timeout_sec=self.stop_timeout_sec)
+    def await_stopped(self, timeout_sec=10):
+        """
+        Awaits node stop finish.
+        """
+        stopped = self.wait_node(self.nodes[0], timeout_sec=timeout_sec)
         assert stopped, "Node %s: did not stop within the specified timeout of %s seconds" % \
-                        (str(node.account), str(self.stop_timeout_sec))
+                        (str(self.nodes[0].account), str(timeout_sec))
 
-        self.await_event("IGNITE_APPLICATION_FINISHED\\|IGNITE_APPLICATION_BROKEN", from_the_beginning=True,
-                         timeout_sec=timeout_sec)
+        self.__check_status("IGNITE_APPLICATION_FINISHED", timeout=timeout_sec)
+
+    # pylint: disable=W0221
+    def stop_node(self, node, clean_shutdown=True, timeout_sec=10):
+        assert node == self.nodes[0]
+        self.stop_async(clean_shutdown)
+        self.await_stopped(timeout_sec)
+
+    def __check_status(self, desired, timeout=1):
+        self.await_event("%s\\|IGNITE_APPLICATION_BROKEN" % desired, timeout, from_the_beginning=True)
+
+        try:
+            self.await_event("IGNITE_APPLICATION_BROKEN", 1, from_the_beginning=True)

Review comment:
       Can we replace 1 with 0?

##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -38,33 +41,54 @@ def __init__(self, context, config, java_class_name, params="", timeout_sec=60,
         self.servicejava_class_name = servicejava_class_name
         self.java_class_name = java_class_name
         self.timeout_sec = timeout_sec
-        self.stop_timeout_sec = 10
+        self.params = params

Review comment:
       How is it used?

##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -38,33 +41,54 @@ def __init__(self, context, config, java_class_name, params="", timeout_sec=60,
         self.servicejava_class_name = servicejava_class_name
         self.java_class_name = java_class_name
         self.timeout_sec = timeout_sec
-        self.stop_timeout_sec = 10
+        self.params = params
 
     def start(self):
         super().start()
 
         self.logger.info("Waiting for Ignite aware Application (%s) to start..." % self.java_class_name)
 
         self.await_event("Topology snapshot", self.timeout_sec, from_the_beginning=True)
-        self.await_event("IGNITE_APPLICATION_INITIALIZED\\|IGNITE_APPLICATION_BROKEN", self.timeout_sec,
-                         from_the_beginning=True)
 
-        try:
-            self.await_event("IGNITE_APPLICATION_INITIALIZED", 1, from_the_beginning=True)
-        except Exception:
-            raise Exception("Java application execution failed. %s" % self.extract_result("ERROR")) from None
+        self.__check_status("IGNITE_APPLICATION_INITIALIZED", timeout=self.timeout_sec)
 
-    # pylint: disable=W0221
-    def stop_node(self, node, clean_shutdown=True, timeout_sec=20):
-        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(node.account)))
-        node.account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown, allow_fail=True)
+    def stop_async(self, clean_shutdown=True):
+        """
+        Stops node in async way.
+        """
+        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(self.nodes[0].account)))
+        self.nodes[0].account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown,
+                                                  allow_fail=True)
 
-        stopped = self.wait_node(node, timeout_sec=self.stop_timeout_sec)
+    def await_stopped(self, timeout_sec=10):
+        """
+        Awaits node stop finish.
+        """
+        stopped = self.wait_node(self.nodes[0], timeout_sec=timeout_sec)
         assert stopped, "Node %s: did not stop within the specified timeout of %s seconds" % \
-                        (str(node.account), str(self.stop_timeout_sec))
+                        (str(self.nodes[0].account), str(timeout_sec))
 
-        self.await_event("IGNITE_APPLICATION_FINISHED\\|IGNITE_APPLICATION_BROKEN", from_the_beginning=True,
-                         timeout_sec=timeout_sec)
+        self.__check_status("IGNITE_APPLICATION_FINISHED", timeout=timeout_sec)
+
+    # pylint: disable=W0221
+    def stop_node(self, node, clean_shutdown=True, timeout_sec=10):
+        assert node == self.nodes[0]
+        self.stop_async(clean_shutdown)
+        self.await_stopped(timeout_sec)
+
+    def __check_status(self, desired, timeout=1):
+        self.await_event("%s\\|IGNITE_APPLICATION_BROKEN" % desired, timeout, from_the_beginning=True)
+
+        try:
+            self.await_event("IGNITE_APPLICATION_BROKEN", 1, from_the_beginning=True)
+            raise Exception("Java application execution failed. %s" % self.extract_result("ERROR"))
+        except TimeoutError:
+            pass
+
+        try:
+            self.await_event(desired, 1, from_the_beginning=True)
+        except Exception:
+            raise Exception("Java application execution falied.") from None

Review comment:
       falied -> failed

##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/cellular_affinity_test/PreparedTxStreamer.java
##########
@@ -0,0 +1,102 @@
+/*
+ * 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.ducktest.tests.cellular_affinity_test;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+import org.apache.ignite.internal.processors.cache.transactions.TransactionProxyImpl;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.transactions.Transaction;
+
+/**
+ *
+ */
+public class PreparedTxStreamer extends IgniteAwareApplication {
+    /**
+     * {@inheritDoc}
+     */
+    @Override protected void run(JsonNode jsonNode) throws Exception {
+        final String cacheName = jsonNode.get("cacheName").asText();
+        final String attr = jsonNode.get("attr").asText();
+        final String cell = jsonNode.get("cell").asText();
+        final int txCnt = jsonNode.get("txCnt").asInt();
+
+        markInitialized();
+
+        waitForActivation();
+
+        IgniteCache<Integer, Integer> cache = ignite.getOrCreateCache(cacheName);
+
+        log.info("Starting Prepared Txs...");
+
+        Affinity<Integer> aff = ignite.affinity(cacheName);
+
+        int cnt = 0;
+        int i = -1; // Negative keys to have no intersection with load.
+
+        while (cnt != txCnt && !terminated()) {
+            Collection<ClusterNode> nodes = aff.mapKeyToPrimaryAndBackups(i);
+
+            Map<Object, Long> stat = nodes.stream().collect(
+                Collectors.groupingBy(n -> n.attributes().get(attr), Collectors.counting()));
+
+            assert 1 == stat.keySet().size() :
+                "Partition should be located on nodes from only one cell " +
+                    "[key=" + i + ", nodes=" + nodes.size() + ", stat=" + stat + "]";
+
+            if (stat.containsKey(cell)) {
+                cnt++;
+
+                Transaction tx = ignite.transactions().txStart();
+
+                cache.put(i, i);
+
+                try {
+                    ((TransactionProxyImpl<?, ?>)tx).tx().prepare(true);
+                }
+                catch (IgniteCheckedException e) {

Review comment:
       `IgniteAwareApplication::start` already catch any exception and mark app as broken

##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/cellular_affinity_test/PreparedTxStreamer.java
##########
@@ -0,0 +1,102 @@
+/*
+ * 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.ducktest.tests.cellular_affinity_test;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+import org.apache.ignite.internal.processors.cache.transactions.TransactionProxyImpl;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.transactions.Transaction;
+
+/**
+ *

Review comment:
       Could you please provide a short brief of the class

##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/cellular_affinity_test/TxStreamer.java
##########
@@ -0,0 +1,114 @@
+/*
+ * 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.ducktest.tests.cellular_affinity_test;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ *

Review comment:
       Could you please provide a short brief of the class

##########
File path: modules/ducktests/tests/ignitetest/services/utils/ignite_spec.py
##########
@@ -147,6 +146,8 @@ def __init__(self, modules, **kwargs):
         libs.append("log4j")
         libs = list(map(lambda m: self.path.module(m) + "/*", libs))
 
+        libs.append(IgnitePath(DEV_BRANCH).module("ducktests") + "/*")

Review comment:
       Why do you add ducktests to NodeSpec?

##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -38,33 +41,54 @@ def __init__(self, context, config, java_class_name, params="", timeout_sec=60,
         self.servicejava_class_name = servicejava_class_name
         self.java_class_name = java_class_name
         self.timeout_sec = timeout_sec
-        self.stop_timeout_sec = 10
+        self.params = params
 
     def start(self):
         super().start()
 
         self.logger.info("Waiting for Ignite aware Application (%s) to start..." % self.java_class_name)
 
         self.await_event("Topology snapshot", self.timeout_sec, from_the_beginning=True)
-        self.await_event("IGNITE_APPLICATION_INITIALIZED\\|IGNITE_APPLICATION_BROKEN", self.timeout_sec,
-                         from_the_beginning=True)
 
-        try:
-            self.await_event("IGNITE_APPLICATION_INITIALIZED", 1, from_the_beginning=True)
-        except Exception:
-            raise Exception("Java application execution failed. %s" % self.extract_result("ERROR")) from None
+        self.__check_status("IGNITE_APPLICATION_INITIALIZED", timeout=self.timeout_sec)
 
-    # pylint: disable=W0221
-    def stop_node(self, node, clean_shutdown=True, timeout_sec=20):
-        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(node.account)))
-        node.account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown, allow_fail=True)
+    def stop_async(self, clean_shutdown=True):
+        """
+        Stops node in async way.
+        """
+        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(self.nodes[0].account)))
+        self.nodes[0].account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown,
+                                                  allow_fail=True)
 
-        stopped = self.wait_node(node, timeout_sec=self.stop_timeout_sec)
+    def await_stopped(self, timeout_sec=10):
+        """
+        Awaits node stop finish.
+        """
+        stopped = self.wait_node(self.nodes[0], timeout_sec=timeout_sec)
         assert stopped, "Node %s: did not stop within the specified timeout of %s seconds" % \
-                        (str(node.account), str(self.stop_timeout_sec))
+                        (str(self.nodes[0].account), str(timeout_sec))
 
-        self.await_event("IGNITE_APPLICATION_FINISHED\\|IGNITE_APPLICATION_BROKEN", from_the_beginning=True,
-                         timeout_sec=timeout_sec)
+        self.__check_status("IGNITE_APPLICATION_FINISHED", timeout=timeout_sec)
+
+    # pylint: disable=W0221
+    def stop_node(self, node, clean_shutdown=True, timeout_sec=10):
+        assert node == self.nodes[0]
+        self.stop_async(clean_shutdown)
+        self.await_stopped(timeout_sec)
+
+    def __check_status(self, desired, timeout=1):
+        self.await_event("%s\\|IGNITE_APPLICATION_BROKEN" % desired, timeout, from_the_beginning=True)
+
+        try:
+            self.await_event("IGNITE_APPLICATION_BROKEN", 1, from_the_beginning=True)

Review comment:
       Can we replace 1 with 0?

##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -38,33 +41,54 @@ def __init__(self, context, config, java_class_name, params="", timeout_sec=60,
         self.servicejava_class_name = servicejava_class_name
         self.java_class_name = java_class_name
         self.timeout_sec = timeout_sec
-        self.stop_timeout_sec = 10
+        self.params = params

Review comment:
       How is it used?

##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -38,33 +41,54 @@ def __init__(self, context, config, java_class_name, params="", timeout_sec=60,
         self.servicejava_class_name = servicejava_class_name
         self.java_class_name = java_class_name
         self.timeout_sec = timeout_sec
-        self.stop_timeout_sec = 10
+        self.params = params
 
     def start(self):
         super().start()
 
         self.logger.info("Waiting for Ignite aware Application (%s) to start..." % self.java_class_name)
 
         self.await_event("Topology snapshot", self.timeout_sec, from_the_beginning=True)
-        self.await_event("IGNITE_APPLICATION_INITIALIZED\\|IGNITE_APPLICATION_BROKEN", self.timeout_sec,
-                         from_the_beginning=True)
 
-        try:
-            self.await_event("IGNITE_APPLICATION_INITIALIZED", 1, from_the_beginning=True)
-        except Exception:
-            raise Exception("Java application execution failed. %s" % self.extract_result("ERROR")) from None
+        self.__check_status("IGNITE_APPLICATION_INITIALIZED", timeout=self.timeout_sec)
 
-    # pylint: disable=W0221
-    def stop_node(self, node, clean_shutdown=True, timeout_sec=20):
-        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(node.account)))
-        node.account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown, allow_fail=True)
+    def stop_async(self, clean_shutdown=True):
+        """
+        Stops node in async way.
+        """
+        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(self.nodes[0].account)))
+        self.nodes[0].account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown,
+                                                  allow_fail=True)
 
-        stopped = self.wait_node(node, timeout_sec=self.stop_timeout_sec)
+    def await_stopped(self, timeout_sec=10):
+        """
+        Awaits node stop finish.
+        """
+        stopped = self.wait_node(self.nodes[0], timeout_sec=timeout_sec)
         assert stopped, "Node %s: did not stop within the specified timeout of %s seconds" % \
-                        (str(node.account), str(self.stop_timeout_sec))
+                        (str(self.nodes[0].account), str(timeout_sec))
 
-        self.await_event("IGNITE_APPLICATION_FINISHED\\|IGNITE_APPLICATION_BROKEN", from_the_beginning=True,
-                         timeout_sec=timeout_sec)
+        self.__check_status("IGNITE_APPLICATION_FINISHED", timeout=timeout_sec)
+
+    # pylint: disable=W0221
+    def stop_node(self, node, clean_shutdown=True, timeout_sec=10):
+        assert node == self.nodes[0]
+        self.stop_async(clean_shutdown)
+        self.await_stopped(timeout_sec)
+
+    def __check_status(self, desired, timeout=1):
+        self.await_event("%s\\|IGNITE_APPLICATION_BROKEN" % desired, timeout, from_the_beginning=True)
+
+        try:
+            self.await_event("IGNITE_APPLICATION_BROKEN", 1, from_the_beginning=True)
+            raise Exception("Java application execution failed. %s" % self.extract_result("ERROR"))
+        except TimeoutError:
+            pass
+
+        try:
+            self.await_event(desired, 1, from_the_beginning=True)
+        except Exception:
+            raise Exception("Java application execution falied.") from None

Review comment:
       falied -> failed

##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/cellular_affinity_test/PreparedTxStreamer.java
##########
@@ -0,0 +1,102 @@
+/*
+ * 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.ducktest.tests.cellular_affinity_test;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+import org.apache.ignite.internal.processors.cache.transactions.TransactionProxyImpl;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.transactions.Transaction;
+
+/**
+ *
+ */
+public class PreparedTxStreamer extends IgniteAwareApplication {
+    /**
+     * {@inheritDoc}
+     */
+    @Override protected void run(JsonNode jsonNode) throws Exception {
+        final String cacheName = jsonNode.get("cacheName").asText();
+        final String attr = jsonNode.get("attr").asText();
+        final String cell = jsonNode.get("cell").asText();
+        final int txCnt = jsonNode.get("txCnt").asInt();
+
+        markInitialized();
+
+        waitForActivation();
+
+        IgniteCache<Integer, Integer> cache = ignite.getOrCreateCache(cacheName);
+
+        log.info("Starting Prepared Txs...");
+
+        Affinity<Integer> aff = ignite.affinity(cacheName);
+
+        int cnt = 0;
+        int i = -1; // Negative keys to have no intersection with load.
+
+        while (cnt != txCnt && !terminated()) {
+            Collection<ClusterNode> nodes = aff.mapKeyToPrimaryAndBackups(i);
+
+            Map<Object, Long> stat = nodes.stream().collect(
+                Collectors.groupingBy(n -> n.attributes().get(attr), Collectors.counting()));
+
+            assert 1 == stat.keySet().size() :
+                "Partition should be located on nodes from only one cell " +
+                    "[key=" + i + ", nodes=" + nodes.size() + ", stat=" + stat + "]";
+
+            if (stat.containsKey(cell)) {
+                cnt++;
+
+                Transaction tx = ignite.transactions().txStart();
+
+                cache.put(i, i);
+
+                try {
+                    ((TransactionProxyImpl<?, ?>)tx).tx().prepare(true);
+                }
+                catch (IgniteCheckedException e) {

Review comment:
       `IgniteAwareApplication::start` already catch any exception and mark app as broken

##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/cellular_affinity_test/PreparedTxStreamer.java
##########
@@ -0,0 +1,102 @@
+/*
+ * 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.ducktest.tests.cellular_affinity_test;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+import org.apache.ignite.internal.processors.cache.transactions.TransactionProxyImpl;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.transactions.Transaction;
+
+/**
+ *

Review comment:
       Could you please provide a short brief of the class

##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/cellular_affinity_test/TxStreamer.java
##########
@@ -0,0 +1,114 @@
+/*
+ * 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.ducktest.tests.cellular_affinity_test;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ *

Review comment:
       Could you please provide a short brief of the class

##########
File path: modules/ducktests/tests/ignitetest/services/utils/ignite_spec.py
##########
@@ -147,6 +146,8 @@ def __init__(self, modules, **kwargs):
         libs.append("log4j")
         libs = list(map(lambda m: self.path.module(m) + "/*", libs))
 
+        libs.append(IgnitePath(DEV_BRANCH).module("ducktests") + "/*")

Review comment:
       Why do you add ducktests to NodeSpec?

##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -38,33 +41,54 @@ def __init__(self, context, config, java_class_name, params="", timeout_sec=60,
         self.servicejava_class_name = servicejava_class_name
         self.java_class_name = java_class_name
         self.timeout_sec = timeout_sec
-        self.stop_timeout_sec = 10
+        self.params = params
 
     def start(self):
         super().start()
 
         self.logger.info("Waiting for Ignite aware Application (%s) to start..." % self.java_class_name)
 
         self.await_event("Topology snapshot", self.timeout_sec, from_the_beginning=True)
-        self.await_event("IGNITE_APPLICATION_INITIALIZED\\|IGNITE_APPLICATION_BROKEN", self.timeout_sec,
-                         from_the_beginning=True)
 
-        try:
-            self.await_event("IGNITE_APPLICATION_INITIALIZED", 1, from_the_beginning=True)
-        except Exception:
-            raise Exception("Java application execution failed. %s" % self.extract_result("ERROR")) from None
+        self.__check_status("IGNITE_APPLICATION_INITIALIZED", timeout=self.timeout_sec)
 
-    # pylint: disable=W0221
-    def stop_node(self, node, clean_shutdown=True, timeout_sec=20):
-        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(node.account)))
-        node.account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown, allow_fail=True)
+    def stop_async(self, clean_shutdown=True):
+        """
+        Stops node in async way.
+        """
+        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(self.nodes[0].account)))
+        self.nodes[0].account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown,
+                                                  allow_fail=True)
 
-        stopped = self.wait_node(node, timeout_sec=self.stop_timeout_sec)
+    def await_stopped(self, timeout_sec=10):
+        """
+        Awaits node stop finish.
+        """
+        stopped = self.wait_node(self.nodes[0], timeout_sec=timeout_sec)
         assert stopped, "Node %s: did not stop within the specified timeout of %s seconds" % \
-                        (str(node.account), str(self.stop_timeout_sec))
+                        (str(self.nodes[0].account), str(timeout_sec))
 
-        self.await_event("IGNITE_APPLICATION_FINISHED\\|IGNITE_APPLICATION_BROKEN", from_the_beginning=True,
-                         timeout_sec=timeout_sec)
+        self.__check_status("IGNITE_APPLICATION_FINISHED", timeout=timeout_sec)
+
+    # pylint: disable=W0221
+    def stop_node(self, node, clean_shutdown=True, timeout_sec=10):
+        assert node == self.nodes[0]
+        self.stop_async(clean_shutdown)
+        self.await_stopped(timeout_sec)
+
+    def __check_status(self, desired, timeout=1):
+        self.await_event("%s\\|IGNITE_APPLICATION_BROKEN" % desired, timeout, from_the_beginning=True)
+
+        try:
+            self.await_event("IGNITE_APPLICATION_BROKEN", 1, from_the_beginning=True)

Review comment:
       Can we replace 1 with 0?

##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -38,33 +41,54 @@ def __init__(self, context, config, java_class_name, params="", timeout_sec=60,
         self.servicejava_class_name = servicejava_class_name
         self.java_class_name = java_class_name
         self.timeout_sec = timeout_sec
-        self.stop_timeout_sec = 10
+        self.params = params

Review comment:
       How is it used?

##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -38,33 +41,54 @@ def __init__(self, context, config, java_class_name, params="", timeout_sec=60,
         self.servicejava_class_name = servicejava_class_name
         self.java_class_name = java_class_name
         self.timeout_sec = timeout_sec
-        self.stop_timeout_sec = 10
+        self.params = params
 
     def start(self):
         super().start()
 
         self.logger.info("Waiting for Ignite aware Application (%s) to start..." % self.java_class_name)
 
         self.await_event("Topology snapshot", self.timeout_sec, from_the_beginning=True)
-        self.await_event("IGNITE_APPLICATION_INITIALIZED\\|IGNITE_APPLICATION_BROKEN", self.timeout_sec,
-                         from_the_beginning=True)
 
-        try:
-            self.await_event("IGNITE_APPLICATION_INITIALIZED", 1, from_the_beginning=True)
-        except Exception:
-            raise Exception("Java application execution failed. %s" % self.extract_result("ERROR")) from None
+        self.__check_status("IGNITE_APPLICATION_INITIALIZED", timeout=self.timeout_sec)
 
-    # pylint: disable=W0221
-    def stop_node(self, node, clean_shutdown=True, timeout_sec=20):
-        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(node.account)))
-        node.account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown, allow_fail=True)
+    def stop_async(self, clean_shutdown=True):
+        """
+        Stops node in async way.
+        """
+        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(self.nodes[0].account)))
+        self.nodes[0].account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown,
+                                                  allow_fail=True)
 
-        stopped = self.wait_node(node, timeout_sec=self.stop_timeout_sec)
+    def await_stopped(self, timeout_sec=10):
+        """
+        Awaits node stop finish.
+        """
+        stopped = self.wait_node(self.nodes[0], timeout_sec=timeout_sec)
         assert stopped, "Node %s: did not stop within the specified timeout of %s seconds" % \
-                        (str(node.account), str(self.stop_timeout_sec))
+                        (str(self.nodes[0].account), str(timeout_sec))
 
-        self.await_event("IGNITE_APPLICATION_FINISHED\\|IGNITE_APPLICATION_BROKEN", from_the_beginning=True,
-                         timeout_sec=timeout_sec)
+        self.__check_status("IGNITE_APPLICATION_FINISHED", timeout=timeout_sec)
+
+    # pylint: disable=W0221
+    def stop_node(self, node, clean_shutdown=True, timeout_sec=10):
+        assert node == self.nodes[0]
+        self.stop_async(clean_shutdown)
+        self.await_stopped(timeout_sec)
+
+    def __check_status(self, desired, timeout=1):
+        self.await_event("%s\\|IGNITE_APPLICATION_BROKEN" % desired, timeout, from_the_beginning=True)
+
+        try:
+            self.await_event("IGNITE_APPLICATION_BROKEN", 1, from_the_beginning=True)
+            raise Exception("Java application execution failed. %s" % self.extract_result("ERROR"))
+        except TimeoutError:
+            pass
+
+        try:
+            self.await_event(desired, 1, from_the_beginning=True)
+        except Exception:
+            raise Exception("Java application execution falied.") from None

Review comment:
       falied -> failed

##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/cellular_affinity_test/PreparedTxStreamer.java
##########
@@ -0,0 +1,102 @@
+/*
+ * 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.ducktest.tests.cellular_affinity_test;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+import org.apache.ignite.internal.processors.cache.transactions.TransactionProxyImpl;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.transactions.Transaction;
+
+/**
+ *
+ */
+public class PreparedTxStreamer extends IgniteAwareApplication {
+    /**
+     * {@inheritDoc}
+     */
+    @Override protected void run(JsonNode jsonNode) throws Exception {
+        final String cacheName = jsonNode.get("cacheName").asText();
+        final String attr = jsonNode.get("attr").asText();
+        final String cell = jsonNode.get("cell").asText();
+        final int txCnt = jsonNode.get("txCnt").asInt();
+
+        markInitialized();
+
+        waitForActivation();
+
+        IgniteCache<Integer, Integer> cache = ignite.getOrCreateCache(cacheName);
+
+        log.info("Starting Prepared Txs...");
+
+        Affinity<Integer> aff = ignite.affinity(cacheName);
+
+        int cnt = 0;
+        int i = -1; // Negative keys to have no intersection with load.
+
+        while (cnt != txCnt && !terminated()) {
+            Collection<ClusterNode> nodes = aff.mapKeyToPrimaryAndBackups(i);
+
+            Map<Object, Long> stat = nodes.stream().collect(
+                Collectors.groupingBy(n -> n.attributes().get(attr), Collectors.counting()));
+
+            assert 1 == stat.keySet().size() :
+                "Partition should be located on nodes from only one cell " +
+                    "[key=" + i + ", nodes=" + nodes.size() + ", stat=" + stat + "]";
+
+            if (stat.containsKey(cell)) {
+                cnt++;
+
+                Transaction tx = ignite.transactions().txStart();
+
+                cache.put(i, i);
+
+                try {
+                    ((TransactionProxyImpl<?, ?>)tx).tx().prepare(true);
+                }
+                catch (IgniteCheckedException e) {

Review comment:
       `IgniteAwareApplication::start` already catch any exception and mark app as broken

##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/cellular_affinity_test/PreparedTxStreamer.java
##########
@@ -0,0 +1,102 @@
+/*
+ * 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.ducktest.tests.cellular_affinity_test;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+import org.apache.ignite.internal.processors.cache.transactions.TransactionProxyImpl;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.transactions.Transaction;
+
+/**
+ *

Review comment:
       Could you please provide a short brief of the class

##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/cellular_affinity_test/TxStreamer.java
##########
@@ -0,0 +1,114 @@
+/*
+ * 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.ducktest.tests.cellular_affinity_test;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ *

Review comment:
       Could you please provide a short brief of the class

##########
File path: modules/ducktests/tests/ignitetest/services/utils/ignite_spec.py
##########
@@ -147,6 +146,8 @@ def __init__(self, modules, **kwargs):
         libs.append("log4j")
         libs = list(map(lambda m: self.path.module(m) + "/*", libs))
 
+        libs.append(IgnitePath(DEV_BRANCH).module("ducktests") + "/*")

Review comment:
       Why do you add ducktests to NodeSpec?

##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -38,33 +41,54 @@ def __init__(self, context, config, java_class_name, params="", timeout_sec=60,
         self.servicejava_class_name = servicejava_class_name
         self.java_class_name = java_class_name
         self.timeout_sec = timeout_sec
-        self.stop_timeout_sec = 10
+        self.params = params
 
     def start(self):
         super().start()
 
         self.logger.info("Waiting for Ignite aware Application (%s) to start..." % self.java_class_name)
 
         self.await_event("Topology snapshot", self.timeout_sec, from_the_beginning=True)
-        self.await_event("IGNITE_APPLICATION_INITIALIZED\\|IGNITE_APPLICATION_BROKEN", self.timeout_sec,
-                         from_the_beginning=True)
 
-        try:
-            self.await_event("IGNITE_APPLICATION_INITIALIZED", 1, from_the_beginning=True)
-        except Exception:
-            raise Exception("Java application execution failed. %s" % self.extract_result("ERROR")) from None
+        self.__check_status("IGNITE_APPLICATION_INITIALIZED", timeout=self.timeout_sec)
 
-    # pylint: disable=W0221
-    def stop_node(self, node, clean_shutdown=True, timeout_sec=20):
-        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(node.account)))
-        node.account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown, allow_fail=True)
+    def stop_async(self, clean_shutdown=True):
+        """
+        Stops node in async way.
+        """
+        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(self.nodes[0].account)))
+        self.nodes[0].account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown,
+                                                  allow_fail=True)
 
-        stopped = self.wait_node(node, timeout_sec=self.stop_timeout_sec)
+    def await_stopped(self, timeout_sec=10):
+        """
+        Awaits node stop finish.
+        """
+        stopped = self.wait_node(self.nodes[0], timeout_sec=timeout_sec)
         assert stopped, "Node %s: did not stop within the specified timeout of %s seconds" % \
-                        (str(node.account), str(self.stop_timeout_sec))
+                        (str(self.nodes[0].account), str(timeout_sec))
 
-        self.await_event("IGNITE_APPLICATION_FINISHED\\|IGNITE_APPLICATION_BROKEN", from_the_beginning=True,
-                         timeout_sec=timeout_sec)
+        self.__check_status("IGNITE_APPLICATION_FINISHED", timeout=timeout_sec)
+
+    # pylint: disable=W0221
+    def stop_node(self, node, clean_shutdown=True, timeout_sec=10):
+        assert node == self.nodes[0]
+        self.stop_async(clean_shutdown)
+        self.await_stopped(timeout_sec)
+
+    def __check_status(self, desired, timeout=1):
+        self.await_event("%s\\|IGNITE_APPLICATION_BROKEN" % desired, timeout, from_the_beginning=True)
+
+        try:
+            self.await_event("IGNITE_APPLICATION_BROKEN", 1, from_the_beginning=True)

Review comment:
       Can we replace 1 with 0?

##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -38,33 +41,54 @@ def __init__(self, context, config, java_class_name, params="", timeout_sec=60,
         self.servicejava_class_name = servicejava_class_name
         self.java_class_name = java_class_name
         self.timeout_sec = timeout_sec
-        self.stop_timeout_sec = 10
+        self.params = params

Review comment:
       How is it used?

##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -38,33 +41,54 @@ def __init__(self, context, config, java_class_name, params="", timeout_sec=60,
         self.servicejava_class_name = servicejava_class_name
         self.java_class_name = java_class_name
         self.timeout_sec = timeout_sec
-        self.stop_timeout_sec = 10
+        self.params = params
 
     def start(self):
         super().start()
 
         self.logger.info("Waiting for Ignite aware Application (%s) to start..." % self.java_class_name)
 
         self.await_event("Topology snapshot", self.timeout_sec, from_the_beginning=True)
-        self.await_event("IGNITE_APPLICATION_INITIALIZED\\|IGNITE_APPLICATION_BROKEN", self.timeout_sec,
-                         from_the_beginning=True)
 
-        try:
-            self.await_event("IGNITE_APPLICATION_INITIALIZED", 1, from_the_beginning=True)
-        except Exception:
-            raise Exception("Java application execution failed. %s" % self.extract_result("ERROR")) from None
+        self.__check_status("IGNITE_APPLICATION_INITIALIZED", timeout=self.timeout_sec)
 
-    # pylint: disable=W0221
-    def stop_node(self, node, clean_shutdown=True, timeout_sec=20):
-        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(node.account)))
-        node.account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown, allow_fail=True)
+    def stop_async(self, clean_shutdown=True):
+        """
+        Stops node in async way.
+        """
+        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, str(self.nodes[0].account)))
+        self.nodes[0].account.kill_java_processes(self.servicejava_class_name, clean_shutdown=clean_shutdown,
+                                                  allow_fail=True)
 
-        stopped = self.wait_node(node, timeout_sec=self.stop_timeout_sec)
+    def await_stopped(self, timeout_sec=10):
+        """
+        Awaits node stop finish.
+        """
+        stopped = self.wait_node(self.nodes[0], timeout_sec=timeout_sec)
         assert stopped, "Node %s: did not stop within the specified timeout of %s seconds" % \
-                        (str(node.account), str(self.stop_timeout_sec))
+                        (str(self.nodes[0].account), str(timeout_sec))
 
-        self.await_event("IGNITE_APPLICATION_FINISHED\\|IGNITE_APPLICATION_BROKEN", from_the_beginning=True,
-                         timeout_sec=timeout_sec)
+        self.__check_status("IGNITE_APPLICATION_FINISHED", timeout=timeout_sec)
+
+    # pylint: disable=W0221
+    def stop_node(self, node, clean_shutdown=True, timeout_sec=10):
+        assert node == self.nodes[0]
+        self.stop_async(clean_shutdown)
+        self.await_stopped(timeout_sec)
+
+    def __check_status(self, desired, timeout=1):
+        self.await_event("%s\\|IGNITE_APPLICATION_BROKEN" % desired, timeout, from_the_beginning=True)
+
+        try:
+            self.await_event("IGNITE_APPLICATION_BROKEN", 1, from_the_beginning=True)
+            raise Exception("Java application execution failed. %s" % self.extract_result("ERROR"))
+        except TimeoutError:
+            pass
+
+        try:
+            self.await_event(desired, 1, from_the_beginning=True)
+        except Exception:
+            raise Exception("Java application execution falied.") from None

Review comment:
       falied -> failed

##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/cellular_affinity_test/PreparedTxStreamer.java
##########
@@ -0,0 +1,102 @@
+/*
+ * 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.ducktest.tests.cellular_affinity_test;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+import org.apache.ignite.internal.processors.cache.transactions.TransactionProxyImpl;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.transactions.Transaction;
+
+/**
+ *
+ */
+public class PreparedTxStreamer extends IgniteAwareApplication {
+    /**
+     * {@inheritDoc}
+     */
+    @Override protected void run(JsonNode jsonNode) throws Exception {
+        final String cacheName = jsonNode.get("cacheName").asText();
+        final String attr = jsonNode.get("attr").asText();
+        final String cell = jsonNode.get("cell").asText();
+        final int txCnt = jsonNode.get("txCnt").asInt();
+
+        markInitialized();
+
+        waitForActivation();
+
+        IgniteCache<Integer, Integer> cache = ignite.getOrCreateCache(cacheName);
+
+        log.info("Starting Prepared Txs...");
+
+        Affinity<Integer> aff = ignite.affinity(cacheName);
+
+        int cnt = 0;
+        int i = -1; // Negative keys to have no intersection with load.
+
+        while (cnt != txCnt && !terminated()) {
+            Collection<ClusterNode> nodes = aff.mapKeyToPrimaryAndBackups(i);
+
+            Map<Object, Long> stat = nodes.stream().collect(
+                Collectors.groupingBy(n -> n.attributes().get(attr), Collectors.counting()));
+
+            assert 1 == stat.keySet().size() :
+                "Partition should be located on nodes from only one cell " +
+                    "[key=" + i + ", nodes=" + nodes.size() + ", stat=" + stat + "]";
+
+            if (stat.containsKey(cell)) {
+                cnt++;
+
+                Transaction tx = ignite.transactions().txStart();
+
+                cache.put(i, i);
+
+                try {
+                    ((TransactionProxyImpl<?, ?>)tx).tx().prepare(true);
+                }
+                catch (IgniteCheckedException e) {

Review comment:
       `IgniteAwareApplication::start` already catch any exception and mark app as broken

##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/cellular_affinity_test/PreparedTxStreamer.java
##########
@@ -0,0 +1,102 @@
+/*
+ * 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.ducktest.tests.cellular_affinity_test;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+import org.apache.ignite.internal.processors.cache.transactions.TransactionProxyImpl;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.transactions.Transaction;
+
+/**
+ *

Review comment:
       Could you please provide a short brief of the class

##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/cellular_affinity_test/TxStreamer.java
##########
@@ -0,0 +1,114 @@
+/*
+ * 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.ducktest.tests.cellular_affinity_test;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ *

Review comment:
       Could you please provide a short brief of the class

##########
File path: modules/ducktests/tests/ignitetest/services/utils/ignite_spec.py
##########
@@ -147,6 +146,8 @@ def __init__(self, modules, **kwargs):
         libs.append("log4j")
         libs = list(map(lambda m: self.path.module(m) + "/*", libs))
 
+        libs.append(IgnitePath(DEV_BRANCH).module("ducktests") + "/*")

Review comment:
       Why do you add ducktests to NodeSpec?




----------------------------------------------------------------
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] [ignite] ivandasch commented on a change in pull request #8232: IGNITE-13433 Benchmark confirms operation's latency drop decrease on Cellular switch comparing to PME-free switch

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



##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/cellular_affinity_test/CellularTxStreamer.java
##########
@@ -0,0 +1,114 @@
+/*
+ * 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.ducktest.tests.cellular_affinity_test;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ * Streams transactions to specified cell.
+ */
+public class CellularTxStreamer extends IgniteAwareApplication {
+    /**

Review comment:
       I suppose that this should be one-lined




----------------------------------------------------------------
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] [ignite] anton-vinogradov commented on a change in pull request #8232: IGNITE-13433 Benchmark confirms operation's latency drop decrease on Cellular switch comparing to PME-free switch

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



##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/cellular_affinity_test/CellularTxStreamer.java
##########
@@ -0,0 +1,114 @@
+/*
+ * 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.ducktest.tests.cellular_affinity_test;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ * Streams transactions to specified cell.
+ */
+public class CellularTxStreamer extends IgniteAwareApplication {
+    /**

Review comment:
       Correct. 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.

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