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

Assertion `row_get_rec_trx_id(rec, clust_index, offsets) == node->trx->id' failed in row_undo_search_clust_to_pcur upon altering a sequence

Details

    Description

      --source include/have_innodb.inc
      CREATE SEQUENCE a ENGINE=InnoDB ;
      CREATE TEMPORARY SEQUENCE b ENGINE=InnoDB;
      ALTER SEQUENCE IF EXISTS a RESTART WITH 0;
      

      10.3 86b941703

      mysqld: /data/src/10.3/storage/innobase/row/row0undo.cc:196: bool row_undo_search_clust_to_pcur(undo_node_t*): Assertion `row_get_rec_trx_id(rec, clust_index, offsets) == node->trx->id' failed.
      170607 10:32:53 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f0e5573aee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
      #8  0x00005605799f323a in row_undo_search_clust_to_pcur (node=0x7f0dfc036c38) at /data/src/10.3/storage/innobase/row/row0undo.cc:195
      #9  0x0000560579be29b3 in row_undo_ins_parse_undo_rec (node=0x7f0dfc036c38, dict_locked=0) at /data/src/10.3/storage/innobase/row/row0uins.cc:372
      #10 0x0000560579be2d23 in row_undo_ins (node=0x7f0dfc036c38, thr=0x7f0dfc036a80) at /data/src/10.3/storage/innobase/row/row0uins.cc:474
      #11 0x00005605799f3638 in row_undo (node=0x7f0dfc036c38, thr=0x7f0dfc036a80) at /data/src/10.3/storage/innobase/row/row0undo.cc:296
      #12 0x00005605799f3785 in row_undo_step (thr=0x7f0dfc036a80) at /data/src/10.3/storage/innobase/row/row0undo.cc:342
      #13 0x0000560579952a0b in que_thr_step (thr=0x7f0dfc036a80) at /data/src/10.3/storage/innobase/que/que0que.cc:1051
      #14 0x0000560579952c25 in que_run_threads_low (thr=0x7f0dfc036a80) at /data/src/10.3/storage/innobase/que/que0que.cc:1115
      #15 0x0000560579952dce in que_run_threads (thr=0x7f0dfc036a80) at /data/src/10.3/storage/innobase/que/que0que.cc:1155
      #16 0x0000560579a54abe in trx_rollback_to_savepoint_low (trx=0x7f0e4b3fe8c8, savept=0x0) at /data/src/10.3/storage/innobase/trx/trx0roll.cc:118
      #17 0x0000560579a54e28 in trx_rollback_for_mysql_low (trx=0x7f0e4b3fe8c8) at /data/src/10.3/storage/innobase/trx/trx0roll.cc:180
      #18 0x0000560579a55112 in trx_rollback_low (trx=0x7f0e4b3fe8c8) at /data/src/10.3/storage/innobase/trx/trx0roll.cc:212
      #19 0x0000560579a55449 in trx_rollback_for_mysql (trx=0x7f0e4b3fe8c8) at /data/src/10.3/storage/innobase/trx/trx0roll.cc:288
      #20 0x000056057985d77b in innobase_rollback (hton=0x56057b9b4a00, thd=0x7f0dfc000b00, rollback_trx=false) at /data/src/10.3/storage/innobase/handler/ha_innodb.cc:4816
      #21 0x00005605795532ae in ha_rollback_trans (thd=0x7f0dfc000b00, all=false) at /data/src/10.3/sql/handler.cc:1662
      #22 0x00005605793ff43c in trans_rollback_stmt (thd=0x7f0dfc000b00) at /data/src/10.3/sql/transaction.cc:566
      #23 0x00005605792ab048 in mysql_execute_command (thd=0x7f0dfc000b00) at /data/src/10.3/sql/sql_parse.cc:6275
      #24 0x00005605792af860 in mysql_parse (thd=0x7f0dfc000b00, rawbuf=0x7f0dfc0148c8 "ALTER SEQUENCE IF EXISTS a RESTART WITH 0", length=41, parser_state=0x7f0e48345200, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7927
      #25 0x000056057929d518 in dispatch_command (command=COM_QUERY, thd=0x7f0dfc000b00, packet=0x7f0dfc08f811 "ALTER SEQUENCE IF EXISTS a RESTART WITH 0", packet_length=41, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1817
      #26 0x000056057929bec1 in do_command (thd=0x7f0dfc000b00) at /data/src/10.3/sql/sql_parse.cc:1380
      #27 0x00005605793e93f4 in do_handle_one_connection (connect=0x56057bfc1a60) at /data/src/10.3/sql/sql_connect.cc:1354
      #28 0x00005605793e9181 in handle_one_connection (arg=0x56057bfc1a60) at /data/src/10.3/sql/sql_connect.cc:1260
      #29 0x0000560579845a8d in pfs_spawn_thread (arg=0x56057bf086f0) at /data/src/10.3/storage/perfschema/pfs.cc:1862
      #30 0x00007f0e57474494 in start_thread (arg=0x7f0e48346700) at pthread_create.c:333
      #31 0x00007f0e557f793f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      Also reproducible on bb-10.2-ext 3d428e017d.

      Attachments

        Issue Links

          Activity

            elenst, apparently this has been changed in the SQL layer. I currently get this:

            mysqltest: At line 4: query 'ALTER SEQUENCE IF EXISTS a RESTART WITH 0' failed: 4085: Sequence 'test.a' values are conflicting
            

            For what it is worth, ALTER SEQUENCE should always use the ALGORITHM=COPY path (similar to CREATE SEQUENCE, I assume).
            The crash on rollback should have been fixed very early (maybe already in 10.3.1, and for sure by 10.3.2). There were some bugs that InnoDB was writing undo log for inserting the sequence state record. It is not supposed to do that; there specifically is no undo logging.

            marko Marko Mäkelä added a comment - elenst , apparently this has been changed in the SQL layer. I currently get this: mysqltest: At line 4: query 'ALTER SEQUENCE IF EXISTS a RESTART WITH 0' failed: 4085: Sequence 'test.a' values are conflicting For what it is worth, ALTER SEQUENCE should always use the ALGORITHM=COPY path (similar to CREATE SEQUENCE, I assume). The crash on rollback should have been fixed very early (maybe already in 10.3.1, and for sure by 10.3.2). There were some bugs that InnoDB was writing undo log for inserting the sequence state record. It is not supposed to do that; there specifically is no undo logging.

            The assertion failure disappeared from bb-10.2-ext after this commit:

            commit 773c3ceb573ea5ae8506237d3648412251ce02e7
            Author: Marko Mäkelä <marko.makela@mariadb.com>
            Date:   Thu Jan 11 15:39:36 2018 +0200
             
                MDEV-14824 Assertion `!trx_is_started(trx)' failed in innobase_start_trx_and_assign_read_view
                
                In CREATE SEQUENCE or CREATE TEMPORARY SEQUENCE, we should not start
                an InnoDB transaction for inserting the sequence status record into
                the underlying no-rollback table. Because we did this, a debug assertion
                failure would fail in START TRANSACTION WITH CONSISTENT SNAPSHOT after
                CREATE TEMPORARY SEQUENCE was executed.
                
                row_ins_step(): Do not start the transaction. Let the caller do that.
                
                que_thr_step(): Start the transaction before calling row_ins_step().
                
                row_ins_clust_index_entry(): Skip locking and undo logging for no-rollback
                tables, even for temporary no-rollback tables.
                
                row_ins_index_entry(): Allow trx->id==0 for no-rollback tables.
                
                row_insert_for_mysql(): Do not start a transaction for no-rollback tables.
            

            elenst Elena Stepanova added a comment - The assertion failure disappeared from bb-10.2-ext after this commit: commit 773c3ceb573ea5ae8506237d3648412251ce02e7 Author: Marko Mäkelä <marko.makela@mariadb.com> Date: Thu Jan 11 15:39:36 2018 +0200   MDEV-14824 Assertion `!trx_is_started(trx)' failed in innobase_start_trx_and_assign_read_view In CREATE SEQUENCE or CREATE TEMPORARY SEQUENCE, we should not start an InnoDB transaction for inserting the sequence status record into the underlying no-rollback table. Because we did this, a debug assertion failure would fail in START TRANSACTION WITH CONSISTENT SNAPSHOT after CREATE TEMPORARY SEQUENCE was executed. row_ins_step(): Do not start the transaction. Let the caller do that. que_thr_step(): Start the transaction before calling row_ins_step(). row_ins_clust_index_entry(): Skip locking and undo logging for no-rollback tables, even for temporary no-rollback tables. row_ins_index_entry(): Allow trx->id==0 for no-rollback tables. row_insert_for_mysql(): Do not start a transaction for no-rollback tables.

            People

              elenst Elena Stepanova
              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.