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

view.test, server crash with --big-tables=1

Details

    Description

      to reproduce:

      ./mtr view.test --mysqld=--big-tables=1
      

      main.view                                [ fail ]
              Test ended at 2018-03-15 13:54:25
       
      CURRENT_TEST: main.view
      mysqltest: At line 1380: query 'insert into v3(a,b) select * from t2' failed with wrong errno 2013: 'Lost connection to MySQL server during query', instead of 1393...
       
      The result from queries just before the failure was:
      < snip >
      select * from v3;
      a	b
      2	1
      300	1
      2	3
      300	3
      deallocate prepare stmt1;
      drop view v3,v2;
      drop tables t1,t2;
      create table t1 (a int, primary key (a), b int);
      create table t2 (a int, primary key (a), b int);
      insert into t2 values (1000, 2000);
      create view v3 (a,b) as select t1.a as a, t2.a as b from t1, t2;
      insert into v3 values (1,2);
      ERROR HY000: Can not insert into join view 'test.v3' without fields list
      insert into v3 select * from t2;
      ERROR HY000: Can not insert into join view 'test.v3' without fields list
      insert into v3(a,b) values (1,2);
      ERROR HY000: Can not modify more than one base table through a join view 'test.v3'
      insert into v3(a,b) select * from t2;
      

      Server version: 10.2.14-MariaDB-debug-log
      key_buffer_size=1048576
      read_buffer_size=131072
      max_used_connections=1
      max_threads=153
      thread_count=2
      It is possible that mysqld could use up to 
      key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 63177 K  bytes of memory
      Hope that's ok; if not, decrease some variables in the equation.
       
      Thread pointer: 0x7f3c5c000a98
      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 = 0x7f3c782cfe70 thread_stack 0x49000
      mysys/stacktrace.c:267(my_print_stacktrace)[0x55c9f9d96af8]
      sql/signal_handler.cc:168(handle_fatal_signal)[0x55c9f9629037]
      /lib/x86_64-linux-gnu/libpthread.so.0(+0x11390)[0x7f3c7e443390]
      maria/ma_write.c:1793(maria_end_bulk_insert)[0x55c9f9c9f217]
      maria/ha_maria.cc:2223(ha_maria::end_bulk_insert())[0x55c9f9c2706d]
      sql/handler.h:2905(handler::ha_end_bulk_insert())[0x55c9f939df6b]
      sql/sql_insert.cc:3948(select_insert::abort_result_set())[0x55c9f939bb98]
      sql/sql_select.cc:383(handle_select(THD*, LEX*, select_result*, unsigned long))[0x55c9f93f68eb]
      sql/sql_parse.cc:4525(mysql_execute_command(THD*))[0x55c9f93bb692]
      sql/sql_parse.cc:7902(mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool))[0x55c9f93c61e0]
      sql/sql_parse.cc:1808(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool))[0x55c9f93b3e0f]
      sql/sql_parse.cc:1360(do_command(THD*))[0x55c9f93b276b]
      sql/sql_connect.cc:1335(do_handle_one_connection(CONNECT*))[0x55c9f9500ee9]
      sql/sql_connect.cc:1242(handle_one_connection)[0x55c9f9500c69]
      perfschema/pfs.cc:1864(pfs_spawn_thread)[0x55c9f985e8ce]
      /lib/x86_64-linux-gnu/libpthread.so.0(+0x76ba)[0x7f3c7e4396ba]
      x86_64/clone.S:111(clone)[0x7f3c7d8ce41d]
       
      Trying to get some variables.
      Some pointers may be invalid and cause the dump to abort.
      Query (0x7f3c5c1bdc80): insert into v3(a,b) select * from t2
      Connection ID (thread ID): 4
      Status: NOT_KILLED
       
      Optimizer switch: index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on
       
      The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
      information that should help you find out what is causing the crash.
      Writing a core file at /home/alice/git/10.2/mysql-test/var/mysqld.1/data/
      ----------SERVER LOG END-------------
      
      

       
      Thread 1 (Thread 0x7f3c782d0700 (LWP 31990)):
      #0  __pthread_kill (threadid=<optimized out>, signo=11) at ../sysdeps/unix/sysv/linux/pthread_kill.c:62
      #1  0x000055c9f9d96bea in my_write_core (sig=11) at /home/alice/git/10.2/mysys/stacktrace.c:477
      #2  0x000055c9f962945f in handle_fatal_signal (sig=11) at /home/alice/git/10.2/sql/signal_handler.cc:305
      #3  <signal handler called>
      #4  0x000055c9f9c9f217 in maria_end_bulk_insert (info=0x0) at /home/alice/git/10.2/storage/maria/ma_write.c:1793
      #5  0x000055c9f9c2706d in ha_maria::end_bulk_insert (this=0x7f3c5c1d8110) at /home/alice/git/10.2/storage/maria/ha_maria.cc:2222
      #6  0x000055c9f939df6b in handler::ha_end_bulk_insert (this=0x7f3c5c1d8110) at /home/alice/git/10.2/sql/handler.h:2905
      #7  0x000055c9f939bb98 in select_insert::abort_result_set (this=0x7f3c5c1d8930) at /home/alice/git/10.2/sql/sql_insert.cc:3932
      #8  0x000055c9f93f68eb in handle_select (thd=0x7f3c5c000a98, lex=0x7f3c5c004578, result=0x7f3c5c1d8930, setup_tables_done_option=1073741824) at /home/alice/git/10.2/sql/sql_select.cc:382
      #9  0x000055c9f93bb692 in mysql_execute_command (thd=0x7f3c5c000a98) at /home/alice/git/10.2/sql/sql_parse.cc:4525
      #10 0x000055c9f93c61e0 in mysql_parse (thd=0x7f3c5c000a98, rawbuf=0x7f3c5c1bdc80 "insert into v3(a,b) select * from t2", length=36, parser_state=0x7f3c782cf1f0, is_com_multi=false, is_next_command=false) at /home/alice/git/10.2/sql/sql_parse.cc:7902
      #11 0x000055c9f93b3e0f in dispatch_command (command=COM_QUERY, thd=0x7f3c5c000a98, packet=0x7f3c5c082089 "insert into v3(a,b) select * from t2", packet_length=36, is_com_multi=false, is_next_command=false) at /home/alice/git/10.2/sql/sql_parse.cc:1806
      #12 0x000055c9f93b276b in do_command (thd=0x7f3c5c000a98) at /home/alice/git/10.2/sql/sql_parse.cc:1360
      #13 0x000055c9f9500ee9 in do_handle_one_connection (connect=0x55c9fbca1ba8) at /home/alice/git/10.2/sql/sql_connect.cc:1335
      #14 0x000055c9f9500c69 in handle_one_connection (arg=0x55c9fbca1ba8) at /home/alice/git/10.2/sql/sql_connect.cc:1241
      #15 0x000055c9f985e8ce in pfs_spawn_thread (arg=0x55c9fbc46ee8) at /home/alice/git/10.2/storage/perfschema/pfs.cc:1862
      #16 0x00007f3c7e4396ba in start_thread (arg=0x7f3c782d0700) at pthread_create.c:333
      #17 0x00007f3c7d8ce41d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
      

      Attachments

        Issue Links

          Activity

            Still reproducible.

            elenst Elena Stepanova added a comment - Still reproducible.
            alice Alice Sherepa added a comment -

            test case from MDEV-18148:

            set big_tables=ON;
             
            CREATE TABLE t1 ( f1 int , f2 int , f3 int , f4 int);
            CREATE TABLE t2 ( f1 int , f2 int , f3 int , f4 int);
             
            CREATE VIEW v1 AS 
            	SELECT t2.f1, t1.f2, t2.f3, t2.f4 FROM (t1 JOIN t2);
             
            REPLACE INTO v1 (f1, f2, f3, f4)
            	SELECT f1, f2, f3, f4 FROM t1;
            

            alice Alice Sherepa added a comment - test case from MDEV-18148 : set big_tables= ON ; CREATE TABLE t1 ( f1 int , f2 int , f3 int , f4 int ); CREATE TABLE t2 ( f1 int , f2 int , f3 int , f4 int ); CREATE VIEW v1 AS SELECT t2.f1, t1.f2, t2.f3, t2.f4 FROM (t1 JOIN t2); REPLACE INTO v1 (f1, f2, f3, f4) SELECT f1, f2, f3, f4 FROM t1;

            test suite for 10.2 and above

            CREATE TABLE t1 (a INT, b BLOB);
            CREATE TABLE t2 (c INT);
            CREATE TRIGGER tr BEFORE UPDATE ON t2 FOR EACH ROW SET @a = 1;
            CREATE VIEW v AS SELECT a, b FROM t1 JOIN t2;
             
            --error ER_BAD_FIELD_ERROR
            INSERT INTO v (x) SELECT 1;
             
            # Cleanup
            DROP VIEW v;
            DROP TABLE t1, t2;
            

            sanja Oleksandr Byelkin added a comment - test suite for 10.2 and above CREATE TABLE t1 (a INT, b BLOB); CREATE TABLE t2 (c INT); CREATE TRIGGER tr BEFORE UPDATE ON t2 FOR EACH ROW SET @a = 1; CREATE VIEW v AS SELECT a, b FROM t1 JOIN t2; --error ER_BAD_FIELD_ERROR INSERT INTO v (x) SELECT 1; # Cleanup DROP VIEW v; DROP TABLE t1, t2;

            The problem is that we are trying to deal with not opened table of view dummy.

            diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
            index 4005153cb64..3bcff7bdd56 100644
            --- a/sql/sql_insert.cc
            +++ b/sql/sql_insert.cc
            @@ -3945,7 +3945,7 @@ void select_insert::abort_result_set() {
                 will be NULL. In that case, we still need to execute the rollback
                 and the end of the function.
                */
            -  if (table)
            +  if (table && table->query_id)
               {
                 bool changed, transactional_table;
                 /*
            

            "official" way of getting known that TABLE is not opened should be found or the check should be used with check of being internal temporary table.

            sanja Oleksandr Byelkin added a comment - The problem is that we are trying to deal with not opened table of view dummy. diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 4005153cb64..3bcff7bdd56 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -3945,7 +3945,7 @@ void select_insert::abort_result_set() { will be NULL. In that case, we still need to execute the rollback and the end of the function. */ - if (table) + if (table && table->query_id) { bool changed, transactional_table; /* "official" way of getting known that TABLE is not opened should be found or the check should be used with check of being internal temporary table.

            commit 985822666e5b72a074e53ff5072a585b0a9725c7 (HEAD > bb-5.5MDEV-15572, origin/bb-5.5-MDEV-15572)
            Author: Oleksandr Byelkin <sanja@mariadb.com>
            Date: Thu Jul 11 14:50:50 2019 +0200

            MDEV-15572: view.test, server crash with --big-tables=1

            Check that table is really opened before cleanup using handler.

            sanja Oleksandr Byelkin added a comment - commit 985822666e5b72a074e53ff5072a585b0a9725c7 (HEAD > bb-5.5 MDEV-15572 , origin/bb-5.5- MDEV-15572 ) Author: Oleksandr Byelkin <sanja@mariadb.com> Date: Thu Jul 11 14:50:50 2019 +0200 MDEV-15572 : view.test, server crash with --big-tables=1 Check that table is really opened before cleanup using handler.

            ok to push

            serg Sergei Golubchik added a comment - ok to push

            People

              sanja Oleksandr Byelkin
              alice Alice Sherepa
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.