public void testLongQueries() throws Exception {
  IgniteH2Indexing spi=getIndexing();
  long longQryExecTime=CacheConfiguration.DFLT_LONG_QRY_WARN_TIMEOUT;
  GridStringLogger log=new GridStringLogger(false,this.log);
  IgniteLogger oldLog=GridTestUtils.getFieldValue(spi,"log");
  try {
    GridTestUtils.setFieldValue(spi,"log",log);
    String sql="select sum(x) FROM SYSTEM_RANGE(?, ?)";
    long now=U.currentTimeMillis();
    long time=now;
    long range=1000000L;
    while (now - time <= longQryExecTime * 3 / 2) {
      time=now;
      range*=3;
      GridQueryFieldsResult res=spi.queryLocalSqlFields("A",sql,Arrays.<Object>asList(1,range),null,false);
      assert res.iterator().hasNext();
      now=U.currentTimeMillis();
    }
    String res=log.toString();
    F.println(res);
    assertTrue(res.contains("/* PUBLIC.RANGE_INDEX */"));
  }
  finally {
    GridTestUtils.setFieldValue(spi,"log",oldLog);
  }
}

public void testLongQueries ( ) throws Exception { IgniteH2Indexing spi = getIndexing ( ) ; long longQryExecTime = CacheConfiguration . DFLT_LONG_QRY_WARN_TIMEOUT ; GridStringLogger log = new GridStringLogger ( false , this . log ) ; IgniteLogger oldLog = GridTestUtils . getFieldValue ( spi , "log" ) ; try { GridTestUtils . setFieldValue ( spi , "log" , log ) ; String sql = "select sum(x) FROM SYSTEM_RANGE(?, ?)" ; long now = U . currentTimeMillis ( ) ; long time = now ; long range = 1000000L ; while ( now - time <= longQryExecTime * 3 / 2 ) { time = now ; range *= 3 ; GridQueryFieldsResult res = spi . queryLocalSqlFields ( "A" , sql , Arrays . < Object > asList ( 1 , range ) , null , false ) ; assert res . iterator ( ) . hasNext ( ) ; now = U . currentTimeMillis ( ) ; } String res = log . toString ( ) ; F . println ( res ) ; assertTrue ( res . contains ( "/* PUBLIC.RANGE_INDEX */" ) ) ; } finally { GridTestUtils . setFieldValue ( spi , "log" , oldLog ) ; } }
test long queries write explain warnings into log .
