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

Assertion `table->file->stats.records > 0 || error' failed in join_read_const_table or wrong result upon INSERT into Aria table

    XMLWordPrintable

Details

    Description

      CREATE TABLE t1 (a INT) ENGINE=Aria;
       
      --connect (con1,localhost,root,,test)
      LOCK TABLE t1 WRITE;
      SELECT * INTO OUTFILE 'load.data' FROM t1;
      LOAD DATA INFILE 'load.data' INTO TABLE t1;
      INSERT INTO t1 VALUES (1),(2);
       
      --connection default
      --send
        INSERT INTO t1 SELECT * FROM t1;
       
      # Cleanup
      --connection con1
      UNLOCK TABLES;
      --disconnect con1
      --connection default
      --reap
       
      SELECT * FROM t1;
      DROP TABLE t1;
      --let $datadir= `SELECT @@datadir`
      --remove_file $datadir/test/load.data
      

      10.1 82524239c4

      mysqld: /data/src/10.1/sql/sql_select.cc:18915: int join_read_const_table(THD*, JOIN_TAB*, POSITION*): Assertion `table->file->stats.records > 0 || error' failed.
      180928  0:58:46 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007fef3b906ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
      #8  0x000055648cf65117 in join_read_const_table (thd=0x7fef348d5070, tab=0x7fef32c44718, pos=0x7fef32c44c68) at /data/src/10.1/sql/sql_select.cc:18915
      #9  0x000055648cf3fd1b in make_join_statistics (join=0x7fef32c43fd8, tables_list=..., keyuse_array=0x7fef32c44318) at /data/src/10.1/sql/sql_select.cc:3824
      #10 0x000055648cf37511 in JOIN::optimize_inner (this=0x7fef32c43fd8) at /data/src/10.1/sql/sql_select.cc:1403
      #11 0x000055648cf361c0 in JOIN::optimize (this=0x7fef32c43fd8) at /data/src/10.1/sql/sql_select.cc:1058
      #12 0x000055648cf3eb3e in mysql_select (thd=0x7fef348d5070, rref_pointer_array=0x7fef348d9550, tables=0x7fef32c438a8, wild_num=1, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=3489925888, result=0x7fef32c43f38, unit=0x7fef348d8ba8, select_lex=0x7fef348d92a8) at /data/src/10.1/sql/sql_select.cc:3485
      #13 0x000055648cf3428a in handle_select (thd=0x7fef348d5070, lex=0x7fef348d8ae0, result=0x7fef32c43f38, setup_tables_done_option=1073741824) at /data/src/10.1/sql/sql_select.cc:388
      #14 0x000055648cefd0af in mysql_execute_command (thd=0x7fef348d5070) at /data/src/10.1/sql/sql_parse.cc:4039
      #15 0x000055648cf0785d in mysql_parse (thd=0x7fef348d5070, rawbuf=0x7fef32c43088 "INSERT INTO t1 SELECT * FROM t1", length=31, parser_state=0x7fef3d98a5e0) at /data/src/10.1/sql/sql_parse.cc:7465
      #16 0x000055648cef60cf in dispatch_command (command=COM_QUERY, thd=0x7fef348d5070, packet=0x7fef373f9071 "INSERT INTO t1 SELECT * FROM t1", packet_length=31) at /data/src/10.1/sql/sql_parse.cc:1495
      #17 0x000055648cef4e54 in do_command (thd=0x7fef348d5070) at /data/src/10.1/sql/sql_parse.cc:1124
      #18 0x000055648d02f827 in do_handle_one_connection (thd_arg=0x7fef348d5070) at /data/src/10.1/sql/sql_connect.cc:1330
      #19 0x000055648d02f58b in handle_one_connection (arg=0x7fef348d5070) at /data/src/10.1/sql/sql_connect.cc:1242
      #20 0x000055648d3ede1c in pfs_spawn_thread (arg=0x7fef3b039ef0) at /data/src/10.1/storage/perfschema/pfs.cc:1861
      #21 0x00007fef3d60a494 in start_thread (arg=0x7fef3d98bb00) at pthread_create.c:333
      #22 0x00007fef3b9c393f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      Not reproducible with MyISAM or InnoDB.

      Non-debug build doesn't crash, but it produces a questionable table contents which is returned by SELECT in the test case:

      SELECT * FROM t1;
      a
      1
      2
      1
      

      Since the INSERT .. SELECT doesn't fail, it's reasonable to expect 4 rows in the table.

      Attachments

        Issue Links

          Activity

            People

              monty Michael Widenius
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.