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

Assertion failures in select_insert::abort_result_set and mysql_load upon attempt to replace into a full table

Details

    Description

      Note: It seems the test case should have nothing to do with versioning, but I couldn't reproduce the failures on a non-versioned partitioned table, the last replace ends with ER_RECORD_FILE_FULL as expected. Possibly it's just the matter of exact data length which I failed to achieve.

      Note: The test cases are tuned for MTR, which reduces the max_heap_table_size to 1M only. The flow is scalable – to get a failure on a bigger value, e.g. default 16M, just add more REPLACEs or LOADs.

      Test case for REPLACE

      --source include/have_partition.inc
       
      CREATE TABLE t1 (
        pk INTEGER AUTO_INCREMENT,
        PRIMARY KEY (pk),
        f VARCHAR(45000)
      ) WITH SYSTEM VERSIONING ENGINE=MEMORY 
        PARTITION BY SYSTEM_TIME INTERVAL 1 YEAR (PARTITION p1 HISTORY, PARTITION pn CURRENT);
       
      INSERT INTO t1 () VALUES (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),();
       
      REPLACE INTO t1 SELECT * FROM t1;
      --error ER_RECORD_FILE_FULL
      REPLACE INTO t1 SELECT * FROM t1;
      --error ER_RECORD_FILE_FULL
      REPLACE INTO t1 SELECT * FROM t1;
       
      # Cleanup
      DROP TABLE t1;
      

      10.3 95f3c142a4

      2018-12-04  1:27:01 4 [ERROR] mysqld: The table 't1' is full
      2018-12-04  1:27:01 4 [ERROR] mysqld: The table 't1' is full
      mysqld: /data/src/10.3/sql/sql_insert.cc:4070: virtual void select_insert::abort_result_set(): Assertion `transactional_table || !changed || thd->transaction.stmt.modified_non_trans_table' failed.
      181204  1:27:01 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007ffb5977aee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
      #8  0x000055b9d05cbc29 in select_insert::abort_result_set (this=0x7ffb38015c80) at /data/src/10.3/sql/sql_insert.cc:4069
      #9  0x000055b9d0640e7c in handle_select (thd=0x7ffb38000b00, lex=0x7ffb380048e8, result=0x7ffb38015c80, setup_tables_done_option=1073741824) at /data/src/10.3/sql/sql_select.cc:391
      #10 0x000055b9d06051ce in mysql_execute_command (thd=0x7ffb38000b00) at /data/src/10.3/sql/sql_parse.cc:4833
      #11 0x000055b9d060f7cb in mysql_parse (thd=0x7ffb38000b00, rawbuf=0x7ffb38014cd8 "REPLACE INTO t1 SELECT * FROM t1", length=32, parser_state=0x7ffb541225f0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:8091
      #12 0x000055b9d05fc97f in dispatch_command (command=COM_QUERY, thd=0x7ffb38000b00, packet=0x7ffb3800b1e1 "REPLACE INTO t1 SELECT * FROM t1", packet_length=32, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1850
      #13 0x000055b9d05fb3a3 in do_command (thd=0x7ffb38000b00) at /data/src/10.3/sql/sql_parse.cc:1395
      #14 0x000055b9d07630a0 in do_handle_one_connection (connect=0x55b9d41e1c80) at /data/src/10.3/sql/sql_connect.cc:1402
      #15 0x000055b9d0762e24 in handle_one_connection (arg=0x55b9d41e1c80) at /data/src/10.3/sql/sql_connect.cc:1308
      #16 0x000055b9d0bfd41d in pfs_spawn_thread (arg=0x55b9d422e8a0) at /data/src/10.3/storage/perfschema/pfs.cc:1862
      #17 0x00007ffb5b236494 in start_thread (arg=0x7ffb54123700) at pthread_create.c:333
      #18 0x00007ffb5983793f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      Test case for LOAD

      --source include/have_partition.inc
       
      CREATE TABLE t1 (
        pk INTEGER AUTO_INCREMENT,
        PRIMARY KEY (pk),
        f VARCHAR(45000)
      ) WITH SYSTEM VERSIONING ENGINE=MEMORY 
        PARTITION BY SYSTEM_TIME INTERVAL 1 YEAR (PARTITION p1 HISTORY, PARTITION pn CURRENT);
       
      INSERT INTO t1 () VALUES (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),();
       
      SELECT * FROM t1 INTO OUTFILE 'load.data';
      LOAD DATA INFILE 'load.data' REPLACE INTO TABLE t1;
      --error ER_RECORD_FILE_FULL
      LOAD DATA INFILE 'load.data' REPLACE INTO TABLE t1;
      --error ER_RECORD_FILE_FULL
      LOAD DATA INFILE 'load.data' REPLACE INTO TABLE t1;
       
      # Cleanup
      --let $datadir= `SELECT @@datadir`
      --remove_file $datadir/test/load.data
      DROP TABLE t1;
      

      10.3 95f3c142a4

      2018-12-04  1:33:21 4 [ERROR] mysqld: The table 't1' is full
      2018-12-04  1:33:21 4 [ERROR] mysqld: The table 't1' is full
      mysqld: /data/src/10.3/sql/sql_load.cc:795: int mysql_load(THD*, const sql_exchange*, TABLE_LIST*, List<Item>&, List<Item>&, List<Item>&, enum_duplicates, bool, bool): Assertion `transactional_table || !(info.copied || info.deleted) || thd->transaction.stmt.modified_non_trans_table' failed.
      181204  1:33:21 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f228ca88ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
      #8  0x00005651cd1c0e0a in mysql_load (thd=0x7f226c000b00, ex=0x7f226c014dc8, table_list=0x7f226c014e50, fields_vars=..., set_fields=..., set_values=..., handle_duplicates=DUP_REPLACE, ignore=false, read_file_from_client=false) at /data/src/10.3/sql/sql_load.cc:794
      #9  0x00005651cd1d531c in mysql_execute_command (thd=0x7f226c000b00) at /data/src/10.3/sql/sql_parse.cc:5126
      #10 0x00005651cd1de7cb in mysql_parse (thd=0x7f226c000b00, rawbuf=0x7f226c014cd8 "LOAD DATA INFILE 'load.data' REPLACE INTO TABLE t1", length=50, parser_state=0x7f2282c005f0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:8091
      #11 0x00005651cd1cb97f in dispatch_command (command=COM_QUERY, thd=0x7f226c000b00, packet=0x7f226c00b1e1 "LOAD DATA INFILE 'load.data' REPLACE INTO TABLE t1", packet_length=50, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1850
      #12 0x00005651cd1ca3a3 in do_command (thd=0x7f226c000b00) at /data/src/10.3/sql/sql_parse.cc:1395
      #13 0x00005651cd3320a0 in do_handle_one_connection (connect=0x5651cfd92c80) at /data/src/10.3/sql/sql_connect.cc:1402
      #14 0x00005651cd331e24 in handle_one_connection (arg=0x5651cfd92c80) at /data/src/10.3/sql/sql_connect.cc:1308
      #15 0x00005651cd7cc41d in pfs_spawn_thread (arg=0x5651cfddf8a0) at /data/src/10.3/storage/perfschema/pfs.cc:1862
      #16 0x00007f228e544494 in start_thread (arg=0x7f2282c01700) at pthread_create.c:333
      #17 0x00007f228cb4593f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      No visible problems on a non-debug build.
      I couldn't check 10.2 and earlier versions, because couldn't get rid of versioning in the scenario.

      Attachments

        Issue Links

          Activity

            In 10.5 (at least) the assertion has changed just enough to make it not findable in JIRA:

            10.5 f67522ed

            mariadbd: /data/src/10.5/sql/sql_load.cc:819: int mysql_load(THD*, const sql_exchange*, TABLE_LIST*, List<Item>&, List<Item>&, List<Item>&, enum_duplicates, bool, bool): Assertion `transactional_table || !(info.copied || info.deleted) || thd->transaction->stmt.modified_non_trans_table' failed.
            200615 13:37:03 [ERROR] mysqld got signal 6 ;
             
            #6  0x00007f06c4b81e67 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x562199148d20 "transactional_table || !(info.copied || info.deleted) || thd->transaction->stmt.modified_non_trans_table", file=file@entry=0x562199148bf8 "/data/src/10.5/sql/sql_load.cc", line=line@entry=819, function=function@entry=0x562199149100 <mysql_load(THD*, sql_exchange const*, TABLE_LIST*, List<Item>&, List<Item>&, List<Item>&, enum_duplicates, bool, bool)::__PRETTY_FUNCTION__> "int mysql_load(THD*, const sql_exchange*, TABLE_LIST*, List<Item>&, List<Item>&, List<Item>&, enum_duplicates, bool, bool)") at assert.c:92
            #7  0x00007f06c4b81f12 in __GI___assert_fail (assertion=0x562199148d20 "transactional_table || !(info.copied || info.deleted) || thd->transaction->stmt.modified_non_trans_table", file=0x562199148bf8 "/data/src/10.5/sql/sql_load.cc", line=819, function=0x562199149100 <mysql_load(THD*, sql_exchange const*, TABLE_LIST*, List<Item>&, List<Item>&, List<Item>&, enum_duplicates, bool, bool)::__PRETTY_FUNCTION__> "int mysql_load(THD*, const sql_exchange*, TABLE_LIST*, List<Item>&, List<Item>&, List<Item>&, enum_duplicates, bool, bool)") at assert.c:101
            #8  0x0000562198387bac in mysql_load (thd=0x7f067c000b18, ex=0x7f067c013a80, table_list=0x7f067c013b08, fields_vars=..., set_fields=..., set_values=..., handle_duplicates=DUP_REPLACE, ignore=false, read_file_from_client=false) at /data/src/10.5/sql/sql_load.cc:818
            #9  0x000056219839dc7e in mysql_execute_command (thd=0x7f067c000b18) at /data/src/10.5/sql/sql_parse.cc:5003
            #10 0x00005621983a786b in mysql_parse (thd=0x7f067c000b18, rawbuf=0x7f067c013950 "LOAD /* QNO 30738 CON_ID 10 */ DATA INFILE 'load_t9_HEAP' REPLACE INTO TABLE t9_HEAP", length=84, parser_state=0x7f06b6afa520, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:7992
            #11 0x0000562198393bf1 in dispatch_command (command=COM_QUERY, thd=0x7f067c000b18, packet=0x7f067c171759 "LOAD /* QNO 30738 CON_ID 10 */ DATA INFILE 'load_t9_HEAP' REPLACE INTO TABLE t9_HEAP", packet_length=84, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:1875
            #12 0x0000562198392329 in do_command (thd=0x7f067c000b18) at /data/src/10.5/sql/sql_parse.cc:1356
            #13 0x0000562198536307 in do_handle_one_connection (connect=0x56219d65c538, put_in_cache=true) at /data/src/10.5/sql/sql_connect.cc:1411
            #14 0x000056219853606f in handle_one_connection (arg=0x56219d65c538) at /data/src/10.5/sql/sql_connect.cc:1313
            #15 0x0000562198a6cfdc in pfs_spawn_thread (arg=0x56219d671de8) at /data/src/10.5/storage/perfschema/pfs.cc:2201
            #16 0x00007f06c6b0a4a4 in start_thread (arg=0x7f06b6afb700) at pthread_create.c:456
            #17 0x00007f06c4c3ed0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
            

            elenst Elena Stepanova added a comment - In 10.5 (at least) the assertion has changed just enough to make it not findable in JIRA: 10.5 f67522ed mariadbd: /data/src/10.5/sql/sql_load.cc:819: int mysql_load(THD*, const sql_exchange*, TABLE_LIST*, List<Item>&, List<Item>&, List<Item>&, enum_duplicates, bool, bool): Assertion `transactional_table || !(info.copied || info.deleted) || thd->transaction->stmt.modified_non_trans_table' failed. 200615 13:37:03 [ERROR] mysqld got signal 6 ;   #6 0x00007f06c4b81e67 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x562199148d20 "transactional_table || !(info.copied || info.deleted) || thd->transaction->stmt.modified_non_trans_table", file=file@entry=0x562199148bf8 "/data/src/10.5/sql/sql_load.cc", line=line@entry=819, function=function@entry=0x562199149100 <mysql_load(THD*, sql_exchange const*, TABLE_LIST*, List<Item>&, List<Item>&, List<Item>&, enum_duplicates, bool, bool)::__PRETTY_FUNCTION__> "int mysql_load(THD*, const sql_exchange*, TABLE_LIST*, List<Item>&, List<Item>&, List<Item>&, enum_duplicates, bool, bool)") at assert.c:92 #7 0x00007f06c4b81f12 in __GI___assert_fail (assertion=0x562199148d20 "transactional_table || !(info.copied || info.deleted) || thd->transaction->stmt.modified_non_trans_table", file=0x562199148bf8 "/data/src/10.5/sql/sql_load.cc", line=819, function=0x562199149100 <mysql_load(THD*, sql_exchange const*, TABLE_LIST*, List<Item>&, List<Item>&, List<Item>&, enum_duplicates, bool, bool)::__PRETTY_FUNCTION__> "int mysql_load(THD*, const sql_exchange*, TABLE_LIST*, List<Item>&, List<Item>&, List<Item>&, enum_duplicates, bool, bool)") at assert.c:101 #8 0x0000562198387bac in mysql_load (thd=0x7f067c000b18, ex=0x7f067c013a80, table_list=0x7f067c013b08, fields_vars=..., set_fields=..., set_values=..., handle_duplicates=DUP_REPLACE, ignore=false, read_file_from_client=false) at /data/src/10.5/sql/sql_load.cc:818 #9 0x000056219839dc7e in mysql_execute_command (thd=0x7f067c000b18) at /data/src/10.5/sql/sql_parse.cc:5003 #10 0x00005621983a786b in mysql_parse (thd=0x7f067c000b18, rawbuf=0x7f067c013950 "LOAD /* QNO 30738 CON_ID 10 */ DATA INFILE 'load_t9_HEAP' REPLACE INTO TABLE t9_HEAP", length=84, parser_state=0x7f06b6afa520, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:7992 #11 0x0000562198393bf1 in dispatch_command (command=COM_QUERY, thd=0x7f067c000b18, packet=0x7f067c171759 "LOAD /* QNO 30738 CON_ID 10 */ DATA INFILE 'load_t9_HEAP' REPLACE INTO TABLE t9_HEAP", packet_length=84, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:1875 #12 0x0000562198392329 in do_command (thd=0x7f067c000b18) at /data/src/10.5/sql/sql_parse.cc:1356 #13 0x0000562198536307 in do_handle_one_connection (connect=0x56219d65c538, put_in_cache=true) at /data/src/10.5/sql/sql_connect.cc:1411 #14 0x000056219853606f in handle_one_connection (arg=0x56219d65c538) at /data/src/10.5/sql/sql_connect.cc:1313 #15 0x0000562198a6cfdc in pfs_spawn_thread (arg=0x56219d671de8) at /data/src/10.5/storage/perfschema/pfs.cc:2201 #16 0x00007f06c6b0a4a4 in start_thread (arg=0x7f06b6afb700) at pthread_create.c:456 #17 0x00007f06c4c3ed0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
            nikitamalyavin Nikita Malyavin added a comment - - edited

            midenok unfortunately engine=memory is essential to reproduce – it has to fail with ER_RECORD_FILE_FULL because of reduced max_heap_table_size

            nikitamalyavin Nikita Malyavin added a comment - - edited midenok unfortunately engine=memory is essential to reproduce – it has to fail with ER_RECORD_FILE_FULL because of reduced max_heap_table_size

            People

              nikitamalyavin Nikita Malyavin
              elenst Elena Stepanova
              Votes:
              0 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.