sanpwc commented on code in PR #6243:
URL: https://github.com/apache/ignite-3/pull/6243#discussion_r2210202244


##########
modules/runner/src/testFixtures/java/org/apache/ignite/internal/BaseIgniteRestartTest.java:
##########
@@ -139,15 +140,27 @@ void setUp(TestInfo testInfo) {
     public void afterEachTest() throws Exception {
         var closeables = new ArrayList<AutoCloseable>();
 
-        for (IgniteServer node : IGNITE_SERVERS) {
+        List<String> serverNames = IGNITE_SERVERS.stream()
+                .filter(Objects::nonNull)
+                .map(IgniteServer::name)
+                .collect(toList());
+
+        log.info("Shutting the cluster down [nodes={}]", serverNames);
+
+        // Stop all nodes in reverse order to ensure that the first started 
node (MS node) is stopped last.
+        for (int i = IGNITE_SERVERS.size() - 1; i >= 0; i--) {

Review Comment:
   `IGNITE_SERVERS.reversed()` ?



##########
modules/runner/src/testFixtures/java/org/apache/ignite/internal/BaseIgniteRestartTest.java:
##########
@@ -139,15 +140,27 @@ void setUp(TestInfo testInfo) {
     public void afterEachTest() throws Exception {
         var closeables = new ArrayList<AutoCloseable>();
 
-        for (IgniteServer node : IGNITE_SERVERS) {
+        List<String> serverNames = IGNITE_SERVERS.stream()
+                .filter(Objects::nonNull)
+                .map(IgniteServer::name)
+                .collect(toList());
+
+        log.info("Shutting the cluster down [nodes={}]", serverNames);
+
+        // Stop all nodes in reverse order to ensure that the first started 
node (MS node) is stopped last.
+        for (int i = IGNITE_SERVERS.size() - 1; i >= 0; i--) {
+            IgniteServer node = IGNITE_SERVERS.get(i);
+
             if (node != null) {
                 closeables.add(node::shutdown);
             }
         }
 
         if (!partialNodes.isEmpty()) {
-            for (PartialNode partialNode : partialNodes) {
-                closeables.add(partialNode::stop);
+            for (int i = partialNodes.size() - 1; i >= 0; i--) {

Review Comment:
   Provided solution is not robust. Generally (as a hack) we should stop CMG/MG 
last, while we may have CMG/MG hosted on both partial and full nodes, thus it's 
not valid to stop IGNITE_SERVERS first and partialNodes after that.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to