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

          Activity

            People

            • Assignee:
              serg Sergei Golubchik
              Reporter:
              elenst Elena Stepanova
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: