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

Assertion with versioned table upon DELETE from view of view after replacing first view

    XMLWordPrintable

Details

    Description

      Server crashes in close_thread_tables, Assertion `file->s->temporary' failed, Assertion `!m_file' failed with versioned tables, views and PS protocol

      Run in MTR with --ps-protocol

      CREATE TABLE t1 (a INT);
      CREATE TABLE t2 (b INT) WITH SYSTEM VERSIONING;
      CREATE VIEW v1 AS SELECT * FROM t1;
      CREATE VIEW v2 AS SELECT * FROM v1;
      CREATE OR REPLACE VIEW v1 AS SELECT * FROM t2;
      DELETE FROM v2;
       
      # Cleanup
      DROP VIEW v2;
      DROP VIEW v1;
      DROP TABLE t1, t2;
      

      10.4 f9ceb0a6

      #3  <signal handler called>
      #4  0x000055ad502f820a in close_thread_tables (thd=0x7f738c000af0) at /data/src/10.4/sql/sql_base.cc:914
      #5  0x000055ad503cba0b in Prepared_statement::prepare (this=0x7f738c040600, packet=0x7f738c008341 "DELETE FROM v2", packet_len=14) at /data/src/10.4/sql/sql_prepare.cc:4065
      #6  0x000055ad503c7f91 in mysqld_stmt_prepare (thd=0x7f738c000af0, packet=0x7f738c008341 "DELETE FROM v2", packet_length=14) at /data/src/10.4/sql/sql_prepare.cc:2658
      #7  0x000055ad50398bbb in dispatch_command (command=COM_STMT_PREPARE, thd=0x7f738c000af0, packet=0x7f738c008341 "DELETE FROM v2", packet_length=14, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1786
      #8  0x000055ad503976e9 in do_command (thd=0x7f738c000af0) at /data/src/10.4/sql/sql_parse.cc:1360
      #9  0x000055ad5051fd5d in do_handle_one_connection (connect=0x55ad54730e60) at /data/src/10.4/sql/sql_connect.cc:1412
      #10 0x000055ad5051faac in handle_one_connection (arg=0x55ad54730e60) at /data/src/10.4/sql/sql_connect.cc:1316
      #11 0x000055ad50f21da1 in pfs_spawn_thread (arg=0x55ad546556c0) at /data/src/10.4/storage/perfschema/pfs.cc:1862
      #12 0x00007f73a56054a4 in start_thread (arg=0x7f739dc62700) at pthread_create.c:456
      #13 0x00007f73a3b4cd0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      Or (doesn't need --ps-protocol):

      CREATE TABLE t1 (a INT);
      CREATE TABLE t2 (b INT) WITH SYSTEM VERSIONING;
      CREATE VIEW v1 AS SELECT * FROM t1;
      CREATE VIEW v2 AS SELECT * FROM v1;
      CREATE OR REPLACE VIEW v1 AS SELECT * FROM t2;
      EXECUTE IMMEDIATE "DELETE FROM v2";
       
      # Cleanup
      DROP VIEW v2;
      DROP VIEW v1;
      DROP TABLE t1, t2;
      

      #3  <signal handler called>
      #4  0x000055843be7820a in close_thread_tables (thd=0x7fcb24000af0) at /data/src/10.4/sql/sql_base.cc:914
      #5  0x000055843bf4ba0b in Prepared_statement::prepare (this=0x7fcb24183210, packet=0x7fcb240131e8 "DELETE FROM v2", packet_len=14) at /data/src/10.4/sql/sql_prepare.cc:4065
      #6  0x000055843bf4e19b in Prepared_statement::execute_immediate (this=0x7fcb24183210, query=0x7fcb240131e8 "DELETE FROM v2", query_len=14) at /data/src/10.4/sql/sql_prepare.cc:4874
      #7  0x000055843bf48872 in mysql_sql_stmt_execute_immediate (thd=0x7fcb24000af0) at /data/src/10.4/sql/sql_prepare.cc:2921
      #8  0x000055843bf1f476 in mysql_execute_command (thd=0x7fcb24000af0) at /data/src/10.4/sql/sql_parse.cc:3905
      #9  0x000055843bf2deb7 in mysql_parse (thd=0x7fcb24000af0, rawbuf=0x7fcb24013138 "EXECUTE IMMEDIATE \"DELETE FROM v2\"", length=34, parser_state=0x7fcb359dd170, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7901
      #10 0x000055843bf1905c in dispatch_command (command=COM_QUERY, thd=0x7fcb24000af0, packet=0x7fcb24008341 "EXECUTE IMMEDIATE \"DELETE FROM v2\"", packet_length=34, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1842
      #11 0x000055843bf176e9 in do_command (thd=0x7fcb24000af0) at /data/src/10.4/sql/sql_parse.cc:1360
      #12 0x000055843c09fd5d in do_handle_one_connection (connect=0x55843fc14e60) at /data/src/10.4/sql/sql_connect.cc:1412
      #13 0x000055843c09faac in handle_one_connection (arg=0x55843fc14e60) at /data/src/10.4/sql/sql_connect.cc:1316
      #14 0x000055843caa1da1 in pfs_spawn_thread (arg=0x55843fb396c0) at /data/src/10.4/storage/perfschema/pfs.cc:1862
      #15 0x00007fcb3d3814a4 in start_thread (arg=0x7fcb359de700) at pthread_create.c:456
      #16 0x00007fcb3b8c8d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      Variation with Aria:

      CREATE TABLE t1 (a INT) ENGINE=Aria;
      CREATE TABLE t2 (b INT)  ENGINE=Aria WITH SYSTEM VERSIONING;
      CREATE VIEW v1 AS SELECT * FROM t1;
      CREATE VIEW v2 AS SELECT * FROM v1;
      CREATE OR REPLACE VIEW v1 AS SELECT * FROM t2;
      EXECUTE IMMEDIATE "DELETE FROM v2";
       
      # Cleanup
      DROP VIEW v2;
      DROP VIEW v1;
      DROP TABLE t1, t2;
      

      mysqld: /data/src/10.4/storage/maria/ha_maria.cc:2674: virtual void ha_maria::drop_table(const char*): Assertion `file->s->temporary' failed.
      191126 19:27:12 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f3d80cb9f12 in __GI___assert_fail (assertion=0x55be51b3821a "file->s->temporary", file=0x55be51b37810 "/data/src/10.4/storage/maria/ha_maria.cc", line=2674, function=0x55be51b38e40 <ha_maria::drop_table(char const*)::__PRETTY_FUNCTION__> "virtual void ha_maria::drop_table(const char*)") at assert.c:101
      #8  0x000055be514ff15e in ha_maria::drop_table (this=0x7f3d60041f08, name=0x7f3d60145be0 "./test/t2") at /data/src/10.4/storage/maria/ha_maria.cc:2674
      #9  0x000055be50e56abe in handler::ha_drop_table (this=0x7f3d60041f08, name=0x7f3d60145be0 "./test/t2") at /data/src/10.4/sql/handler.cc:4713
      #10 0x000055be50b6b179 in free_tmp_table (thd=0x7f3d60000af0, entry=0x7f3d600410a0) at /data/src/10.4/sql/sql_select.cc:19523
      #11 0x000055be50a95319 in mysql_derived_prepare (thd=0x7f3d60000af0, lex=0x7f3d600514e8, derived=0x7f3d600530d8) at /data/src/10.4/sql/sql_derived.cc:885
      #12 0x000055be50a93200 in mysql_handle_derived (lex=0x7f3d600514e8, phases=2) at /data/src/10.4/sql/sql_derived.cc:126
      #13 0x000055be50b136b9 in mysql_test_delete (stmt=0x7f3d601435a0, table_list=0x7f3d600530d8) at /data/src/10.4/sql/sql_prepare.cc:1467
      #14 0x000055be50b15626 in check_prepared_statement (stmt=0x7f3d601435a0) at /data/src/10.4/sql/sql_prepare.cc:2340
      #15 0x000055be50b1990f in Prepared_statement::prepare (this=0x7f3d601435a0, packet=0x7f3d600131e8 "DELETE FROM v2", packet_len=14) at /data/src/10.4/sql/sql_prepare.cc:4048
      #16 0x000055be50b1c19b in Prepared_statement::execute_immediate (this=0x7f3d601435a0, query=0x7f3d600131e8 "DELETE FROM v2", query_len=14) at /data/src/10.4/sql/sql_prepare.cc:4874
      #17 0x000055be50b16872 in mysql_sql_stmt_execute_immediate (thd=0x7f3d60000af0) at /data/src/10.4/sql/sql_prepare.cc:2921
      #18 0x000055be50aed476 in mysql_execute_command (thd=0x7f3d60000af0) at /data/src/10.4/sql/sql_parse.cc:3905
      #19 0x000055be50afbeb7 in mysql_parse (thd=0x7f3d60000af0, rawbuf=0x7f3d60013138 "EXECUTE IMMEDIATE \"DELETE FROM v2\"", length=34, parser_state=0x7f3d76e71170, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7901
      #20 0x000055be50ae705c in dispatch_command (command=COM_QUERY, thd=0x7f3d60000af0, packet=0x7f3d60008341 "EXECUTE IMMEDIATE \"DELETE FROM v2\"", packet_length=34, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1842
      #21 0x000055be50ae56e9 in do_command (thd=0x7f3d60000af0) at /data/src/10.4/sql/sql_parse.cc:1360
      #22 0x000055be50c6dd5d in do_handle_one_connection (connect=0x55be5455ee60) at /data/src/10.4/sql/sql_connect.cc:1412
      #23 0x000055be50c6daac in handle_one_connection (arg=0x55be5455ee60) at /data/src/10.4/sql/sql_connect.cc:1316
      #24 0x000055be5166fda1 in pfs_spawn_thread (arg=0x55be544836c0) at /data/src/10.4/storage/perfschema/pfs.cc:1862
      #25 0x00007f3d8282f4a4 in start_thread (arg=0x7f3d76e72700) at pthread_create.c:456
      #26 0x00007f3d80d76d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      Variation with partitioning:

      --source include/have_partition.inc
       
      CREATE TABLE t1 (a INT);
      CREATE TABLE t2 (b INT) WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME INTERVAL 1 DAY (PARTITION p0 HISTORY, PARTITION pn CURRENT);
      CREATE VIEW v1 AS SELECT * FROM t1;
      CREATE VIEW v2 AS SELECT * FROM v1;
      CREATE OR REPLACE VIEW v1 AS SELECT * FROM t2;
      EXECUTE IMMEDIATE "DELETE FROM v2";
       
      # Cleanup
      DROP VIEW v2;
      DROP VIEW v1;
      DROP TABLE t1, t2;
      

      mysqld: /data/src/10.4/sql/ha_partition.cc:3085: bool ha_partition::setup_engine_array(MEM_ROOT*): Assertion `!m_file' failed.
      191126 19:33:14 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f147882bf12 in __GI___assert_fail (assertion=0x56524a61247a "!m_file", file=0x56524a611ab0 "/data/src/10.4/sql/ha_partition.cc", line=3085, function=0x56524a615b60 <ha_partition::setup_engine_array(st_mem_root*)::__PRETTY_FUNCTION__> "bool ha_partition::setup_engine_array(MEM_ROOT*)") at assert.c:101
      #8  0x000056524a124dba in ha_partition::setup_engine_array (this=0x7f142013fa28, mem_root=0x7f1420006478) at /data/src/10.4/sql/ha_partition.cc:3085
      #9  0x000056524a125150 in ha_partition::get_from_handler_file (this=0x7f142013fa28, name=0x7f1420139510 "./test/t2", mem_root=0x7f1420006478, is_clone=false) at /data/src/10.4/sql/ha_partition.cc:3164
      #10 0x000056524a1225bf in ha_partition::del_ren_table (this=0x7f142013fa28, from=0x7f1420139510 "./test/t2", to=0x0) at /data/src/10.4/sql/ha_partition.cc:2354
      #11 0x000056524a11d791 in ha_partition::delete_table (this=0x7f142013fa28, name=0x7f1420139510 "./test/t2") at /data/src/10.4/sql/ha_partition.cc:579
      #12 0x00005652498e870c in handler::drop_table (this=0x7f142013fa28, name=0x7f1420139510 "./test/t2") at /data/src/10.4/sql/handler.cc:4271
      #13 0x00005652498e9abe in handler::ha_drop_table (this=0x7f142013fa28, name=0x7f1420139510 "./test/t2") at /data/src/10.4/sql/handler.cc:4713
      #14 0x00005652495fe179 in free_tmp_table (thd=0x7f1420000af0, entry=0x7f142013ebc0) at /data/src/10.4/sql/sql_select.cc:19523
      #15 0x0000565249528319 in mysql_derived_prepare (thd=0x7f1420000af0, lex=0x7f1420049178, derived=0x7f142004ad68) at /data/src/10.4/sql/sql_derived.cc:885
      #16 0x0000565249526200 in mysql_handle_derived (lex=0x7f1420049178, phases=2) at /data/src/10.4/sql/sql_derived.cc:126
      #17 0x00005652495a66b9 in mysql_test_delete (stmt=0x7f1420136f20, table_list=0x7f142004ad68) at /data/src/10.4/sql/sql_prepare.cc:1467
      #18 0x00005652495a8626 in check_prepared_statement (stmt=0x7f1420136f20) at /data/src/10.4/sql/sql_prepare.cc:2340
      #19 0x00005652495ac90f in Prepared_statement::prepare (this=0x7f1420136f20, packet=0x7f14200131e8 "DELETE FROM v2", packet_len=14) at /data/src/10.4/sql/sql_prepare.cc:4048
      #20 0x00005652495af19b in Prepared_statement::execute_immediate (this=0x7f1420136f20, query=0x7f14200131e8 "DELETE FROM v2", query_len=14) at /data/src/10.4/sql/sql_prepare.cc:4874
      #21 0x00005652495a9872 in mysql_sql_stmt_execute_immediate (thd=0x7f1420000af0) at /data/src/10.4/sql/sql_prepare.cc:2921
      #22 0x0000565249580476 in mysql_execute_command (thd=0x7f1420000af0) at /data/src/10.4/sql/sql_parse.cc:3905
      #23 0x000056524958eeb7 in mysql_parse (thd=0x7f1420000af0, rawbuf=0x7f1420013138 "EXECUTE IMMEDIATE \"DELETE FROM v2\"", length=34, parser_state=0x7f1471bfc170, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7901
      #24 0x000056524957a05c in dispatch_command (command=COM_QUERY, thd=0x7f1420000af0, packet=0x7f142019dd81 "EXECUTE IMMEDIATE \"DELETE FROM v2\"", packet_length=34, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1842
      #25 0x00005652495786e9 in do_command (thd=0x7f1420000af0) at /data/src/10.4/sql/sql_parse.cc:1360
      #26 0x0000565249700d5d in do_handle_one_connection (connect=0x56524dbace20) at /data/src/10.4/sql/sql_connect.cc:1412
      #27 0x0000565249700aac in handle_one_connection (arg=0x56524dbace20) at /data/src/10.4/sql/sql_connect.cc:1316
      #28 0x000056524a102da1 in pfs_spawn_thread (arg=0x56524dad1a50) at /data/src/10.4/storage/perfschema/pfs.cc:1862
      #29 0x00007f147a3a14a4 in start_thread (arg=0x7f1471bfd700) at pthread_create.c:456
      #30 0x00007f14788e8d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      Reproducible on 10.3-10.5.
      Without prepared statements the test fails with MDEV-21146.

      Attachments

        Issue Links

          Activity

            People

              midenok Aleksey Midenkov
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              1 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.