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

Pavel Pereslegin updated IGNITE-19176:
--------------------------------------
    Description: 
When we try to insert values into a single column  table using RW transaction, 
those values are not visible in the same transaction.

Example
{code:java}
create table test(id int primary key) // single column table
{code}
{code:java}
// case 1
start RW tx 
  insert into test values (0), (1)
  select count(*) from test // returns 0 instead of 2
finish tx{code}
{code:java}
// case 2
start RW tx
   insert into test values (0), (1)
commit tx

start RW tx
   select count(*) from test // returns 0 instead of 2
finish tx{code}

If we do this using RO transaction - all works fine.
If we add a column to the table, everything will work fine.

Reproducer
{code:java}
@Test
public void test() {
    sql("CREATE TABLE myTbl (id INT PRIMARY KEY) WITH REPLICAS=2, 
PARTITIONS=10");
    Ignite ignite = CLUSTER_NODES.get(0);
    ignite.transactions().runInTransaction(tx -> {
        sql(tx, "INSERT INTO myTbl VALUES (0), (1)");
        List<List<Object>> rows = sql(tx, "SELECT count(*) from myTbl");
        assertEquals(2L, rows.get(0).get(0));
    });
} {code}
 

  was:
When we try to insert values into a single column  table using explicit 
transaction, those values are not visible in the same transaction.

Example
{code:java}
create table test(id int primary key) // single column table
{code}
{code:java}
// case 1
start RW tx 
  insert into test values (0), (1)
  select count(*) from test // returns 0 instead of 2
finish tx{code}
{code:java}
// case 2
start RW tx
   insert into test values (0), (1)
commit tx

start RW tx
   select count(*) from test // returns 0 instead of 2
finish tx{code}

If we do this using RO transaction - all works fine.
If we add a column to the table, everything will work fine.

Reproducer
{code:java}
@Test
public void test() {
    sql("CREATE TABLE myTbl (id INT PRIMARY KEY) WITH REPLICAS=2, 
PARTITIONS=10");
    Ignite ignite = CLUSTER_NODES.get(0);
    ignite.transactions().runInTransaction(tx -> {
        sql(tx, "INSERT INTO myTbl VALUES (0), (1)");
        List<List<Object>> rows = sql(tx, "SELECT count(*) from myTbl");
        assertEquals(2L, rows.get(0).get(0));
    });
} {code}
 


> Sql. RW transaction skips rows without value.
> ---------------------------------------------
>
>                 Key: IGNITE-19176
>                 URL: https://issues.apache.org/jira/browse/IGNITE-19176
>             Project: Ignite
>          Issue Type: Bug
>          Components: sql
>            Reporter: Pavel Pereslegin
>            Assignee: Pavel Pereslegin
>            Priority: Major
>              Labels: ignite-3
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> When we try to insert values into a single column  table using RW 
> transaction, those values are not visible in the same transaction.
> Example
> {code:java}
> create table test(id int primary key) // single column table
> {code}
> {code:java}
> // case 1
> start RW tx 
>   insert into test values (0), (1)
>   select count(*) from test // returns 0 instead of 2
> finish tx{code}
> {code:java}
> // case 2
> start RW tx
>    insert into test values (0), (1)
> commit tx
> start RW tx
>    select count(*) from test // returns 0 instead of 2
> finish tx{code}
> If we do this using RO transaction - all works fine.
> If we add a column to the table, everything will work fine.
> Reproducer
> {code:java}
> @Test
> public void test() {
>     sql("CREATE TABLE myTbl (id INT PRIMARY KEY) WITH REPLICAS=2, 
> PARTITIONS=10");
>     Ignite ignite = CLUSTER_NODES.get(0);
>     ignite.transactions().runInTransaction(tx -> {
>         sql(tx, "INSERT INTO myTbl VALUES (0), (1)");
>         List<List<Object>> rows = sql(tx, "SELECT count(*) from myTbl");
>         assertEquals(2L, rows.get(0).get(0));
>     });
> } {code}
>  



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

Reply via email to