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

Assertion `!trx_is_started(trx)' failed in innobase_start_trx_and_assign_read_view

Details

    Description

      --source include/have_innodb.inc
       
      CREATE OR REPLACE TEMPORARY SEQUENCE seq ENGINE=InnoDB;
      START TRANSACTION WITH CONSISTENT SNAPSHOT;
       
      # Cleanup
      COMMIT;
      DROP SEQUENCE seq;
      

      10.3 1761e382088

      mysqld: /data/src/10.3/storage/innobase/handler/ha_innodb.cc:4350: int innobase_start_trx_and_assign_read_view(handlerton*, THD*): Assertion `!trx_is_started(trx)' failed.
      171231  0:39:53 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007fb562b05ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
      #8  0x000055c61fef9917 in innobase_start_trx_and_assign_read_view (hton=0x55c623615350, thd=0x7fb508000b00) at /data/src/10.3/storage/innobase/handler/ha_innodb.cc:4350
      #9  0x000055c61fbd36bc in snapshot_handlerton (thd=0x7fb508000b00, plugin=0x7fb508035970, arg=0x7fb55c11247e) at /data/src/10.3/sql/handler.cc:2346
      #10 0x000055c61f91c52b in plugin_foreach_with_mask (thd=0x7fb508000b00, func=0x55c61fbd3663 <snapshot_handlerton(THD*, plugin_ref, void*)>, type=1, state_mask=8, arg=0x7fb55c11247e) at /data/src/10.3/sql/sql_plugin.cc:2429
      #11 0x000055c61fbd3729 in ha_start_consistent_snapshot (thd=0x7fb508000b00) at /data/src/10.3/sql/handler.cc:2365
      #12 0x000055c61fa67931 in trans_begin (thd=0x7fb508000b00, flags=1) at /data/src/10.3/sql/transaction.cc:277
      #13 0x000055c61f907eaf in mysql_execute_command (thd=0x7fb508000b00) at /data/src/10.3/sql/sql_parse.cc:5737
      #14 0x000055c61f90e53a in mysql_parse (thd=0x7fb508000b00, rawbuf=0x7fb508014b58 "START TRANSACTION WITH CONSISTENT SNAPSHOT", length=42, parser_state=0x7fb55c113610, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7966
      #15 0x000055c61f8fbeaf in dispatch_command (command=COM_QUERY, thd=0x7fb508000b00, packet=0x7fb50800b061 "START TRANSACTION WITH CONSISTENT SNAPSHOT", packet_length=42, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1824
      #16 0x000055c61f8fa8e3 in do_command (thd=0x7fb508000b00) at /data/src/10.3/sql/sql_parse.cc:1369
      #17 0x000055c61fa5435a in do_handle_one_connection (connect=0x55c623c0d0e0) at /data/src/10.3/sql/sql_connect.cc:1420
      #18 0x000055c61fa540e7 in handle_one_connection (arg=0x55c623c0d0e0) at /data/src/10.3/sql/sql_connect.cc:1326
      #19 0x000055c61fee11e6 in pfs_spawn_thread (arg=0x55c623b672a0) at /data/src/10.3/storage/perfschema/pfs.cc:1863
      #20 0x00007fb5647dc494 in start_thread (arg=0x7fb55c114700) at pthread_create.c:333
      #21 0x00007fb562bc293f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      Attachments

        Issue Links

          Activity

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

            CREATE OR REPLACE TEMPORARY SEQUENCE seq ENGINE=InnoDB;
            START TRANSACTION WITH CONSISTENT SNAPSHOT;

            # Cleanup
            COMMIT;
            DROP SEQUENCE s;
            {code}
            {noformat:title=10.3 1761e382088}
            mysqld: /data/src/10.3/storage/innobase/handler/ha_innodb.cc:4350: int innobase_start_trx_and_assign_read_view(handlerton*, THD*): Assertion `!trx_is_started(trx)' failed.
            171231 0:39:53 [ERROR] mysqld got signal 6 ;

            #7 0x00007fb562b05ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
            #8 0x000055c61fef9917 in innobase_start_trx_and_assign_read_view (hton=0x55c623615350, thd=0x7fb508000b00) at /data/src/10.3/storage/innobase/handler/ha_innodb.cc:4350
            #9 0x000055c61fbd36bc in snapshot_handlerton (thd=0x7fb508000b00, plugin=0x7fb508035970, arg=0x7fb55c11247e) at /data/src/10.3/sql/handler.cc:2346
            #10 0x000055c61f91c52b in plugin_foreach_with_mask (thd=0x7fb508000b00, func=0x55c61fbd3663 <snapshot_handlerton(THD*, plugin_ref, void*)>, type=1, state_mask=8, arg=0x7fb55c11247e) at /data/src/10.3/sql/sql_plugin.cc:2429
            #11 0x000055c61fbd3729 in ha_start_consistent_snapshot (thd=0x7fb508000b00) at /data/src/10.3/sql/handler.cc:2365
            #12 0x000055c61fa67931 in trans_begin (thd=0x7fb508000b00, flags=1) at /data/src/10.3/sql/transaction.cc:277
            #13 0x000055c61f907eaf in mysql_execute_command (thd=0x7fb508000b00) at /data/src/10.3/sql/sql_parse.cc:5737
            #14 0x000055c61f90e53a in mysql_parse (thd=0x7fb508000b00, rawbuf=0x7fb508014b58 "START TRANSACTION WITH CONSISTENT SNAPSHOT", length=42, parser_state=0x7fb55c113610, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7966
            #15 0x000055c61f8fbeaf in dispatch_command (command=COM_QUERY, thd=0x7fb508000b00, packet=0x7fb50800b061 "START TRANSACTION WITH CONSISTENT SNAPSHOT", packet_length=42, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1824
            #16 0x000055c61f8fa8e3 in do_command (thd=0x7fb508000b00) at /data/src/10.3/sql/sql_parse.cc:1369
            #17 0x000055c61fa5435a in do_handle_one_connection (connect=0x55c623c0d0e0) at /data/src/10.3/sql/sql_connect.cc:1420
            #18 0x000055c61fa540e7 in handle_one_connection (arg=0x55c623c0d0e0) at /data/src/10.3/sql/sql_connect.cc:1326
            #19 0x000055c61fee11e6 in pfs_spawn_thread (arg=0x55c623b672a0) at /data/src/10.3/storage/perfschema/pfs.cc:1863
            #20 0x00007fb5647dc494 in start_thread (arg=0x7fb55c114700) at pthread_create.c:333
            #21 0x00007fb562bc293f in clone () from /lib/x86_64-linux-gnu/libc.so.6
            {noformat}
            {code:sql}
            --source include/have_innodb.inc

            CREATE OR REPLACE TEMPORARY SEQUENCE seq ENGINE=InnoDB;
            START TRANSACTION WITH CONSISTENT SNAPSHOT;

            # Cleanup
            COMMIT;
            DROP SEQUENCE seq;
            {code}
            {noformat:title=10.3 1761e382088}
            mysqld: /data/src/10.3/storage/innobase/handler/ha_innodb.cc:4350: int innobase_start_trx_and_assign_read_view(handlerton*, THD*): Assertion `!trx_is_started(trx)' failed.
            171231 0:39:53 [ERROR] mysqld got signal 6 ;

            #7 0x00007fb562b05ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
            #8 0x000055c61fef9917 in innobase_start_trx_and_assign_read_view (hton=0x55c623615350, thd=0x7fb508000b00) at /data/src/10.3/storage/innobase/handler/ha_innodb.cc:4350
            #9 0x000055c61fbd36bc in snapshot_handlerton (thd=0x7fb508000b00, plugin=0x7fb508035970, arg=0x7fb55c11247e) at /data/src/10.3/sql/handler.cc:2346
            #10 0x000055c61f91c52b in plugin_foreach_with_mask (thd=0x7fb508000b00, func=0x55c61fbd3663 <snapshot_handlerton(THD*, plugin_ref, void*)>, type=1, state_mask=8, arg=0x7fb55c11247e) at /data/src/10.3/sql/sql_plugin.cc:2429
            #11 0x000055c61fbd3729 in ha_start_consistent_snapshot (thd=0x7fb508000b00) at /data/src/10.3/sql/handler.cc:2365
            #12 0x000055c61fa67931 in trans_begin (thd=0x7fb508000b00, flags=1) at /data/src/10.3/sql/transaction.cc:277
            #13 0x000055c61f907eaf in mysql_execute_command (thd=0x7fb508000b00) at /data/src/10.3/sql/sql_parse.cc:5737
            #14 0x000055c61f90e53a in mysql_parse (thd=0x7fb508000b00, rawbuf=0x7fb508014b58 "START TRANSACTION WITH CONSISTENT SNAPSHOT", length=42, parser_state=0x7fb55c113610, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7966
            #15 0x000055c61f8fbeaf in dispatch_command (command=COM_QUERY, thd=0x7fb508000b00, packet=0x7fb50800b061 "START TRANSACTION WITH CONSISTENT SNAPSHOT", packet_length=42, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1824
            #16 0x000055c61f8fa8e3 in do_command (thd=0x7fb508000b00) at /data/src/10.3/sql/sql_parse.cc:1369
            #17 0x000055c61fa5435a in do_handle_one_connection (connect=0x55c623c0d0e0) at /data/src/10.3/sql/sql_connect.cc:1420
            #18 0x000055c61fa540e7 in handle_one_connection (arg=0x55c623c0d0e0) at /data/src/10.3/sql/sql_connect.cc:1326
            #19 0x000055c61fee11e6 in pfs_spawn_thread (arg=0x55c623b672a0) at /data/src/10.3/storage/perfschema/pfs.cc:1863
            #20 0x00007fb5647dc494 in start_thread (arg=0x7fb55c114700) at pthread_create.c:333
            #21 0x00007fb562bc293f in clone () from /lib/x86_64-linux-gnu/libc.so.6
            {noformat}
            marko Marko Mäkelä made changes -
            Status Open [ 1 ] Confirmed [ 10101 ]
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            Status Confirmed [ 10101 ] In Progress [ 3 ]

            The CREATE SEQUENCE starts two transactions. The first one is an internal one, inside row_table_add_foreign_constraints() executed inside ha_innobase::create().

            The problem is the second transaction that CREATE SEQUENCE is creating, for inserting the initial value, in row_insert_for_mysql(). Because the table should internally skip any transactional processing, that transaction should not have been started in the first place. Because this transaction will not be committed, the assertion in START TRANSACTION WITH CONSISTENT SNAPSHOT will fail. I think that in all other places, InnoDB does the questionable trx_start_if_not_started_xa_low().

            marko Marko Mäkelä added a comment - The CREATE SEQUENCE starts two transactions. The first one is an internal one, inside row_table_add_foreign_constraints() executed inside ha_innobase::create() . The problem is the second transaction that CREATE SEQUENCE is creating, for inserting the initial value, in row_insert_for_mysql() . Because the table should internally skip any transactional processing, that transaction should not have been started in the first place. Because this transaction will not be committed, the assertion in START TRANSACTION WITH CONSISTENT SNAPSHOT will fail. I think that in all other places, InnoDB does the questionable trx_start_if_not_started_xa_low() .
            marko Marko Mäkelä made changes -
            issue.field.resolutiondate 2018-01-11 14:35:52.0 2018-01-11 14:35:52.704
            marko Marko Mäkelä made changes -
            Fix Version/s 10.3.4 [ 22904 ]
            Fix Version/s 10.3 [ 22126 ]
            Resolution Fixed [ 1 ]
            Status In Progress [ 3 ] Closed [ 6 ]
            marko Marko Mäkelä made changes -
            Affects Version/s 10.3.0 [ 22127 ]
            Affects Version/s 10.3 [ 22126 ]
            monty Michael Widenius made changes -
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 84674 ] MariaDB v4 [ 153476 ]

            People

              marko Marko Mäkelä
              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.