|
58 | 58 | import org.junit.runners.Parameterized; |
59 | 59 |
|
60 | 60 | import static org.apache.ignite.configuration.SqlConfiguration.DFLT_SQL_PLAN_HISTORY_SIZE; |
| 61 | +import static org.apache.ignite.internal.processors.performancestatistics.AbstractPerformanceStatisticsTest.startCollectStatistics; |
61 | 62 | import static org.apache.ignite.internal.processors.query.running.RunningQueryManager.SQL_PLAN_HIST_VIEW; |
62 | 63 | import static org.apache.ignite.testframework.GridTestUtils.waitForCondition; |
63 | 64 | import static org.junit.Assert.assertNotEquals; |
@@ -133,19 +134,24 @@ public class SqlPlanHistoryIntegrationTest extends GridCommonAbstractTest { |
133 | 134 | @Parameterized.Parameter(3) |
134 | 135 | public boolean isFullyFetched; |
135 | 136 |
|
| 137 | + /** Flag indicating whether the collection of performance statistics is enabled. */ |
| 138 | + @Parameterized.Parameter(4) |
| 139 | + public boolean isPerfStatsEnabled; |
| 140 | + |
136 | 141 | /** |
137 | 142 | * @return Test parameters. |
138 | 143 | */ |
139 | | - @Parameterized.Parameters(name = "sqlEngine={0}, isClient={1} loc={2}, isFullyFetched={3}") |
| 144 | + @Parameterized.Parameters(name = "sqlEngine={0}, isClient={1} loc={2}, isFullyFetched={3}, isPerfStatsEnabled={4}") |
140 | 145 | public static Collection<Object[]> params() { |
141 | 146 | return Arrays.stream(new Object[][]{ |
142 | 147 | {CalciteQueryEngineConfiguration.ENGINE_NAME}, |
143 | 148 | {IndexingQueryEngineConfiguration.ENGINE_NAME} |
144 | 149 | }).flatMap(sqlEngine -> Arrays.stream(sqlEngine[0].equals(IndexingQueryEngineConfiguration.ENGINE_NAME) ? |
145 | | - new Boolean[]{false} : new Boolean[]{true, false}) |
146 | | - .flatMap(isClient -> Arrays.stream(isClient ? new Boolean[]{false} : new Boolean[]{true, false}) |
147 | | - .flatMap(loc -> Arrays.stream(new Boolean[]{true, false}) |
148 | | - .map(isFullyFetched -> new Object[]{sqlEngine[0], isClient, loc, isFullyFetched}))) |
| 150 | + new Boolean[]{false} : new Boolean[]{true, false}) |
| 151 | + .flatMap(isClient -> Arrays.stream(isClient ? new Boolean[]{false} : new Boolean[]{true, false}) |
| 152 | + .flatMap(loc -> Arrays.stream(new Boolean[]{true, false}) |
| 153 | + .flatMap(isFullyFetched -> Arrays.stream(new Boolean[]{true, false}) |
| 154 | + .map(isPerfStatsEnabled -> new Object[]{sqlEngine[0], isClient, loc, isFullyFetched, isPerfStatsEnabled})))) |
149 | 155 | ).collect(Collectors.toList()); |
150 | 156 | } |
151 | 157 |
|
@@ -214,6 +220,9 @@ protected void startTestGrid() throws Exception { |
214 | 220 | if (isClient) |
215 | 221 | startClientGrid(1); |
216 | 222 |
|
| 223 | + if (isPerfStatsEnabled) |
| 224 | + startCollectStatistics(); |
| 225 | + |
217 | 226 | IgniteCache<Integer, String> cacheA = queryNode().cache("A"); |
218 | 227 | IgniteCache<Integer, String> cacheB = queryNode().cache("B"); |
219 | 228 |
|
@@ -331,6 +340,12 @@ public void testSqlQueryFailed() throws Exception { |
331 | 340 | runFailedQuery(new SqlQuery<>("String", "from String where fail()=1")); |
332 | 341 | } |
333 | 342 |
|
| 343 | + /** Checks that EXPLAIN queries execute successfully and are not added to the SQL plan history. */ |
| 344 | + @Test |
| 345 | + public void testExplainQuery() throws Exception { |
| 346 | + runQueryWithoutPlan(new SqlFieldsQuery("explain plan for " + SQL)); |
| 347 | + } |
| 348 | + |
334 | 349 | /** Checks ScanQuery. */ |
335 | 350 | @Test |
336 | 351 | public void testScanQuery() throws Exception { |
@@ -370,6 +385,8 @@ public void testSqlFieldsDmlWithJoins() throws Exception { |
370 | 385 | /** Checks that older plan entries are evicted when maximum history size is reached. */ |
371 | 386 | @Test |
372 | 387 | public void testPlanHistoryEviction() throws Exception { |
| 388 | + assumeFalse(isPerfStatsEnabled); |
| 389 | + |
373 | 390 | startTestGrid(); |
374 | 391 |
|
375 | 392 | IgniteCache<Integer, String> cache = queryNode().cache("A"); |
@@ -402,6 +419,8 @@ public void testPlanHistoryEviction() throws Exception { |
402 | 419 | */ |
403 | 420 | @Test |
404 | 421 | public void testEntryReplacement() throws Exception { |
| 422 | + assumeFalse(isPerfStatsEnabled); |
| 423 | + |
405 | 424 | startTestGrid(); |
406 | 425 |
|
407 | 426 | long firstTs; |
@@ -494,6 +513,8 @@ public void testNoScanCountSuffix() throws Exception { |
494 | 513 | assumeTrue("ScanCount suffix can only be present in H2 local query plans", |
495 | 514 | sqlEngine == IndexingQueryEngineConfiguration.ENGINE_NAME && loc); |
496 | 515 |
|
| 516 | + assumeFalse(isPerfStatsEnabled); |
| 517 | + |
497 | 518 | startTestGrid(); |
498 | 519 |
|
499 | 520 | final int iterations = 5; |
@@ -729,6 +750,8 @@ public void checkMetrics(List<SqlPlanHistoryView> sqlPlans) { |
729 | 750 | * @param reset Reset event. |
730 | 751 | */ |
731 | 752 | public void checkReset(Runnable reset) throws Exception { |
| 753 | + assumeFalse(isPerfStatsEnabled); |
| 754 | + |
732 | 755 | startTestGrid(); |
733 | 756 |
|
734 | 757 | IgniteCache<Integer, String> cache = queryNode().cache("A"); |
@@ -756,6 +779,8 @@ public void checkReset(Runnable reset) throws Exception { |
756 | 779 | * @param startGridFirst Flag indicating whether to start the grid before the setup. |
757 | 780 | */ |
758 | 781 | public void checkEmptyHistory(Runnable setup, boolean startGridFirst) throws Exception { |
| 782 | + assumeFalse(isPerfStatsEnabled); |
| 783 | + |
759 | 784 | if (startGridFirst) |
760 | 785 | startTestGrid(); |
761 | 786 |
|
@@ -784,7 +809,7 @@ public void checkDefaultHistorySize( |
784 | 809 | if (isSingleEngineCheck) |
785 | 810 | assumeFalse(sqlEngine == CalciteQueryEngineConfiguration.ENGINE_NAME); |
786 | 811 |
|
787 | | - assumeFalse(isClient || loc || isFullyFetched); |
| 812 | + assumeFalse(isClient || loc || isFullyFetched || isPerfStatsEnabled); |
788 | 813 |
|
789 | 814 | startTestGrid(); |
790 | 815 |
|
|
0 commit comments