timoninmaxim commented on code in PR #10478:
URL: https://github.com/apache/ignite/pull/10478#discussion_r1069040421


##########
modules/control-utility/src/main/java/org/apache/ignite/internal/commandline/query/KillCommand.java:
##########
@@ -212,6 +215,24 @@ public class KillCommand extends AbstractCommand<Object> {
 
                 break;
 
+            case CLIENT:
+                taskName = VisorClientConnectionDropTask.class.getName();
+
+                for (int i = 0; i < 2; i++) {

Review Comment:
   Should it be replaced with while loop over `argIter` iterator?



##########
modules/indexing/src/test/java/org/apache/ignite/util/KillCommandsTests.java:
##########
@@ -472,6 +479,40 @@ public static void doTestCancelContinuousQuery(IgniteEx 
cli, List<IgniteEx> srvs
         }
     }
 
+    /**
+     * Test cancel of the continuous query.

Review Comment:
   Wrong javadoc - there is no continuous query in the test



##########
modules/indexing/src/test/java/org/apache/ignite/util/KillCommandsTests.java:
##########
@@ -472,6 +479,40 @@ public static void doTestCancelContinuousQuery(IgniteEx 
cli, List<IgniteEx> srvs
         }
     }
 
+    /**
+     * Test cancel of the continuous query.
+     *
+     * @param srvs Server nodes.
+     * @param cliCanceler Client connection cancel closure.
+     */
+    public static void doTestCancelClientConnection(List<IgniteEx> srvs, 
Consumer<Long> cliCanceler) {
+        AtomicReference<IgniteClient> cli = new AtomicReference<>(
+            Ignition.startClient(new 
ClientConfiguration().setAddresses(Config.SERVER))
+        );
+
+        assertEquals(ClusterState.ACTIVE, cli.get().cluster().state());
+
+        List<List<?>> conns = execute(srvs.get(0), "SELECT CONNECTION_ID FROM 
SYS.CLIENT_CONNECTIONS");
+
+        assertEquals(1, conns.size());

Review Comment:
   Let's create more connections to test that it's killed the specified 
connection only. Also KILL ALL should be tested with multiple connections.



##########
docs/_docs/sql-reference/operational-commands.adoc:
##########
@@ -397,3 +397,30 @@ control.bat --kill CONSISTENCY
 ----
 
 --
+== KILL CLIENT operations
+
+The `KILL CLIENT` command allows you to cancel local client (thin/jdbc/odbc) 
connection.
+
+[tabs]
+--
+
+tab:Unix[]
+[source,bash]
+----
+./control.sh --kill CLIENT connection_id [--node-id node_id]
+----
+
+tab:Windows[]
+[source,bash]
+----
+control.bat --kill CLIENT connection_id [--node-id node_id]
+----
+
+--
+
+=== Parameters
+
+* `connection_id` - corresponds to the connection id of the client. Note, 
connection_id are local value.

Review Comment:
   should doc that if connection id isn't specified then all connections drops



##########
modules/control-utility/src/test/java/org/apache/ignite/util/KillCommandsControlShTest.java:
##########
@@ -153,6 +154,18 @@ public void testCancelContinuousQuery() throws Exception {
         });
     }
 
+    /** @throws Exception If failed. */
+    @Test
+    public void testCancelClientConnection() {
+        doTestCancelClientConnection(srvs, connId -> {
+            String nodeId = srvs.get(0).localNode().id().toString();
+
+            int res = execute("--kill", "client", "--node-id", nodeId, connId 
== null ? "ALL" : Long.toString(connId));

Review Comment:
   Should command failed if connection wasn't dropped, in case of error or 
wrong/non-existent connection id?
   
   Let's add test for specific node id also



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