Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-26671

Inconsistent SELECT View when modify a record added by another transaction

Details

    Description

      If a transaction modifies an inserted record by a concurrent transaction,
      the visibility of this new record for the current transaction depends on the value of the inserted record.

      This issue is similar to the issue reported in

      https://jira.mariadb.org/browse/MDEV-26643

      but the trigger conditions and behaviors of them are different.

      How to repeat:

      /* init */ drop table if exists t;
      /* init */ create table t(a int, b int);
      /* init */ insert into t values (0, 0), (1, 1);
       
      /* s1 */ begin;
      /* s1 */ select * from t; -- [(0, 0), (1, 1)]
      /* s2 */ begin;
      /* s2 */ insert into t values (10, 2);
      /* s2 */ commit;
      /* s1 */ select * from t; -- [(0, 0), (1, 1)]
      /* s1 */ update t set a = 10 where true;
      /* s1 */ select * from t;  -- [(10, 0), (10, 1)]
      /* s1 */ commit;
       
      -------------------------------------------------------------
       
      /* init */ drop table if exists t;
      /* init */ create table t(a int, b int);
      /* init */ insert into t values (0, 0), (1, 1);
       
      /* s1 */ begin;
      /* s1 */ select * from t; -- [(0, 0), (1, 1)]
      /* s2 */ begin;
      /* s2 */ insert into t values (11, 2);
      /* s2 */ commit;
      /* s1 */ select * from t; -- [(0, 0), (1, 1)]
      /* s1 */ update t set a = 10 where true;
      /* s1 */ select * from t;  -- [(10, 0), (10, 1), (10, 2)]
      /* s1 */ commit;
      

      Attachments

        Issue Links

          Activity

            dinary dinary created issue -
            dinary dinary made changes -
            Field Original Value New Value
            Description If a transaction modifies an inserted record by a concurrent transaction,
            the visibility of this new record for the current transaction depends on the value of the inserted record.

            This issue is similar to the issue reported in

            https://jira.mariadb.org/browse/MDEV-26643

            but the trigger conditions and behaviors of them are different.

            How to repeat:
            /* init */ drop table if exists t;
            /* init */ create table t(a int, b int);
            /* init */ insert into t values (0, 0), (1, 1);

            /* s1 */ begin;
            /* s1 */ select * from t; -- [(0, 0), (1, 1)]
            /* s2 */ begin;
            /* s2 */ insert into t values (10, 2);
            /* s2 */ commit;
            /* s1 */ select * from t; -- [(0, 0), (1, 1)]
            /* s1 */ update t set a = 10 where true;
            /* s1 */ select * from t; -- [(10, 0), (10, 1)]
            /* s1 */ commit;

            -------------------------------------------------------------

            /* init */ drop table if exists t;
            /* init */ create table t(a int, b int);
            /* init */ insert into t values (0, 0), (1, 1);

            /* s1 */ begin;
            /* s1 */ select * from t; -- [(0, 0), (1, 1)]
            /* s2 */ begin;
            /* s2 */ insert into t values (11, 2);
            /* s2 */ commit;
            /* s1 */ select * from t; -- [(0, 0), (1, 1)]
            /* s1 */ update t set a = 10 where true;
            /* s1 */ select * from t; -- [(10, 0), (10, 1), (10, 2)]
            /* s1 */ commit;
            If a transaction modifies an inserted record by a concurrent transaction,
            the visibility of this new record for the current transaction depends on the value of the inserted record.

            This issue is similar to the issue reported in

            https://jira.mariadb.org/browse/MDEV-26643

            but the trigger conditions and behaviors of them are different.

            How to repeat:

            {code:sql}
            /* init */ drop table if exists t;
            /* init */ create table t(a int, b int);
            /* init */ insert into t values (0, 0), (1, 1);

            /* s1 */ begin;
            /* s1 */ select * from t; -- [(0, 0), (1, 1)]
            /* s2 */ begin;
            /* s2 */ insert into t values (10, 2);
            /* s2 */ commit;
            /* s1 */ select * from t; -- [(0, 0), (1, 1)]
            /* s1 */ update t set a = 10 where true;
            /* s1 */ select * from t; -- [(10, 0), (10, 1)]
            /* s1 */ commit;

            -------------------------------------------------------------

            /* init */ drop table if exists t;
            /* init */ create table t(a int, b int);
            /* init */ insert into t values (0, 0), (1, 1);

            /* s1 */ begin;
            /* s1 */ select * from t; -- [(0, 0), (1, 1)]
            /* s2 */ begin;
            /* s2 */ insert into t values (11, 2);
            /* s2 */ commit;
            /* s1 */ select * from t; -- [(0, 0), (1, 1)]
            /* s1 */ update t set a = 10 where true;
            /* s1 */ select * from t; -- [(10, 0), (10, 1), (10, 2)]
            /* s1 */ commit;
            {code}
            alice Alice Sherepa made changes -
            alice Alice Sherepa made changes -
            Assignee Marko Mäkelä [ marko ]
            serg Sergei Golubchik made changes -
            Fix Version/s 10.5 [ 23123 ]
            Fix Version/s 10.6 [ 24028 ]
            marko Marko Mäkelä made changes -
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 125335 ] MariaDB v4 [ 143193 ]
            marko Marko Mäkelä made changes -
            issue.field.resolutiondate 2024-03-20 08:50:41.0 2024-03-20 08:50:41.418
            marko Marko Mäkelä made changes -
            Fix Version/s 10.6.18 [ 29627 ]
            Fix Version/s 10.11.8 [ 29630 ]
            Fix Version/s 11.0.6 [ 29628 ]
            Fix Version/s 11.1.5 [ 29629 ]
            Fix Version/s 11.2.4 [ 29631 ]
            Fix Version/s 11.4.2 [ 29633 ]
            Fix Version/s 10.5 [ 23123 ]
            Fix Version/s 10.6 [ 24028 ]
            Resolution Fixed [ 1 ]
            Status Open [ 1 ] Closed [ 6 ]

            People

              marko Marko Mäkelä
              dinary dinary
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.