You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2021/09/13 06:34:00 UTC

[GitHub] [ignite] NSAmelchev commented on a change in pull request #9376: IGNITE-15346 Iterator of the ClientCacheQueryCursor can be closed during serialization.

NSAmelchev commented on a change in pull request #9376:
URL: https://github.com/apache/ignite/pull/9376#discussion_r707041108



##########
File path: modules/indexing/src/test/java/org/apache/ignite/util/KillCommandsTests.java
##########
@@ -128,6 +154,68 @@ public static void doTestScanQueryCancel(IgniteEx cli, List<IgniteEx> srvs, Cons
         for (int i = 0; i < PAGE_SZ * PAGE_SZ - 1; i++)
             assertNotNull(iter2.next());
 
+        checkScanQueryResources(cli, srvs, qryId);
+
+        qry2.close();
+    }
+
+    /**
+     * Checks cancel of the scan query during fetching.
+     *
+     * @param cli Client node.
+     * @param srvs Server nodes.
+     * @param qryCanceler Query cancel closure.
+     */
+    private static void checkScanQueryCancelDuringFetching(IgniteEx cli, List<IgniteEx> srvs,
+        Consumer<T3<UUID, String, Long>> qryCanceler) throws Exception {
+        filterLatch = new CountDownLatch(1);
+        cancelLatch = new CountDownLatch(1);
+
+        IgniteCache<Object, Object> cache = cli.cache(DEFAULT_CACHE_NAME);
+
+        QueryCursor<Cache.Entry<Object, Object>> qry = cache.query(new ScanQuery<>().setFilter((o, o2) -> {
+            try {
+                filterLatch.countDown();
+
+                cancelLatch.await(TIMEOUT, TimeUnit.MILLISECONDS);
+            }
+            catch (Exception ignored) {
+                // No-op.
+            }
+
+            return true;
+        }));
+
+        IgniteInternalFuture<?> fut = GridTestUtils.runAsync((Runnable)() -> qry.iterator().next());
+
+        assertTrue(filterLatch.await(TIMEOUT, TimeUnit.MILLISECONDS));
+
+        List<List<?>> scanQries0 = execute(srvs.get(0),
+            "SELECT ORIGIN_NODE_ID, CACHE_NAME, QUERY_ID FROM SYS.SCAN_QUERIES");
+
+        assertEquals(1, scanQries0.size());
+
+        UUID originNodeId = (UUID)scanQries0.get(0).get(0);
+        String cacheName = (String)scanQries0.get(0).get(1);
+        long qryId = (Long)scanQries0.get(0).get(2);

Review comment:
       Fixed.

##########
File path: modules/indexing/src/test/java/org/apache/ignite/util/KillCommandsTests.java
##########
@@ -82,14 +87,35 @@
     /** Latch to block compute task execution. */
     private static CountDownLatch computeLatch;
 
+    /** Scan query filter latch. */
+    private static CountDownLatch filterLatch;
+
+    /** Scan query cancel latch. */
+    private static CountDownLatch cancelLatch;
+
     /**
      * Test cancel of the scan query.
      *
      * @param cli Client node.
      * @param srvs Server nodes.
      * @param qryCanceler Query cancel closure.
      */
-    public static void doTestScanQueryCancel(IgniteEx cli, List<IgniteEx> srvs, Consumer<T3<UUID, String, Long>> qryCanceler) {
+    public static void doTestScanQueryCancel(IgniteEx cli, List<IgniteEx> srvs,

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.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

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