Ryabov Dmitrii created IGNITE-13237:
---------------------------------------

             Summary: In some cases IgniteClient#query does not fire 
CacheQueryExecutedEvent
                 Key: IGNITE-13237
                 URL: https://issues.apache.org/jira/browse/IGNITE-13237
             Project: Ignite
          Issue Type: Task
            Reporter: Ryabov Dmitrii
            Assignee: Ryabov Dmitrii
             Fix For: 2.10


In some cases {{IgniteClient#query}} does not fire {{CacheQueryExecutedEvent}}.
 Reproducer:
{code:java|title=IgniteCacheAbstractQuerySelfTest.java}
@Test
public void testClientSqlQueryEvents() throws Exception {
    CountDownLatch execLatch = new CountDownLatch(9);

    IgnitePredicate<Event> lsnr = evt -> {
        assert evt instanceof CacheQueryExecutedEvent;

        System.out.println(">>> EVENT: " + evt);

        CacheQueryExecutedEvent qe = (CacheQueryExecutedEvent)evt;

        assertEquals("SQL_PUBLIC_TEST_TABLE", qe.cacheName());
        assertNotNull(qe.clause());
        assertNull(qe.scanQueryFilter());
        assertNull(qe.continuousQueryFilter());

        execLatch.countDown();

        return true;
    };

    ignite().events().localListen(lsnr, EVT_CACHE_QUERY_EXECUTED);

    ClientConfiguration cc = new 
ClientConfiguration().setAddresses(Config.SERVER);

    try (IgniteClient client = Ignition.startClient(cc)) {
        client.query(new SqlFieldsQuery("create table TEST_TABLE(key int 
primary key, val int)"))
            .getAll();

        client.query(new SqlFieldsQuery("insert into TEST_TABLE values (?, 
?)").setArgs(1, 1))
            .getAll();

        client.query(new SqlFieldsQuery("update TEST_TABLE set val = ?2 where 
key = ?1").setArgs(1, 2))
            .getAll();

        client.query(new SqlFieldsQuery("select * from TEST_TABLE"))
            .getAll();

        client.query(new SqlFieldsQuery("create index idx_1 on 
TEST_TABLE(key)"))
            .getAll();

        client.query(new SqlFieldsQuery("drop index idx_1"))
            .getAll();

        client.query(new SqlFieldsQuery("alter table TEST_TABLE add column val2 
int"))
            .getAll();

        client.query(new SqlFieldsQuery("alter table TEST_TABLE drop val2"))
            .getAll();

        client.query(new SqlFieldsQuery("drop table TEST_TABLE"))
            .getAll();

        assertTrue(execLatch.await(3_000, MILLISECONDS));
    }
    finally {
        ignite().events().stopLocalListen(lsnr, EVT_CACHE_QUERY_EXECUTED);
    }
}
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to