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

Crash in get_best_combination when executing multi-table UPDATE with nested views

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 5.5.40, 5.5(EOL), 10.0(EOL)
    • 5.5.42, 10.0.17
    • Views
    • None

    Description

      Thread pointer: 0x0x7fd13305b200
      Attempting backtrace. You can use the following information to find out
      where mysqld died. If you see no messages after this, something went
      terribly wrong...
      stack_bottom = 0x11ec47e98 thread_stack 0x48000
      0   mysqld                              0x000000010255b5e9 my_print_stacktrace + 60
      0   mysqld                              0x0000000102117677 handle_fatal_signal + 602
      0   libsystem_platform.dylib            0x00007fff886f4f1a _sigtramp + 26
      0   mysqld                              0x000000010254f44c cleanup_dirname + 591
      0   mysqld                              0x00000001022a113c _Z20get_best_combinationP4JOIN + 97
      0   mysqld                              0x000000010228c3ec _ZN4JOIN8optimizeEv + 10688
      0   mysqld                              0x0000000102243a01 _Z22mysql_derived_optimizeP3THDP3LEXP10TABLE_LIST + 215
      0   mysqld                              0x0000000102244505 _Z27mysql_handle_single_derivedP3LEXP10TABLE_LISTj + 185
      0   mysqld                              0x00000001022f398b _ZN10TABLE_LIST14handle_derivedEP3LEXj + 105
      0   mysqld                              0x0000000102257c7c _ZN13st_select_lex14handle_derivedEP3LEXj + 56
      0   mysqld                              0x0000000102289ad5 _ZN4JOIN8optimizeEv + 169
      0   mysqld                              0x00000001022881ba _Z12mysql_selectP3THDPPP4ItemP10TABLE_LISTjR4ListIS1_ES2_jP8st_orderSB_S2_SB_yP13select_resultP18st_select_lex_unitP13st_select_lex + 484
      0   mysqld                              0x00000001022e2d35 _Z18mysql_multi_updateP3THDP10TABLE_LISTP4ListI4ItemES6_PS4_y15enum_duplicatesbP18st_select_lex_unitP13st_select_lexPP12multi_update + 412
      0   mysqld                              0x00000001022667ff _Z21mysql_execute_commandP3THD + 16909
      0   mysqld                              0x0000000102261e4c _Z11mysql_parseP3THDPcjP12Parser_state + 358
      0   mysqld                              0x000000010225f95e _Z16dispatch_command19enum_server_commandP3THDPcj + 957
      0   mysqld                              0x0000000102261ab6 _Z10do_commandP3THD + 226
      0   mysqld                              0x000000010231a25b _Z24do_handle_one_connectionP3THD + 350
      0   mysqld                              0x000000010231a0f0 handle_one_connection + 69
      0   libsystem_pthread.dylib             0x00007fff9344e2fc _pthread_body + 131
      0   libsystem_pthread.dylib             0x00007fff9344e279 _pthread_body + 0
      0   libsystem_pthread.dylib             0x00007fff9344c4b1 thread_start + 13
       
      Trying to get some variables.
      Some pointers may be invalid and cause the dump to abort.
      Query (0x7fd133063c18): is an invalid pointer
      Connection ID (thread ID): 2
      Status: NOT_KILLED
       
      Optimizer switch: index_merge=off,index_merge_union=off,index_merge_sort_union=off,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off

      Test case to follow...

      Attachments

        Activity

          2 ideas:

          1) Use "merge for insert" only with tables which will be inserted/updated deleted (easy with delete, but dificult (if possible for else)
          2) make everything working with merging VIEWs as they done now...

          sanja Oleksandr Byelkin added a comment - 2 ideas: 1) Use "merge for insert" only with tables which will be inserted/updated deleted (easy with delete, but dificult (if possible for else) 2) make everything working with merging VIEWs as they done now...

          Just setting correctly embedding do not allow to get small patch...

          sanja Oleksandr Byelkin added a comment - Just setting correctly embedding do not allow to get small patch...

          Fixed by making everything working with merged normally view (in SELECT-like commands)

          sanja Oleksandr Byelkin added a comment - Fixed by making everything working with merged normally view (in SELECT-like commands)

          sanja:

          • it would be nice if find_table_for_update() had a comment.
          • If I undo a part of your patch like shown below, the testcase still passes and ##mtr --suite=main## passes, too. Is that change necessary? If yes, there needs to be a comment.

          diff -urp 5.5-cp/sql/sql_delete.cc 5.5/sql/sql_delete.cc
          --- 5.5-cp/sql/sql_delete.cc    2015-02-10 21:58:41.668350308 +0300
          +++ 5.5/sql/sql_delete.cc       2015-02-10 21:39:51.896391975 +0300
          @@ -657,10 +657,11 @@ multi_delete::initialize_tables(JOIN *jo
             delete_while_scanning= 1;
             for (walk= delete_tables; walk; walk= walk->next_local)
             {
          -    TABLE_LIST *tbl= walk->correspondent_table->find_table_for_update();
          -    tables_to_delete_from|= tbl->table->map;
          +    tables_to_delete_from|= walk->table->map;
          +    /// TABLE_LIST *tbl= walk->correspondent_table->find_table_for_update();
          +    /// tables_to_delete_from|= tbl->table->map;
               if (delete_while_scanning &&
          -        unique_table(thd, tbl, join->tables_list, false))
          +        unique_table(thd, walk, join->tables_list, false))
               {
                 /*
                   If the table we are going to delete from appears

          psergei Sergei Petrunia added a comment - sanja : it would be nice if find_table_for_update() had a comment. If I undo a part of your patch like shown below, the testcase still passes and ##mtr --suite=main## passes, too. Is that change necessary? If yes, there needs to be a comment. diff -urp 5.5-cp/sql/sql_delete.cc 5.5/sql/sql_delete.cc --- 5.5-cp/sql/sql_delete.cc 2015-02-10 21:58:41.668350308 +0300 +++ 5.5/sql/sql_delete.cc 2015-02-10 21:39:51.896391975 +0300 @@ -657,10 +657,11 @@ multi_delete::initialize_tables(JOIN *jo delete_while_scanning= 1; for (walk= delete_tables; walk; walk= walk->next_local) { - TABLE_LIST *tbl= walk->correspondent_table->find_table_for_update(); - tables_to_delete_from|= tbl->table->map; + tables_to_delete_from|= walk->table->map; + /// TABLE_LIST *tbl= walk->correspondent_table->find_table_for_update(); + /// tables_to_delete_from|= tbl->table->map; if (delete_while_scanning && - unique_table(thd, tbl, join->tables_list, false)) + unique_table(thd, walk, join->tables_list, false)) { /* If the table we are going to delete from appears

          Try it with --ps-protocol it will fail.

          sanja Oleksandr Byelkin added a comment - Try it with --ps-protocol it will fail.

          People

            sanja Oleksandr Byelkin
            kolbe Kolbe Kegel (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 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.