Query timeout

classic Classic list List threaded Threaded
5 messages Options
Vasily Laktionov Vasily Laktionov
Reply | Threaded
Open this post in threaded view
|

Query timeout

Hi all,
Is there any way to set query timeout parameter in JDBC url?



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Taras Ledkov Taras Ledkov
Reply | Threaded
Open this post in threaded view
|

Re: Query timeout

Hi,

queryTimeout=N

in seconds according with JDBC specification:
java.sql.Statement#setQueryTimeout

On 23.03.2020 12:47, breathem wrote:
> Hi all,
> Is there any way to set query timeout parameter in JDBC url?
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/

--
Taras Ledkov
Mail-To: [hidden email]

Vasily Laktionov Vasily Laktionov
Reply | Threaded
Open this post in threaded view
|

Re: Query timeout

I try jdbc:ignite:thin://192.168.1.138:10800;queryTimeout=1 and
jdbc:ignite:thin://192.168.1.138:10800?queryTimeout=1 both.
Query is still executed more then 1 sec without exception.
Is this parameter supported in 2.8.0?



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Taras Ledkov Taras Ledkov
Reply | Threaded
Open this post in threaded view
|

Re: Query timeout

Hi,

Hm.. It works for me.
Looks at the Ignite test:
JdbcThinStatementTimeoutSelfTest#testQueryTimeoutRetrival [1].

Please share your simple reproducer or test.

[1].
https://github.com/apache/ignite/blob/9f19e0160b1ca43a27908849ad46c65ebd8689f1/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinStatementTimeoutSelfTest.java#L212

On 23.03.2020 14:36, breathem wrote:
> I try jdbc:ignite:thin://192.168.1.138:10800;queryTimeout=1 and
> jdbc:ignite:thin://192.168.1.138:10800?queryTimeout=1 both.
> Query is still executed more then 1 sec without exception.
> Is this parameter supported in 2.8.0?
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/

--
Taras Ledkov
Mail-To: [hidden email]

Vasily Laktionov Vasily Laktionov
Reply | Threaded
Open this post in threaded view
|

Re: Query timeout

Hi, Taras.
We try to connect to server via NetBeans 8.2 for development purposes.
In Services tab we add Ignite 2.8.0 JDBC driver (ignite-core-2.8.0.jar) and
choose org.apache.ignite.IgniteJdbcThinDriver.

To reproduce long running query we create 2 tables:
create table if not exists TEST
(kField long not null, vField varchar(100) not null, rField varchar(100) not
null, primary key (kField))
WITH "template=REPLICATED, cache_name=TEST, key_type=KTEST,
value_type=VTEST"

create table if not exists TEST1
(kField long not null, vField varchar(100) not null, rField varchar(100) not
null, primary key (kField))
WITH "template=REPLICATED, cache_name=TEST1, key_type=KTEST1,
value_type=VTEST1"

Then fill this tables with 1 000 000 random data rows, eg
    int size = 1_000_000;
   
    IgniteCallable<Integer> clb = new IgniteCallable<Integer>()
    {
      @IgniteInstanceResource
      Ignite ignite;
     
      @Override
      public Integer call() throws Exception
      {
        IgniteCache<BinaryObject, BinaryObject> test =
ignite.cache("TEST").withKeepBinary();
       
        if (test.size(CachePeekMode.ALL) > 0)
        {
          test.clear();
        }
       
        IgniteBinary bin = ignite.binary();
        long t;
       
        for (int i = 0; i < size; i++)
        {
          BinaryObjectBuilder k = bin.builder("KTEST");
          BinaryObjectBuilder v = bin.builder("VTEST");
         
          t = System.currentTimeMillis();
         
          k.setField("kField", t);
          v.setField("vField", "I am value string " + t);
          v.setField("rField", randomString(100));
         
          test.putAsync(k.build(), v.build());
        }
       
        return null;
      }
    };

Then connect to server via NetBeans with
jdbc:ignite:thin://192.168.1.138:10800?queryTimeout=1

Then make long running query:
select t.kField, t.vField, t1.vField from test t inner join test1 t1 on
t.vField = t1.vField;

This query in our case is executed ~73 sec and not cancelled.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/