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

Assertion in ha_maria::close() upon complex SELECT from specific data

    Details

      Description

      Assertion `file->trn == 0 || file->trn == &dummy_transaction_object' failed in ha_maria::close

      --source include/have_partition.inc
       
      CREATE TABLE t1 (
          pk INT AUTO_INCREMENT,
          a INT,
          b VARCHAR(1),
          PRIMARY KEY (pk),
          KEY (a),
          KEY (b, a)
      ) ENGINE=Aria
        WITH SYSTEM VERSIONING
        PARTITION BY system_time (PARTITION p1 HISTORY, PARTITION pn CURRENT);
       
      INSERT INTO t1 (a, b) VALUES
      (3,'u'),(1,'x'),(4,'l'),(3,'p'),(1,'i'),(NULL,'u'),(97,'i'),(0,'i'),
      (0,'e'),(9,'h'),(5,'f'),(9,NULL),(0,'p'),(2,'n'),(172,'h'),(NULL,'m'),
      (5,'x'),(119,'d'),(1,'d'),(4,'t'),(8,NULL),(NULL,NULL),(6,'v'),(5,'u'),
      (5,'p'),(1,'o'),(7,'v'),(2,'m'),(8,'x'),(9,'n'),(NULL,'b'),(NULL,NULL),
      (3,'r'),(172,'v'),(NULL,'a'),(6,'u'),(6,NULL),(5,'b'),(4,'s'),(3,'t'),
      (2,'b'),(7,'m'),(4,'v'),(6,'n'),(0,'j'),(8,NULL),(5,NULL),(8,'h'),
      (2,'k'),(0,'s');
       
      SELECT a, COUNT(*) FROM t1 WHERE b IN ('d') OR pk < 100 GROUP BY a HAVING a = 0;
       
      # Cleanup
      DROP TABLE t1;
      

      10.4 4d538250

      mysqld: /data/src/10.4/storage/maria/ha_maria.cc:1226: virtual int ha_maria::close(): Assertion `file->trn == 0 || file->trn == &dummy_transaction_object' failed.
      190818 21:00:18 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f9a75605f12 in __GI___assert_fail (assertion=0x55f73dabc250 "file->trn == 0 || file->trn == &dummy_transaction_object", file=0x55f73dabbeb0 "/data/src/10.4/storage/maria/ha_maria.cc", line=1226, function=0x55f73dabd100 <ha_maria::close()::__PRETTY_FUNCTION__> "virtual int ha_maria::close()") at assert.c:101
      #8  0x000055f73d4a4872 in ha_maria::close (this=0x7f9a54184d78) at /data/src/10.4/storage/maria/ha_maria.cc:1226
      #9  0x000055f73ceb0880 in handler::ha_close (this=0x7f9a54184d78) at /data/src/10.4/sql/handler.cc:2820
      #10 0x000055f73d62df0f in ha_partition::close (this=0x7f9a54183d48) at /data/src/10.4/sql/ha_partition.cc:3847
      #11 0x000055f73ceb0880 in handler::ha_close (this=0x7f9a54183d48) at /data/src/10.4/sql/handler.cc:2820
      #12 0x000055f73d012e13 in QUICK_RANGE_SELECT::~QUICK_RANGE_SELECT (this=0x7f9a54183950, __in_chrg=<optimized out>) at /data/src/10.4/sql/opt_range.cc:1342
      #13 0x000055f73d012eb6 in QUICK_RANGE_SELECT::~QUICK_RANGE_SELECT (this=0x7f9a54183950, __in_chrg=<optimized out>) at /data/src/10.4/sql/opt_range.cc:1351
      #14 0x000055f73d03b735 in List<QUICK_SELECT_I>::delete_elements (this=0x7f9a54183890) at /data/src/10.4/sql/sql_list.h:524
      #15 0x000055f73d0145cd in QUICK_ROR_UNION_SELECT::~QUICK_ROR_UNION_SELECT (this=0x7f9a54183850, __in_chrg=<optimized out>) at /data/src/10.4/sql/opt_range.cc:1845
      #16 0x000055f73d01464a in QUICK_ROR_UNION_SELECT::~QUICK_ROR_UNION_SELECT (this=0x7f9a54183850, __in_chrg=<optimized out>) at /data/src/10.4/sql/opt_range.cc:1850
      #17 0x000055f73d01287b in SQL_SELECT::cleanup (this=0x7f9a541a2090) at /data/src/10.4/sql/opt_range.cc:1225
      #18 0x000055f73d012904 in SQL_SELECT::~SQL_SELECT (this=0x7f9a541a2090, __in_chrg=<optimized out>) at /data/src/10.4/sql/opt_range.cc:1239
      #19 0x000055f73cbd6bd2 in st_join_table::cleanup (this=0x7f9a540183d0) at /data/src/10.4/sql/sql_select.cc:13163
      #20 0x000055f73cbd7d7f in JOIN::cleanup (this=0x7f9a540157f8, full=true) at /data/src/10.4/sql/sql_select.cc:13605
      #21 0x000055f73cbd7a1f in JOIN::join_free (this=0x7f9a540157f8) at /data/src/10.4/sql/sql_select.cc:13508
      #22 0x000055f73cbe8309 in do_select (join=0x7f9a540157f8, procedure=0x0) at /data/src/10.4/sql/sql_select.cc:19756
      #23 0x000055f73cbbe2f7 in JOIN::exec_inner (this=0x7f9a540157f8) at /data/src/10.4/sql/sql_select.cc:4419
      #24 0x000055f73cbbd4a4 in JOIN::exec (this=0x7f9a540157f8) at /data/src/10.4/sql/sql_select.cc:4201
      #25 0x000055f73cbbeb49 in mysql_select (thd=0x7f9a54000b00, tables=0x7f9a540139e8, wild_num=0, fields=..., conds=0x7f9a54014888, og_num=1, order=0x0, group=0x7f9a54014ab0, having=0x7f9a54014ca8, proc_param=0x0, select_options=2147748608, result=0x7f9a540157d0, unit=0x7f9a54004a30, select_lex=0x7f9a54013228) at /data/src/10.4/sql/sql_select.cc:4633
      #26 0x000055f73cbaef2a in handle_select (thd=0x7f9a54000b00, lex=0x7f9a54004968, result=0x7f9a540157d0, setup_tables_done_option=0) at /data/src/10.4/sql/sql_select.cc:425
      #27 0x000055f73cb78549 in execute_sqlcom_select (thd=0x7f9a54000b00, all_tables=0x7f9a540139e8) at /data/src/10.4/sql/sql_parse.cc:6356
      #28 0x000055f73cb6e390 in mysql_execute_command (thd=0x7f9a54000b00) at /data/src/10.4/sql/sql_parse.cc:3898
      #29 0x000055f73cb7c2dd in mysql_parse (thd=0x7f9a54000b00, rawbuf=0x7f9a54013128 "SELECT a, COUNT(*) FROM t1 WHERE b IN ('d') OR pk < 100 GROUP BY a HAVING a = 0", length=79, parser_state=0x7f9a6b7b2170, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7908
      #30 0x000055f73cb68586 in dispatch_command (command=COM_QUERY, thd=0x7f9a54000b00, packet=0x7f9a54008331 "", packet_length=79, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1843
      #31 0x000055f73cb66ccc in do_command (thd=0x7f9a54000b00) at /data/src/10.4/sql/sql_parse.cc:1360
      #32 0x000055f73cce0e00 in do_handle_one_connection (connect=0x55f73fe78bd0) at /data/src/10.4/sql/sql_connect.cc:1404
      #33 0x000055f73cce0b4f in handle_one_connection (arg=0x55f73fe78bd0) at /data/src/10.4/sql/sql_connect.cc:1306
      #34 0x000055f73d60cf65 in pfs_spawn_thread (arg=0x55f73fedc550) at /data/src/10.4/storage/perfschema/pfs.cc:1862
      #35 0x00007f9a7717a4a4 in start_thread (arg=0x7f9a6b7b3700) at pthread_create.c:456
      #36 0x00007f9a756c2d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      No obvious effect on a non-debug build.
      Couldn't reproduce on 10.3, but on 10.4 it started happening with this merge:

      commit 1d15a28e52e41fae0847284089b2073ab33162a5 c4feef50cfa4033e646636ed37e255d2b3593fbf a20f6f9853e522ad388f5b968ce11af3c5d1fc10
      Merge: c4feef50cfa a20f6f9853e
      Author:     Marko Mäkelä <marko.makela@mariadb.com>
      AuthorDate: Wed Aug 14 18:06:51 2019 +0300
      Commit:     Marko Mäkelä <marko.makela@mariadb.com>
      CommitDate: Wed Aug 14 18:06:51 2019 +0300
       
          Merge 10.3 into 10.4
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                midenok Aleksey Midenkov
                Reporter:
                elenst Elena Stepanova
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: