oleg-vlsk commented on code in PR #12544:
URL: https://github.com/apache/ignite/pull/12544#discussion_r2579123988


##########
modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SqlDiagnosticIntegrationTest.java:
##########
@@ -1028,6 +1028,66 @@ public void testSqlFieldsQueryWithInitiatorId() throws 
Exception {
         }
     }
 
+    /**
+     * Verifies that query total execution time is correctly accumulated in 
the DURATION_TOTAL field of the
+     * SQL_QUERIES_HISTORY system view.
+     */
+    @Test
+    public void testSqlQueryTotalDuration() throws Exception {
+        IgniteEx grid = grid(0);
+
+        IgniteCache<Long, Long> cache = prepareTestCache(grid);
+
+        long[] totalTimeArr = new long[2];
+
+        AtomicLong curTotalTime = new AtomicLong();
+
+        for (int i = 0; i < totalTimeArr.length; i++) {
+            FunctionsLibrary.latch = new CountDownLatch(1);
+
+            IgniteInternalFuture<?> fut = GridTestUtils.runAsync(
+                () -> cache.query(new SqlFieldsQuery("select * from test where 
waitLatch(10000)")).getAll());
+
+            U.sleep(500);
+
+            FunctionsLibrary.latch.countDown();
+
+            fut.get();
+
+            int finI = i;
+
+            assertTrue(waitForCondition(() -> {
+                SystemView<SqlQueryHistoryView> history = 
grid.context().systemView().view(SQL_QRY_HIST_VIEW);
+
+                assertNotNull(history);
+
+                if (history.size() != 1)
+                    return false;
+
+                SqlQueryHistoryView view = 
first(grid.context().systemView().view(SQL_QRY_HIST_VIEW));
+
+                assertNotNull(view);
+
+                long totalTime = view.durationTotal();
+
+                if (totalTime > curTotalTime.get()) {
+                    curTotalTime.set(totalTime);
+
+                    totalTimeArr[finI] = totalTime;
+
+                    return true;
+                }

Review Comment:
   Corrected the check.



##########
modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SqlDiagnosticIntegrationTest.java:
##########
@@ -1028,6 +1028,66 @@ public void testSqlFieldsQueryWithInitiatorId() throws 
Exception {
         }
     }
 
+    /**
+     * Verifies that query total execution time is correctly accumulated in 
the DURATION_TOTAL field of the
+     * SQL_QUERIES_HISTORY system view.
+     */
+    @Test
+    public void testSqlQueryTotalDuration() throws Exception {
+        IgniteEx grid = grid(0);
+
+        IgniteCache<Long, Long> cache = prepareTestCache(grid);
+
+        long[] totalTimeArr = new long[2];
+
+        AtomicLong curTotalTime = new AtomicLong();
+
+        for (int i = 0; i < totalTimeArr.length; i++) {
+            FunctionsLibrary.latch = new CountDownLatch(1);
+
+            IgniteInternalFuture<?> fut = GridTestUtils.runAsync(
+                () -> cache.query(new SqlFieldsQuery("select * from test where 
waitLatch(10000)")).getAll());
+
+            U.sleep(500);

Review Comment:
   Done.



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