Mikhail Petrov created IGNITE-13361:
---------------------------------------

             Summary: SQL Select query hangs during cursor iteration.
                 Key: IGNITE-13361
                 URL: https://issues.apache.org/jira/browse/IGNITE-13361
             Project: Ignite
          Issue Type: Bug
            Reporter: Mikhail Petrov


The following test hangs intermittently (once for 4-5 runs) on my laptop 
(Ubuntu 20.04, i7-8565u, 16gb RAM). The cursor iteration randomly hangs on the 
stage of waiting for the next page from the remote node.
{code:java}
    /** */
    public static final int NODES_CNT = 2;

    /** */
    public static final int TABLE_POPULATION = 2000;

    /** */
    public static final int SELECT_RANGE = 1000;

    /** */
    public static final int QRY_PAGE_SIZE = 5;

    /** */
    @Test
    public void test() throws Exception {
        for (int i = 0; i < NODES_CNT; i++)
            startGrid(i, false);

        IgniteEx cli = startGrid(NODES_CNT, true);

        GridQueryProcessor qryProc = cli.context().query();

        qryProc.querySqlFields(
            new SqlFieldsQuery("CREATE TABLE test_table (id LONG PRIMARY KEY, 
val LONG)"), false);

        qryProc.querySqlFields(new SqlFieldsQuery("CREATE INDEX val_idx ON 
test_table (val)"), false);

        for (long l = 0; l < TABLE_POPULATION; ++l) {
            qryProc.querySqlFields(
                new SqlFieldsQuery("INSERT INTO test_table (id, val) VALUES (?, 
?)").setArgs(l, l),
                true
            );
        }

        for (int i = 0; i < 10000 ; i++) {
            long lowId = ThreadLocalRandom.current().nextLong(TABLE_POPULATION 
- SELECT_RANGE);

            long highId = lowId + SELECT_RANGE;

            try (
                FieldsQueryCursor<List<?>> cursor = cli
                    .context().query().querySqlFields(
                        new SqlFieldsQuery("SELECT id, val FROM test_table 
WHERE id BETWEEN ? and ?")
                            .setArgs(lowId, highId)
                            .setPageSize(QRY_PAGE_SIZE),
                        false
                    )
            ) {
                cursor.iterator().forEachRemaining(val -> {});
            }
        }
    }

    /** */
    private IgniteEx startGrid(int idx, boolean clientMode) throws Exception {
        return (IgniteEx) Ignition.start(new IgniteConfiguration()
            .setIgniteInstanceName("node-" + idx)
            .setGridLogger(new 
Log4JLogger("modules/core/src/test/config/log4j-test.xml"))
            .setClientMode(clientMode));
    }
{code}



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

Reply via email to