@@ -269,28 +269,33 @@ public void testSqlFieldsCrossCacheQueryFailed() throws Exception {
269
269
*/
270
270
@ Test
271
271
public void testSqlFieldsQueryWithReducePhase () throws Exception {
272
- runQueryWithReducePhase (() -> {
273
- try {
274
- startGridsMultiThreaded (1 , 2 );
272
+ assumeTrue ("Map/reduce queries are only applicable to H2 engine" ,
273
+ sqlEngine == IndexingQueryEngineConfiguration .ENGINE_NAME );
275
274
276
- awaitPartitionMapExchange ( );
275
+ assumeFalse ( "Only distributed queries have map and reduce phases" , loc );
277
276
278
- cacheQuery ( new SqlFieldsQuery ( SQL_WITH_REDUCE_PHASE ). setDistributedJoins ( true ), "pers" );
277
+ startTestGrid ( );
279
278
280
- checkSqlPlanHistory (3 );
281
- }
282
- catch (Exception e ) {
283
- throw new RuntimeException (e );
284
- }
279
+ try {
280
+ startGridsMultiThreaded (1 , 2 );
281
+
282
+ awaitPartitionMapExchange ();
283
+
284
+ cacheQuery (new SqlFieldsQuery (SQL_WITH_REDUCE_PHASE ).setDistributedJoins (true ), "pers" );
285
+
286
+ checkSqlPlanHistory (3 );
285
287
286
288
for (int i = 1 ; i <= 2 ; i ++) {
287
289
List <SqlPlanHistoryView > sqlPlansOnMapNode = getSqlPlanHistory (grid (i ));
288
290
289
- assertTrue (sqlPlansOnMapNode .size () == 2 );
291
+ assertTrue (waitForCondition (() -> sqlPlansOnMapNode .size () == 2 , 1000 ) );
290
292
291
293
checkMetrics (sqlPlansOnMapNode );
292
294
}
293
- });
295
+ }
296
+ catch (Exception e ) {
297
+ throw new RuntimeException (e );
298
+ }
294
299
}
295
300
296
301
/** Checks successful SqlQuery. */
@@ -378,27 +383,21 @@ public void testPlanHistoryEviction() throws Exception {
378
383
public void testEntryReplacement () throws Exception {
379
384
startTestGrid ();
380
385
381
- long firstPlanTS = 0 ;
386
+ long firstTs ;
382
387
383
- for (int i = 0 ; i < 2 ; i ++) {
384
- cacheQuery (new SqlFieldsQuery (SQL ), "A" );
388
+ cacheQuery (new SqlFieldsQuery (SQL ), "A" );
385
389
386
- if (i == 0 ) {
387
- assertTrue (waitForCondition (() -> !getSqlPlanHistory ().isEmpty (), 1000 ));
390
+ assertTrue (waitForCondition (() -> !getSqlPlanHistory ().isEmpty (), 1000 ));
388
391
389
- firstPlanTS = F .first (getSqlPlanHistory ()).lastStartTime ().getTime ();
392
+ firstTs = F .first (getSqlPlanHistory ()).lastStartTime ().getTime ();
390
393
391
- long ts0 = U .currentTimeMillis ();
394
+ long curTs = U .currentTimeMillis ();
392
395
393
- assertTrue (waitForCondition (() -> (U .currentTimeMillis () != ts0 ), 1000 ));
394
- }
395
- else {
396
- long firstPlanTS0 = firstPlanTS ;
396
+ assertTrue (waitForCondition (() -> (U .currentTimeMillis () != curTs ), 1000 ));
397
397
398
- assertTrue (waitForCondition (() ->
399
- F .first (getSqlPlanHistory ()).lastStartTime ().getTime () > firstPlanTS0 , 1000 ));
400
- }
401
- }
398
+ cacheQuery (new SqlFieldsQuery (SQL ), "A" );
399
+
400
+ assertTrue (waitForCondition (() -> F .first (getSqlPlanHistory ()).lastStartTime ().getTime () > firstTs , 1000 ));
402
401
}
403
402
404
403
/** Checks that SQL plan history stays empty if the grid is started with a zero history size. */
@@ -494,21 +493,7 @@ public void runQueryWithoutPlan(Query qry) throws Exception {
494
493
495
494
cacheQuery (qry , "A" );
496
495
497
- checkSqlPlanHistory (0 );
498
- }
499
-
500
- /**
501
- * @param task Test task to execute.
502
- */
503
- public void runQueryWithReducePhase (Runnable task ) throws Exception {
504
- assumeTrue ("Map/reduce queries are only applicable to H2 engine" ,
505
- sqlEngine == IndexingQueryEngineConfiguration .ENGINE_NAME );
506
-
507
- assumeFalse ("Only distributed queries have map and reduce phases" , loc );
508
-
509
- startTestGrid ();
510
-
511
- task .run ();
496
+ assertTrue (getSqlPlanHistory ().isEmpty ());
512
497
}
513
498
514
499
/**
@@ -625,9 +610,6 @@ public List<SqlPlanHistoryView> getSqlPlanHistory(IgniteEx node) {
625
610
* @param size Number of SQL plan entries expected to be in the history.
626
611
*/
627
612
public void checkSqlPlanHistory (int size ) throws Exception {
628
- if (size == 0 )
629
- return ;
630
-
631
613
assertTrue (waitForCondition (() -> getSqlPlanHistory ().size () == size , 1000 ));
632
614
633
615
checkMetrics (getSqlPlanHistory ());
@@ -640,9 +622,6 @@ public void checkSqlPlanHistory(int size) throws Exception {
640
622
* @param isSimpleQry Simple query flag.
641
623
*/
642
624
public void checkSqlPlanHistoryDml (int size , boolean isSimpleQry ) {
643
- if (size == 0 )
644
- return ;
645
-
646
625
List <SqlPlanHistoryView > sqlPlans = getSqlPlanHistory ();
647
626
648
627
assertNotNull (sqlPlans );
0 commit comments