[ 
https://issues.apache.org/jira/browse/IGNITE-22390?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Maksim Zhuravkov updated IGNITE-22390:
--------------------------------------
    Description: 
The following test case begun to fail after (Sql. Avoid starting transaction 
for KV operation) [ https://issues.apache.org/jira/browse/IGNITE-22263 ]
 
{code:java}
package org.apache.ignite.internal.sql.engine;

import static 
org.apache.ignite.internal.catalog.CatalogService.DEFAULT_STORAGE_PROFILE;
import static org.apache.ignite.internal.lang.IgniteStringFormatter.format;
import static org.apache.ignite.internal.testframework.IgniteTestUtils.await;
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.util.Objects;
import org.apache.ignite.internal.app.IgniteImpl;
import org.apache.ignite.internal.sql.BaseSqlIntegrationTest;
import org.apache.ignite.internal.sql.engine.property.SqlProperties;
import org.apache.ignite.internal.sql.engine.property.SqlPropertiesHelper;
import org.apache.ignite.internal.tx.HybridTimestampTracker;
import org.apache.ignite.internal.util.AsyncCursor.BatchedResult;
import org.gridgain.internal.security.context.GridGainSecurity;
import org.gridgain.internal.security.context.SecurityContext;
import org.junit.jupiter.api.Test;

public class ItCursor extends BaseSqlIntegrationTest {

    @Override
    protected int initialNodes() {
        return 1;
    }

    @Test
    public void testCursor() {
        int rowsCount = 2000;

        sql("create zone test_zone with partitions=1, replicas=1, 
storage_profiles='" + DEFAULT_STORAGE_PROFILE + "'");
        sql("create table T (ID INT PRIMARY KEY, VAL INT) with 
primary_zone='TEST_ZONE'");
        sql(format("insert into T select X, X from table(system_range(1, {}))", 
rowsCount));

        String selectAll = "select * from T";

        AsyncSqlCursor<InternalSqlRow> cursor1 = openSqlCursor(selectAll);
        await(cursor1.onFirstPageReady());
        BatchedResult<InternalSqlRow> f = await(cursor1.requestNextAsync(1000));
        assertEquals(1000, f.items().size()); // f.items().size() is zero
    }
    
    private AsyncSqlCursor<InternalSqlRow> openSqlCursor(String sql) {
        IgniteImpl node = CLUSTER.node(0);
        SqlQueryProcessor qryProc = (SqlQueryProcessor) node.queryEngine();
        SqlProperties props = SqlPropertiesHelper.emptyProperties();
        SecurityContext securityCtx = GridGainSecurity.systemContext();

        return Objects.requireNonNull(await(qryProc.queryAsync(props, new 
HybridTimestampTracker(), null, sql, securityCtx)));
    }
}
{code}


  was:
The following test case begun to fail after 
https://issues.apache.org/jira/browse/IGNITE-22263 
 
{code:java}
package org.apache.ignite.internal.sql.engine;

import static 
org.apache.ignite.internal.catalog.CatalogService.DEFAULT_STORAGE_PROFILE;
import static org.apache.ignite.internal.lang.IgniteStringFormatter.format;
import static org.apache.ignite.internal.testframework.IgniteTestUtils.await;
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.util.Objects;
import org.apache.ignite.internal.app.IgniteImpl;
import org.apache.ignite.internal.sql.BaseSqlIntegrationTest;
import org.apache.ignite.internal.sql.engine.property.SqlProperties;
import org.apache.ignite.internal.sql.engine.property.SqlPropertiesHelper;
import org.apache.ignite.internal.tx.HybridTimestampTracker;
import org.apache.ignite.internal.util.AsyncCursor.BatchedResult;
import org.gridgain.internal.security.context.GridGainSecurity;
import org.gridgain.internal.security.context.SecurityContext;
import org.junit.jupiter.api.Test;

public class ItCursor extends BaseSqlIntegrationTest {

    @Override
    protected int initialNodes() {
        return 1;
    }

    @Test
    public void testCursor() {
        int rowsCount = 2000;

        sql("create zone test_zone with partitions=1, replicas=1, 
storage_profiles='" + DEFAULT_STORAGE_PROFILE + "'");
        sql("create table T (ID INT PRIMARY KEY, VAL INT) with 
primary_zone='TEST_ZONE'");
        sql(format("insert into T select X, X from table(system_range(1, {}))", 
rowsCount));

        String selectAll = "select * from T";

        AsyncSqlCursor<InternalSqlRow> cursor1 = openSqlCursor(selectAll);
        await(cursor1.onFirstPageReady());
        BatchedResult<InternalSqlRow> f = await(cursor1.requestNextAsync(1000));
        assertEquals(1000, f.items().size()); // f.items().size() is zero
    }
    
    private AsyncSqlCursor<InternalSqlRow> openSqlCursor(String sql) {
        IgniteImpl node = CLUSTER.node(0);
        SqlQueryProcessor qryProc = (SqlQueryProcessor) node.queryEngine();
        SqlProperties props = SqlPropertiesHelper.emptyProperties();
        SecurityContext securityCtx = GridGainSecurity.systemContext();

        return Objects.requireNonNull(await(qryProc.queryAsync(props, new 
HybridTimestampTracker(), null, sql, securityCtx)));
    }
}
{code}



> Sql. Cursor::requestNextAsync returns stale results
> ---------------------------------------------------
>
>                 Key: IGNITE-22390
>                 URL: https://issues.apache.org/jira/browse/IGNITE-22390
>             Project: Ignite
>          Issue Type: Bug
>          Components: sql
>    Affects Versions: 3.0.0-beta2
>            Reporter: Maksim Zhuravkov
>            Priority: Critical
>              Labels: ignite-3
>
> The following test case begun to fail after (Sql. Avoid starting transaction 
> for KV operation) [ https://issues.apache.org/jira/browse/IGNITE-22263 ]
>  
> {code:java}
> package org.apache.ignite.internal.sql.engine;
> import static 
> org.apache.ignite.internal.catalog.CatalogService.DEFAULT_STORAGE_PROFILE;
> import static org.apache.ignite.internal.lang.IgniteStringFormatter.format;
> import static org.apache.ignite.internal.testframework.IgniteTestUtils.await;
> import static org.junit.jupiter.api.Assertions.assertEquals;
> import java.util.Objects;
> import org.apache.ignite.internal.app.IgniteImpl;
> import org.apache.ignite.internal.sql.BaseSqlIntegrationTest;
> import org.apache.ignite.internal.sql.engine.property.SqlProperties;
> import org.apache.ignite.internal.sql.engine.property.SqlPropertiesHelper;
> import org.apache.ignite.internal.tx.HybridTimestampTracker;
> import org.apache.ignite.internal.util.AsyncCursor.BatchedResult;
> import org.gridgain.internal.security.context.GridGainSecurity;
> import org.gridgain.internal.security.context.SecurityContext;
> import org.junit.jupiter.api.Test;
> public class ItCursor extends BaseSqlIntegrationTest {
>     @Override
>     protected int initialNodes() {
>         return 1;
>     }
>     @Test
>     public void testCursor() {
>         int rowsCount = 2000;
>         sql("create zone test_zone with partitions=1, replicas=1, 
> storage_profiles='" + DEFAULT_STORAGE_PROFILE + "'");
>         sql("create table T (ID INT PRIMARY KEY, VAL INT) with 
> primary_zone='TEST_ZONE'");
>         sql(format("insert into T select X, X from table(system_range(1, 
> {}))", rowsCount));
>         String selectAll = "select * from T";
>         AsyncSqlCursor<InternalSqlRow> cursor1 = openSqlCursor(selectAll);
>         await(cursor1.onFirstPageReady());
>         BatchedResult<InternalSqlRow> f = 
> await(cursor1.requestNextAsync(1000));
>         assertEquals(1000, f.items().size()); // f.items().size() is zero
>     }
>     
>     private AsyncSqlCursor<InternalSqlRow> openSqlCursor(String sql) {
>         IgniteImpl node = CLUSTER.node(0);
>         SqlQueryProcessor qryProc = (SqlQueryProcessor) node.queryEngine();
>         SqlProperties props = SqlPropertiesHelper.emptyProperties();
>         SecurityContext securityCtx = GridGainSecurity.systemContext();
>         return Objects.requireNonNull(await(qryProc.queryAsync(props, new 
> HybridTimestampTracker(), null, sql, securityCtx)));
>     }
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to