alex-plekhanov commented on code in PR #13091:
URL: https://github.com/apache/ignite/pull/13091#discussion_r3241402599
##########
modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlSystemViewsSelfTest.java:
##########
@@ -681,6 +682,84 @@ public void testRunningQueriesViewDuration() throws
Exception {
}
}
+ /** Test SELECT and DML map query flags in running queries system view. */
+ @Test
+ public void testMapQueryRunningQueriesView() throws Exception {
+ IgniteEx ignite = startGrids(2);
+
+ IgniteCache<Integer, Integer> cache = createMapQueryTestCache(ignite);
+
+ checkMapQueryView(ignite, cache, "SELECT * FROM Integer WHERE sleep(?)
>= 0");
+
+ checkMapQueryView(ignite, cache, "DELETE FROM Integer WHERE sleep(?)
>= 0");
+ }
+
+ /** Test map query is unregistered from running queries system view on
error. */
+ @Test
+ public void testMapQueryRunningQueriesViewOnError() throws Exception {
+ IgniteEx ignite = startGrids(2);
+
+ IgniteCache<Integer, Integer> cache = createMapQueryTestCache(ignite);
+
+ String initiatorId = UUID.randomUUID().toString();
+
+ GridTestUtils.assertThrows(log,
+ () -> cache.query(new SqlFieldsQuery("SELECT * FROM Integer WHERE
can_fail(_key = 0) = 0")
+ .setQueryInitiatorId(initiatorId)).getAll(),
+ CacheException.class,
+ "Exception calling user-defined function");
+
+ assertTrue(waitForCondition(() -> !hasMapQueryView(ignite,
initiatorId), 5_000));
+ }
+
+ /** */
+ private void checkMapQueryView(IgniteEx ignite, IgniteCache<Integer,
Integer> cache, String sql) throws Exception {
+ String initiatorId = UUID.randomUUID().toString();
+
+ IgniteInternalFuture<?> fut = GridTestUtils.runAsync(() ->
+ cache.query(new
SqlFieldsQuery(sql).setQueryInitiatorId(initiatorId).setArgs(5_000)).getAll()
Review Comment:
5 seconds sleep for each query delay test for 10 seconds. I think 1 second
here is enough.
--
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]