Hi Nikolay, I think that problem here is that the query you are trying to kill is
> "SELECT QUERY_ID FROM SYS.SQL_QUERIES" itself, which is already completed by the time you run "KILL QUERY" command. I'm not an expert in the system views, but it seems to me that the line > List<List<?>> sqlQries0 = SqlViewExporterSpiTest.execute(ignite0, "SELECT > QUERY_ID FROM SYS.SQL_QUERIES"); returns only the queries which were originated from the ignite0 node. Since "SELECT _KEY, _VAL FROM INTEGER" was started on the client node, it doesn't get into that list. Try to replace "ignite0" with a "client" node in this line. I think it may help: > List<List<?>> sqlQries0 = SqlViewExporterSpiTest.execute(client, "SELECT > QUERY_ID FROM SYS.SQL_QUERIES"); -- Kind Regards Roman Kondakov On 02.03.2020 12:02, Nikolay Izhikov wrote: > Hello, Igniters. > > Ignite right now support `KILL QUERY` command. > I tried to use it and stuck with the simple test. > Error is «Query with provided ID doesn’t exist» > > Can you, please, advise me - How KILL QUERY should be used? > > ``` > @Test > public void testCancelSQLQuery() throws Exception { > IgniteEx ignite0 = startGrids(NODES_CNT); > IgniteEx client = startClientGrid("client"); > > ignite0.cluster().state(ACTIVE); > > initCache(client); > > SqlFieldsQuery qry = new SqlFieldsQuery("SELECT _KEY, _VAL FROM > INTEGER").setSchema("default").setPageSize(10); > Iterator<List<?>> iter = queryProcessor(client).querySqlFields(qry, > true).iterator(); > > assertNotNull(iter.next()); > > List<List<?>> sqlQries0 = SqlViewExporterSpiTest.execute(ignite0, > "SELECT QUERY_ID FROM SYS.SQL_QUERIES"); > assertEquals(1, sqlQries0.size()); > > String qryId = (String)sqlQries0.get(0).get(0); > SqlViewExporterSpiTest.execute(client, "KILL QUERY '" + qryId + "'»); > > //Expecting this iteration will fail. > while(iter.hasNext()) > assertNotNull(iter.next()); > > fail("You shouldn't be here!"); > } > > private void initCache(IgniteEx client) { > IgniteCache<Object, Object> cache = client.getOrCreateCache( > new > CacheConfiguration<>(DEFAULT_CACHE_NAME).setIndexedTypes(Integer.class, > Integer.class)); > > for (int i = 0; i < PAGE_SZ * PAGE_SZ; i++) > cache.put(i, i); > } > ``` > > ``` > class org.apache.ignite.internal.processors.query.IgniteSQLException: Failed > to cancel query > [nodeId=4f812490-47b9-4331-8b51-d783f5300000,qryId=1,err=Query with provided > ID doesn't exist [nodeId=4f812490-47b9-4331-8b51-d783f5300000, qryId=1]] > > at > org.apache.ignite.internal.processors.query.h2.CommandProcessor.processKillQueryCommand(CommandProcessor.java:482) > at > org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommand(CommandProcessor.java:411) > at > org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.executeCommand(IgniteH2Indexing.java:996) > at > org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.querySqlFields(IgniteH2Indexing.java:1085) > at > org.apache.ignite.internal.processors.query.GridQueryProcessor$4.applyx(GridQueryProcessor.java:2454) > ```` >