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

SIGSEGV or Assertion `producing_item != __null' in Item_direct_view_ref::derived_field_transformer_for_where upon updating a view

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.2(EOL), 10.3(EOL), 10.4(EOL)
    • 10.2.19
    • Optimizer, Views
    • None

    Description

      CREATE TABLE t (f1 TEXT, f2 INT);
       
      CREATE ALGORITHM = MERGE VIEW v1 AS SELECT f2 FROM ( SELECT f2 FROM t ) AS sq;
      CREATE ALGORITHM = UNDEFINED VIEW v2 AS SELECT t.f2 FROM v1 JOIN t USING (f2) WHERE f2 < 2;
       
      UPDATE v2 SET f2 = 1;
       
      DROP VIEW v1, v2;
      DROP TABLE t;
      

      10.2 76318d55aa0f debug

      mysqld: /data/src/10.2/sql/item.cc:7214: virtual Item* Item_direct_view_ref::derived_field_transformer_for_where(THD*, uchar*): Assertion `producing_item != __null' failed.
      181030 14:53:33 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007fd06ba0bee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
      #8  0x00005625be75f9bf in Item_direct_view_ref::derived_field_transformer_for_where (this=0x7fd04803bed0, thd=0x7fd048000b00, arg=0x7fd048017278 "P\212w\277%V") at /data/src/10.2/sql/item.cc:7214
      #9  0x00005625be760d05 in Item_ref::transform (this=0x7fd04803bed0, thd=0x7fd048000b00, transformer=&virtual Item::derived_field_transformer_for_where(THD*, unsigned char*), arg=0x7fd048017278 "P\212w\277%V") at /data/src/10.2/sql/item.cc:7728
      #10 0x00005625be7af296 in Item_args::transform_args (this=0x7fd04803bdf8, thd=0x7fd048000b00, transformer=&virtual table offset 1224, arg=0x7fd048017278 "P\212w\277%V") at /data/src/10.2/sql/item_func.cc:332
      #11 0x00005625be7af37d in Item_func::transform (this=0x7fd04803bd70, thd=0x7fd048000b00, transformer=&virtual table offset 1224, argument=0x7fd048017278 "P\212w\277%V") at /data/src/10.2/sql/item_func.cc:368
      #12 0x00005625be492ab2 in pushdown_cond_for_derived (thd=0x7fd048000b00, cond=0x7fd04803b6c0, derived=0x7fd0480361d0) at /data/src/10.2/sql/sql_derived.cc:1301
      #13 0x00005625be5033c3 in JOIN::optimize_inner (this=0x7fd04803a840) at /data/src/10.2/sql/sql_select.cc:1396
      #14 0x00005625be502371 in JOIN::optimize (this=0x7fd04803a840) at /data/src/10.2/sql/sql_select.cc:1115
      #15 0x00005625be50b7ec in mysql_select (thd=0x7fd048000b00, tables=0x7fd048012560, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=1342177408, result=0x7fd04803a778, unit=0x7fd0480046e0, select_lex=0x7fd048004e18) at /data/src/10.2/sql/sql_select.cc:3790
      #16 0x00005625be5b1b2c in mysql_multi_update (thd=0x7fd048000b00, table_list=0x7fd048012560, fields=0x7fd048004f40, values=0x7fd048005418, conds=0x0, options=0, handle_duplicates=DUP_ERROR, ignore=false, unit=0x7fd0480046e0, select_lex=0x7fd048004e18, result=0x7fd065c9c910) at /data/src/10.2/sql/sql_update.cc:1604
      #17 0x00005625be4c37ea in mysql_execute_command (thd=0x7fd048000b00) at /data/src/10.2/sql/sql_parse.cc:4357
      #18 0x00005625be4cf063 in mysql_parse (thd=0x7fd048000b00, rawbuf=0x7fd048012488 "UPDATE v2 SET f2 = 1", length=20, parser_state=0x7fd065c9d200, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:8011
      #19 0x00005625be4bc9bd in dispatch_command (command=COM_QUERY, thd=0x7fd048000b00, packet=0x7fd04808cbb1 "UPDATE v2 SET f2 = 1", packet_length=20, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1824
      #20 0x00005625be4bb320 in do_command (thd=0x7fd048000b00) at /data/src/10.2/sql/sql_parse.cc:1378
      #21 0x00005625be60d5c7 in do_handle_one_connection (connect=0x5625c100ac90) at /data/src/10.2/sql/sql_connect.cc:1335
      #22 0x00005625be60d354 in handle_one_connection (arg=0x5625c100ac90) at /data/src/10.2/sql/sql_connect.cc:1241
      #23 0x00005625bea305aa in pfs_spawn_thread (arg=0x5625c0f51160) at /data/src/10.2/storage/perfschema/pfs.cc:1862
      #24 0x00007fd06d6e2494 in start_thread (arg=0x7fd065c9e700) at pthread_create.c:333
      #25 0x00007fd06bac893f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      10.2 76318d55aa0f non-debug

      #2  <signal handler called>
      #3  Item_direct_view_ref::derived_field_transformer_for_where (this=<optimized out>, thd=0x7f0f200009a8, arg=<optimized out>) at /data/src/10.2/sql/item.cc:7215
      #4  0x0000561ca012057c in Item_args::transform_args (this=this@entry=0x7f0f200b2bb0, thd=thd@entry=0x7f0f200009a8, transformer=&virtual table offset 1224, arg=arg@entry=0x7f0f20013ec0 "P\250\317\240\034V") at /data/src/10.2/sql/item_func.cc:332
      #5  0x0000561ca01205d3 in Item_func::transform (this=0x7f0f200b2b28, thd=0x7f0f200009a8, transformer=<optimized out>, argument=0x7f0f20013ec0 "P\250\317\240\034V") at /data/src/10.2/sql/item_func.cc:368
      #6  0x0000561c9ff0ce9d in pushdown_cond_for_derived (thd=0x7f0f200009a8, cond=<optimized out>, derived=0x7f0f2006c628) at /data/src/10.2/sql/sql_derived.cc:1301
      #7  0x0000561c9ff7e71c in JOIN::optimize_inner (this=0x7f0f200b15f8) at /data/src/10.2/sql/sql_select.cc:1396
      #8  0x0000561c9ff810ea in JOIN::optimize (this=0x7f0f200b15f8) at /data/src/10.2/sql/sql_select.cc:1115
      #9  0x0000561c9ff835cd in mysql_select (thd=thd@entry=0x7f0f200009a8, tables=tables@entry=0x7f0f2000f1a8, wild_num=0, fields=..., conds=conds@entry=0x0, og_num=og_num@entry=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=1342177408, result=0x7f0f200b1530, unit=0x7f0f200043c8, select_lex=0x7f0f20004b00) at /data/src/10.2/sql/sql_select.cc:3790
      #10 0x0000561c9ffcc047 in mysql_multi_update (thd=0x7f0f200009a8, table_list=0x7f0f2000f1a8, fields=<optimized out>, values=0x7f0f20005100, conds=0x0, options=<optimized out>, handle_duplicates=DUP_ERROR, ignore=false, unit=0x7f0f200043c8, select_lex=0x7f0f20004b00, result=0x7f0f3e012d80) at /data/src/10.2/sql/sql_update.cc:1604
      #11 0x0000561c9ff31d7b in mysql_execute_command (thd=0x7f0f200009a8) at /data/src/10.2/sql/sql_parse.cc:4357
      #12 0x0000561c9ff344b9 in mysql_parse (thd=0x7f0f200009a8, rawbuf=<optimized out>, length=20, parser_state=0x7f0f3e014240, is_com_multi=<optimized out>, is_next_command=<optimized out>) at /data/src/10.2/sql/sql_parse.cc:8011
      #13 0x0000561c9ff3715e in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7f0f200009a8, packet=packet@entry=0x7f0f20006d29 "UPDATE v2 SET f2 = 1", packet_length=packet_length@entry=20, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /data/src/10.2/sql/sql_parse.cc:1824
      #14 0x0000561c9ff379a8 in do_command (thd=0x7f0f200009a8) at /data/src/10.2/sql/sql_parse.cc:1378
      #15 0x0000561ca0000bd4 in do_handle_one_connection (connect=connect@entry=0x561ca1aecde8) at /data/src/10.2/sql/sql_connect.cc:1335
      #16 0x0000561ca0000d74 in handle_one_connection (arg=arg@entry=0x561ca1aecde8) at /data/src/10.2/sql/sql_connect.cc:1241
      #17 0x0000561ca02c49a4 in pfs_spawn_thread (arg=0x561ca1aafaf8) at /data/src/10.2/storage/perfschema/pfs.cc:1862
      #18 0x00007f0f45a5b494 in start_thread (arg=0x7f0f3e015700) at pthread_create.c:333
      #19 0x00007f0f43e4193f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      Reproducible with at least InnoDB and MyISAM, on 10.2+, debug and non-debug.

      The failure started happening on 10.2 tree after this commit:

      commit 862a97749d5a36218ba4d55c26eef30cd7b2e3cb
      Author: Igor Babaev
      Date:   Fri Aug 17 19:29:01 2018 -0700
       
          MDEV-17011 “condition_pushdown_for_derived” optimization not used when
                     using INSERT INTO
          
          This patch allows condition pushdown into a materialized derived / view when
          this table is used in INSERT SELECT, multi-table UPDATE and multi-table DELETE.
      

      Attachments

        Activity

          People

            igor Igor Babaev
            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.