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

ER_KEY_NOT_FOUND upon concurrent ALTER and transaction

Details

    Description

      --source include/have_debug_sync.inc
       
      CREATE TABLE t (a int, b int) ENGINE=MyISAM;
      INSERT INTO t VALUES (1,10),(2,20);
      SET debug_sync= 'alter_table_online_progress WAIT_FOR goforit';
      --send
        ALTER TABLE t ADD c INT, ALGORITHM=COPY, LOCK=NONE;
       
      --connect (con1,localhost,root,,)
       
      UPDATE t SET b = 100;
      START TRANSACTION;
      UPDATE t SET b = 200;
       
      --connect (con2,localhost,root,,)
      DELETE FROM t ORDER BY a LIMIT 1;
      DELETE FROM t ORDER BY a LIMIT 1;
       
      --connection con1
      COMMIT;
      SET debug_sync= 'now SIGNAL goforit';
       
      --connection default
      --reap
       
      # Cleanup
      DROP TABLE t;
      --disconnect con2
      --disconnect con1
      

      bb-11.0-oalter 90cf6464fae

      mysqltest: At line 24: query 'reap' failed: ER_KEY_NOT_FOUND (1032): Can't find record in 't'
      

      error log

      2023-04-13  1:51:44 4 [ERROR] mariadbd: Can't find record in 't'
      2023-04-13  1:51:44 4 [ERROR] Slave SQL: Could not execute Delete_rows_v1 event on table test.t; Can't find record in 't', Error_code: 1032; handler error HA_ERR_END_OF_FILE; the event's master log FIRST, end_log_pos 112, Internal MariaDB error code: 1032
      

      Reproducible with at least MyISAM and Aria. The test case is not directly applicable to InnoDB, it hits innodb_lock_wait_timeout instead. I didn't try to modify it for InnoDB.

      Attachments

        Issue Links

          Activity

            elenst Elena Stepanova created issue -
            elenst Elena Stepanova made changes -
            Field Original Value New Value
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            Description {code:sql}
            --source include/have_debug_sync.inc

            CREATE TABLE t (a int, b int) ENGINE=MyISAM;
            INSERT INTO t VALUES (1,10),(2,20);
            SET debug_sync= 'alter_table_online_progress WAIT_FOR goforit';
            --send
              ALTER TABLE t ADD c INT, ALGORITHM=COPY, LOCK=NONE;

            --connect (con1,localhost,root,,)

            UPDATE t SET b = 100;
            START TRANSACTION;
            UPDATE t SET b = 200;

            --connect (con2,localhost,root,,)
            DELETE FROM t ORDER BY a LIMIT 1;
            DELETE FROM t ORDER BY a LIMIT 1;

            --connection con1
            COMMIT;
            SET debug_sync= 'now SIGNAL goforit';

            --connection default
            --reap

            # Cleanup
            DROP TABLE t;
            --disconnect con2
            --disconnect con1
            {code}

            {code:sql|title=bb-11.0-oalter 90cf6464fae}
            mysqltest: At line 24: query 'reap' failed: ER_KEY_NOT_FOUND (1032): Can't find record in 't'
            {code}
            {noformat:title=error log}
            2023-04-13 1:51:44 4 [ERROR] mariadbd: Can't find record in 't'
            2023-04-13 1:51:44 4 [ERROR] Slave SQL: Could not execute Delete_rows_v1 event on table test.t; Can't find record in 't', Error_code: 1032; handler error HA_ERR_END_OF_FILE; the event's master log FIRST, end_log_pos 112, Internal MariaDB error code: 1032
            {noformat}
            {code:sql}
            --source include/have_debug_sync.inc

            CREATE TABLE t (a int, b int) ENGINE=MyISAM;
            INSERT INTO t VALUES (1,10),(2,20);
            SET debug_sync= 'alter_table_online_progress WAIT_FOR goforit';
            --send
              ALTER TABLE t ADD c INT, ALGORITHM=COPY, LOCK=NONE;

            --connect (con1,localhost,root,,)

            UPDATE t SET b = 100;
            START TRANSACTION;
            UPDATE t SET b = 200;

            --connect (con2,localhost,root,,)
            DELETE FROM t ORDER BY a LIMIT 1;
            DELETE FROM t ORDER BY a LIMIT 1;

            --connection con1
            COMMIT;
            SET debug_sync= 'now SIGNAL goforit';

            --connection default
            --reap

            # Cleanup
            DROP TABLE t;
            --disconnect con2
            --disconnect con1
            {code}

            {code:sql|title=bb-11.0-oalter 90cf6464fae}
            mysqltest: At line 24: query 'reap' failed: ER_KEY_NOT_FOUND (1032): Can't find record in 't'
            {code}
            {noformat:title=error log}
            2023-04-13 1:51:44 4 [ERROR] mariadbd: Can't find record in 't'
            2023-04-13 1:51:44 4 [ERROR] Slave SQL: Could not execute Delete_rows_v1 event on table test.t; Can't find record in 't', Error_code: 1032; handler error HA_ERR_END_OF_FILE; the event's master log FIRST, end_log_pos 112, Internal MariaDB error code: 1032
            {noformat}

            Reproducible with at least MyISAM and Aria. The test case is not directly applicable to InnoDB, it hits innodb_lock_wait_timeout instead. I didn't try to modify it for InnoDB.
            nikitamalyavin Nikita Malyavin made changes -
            Summary ER_KEY_NOT_FOUND upon concurrent ALTER and DML ER_KEY_NOT_FOUND upon concurrent ALTER on MyISAM and transaction
            nikitamalyavin Nikita Malyavin made changes -
            Summary ER_KEY_NOT_FOUND upon concurrent ALTER on MyISAM and transaction ER_KEY_NOT_FOUND upon concurrent ALTER and transaction
            nikitamalyavin Nikita Malyavin made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            nikitamalyavin Nikita Malyavin made changes -
            Assignee Nikita Malyavin [ nikitamalyavin ] Sergei Golubchik [ serg ]
            Status In Progress [ 3 ] In Review [ 10002 ]
            serg Sergei Golubchik made changes -
            Assignee Sergei Golubchik [ serg ] Nikita Malyavin [ nikitamalyavin ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            nikitamalyavin Nikita Malyavin made changes -
            Assignee Nikita Malyavin [ nikitamalyavin ] Sergei Golubchik [ serg ]
            Status Stalled [ 10000 ] In Review [ 10002 ]
            serg Sergei Golubchik made changes -
            Assignee Sergei Golubchik [ serg ] Nikita Malyavin [ nikitamalyavin ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            nikitamalyavin Nikita Malyavin made changes -
            Status Stalled [ 10000 ] In Testing [ 10301 ]
            ralf.gebhardt Ralf Gebhardt made changes -
            Fix Version/s 11.2 [ 28603 ]
            Fix Version/s 11.1 [ 28549 ]
            serg Sergei Golubchik made changes -
            Fix Version/s 11.2.1 [ 29034 ]
            Fix Version/s 11.2 [ 28603 ]
            Resolution Fixed [ 1 ]
            Status In Testing [ 10301 ] Closed [ 6 ]

            People

              nikitamalyavin Nikita Malyavin
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.