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

2nd execution of SP does not detect ER_VERS_NOT_VERSIONED

Details

    Description

      CREATE TABLE t1 (a INT);
      CREATE PROCEDURE sp() SELECT * FROM t1 FOR SYSTEM_TIME ALL;
      --error ER_VERS_NOT_VERSIONED
      CALL sp;
      --error ER_VERS_NOT_VERSIONED
      CALL sp;
       
      # Cleanup
      DROP TABLE t1;
      DROP PROCEDURE sp;
      

      10.3 69b33fca

      mysqltest: At line 6: query 'CALL sp' succeeded - should have failed with errno 4124...
      

      Same with DELETE HISTORY. As a side-effect, the 2nd execution is written into the binary log and breaks replication.

      Attachments

        Issue Links

          Activity

            Here is another one, apparently – same as MDEV-21144, but with DELETE which results in a quite different stack trace:

            CREATE TABLE t1 (a INT);
            INSERT INTO t1 VALUES (1);
            CREATE  PROCEDURE sp () DELETE FROM t1 FOR PORTION OF app FROM '2019-11-28' TO '2019-11-29';
            --error ER_PERIOD_NOT_FOUND
            CALL sp;
            --error ER_PERIOD_NOT_FOUND
            CALL sp;
            

            10.4 a3b63b8d

            #3  <signal handler called>
            #4  0x000055f2c44cbf3d in TABLE::insert_portion_of_time (this=0x7f0dbc1394d0, thd=0x7f0dbc000af0, period_conds=..., rows_inserted=0x7f0dd85ff280) at /data/src/10.4/sql/table.cc:8429
            #5  0x000055f2c48b8be5 in mysql_delete (thd=0x7f0dbc000af0, table_list=0x7f0dbc066e08, conds=0x0, order_list=0x7f0dbc069480, limit=18446744073709551615, options=0, result=0x0) at /data/src/10.4/sql/sql_delete.cc:809
            #6  0x000055f2c4394978 in mysql_execute_command (thd=0x7f0dbc000af0) at /data/src/10.4/sql/sql_parse.cc:4728
            #7  0x000055f2c42a31b6 in sp_instr_stmt::exec_core (this=0x7f0dbc067640, thd=0x7f0dbc000af0, nextp=0x7f0dd86006b4) at /data/src/10.4/sql/sp_head.cc:3670
            #8  0x000055f2c42a250f in sp_lex_keeper::reset_lex_and_exec_core (this=0x7f0dbc067688, thd=0x7f0dbc000af0, nextp=0x7f0dd86006b4, open_tables=false, instr=0x7f0dbc067640) at /data/src/10.4/sql/sp_head.cc:3398
            #9  0x000055f2c42a2d7a in sp_instr_stmt::execute (this=0x7f0dbc067640, thd=0x7f0dbc000af0, nextp=0x7f0dd86006b4) at /data/src/10.4/sql/sp_head.cc:3576
            #10 0x000055f2c429c41f in sp_head::execute (this=0x7f0dbc066058, thd=0x7f0dbc000af0, merge_da_on_success=true) at /data/src/10.4/sql/sp_head.cc:1346
            #11 0x000055f2c429f253 in sp_head::execute_procedure (this=0x7f0dbc066058, thd=0x7f0dbc000af0, args=0x7f0dbc0058d8) at /data/src/10.4/sql/sp_head.cc:2351
            #12 0x000055f2c438ea3f in do_execute_sp (thd=0x7f0dbc000af0, sp=0x7f0dbc066058) at /data/src/10.4/sql/sql_parse.cc:3015
            #13 0x000055f2c438f726 in Sql_cmd_call::execute (this=0x7f0dbc0131e0, thd=0x7f0dbc000af0) at /data/src/10.4/sql/sql_parse.cc:3257
            #14 0x000055f2c439ab1b in mysql_execute_command (thd=0x7f0dbc000af0) at /data/src/10.4/sql/sql_parse.cc:6102
            #15 0x000055f2c43a01dd in mysql_parse (thd=0x7f0dbc000af0, rawbuf=0x7f0dbc013138 "CALL sp", length=7, parser_state=0x7f0dd8602170, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7901
            #16 0x000055f2c438b382 in dispatch_command (command=COM_QUERY, thd=0x7f0dbc000af0, packet=0x7f0dbc008341 "CALL sp", packet_length=7, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1842
            #17 0x000055f2c4389a0f in do_command (thd=0x7f0dbc000af0) at /data/src/10.4/sql/sql_parse.cc:1360
            #18 0x000055f2c45123cd in do_handle_one_connection (connect=0x55f2c821fc10) at /data/src/10.4/sql/sql_connect.cc:1412
            #19 0x000055f2c451211c in handle_one_connection (arg=0x55f2c821fc10) at /data/src/10.4/sql/sql_connect.cc:1316
            #20 0x000055f2c4f142ff in pfs_spawn_thread (arg=0x55f2c818a830) at /data/src/10.4/storage/perfschema/pfs.cc:1862
            #21 0x00007f0ddf7a54a4 in start_thread (arg=0x7f0dd8603700) at pthread_create.c:456
            #22 0x00007f0dddcecd0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
            

            elenst Elena Stepanova added a comment - Here is another one, apparently – same as MDEV-21144 , but with DELETE which results in a quite different stack trace: CREATE TABLE t1 (a INT ); INSERT INTO t1 VALUES (1); CREATE PROCEDURE sp () DELETE FROM t1 FOR PORTION OF app FROM '2019-11-28' TO '2019-11-29' ; --error ER_PERIOD_NOT_FOUND CALL sp; --error ER_PERIOD_NOT_FOUND CALL sp; 10.4 a3b63b8d #3 <signal handler called> #4 0x000055f2c44cbf3d in TABLE::insert_portion_of_time (this=0x7f0dbc1394d0, thd=0x7f0dbc000af0, period_conds=..., rows_inserted=0x7f0dd85ff280) at /data/src/10.4/sql/table.cc:8429 #5 0x000055f2c48b8be5 in mysql_delete (thd=0x7f0dbc000af0, table_list=0x7f0dbc066e08, conds=0x0, order_list=0x7f0dbc069480, limit=18446744073709551615, options=0, result=0x0) at /data/src/10.4/sql/sql_delete.cc:809 #6 0x000055f2c4394978 in mysql_execute_command (thd=0x7f0dbc000af0) at /data/src/10.4/sql/sql_parse.cc:4728 #7 0x000055f2c42a31b6 in sp_instr_stmt::exec_core (this=0x7f0dbc067640, thd=0x7f0dbc000af0, nextp=0x7f0dd86006b4) at /data/src/10.4/sql/sp_head.cc:3670 #8 0x000055f2c42a250f in sp_lex_keeper::reset_lex_and_exec_core (this=0x7f0dbc067688, thd=0x7f0dbc000af0, nextp=0x7f0dd86006b4, open_tables=false, instr=0x7f0dbc067640) at /data/src/10.4/sql/sp_head.cc:3398 #9 0x000055f2c42a2d7a in sp_instr_stmt::execute (this=0x7f0dbc067640, thd=0x7f0dbc000af0, nextp=0x7f0dd86006b4) at /data/src/10.4/sql/sp_head.cc:3576 #10 0x000055f2c429c41f in sp_head::execute (this=0x7f0dbc066058, thd=0x7f0dbc000af0, merge_da_on_success=true) at /data/src/10.4/sql/sp_head.cc:1346 #11 0x000055f2c429f253 in sp_head::execute_procedure (this=0x7f0dbc066058, thd=0x7f0dbc000af0, args=0x7f0dbc0058d8) at /data/src/10.4/sql/sp_head.cc:2351 #12 0x000055f2c438ea3f in do_execute_sp (thd=0x7f0dbc000af0, sp=0x7f0dbc066058) at /data/src/10.4/sql/sql_parse.cc:3015 #13 0x000055f2c438f726 in Sql_cmd_call::execute (this=0x7f0dbc0131e0, thd=0x7f0dbc000af0) at /data/src/10.4/sql/sql_parse.cc:3257 #14 0x000055f2c439ab1b in mysql_execute_command (thd=0x7f0dbc000af0) at /data/src/10.4/sql/sql_parse.cc:6102 #15 0x000055f2c43a01dd in mysql_parse (thd=0x7f0dbc000af0, rawbuf=0x7f0dbc013138 "CALL sp", length=7, parser_state=0x7f0dd8602170, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7901 #16 0x000055f2c438b382 in dispatch_command (command=COM_QUERY, thd=0x7f0dbc000af0, packet=0x7f0dbc008341 "CALL sp", packet_length=7, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1842 #17 0x000055f2c4389a0f in do_command (thd=0x7f0dbc000af0) at /data/src/10.4/sql/sql_parse.cc:1360 #18 0x000055f2c45123cd in do_handle_one_connection (connect=0x55f2c821fc10) at /data/src/10.4/sql/sql_connect.cc:1412 #19 0x000055f2c451211c in handle_one_connection (arg=0x55f2c821fc10) at /data/src/10.4/sql/sql_connect.cc:1316 #20 0x000055f2c4f142ff in pfs_spawn_thread (arg=0x55f2c818a830) at /data/src/10.4/storage/perfschema/pfs.cc:1862 #21 0x00007f0ddf7a54a4 in start_thread (arg=0x7f0dd8603700) at pthread_create.c:456 #22 0x00007f0dddcecd0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

            And another one

            CREATE TABLE t1 (a INT) WITH SYSTEM VERSIONING;
            REPLACE INTO t1 VALUES (1),(2);
            CREATE TRIGGER tr BEFORE DELETE ON t1 FOR EACH ROW DELETE FROM xx;
            CREATE PROCEDURE pr() DELETE FROM t1; 
            --error ER_NO_SUCH_TABLE
            CALL pr;
            --error ER_NO_SUCH_TABLE
            CALL pr;
            

            10.3 57cab7cd

            mysqld: /data/src/10.3/sql/sql_delete.cc:923: int mysql_prepare_delete(THD*, TABLE_LIST*, uint, List<Item>&, Item**, bool*): Assertion `!table_list->vers_conditions.is_set() || !*conds || thd->stmt_arena->is_stmt_execute()' failed.
            191201 15:19:36 [ERROR] mysqld got signal 6 ;
             
            #7  0x00007f27366f1f12 in __GI___assert_fail (assertion=0x5629200cf438 "!table_list->vers_conditions.is_set() || !*conds || thd->stmt_arena->is_stmt_execute()", file=0x5629200cf258 "/data/src/10.3/sql/sql_delete.cc", line=923, function=0x5629200cf820 <mysql_prepare_delete(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item**, bool*)::__PRETTY_FUNCTION__> "int mysql_prepare_delete(THD*, TABLE_LIST*, uint, List<Item>&, Item**, bool*)") at assert.c:101
            #8  0x000056291f7969c8 in mysql_prepare_delete (thd=0x7f2720000af0, table_list=0x7f272011f188, wild_num=0, field_list=..., conds=0x7f27308edff8, delete_while_scanning=0x7f27308ee013) at /data/src/10.3/sql/sql_delete.cc:922
            #9  0x000056291f794295 in mysql_delete (thd=0x7f2720000af0, table_list=0x7f272011f188, conds=0x7f27201805b0, order_list=0x7f272017f938, limit=18446744073709551615, options=0, result=0x0) at /data/src/10.3/sql/sql_delete.cc:323
            #10 0x000056291f2cba24 in mysql_execute_command (thd=0x7f2720000af0) at /data/src/10.3/sql/sql_parse.cc:4658
            #11 0x000056291f1ebea6 in sp_instr_stmt::exec_core (this=0x7f272011f7d8, thd=0x7f2720000af0, nextp=0x7f27308ef1c4) at /data/src/10.3/sql/sp_head.cc:3596
            #12 0x000056291f1eb2f4 in sp_lex_keeper::reset_lex_and_exec_core (this=0x7f272011f820, thd=0x7f2720000af0, nextp=0x7f27308ef1c4, open_tables=false, instr=0x7f272011f7d8) at /data/src/10.3/sql/sp_head.cc:3324
            #13 0x000056291f1eba86 in sp_instr_stmt::execute (this=0x7f272011f7d8, thd=0x7f2720000af0, nextp=0x7f27308ef1c4) at /data/src/10.3/sql/sp_head.cc:3502
            #14 0x000056291f1e5654 in sp_head::execute (this=0x7f272011e528, thd=0x7f2720000af0, merge_da_on_success=true) at /data/src/10.3/sql/sp_head.cc:1356
            #15 0x000056291f1e810c in sp_head::execute_procedure (this=0x7f272011e528, thd=0x7f2720000af0, args=0x7f2720005770) at /data/src/10.3/sql/sp_head.cc:2296
            #16 0x000056291f2c6302 in do_execute_sp (thd=0x7f2720000af0, sp=0x7f272011e528) at /data/src/10.3/sql/sql_parse.cc:2992
            #17 0x000056291f2c6f78 in Sql_cmd_call::execute (this=0x7f27200128c0, thd=0x7f2720000af0) at /data/src/10.3/sql/sql_parse.cc:3232
            #18 0x000056291f2d0e16 in mysql_execute_command (thd=0x7f2720000af0) at /data/src/10.3/sql/sql_parse.cc:6031
            #19 0x000056291f2d6577 in mysql_parse (thd=0x7f2720000af0, rawbuf=0x7f2720012808 "CALL pr", length=7, parser_state=0x7f27308f05e0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7818
            #20 0x000056291f2c30c3 in dispatch_command (command=COM_QUERY, thd=0x7f2720000af0, packet=0x7f2720008c61 "CALL pr", packet_length=7, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1856
            #21 0x000056291f2c1a0b in do_command (thd=0x7f2720000af0) at /data/src/10.3/sql/sql_parse.cc:1401
            #22 0x000056291f438e4c in do_handle_one_connection (connect=0x562922d91a40) at /data/src/10.3/sql/sql_connect.cc:1403
            #23 0x000056291f438bae in handle_one_connection (arg=0x562922d91a40) at /data/src/10.3/sql/sql_connect.cc:1308
            #24 0x000056291fde54f0 in pfs_spawn_thread (arg=0x562922daca00) at /data/src/10.3/storage/perfschema/pfs.cc:1862
            #25 0x00007f27382674a4 in start_thread (arg=0x7f27308f1700) at pthread_create.c:456
            #26 0x00007f27367aed0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
            

            elenst Elena Stepanova added a comment - And another one CREATE TABLE t1 (a INT ) WITH SYSTEM VERSIONING; REPLACE INTO t1 VALUES (1),(2); CREATE TRIGGER tr BEFORE DELETE ON t1 FOR EACH ROW DELETE FROM xx; CREATE PROCEDURE pr() DELETE FROM t1; --error ER_NO_SUCH_TABLE CALL pr; --error ER_NO_SUCH_TABLE CALL pr; 10.3 57cab7cd mysqld: /data/src/10.3/sql/sql_delete.cc:923: int mysql_prepare_delete(THD*, TABLE_LIST*, uint, List<Item>&, Item**, bool*): Assertion `!table_list->vers_conditions.is_set() || !*conds || thd->stmt_arena->is_stmt_execute()' failed. 191201 15:19:36 [ERROR] mysqld got signal 6 ;   #7 0x00007f27366f1f12 in __GI___assert_fail (assertion=0x5629200cf438 "!table_list->vers_conditions.is_set() || !*conds || thd->stmt_arena->is_stmt_execute()", file=0x5629200cf258 "/data/src/10.3/sql/sql_delete.cc", line=923, function=0x5629200cf820 <mysql_prepare_delete(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item**, bool*)::__PRETTY_FUNCTION__> "int mysql_prepare_delete(THD*, TABLE_LIST*, uint, List<Item>&, Item**, bool*)") at assert.c:101 #8 0x000056291f7969c8 in mysql_prepare_delete (thd=0x7f2720000af0, table_list=0x7f272011f188, wild_num=0, field_list=..., conds=0x7f27308edff8, delete_while_scanning=0x7f27308ee013) at /data/src/10.3/sql/sql_delete.cc:922 #9 0x000056291f794295 in mysql_delete (thd=0x7f2720000af0, table_list=0x7f272011f188, conds=0x7f27201805b0, order_list=0x7f272017f938, limit=18446744073709551615, options=0, result=0x0) at /data/src/10.3/sql/sql_delete.cc:323 #10 0x000056291f2cba24 in mysql_execute_command (thd=0x7f2720000af0) at /data/src/10.3/sql/sql_parse.cc:4658 #11 0x000056291f1ebea6 in sp_instr_stmt::exec_core (this=0x7f272011f7d8, thd=0x7f2720000af0, nextp=0x7f27308ef1c4) at /data/src/10.3/sql/sp_head.cc:3596 #12 0x000056291f1eb2f4 in sp_lex_keeper::reset_lex_and_exec_core (this=0x7f272011f820, thd=0x7f2720000af0, nextp=0x7f27308ef1c4, open_tables=false, instr=0x7f272011f7d8) at /data/src/10.3/sql/sp_head.cc:3324 #13 0x000056291f1eba86 in sp_instr_stmt::execute (this=0x7f272011f7d8, thd=0x7f2720000af0, nextp=0x7f27308ef1c4) at /data/src/10.3/sql/sp_head.cc:3502 #14 0x000056291f1e5654 in sp_head::execute (this=0x7f272011e528, thd=0x7f2720000af0, merge_da_on_success=true) at /data/src/10.3/sql/sp_head.cc:1356 #15 0x000056291f1e810c in sp_head::execute_procedure (this=0x7f272011e528, thd=0x7f2720000af0, args=0x7f2720005770) at /data/src/10.3/sql/sp_head.cc:2296 #16 0x000056291f2c6302 in do_execute_sp (thd=0x7f2720000af0, sp=0x7f272011e528) at /data/src/10.3/sql/sql_parse.cc:2992 #17 0x000056291f2c6f78 in Sql_cmd_call::execute (this=0x7f27200128c0, thd=0x7f2720000af0) at /data/src/10.3/sql/sql_parse.cc:3232 #18 0x000056291f2d0e16 in mysql_execute_command (thd=0x7f2720000af0) at /data/src/10.3/sql/sql_parse.cc:6031 #19 0x000056291f2d6577 in mysql_parse (thd=0x7f2720000af0, rawbuf=0x7f2720012808 "CALL pr", length=7, parser_state=0x7f27308f05e0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7818 #20 0x000056291f2c30c3 in dispatch_command (command=COM_QUERY, thd=0x7f2720000af0, packet=0x7f2720008c61 "CALL pr", packet_length=7, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1856 #21 0x000056291f2c1a0b in do_command (thd=0x7f2720000af0) at /data/src/10.3/sql/sql_parse.cc:1401 #22 0x000056291f438e4c in do_handle_one_connection (connect=0x562922d91a40) at /data/src/10.3/sql/sql_connect.cc:1403 #23 0x000056291f438bae in handle_one_connection (arg=0x562922d91a40) at /data/src/10.3/sql/sql_connect.cc:1308 #24 0x000056291fde54f0 in pfs_spawn_thread (arg=0x562922daca00) at /data/src/10.3/storage/perfschema/pfs.cc:1862 #25 0x00007f27382674a4 in start_thread (arg=0x7f27308f1700) at pthread_create.c:456 #26 0x00007f27367aed0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

            The test case from the previous comment still fails with the same assertion failure.

            10.3 9d9a2253

            mysqld: /data/src/10.3/sql/sql_delete.cc:923: int mysql_prepare_delete(THD*, TABLE_LIST*, uint, List<Item>&, Item**, bool*): Assertion `!table_list->vers_conditions.is_set() || !*conds || thd->stmt_arena->is_stmt_execute()' failed.
            191203 13:20:25 [ERROR] mysqld got signal 6 ;
             
            #7  0x00007f6f820e9f12 in __GI___assert_fail (assertion=0x5652ff4113d8 "!table_list->vers_conditions.is_set() || !*conds || thd->stmt_arena->is_stmt_execute()", file=0x5652ff4111f8 "/data/src/10.3/sql/sql_delete.cc", line=923, function=0x5652ff4117c0 <mysql_prepare_delete(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item**, bool*)::__PRETTY_FUNCTION__> "int mysql_prepare_delete(THD*, TABLE_LIST*, uint, List<Item>&, Item**, bool*)") at assert.c:101
            #8  0x00005652fead771c in mysql_prepare_delete (thd=0x7f6f6c000af0, table_list=0x7f6f6c0729d8, wild_num=0, field_list=..., conds=0x7f6f7c2e5ff8, delete_while_scanning=0x7f6f7c2e6013) at /data/src/10.3/sql/sql_delete.cc:922
            #9  0x00005652fead4fe9 in mysql_delete (thd=0x7f6f6c000af0, table_list=0x7f6f6c0729d8, conds=0x7f6f6c075560, order_list=0x7f6f6c0748e0, limit=18446744073709551615, options=0, result=0x0) at /data/src/10.3/sql/sql_delete.cc:323
            #10 0x00005652fe60c5f8 in mysql_execute_command (thd=0x7f6f6c000af0) at /data/src/10.3/sql/sql_parse.cc:4658
            #11 0x00005652fe52c2d6 in sp_instr_stmt::exec_core (this=0x7f6f6c073030, thd=0x7f6f6c000af0, nextp=0x7f6f7c2e71c4) at /data/src/10.3/sql/sp_head.cc:3596
            #12 0x00005652fe52b724 in sp_lex_keeper::reset_lex_and_exec_core (this=0x7f6f6c073078, thd=0x7f6f6c000af0, nextp=0x7f6f7c2e71c4, open_tables=false, instr=0x7f6f6c073030) at /data/src/10.3/sql/sp_head.cc:3324
            #13 0x00005652fe52beb6 in sp_instr_stmt::execute (this=0x7f6f6c073030, thd=0x7f6f6c000af0, nextp=0x7f6f7c2e71c4) at /data/src/10.3/sql/sp_head.cc:3502
            #14 0x00005652fe525a84 in sp_head::execute (this=0x7f6f6c071d78, thd=0x7f6f6c000af0, merge_da_on_success=true) at /data/src/10.3/sql/sp_head.cc:1356
            #15 0x00005652fe52853c in sp_head::execute_procedure (this=0x7f6f6c071d78, thd=0x7f6f6c000af0, args=0x7f6f6c005778) at /data/src/10.3/sql/sp_head.cc:2296
            #16 0x00005652fe606ed6 in do_execute_sp (thd=0x7f6f6c000af0, sp=0x7f6f6c071d78) at /data/src/10.3/sql/sql_parse.cc:2992
            #17 0x00005652fe607b4c in Sql_cmd_call::execute (this=0x7f6f6c0128d0, thd=0x7f6f6c000af0) at /data/src/10.3/sql/sql_parse.cc:3232
            #18 0x00005652fe6119ea in mysql_execute_command (thd=0x7f6f6c000af0) at /data/src/10.3/sql/sql_parse.cc:6031
            #19 0x00005652fe61714b in mysql_parse (thd=0x7f6f6c000af0, rawbuf=0x7f6f6c012818 "CALL pr", length=7, parser_state=0x7f6f7c2e85e0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7818
            #20 0x00005652fe603c97 in dispatch_command (command=COM_QUERY, thd=0x7f6f6c000af0, packet=0x7f6f6c123431 "CALL pr", packet_length=7, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1856
            #21 0x00005652fe6025df in do_command (thd=0x7f6f6c000af0) at /data/src/10.3/sql/sql_parse.cc:1401
            #22 0x00005652fe779a70 in do_handle_one_connection (connect=0x5653028a3a50) at /data/src/10.3/sql/sql_connect.cc:1403
            #23 0x00005652fe7797d2 in handle_one_connection (arg=0x5653028a3a50) at /data/src/10.3/sql/sql_connect.cc:1308
            #24 0x00005652ff12730c in pfs_spawn_thread (arg=0x5653028bea10) at /data/src/10.3/storage/perfschema/pfs.cc:1862
            #25 0x00007f6f83c5f4a4 in start_thread (arg=0x7f6f7c2e9700) at pthread_create.c:456
            #26 0x00007f6f821a6d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
            

            elenst Elena Stepanova added a comment - The test case from the previous comment still fails with the same assertion failure. 10.3 9d9a2253 mysqld: /data/src/10.3/sql/sql_delete.cc:923: int mysql_prepare_delete(THD*, TABLE_LIST*, uint, List<Item>&, Item**, bool*): Assertion `!table_list->vers_conditions.is_set() || !*conds || thd->stmt_arena->is_stmt_execute()' failed. 191203 13:20:25 [ERROR] mysqld got signal 6 ;   #7 0x00007f6f820e9f12 in __GI___assert_fail (assertion=0x5652ff4113d8 "!table_list->vers_conditions.is_set() || !*conds || thd->stmt_arena->is_stmt_execute()", file=0x5652ff4111f8 "/data/src/10.3/sql/sql_delete.cc", line=923, function=0x5652ff4117c0 <mysql_prepare_delete(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item**, bool*)::__PRETTY_FUNCTION__> "int mysql_prepare_delete(THD*, TABLE_LIST*, uint, List<Item>&, Item**, bool*)") at assert.c:101 #8 0x00005652fead771c in mysql_prepare_delete (thd=0x7f6f6c000af0, table_list=0x7f6f6c0729d8, wild_num=0, field_list=..., conds=0x7f6f7c2e5ff8, delete_while_scanning=0x7f6f7c2e6013) at /data/src/10.3/sql/sql_delete.cc:922 #9 0x00005652fead4fe9 in mysql_delete (thd=0x7f6f6c000af0, table_list=0x7f6f6c0729d8, conds=0x7f6f6c075560, order_list=0x7f6f6c0748e0, limit=18446744073709551615, options=0, result=0x0) at /data/src/10.3/sql/sql_delete.cc:323 #10 0x00005652fe60c5f8 in mysql_execute_command (thd=0x7f6f6c000af0) at /data/src/10.3/sql/sql_parse.cc:4658 #11 0x00005652fe52c2d6 in sp_instr_stmt::exec_core (this=0x7f6f6c073030, thd=0x7f6f6c000af0, nextp=0x7f6f7c2e71c4) at /data/src/10.3/sql/sp_head.cc:3596 #12 0x00005652fe52b724 in sp_lex_keeper::reset_lex_and_exec_core (this=0x7f6f6c073078, thd=0x7f6f6c000af0, nextp=0x7f6f7c2e71c4, open_tables=false, instr=0x7f6f6c073030) at /data/src/10.3/sql/sp_head.cc:3324 #13 0x00005652fe52beb6 in sp_instr_stmt::execute (this=0x7f6f6c073030, thd=0x7f6f6c000af0, nextp=0x7f6f7c2e71c4) at /data/src/10.3/sql/sp_head.cc:3502 #14 0x00005652fe525a84 in sp_head::execute (this=0x7f6f6c071d78, thd=0x7f6f6c000af0, merge_da_on_success=true) at /data/src/10.3/sql/sp_head.cc:1356 #15 0x00005652fe52853c in sp_head::execute_procedure (this=0x7f6f6c071d78, thd=0x7f6f6c000af0, args=0x7f6f6c005778) at /data/src/10.3/sql/sp_head.cc:2296 #16 0x00005652fe606ed6 in do_execute_sp (thd=0x7f6f6c000af0, sp=0x7f6f6c071d78) at /data/src/10.3/sql/sql_parse.cc:2992 #17 0x00005652fe607b4c in Sql_cmd_call::execute (this=0x7f6f6c0128d0, thd=0x7f6f6c000af0) at /data/src/10.3/sql/sql_parse.cc:3232 #18 0x00005652fe6119ea in mysql_execute_command (thd=0x7f6f6c000af0) at /data/src/10.3/sql/sql_parse.cc:6031 #19 0x00005652fe61714b in mysql_parse (thd=0x7f6f6c000af0, rawbuf=0x7f6f6c012818 "CALL pr", length=7, parser_state=0x7f6f7c2e85e0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7818 #20 0x00005652fe603c97 in dispatch_command (command=COM_QUERY, thd=0x7f6f6c000af0, packet=0x7f6f6c123431 "CALL pr", packet_length=7, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1856 #21 0x00005652fe6025df in do_command (thd=0x7f6f6c000af0) at /data/src/10.3/sql/sql_parse.cc:1401 #22 0x00005652fe779a70 in do_handle_one_connection (connect=0x5653028a3a50) at /data/src/10.3/sql/sql_connect.cc:1403 #23 0x00005652fe7797d2 in handle_one_connection (arg=0x5653028a3a50) at /data/src/10.3/sql/sql_connect.cc:1308 #24 0x00005652ff12730c in pfs_spawn_thread (arg=0x5653028bea10) at /data/src/10.3/storage/perfschema/pfs.cc:1862 #25 0x00007f6f83c5f4a4 in start_thread (arg=0x7f6f7c2e9700) at pthread_create.c:456 #26 0x00007f6f821a6d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

            Both MDEV-20497 and MDEV-21144 are closed as duplicates of this one, but similar test cases still crash with the same stack traces as in those bug reports.

            CREATE TABLE t1 (a INT, s DATE, e DATE, PERIOD FOR app(s,e));
            CREATE PROCEDURE sp() UPDATE t1 FOR PORTION OF app FROM '2019-01-01' TO '2019-12-31' SET a = 0;
            LOCK TABLE t1 READ;
            --error ER_TABLE_NOT_LOCKED_FOR_WRITE
            CALL sp;
            UNLOCK TABLES;
            CALL sp;
             
            # Cleanup
            DROP PROCEDURE sp;
            DROP TABLE t1;
            

            10.4 0b8b11b0

            #3  <signal handler called>
            #4  0x0000561f65d95963 in check_fields (thd=0x7fd210000af0, table=0x7fd21013edb0, items=..., update_view=false) at /data/src/10.4/sql/sql_update.cc:198
            #5  0x0000561f65d96803 in mysql_update (thd=0x7fd210000af0, table_list=0x7fd21013edb0, fields=..., values=..., conds=0x0, order_num=0, order=0x0, limit=18446744073709551615, ignore=false, found_return=0x7fd221ba0cf0, updated_return=0x7fd221ba0db0) at /data/src/10.4/sql/sql_update.cc:483
            #6  0x0000561f65c893b9 in mysql_execute_command (thd=0x7fd210000af0) at /data/src/10.4/sql/sql_parse.cc:4377
            #7  0x0000561f65b99276 in sp_instr_stmt::exec_core (this=0x7fd21013f648, thd=0x7fd210000af0, nextp=0x7fd221ba16a4) at /data/src/10.4/sql/sp_head.cc:3670
            #8  0x0000561f65b985cf in sp_lex_keeper::reset_lex_and_exec_core (this=0x7fd21013f690, thd=0x7fd210000af0, nextp=0x7fd221ba16a4, open_tables=false, instr=0x7fd21013f648) at /data/src/10.4/sql/sp_head.cc:3398
            #9  0x0000561f65b98e3a in sp_instr_stmt::execute (this=0x7fd21013f648, thd=0x7fd210000af0, nextp=0x7fd221ba16a4) at /data/src/10.4/sql/sp_head.cc:3576
            #10 0x0000561f65b924df in sp_head::execute (this=0x7fd21013de58, thd=0x7fd210000af0, merge_da_on_success=true) at /data/src/10.4/sql/sp_head.cc:1346
            #11 0x0000561f65b95313 in sp_head::execute_procedure (this=0x7fd21013de58, thd=0x7fd210000af0, args=0x7fd2100058e8) at /data/src/10.4/sql/sp_head.cc:2351
            #12 0x0000561f65c84be9 in do_execute_sp (thd=0x7fd210000af0, sp=0x7fd21013de58) at /data/src/10.4/sql/sql_parse.cc:3015
            #13 0x0000561f65c858d0 in Sql_cmd_call::execute (this=0x7fd210013200, thd=0x7fd210000af0) at /data/src/10.4/sql/sql_parse.cc:3257
            #14 0x0000561f65c90cc5 in mysql_execute_command (thd=0x7fd210000af0) at /data/src/10.4/sql/sql_parse.cc:6102
            #15 0x0000561f65c96387 in mysql_parse (thd=0x7fd210000af0, rawbuf=0x7fd210013158 "CALL sp", length=7, parser_state=0x7fd221ba3160, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7901
            #16 0x0000561f65c8152c in dispatch_command (command=COM_QUERY, thd=0x7fd210000af0, packet=0x7fd210008361 "CALL sp", packet_length=7, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1842
            #17 0x0000561f65c7fbb9 in do_command (thd=0x7fd210000af0) at /data/src/10.4/sql/sql_parse.cc:1360
            #18 0x0000561f65e086a7 in do_handle_one_connection (connect=0x561f68e424c0) at /data/src/10.4/sql/sql_connect.cc:1412
            #19 0x0000561f65e083f6 in handle_one_connection (arg=0x561f68e424c0) at /data/src/10.4/sql/sql_connect.cc:1316
            #20 0x0000561f6680a7bb in pfs_spawn_thread (arg=0x561f68dac890) at /data/src/10.4/storage/perfschema/pfs.cc:1862
            #21 0x00007fd2295474a4 in start_thread (arg=0x7fd221ba4700) at pthread_create.c:456
            #22 0x00007fd227a8ed0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
            

            CREATE TABLE t1 (a INT, s DATE, e DATE, PERIOD FOR app(s,e));
            CREATE PROCEDURE sp() UPDATE t1 FOR PORTION OF app FROM '2019-01-01' TO CURDATE SET a = 0;
            LOCK TABLE t1 READ;
            --error ER_TABLE_NOT_LOCKED_FOR_WRITE
            CALL sp;
            UNLOCK TABLES;
            CALL sp;
             
            # Cleanup
            DROP PROCEDURE sp;
            DROP TABLE t1;
            

            #3  <signal handler called>
            #4  0x000055a46fb37475 in Item_field::used_tables (this=0x7fb81413ed10) at /data/src/10.4/sql/item.cc:3324
            #5  0x000055a46f690ee9 in Item::const_item (this=0x7fb81413ed10) at /data/src/10.4/sql/item.h:1650
            #6  0x000055a46f8c26a9 in mysql_update (thd=0x7fb814000af0, table_list=0x7fb81413ee28, fields=..., values=..., conds=0x0, order_num=0, order=0x0, limit=18446744073709551615, ignore=false, found_return=0x7fb825f93cf0, updated_return=0x7fb825f93db0) at /data/src/10.4/sql/sql_update.cc:463
            #7  0x000055a46f7b53b9 in mysql_execute_command (thd=0x7fb814000af0) at /data/src/10.4/sql/sql_parse.cc:4377
            #8  0x000055a46f6c5276 in sp_instr_stmt::exec_core (this=0x7fb81413f6c0, thd=0x7fb814000af0, nextp=0x7fb825f946a4) at /data/src/10.4/sql/sp_head.cc:3670
            #9  0x000055a46f6c45cf in sp_lex_keeper::reset_lex_and_exec_core (this=0x7fb81413f708, thd=0x7fb814000af0, nextp=0x7fb825f946a4, open_tables=false, instr=0x7fb81413f6c0) at /data/src/10.4/sql/sp_head.cc:3398
            #10 0x000055a46f6c4e3a in sp_instr_stmt::execute (this=0x7fb81413f6c0, thd=0x7fb814000af0, nextp=0x7fb825f946a4) at /data/src/10.4/sql/sp_head.cc:3576
            #11 0x000055a46f6be4df in sp_head::execute (this=0x7fb81413de78, thd=0x7fb814000af0, merge_da_on_success=true) at /data/src/10.4/sql/sp_head.cc:1346
            #12 0x000055a46f6c1313 in sp_head::execute_procedure (this=0x7fb81413de78, thd=0x7fb814000af0, args=0x7fb8140058e8) at /data/src/10.4/sql/sp_head.cc:2351
            #13 0x000055a46f7b0be9 in do_execute_sp (thd=0x7fb814000af0, sp=0x7fb81413de78) at /data/src/10.4/sql/sql_parse.cc:3015
            #14 0x000055a46f7b18d0 in Sql_cmd_call::execute (this=0x7fb814013200, thd=0x7fb814000af0) at /data/src/10.4/sql/sql_parse.cc:3257
            #15 0x000055a46f7bccc5 in mysql_execute_command (thd=0x7fb814000af0) at /data/src/10.4/sql/sql_parse.cc:6102
            #16 0x000055a46f7c2387 in mysql_parse (thd=0x7fb814000af0, rawbuf=0x7fb814013158 "CALL sp", length=7, parser_state=0x7fb825f96160, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7901
            #17 0x000055a46f7ad52c in dispatch_command (command=COM_QUERY, thd=0x7fb814000af0, packet=0x7fb814008361 "CALL sp", packet_length=7, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1842
            #18 0x000055a46f7abbb9 in do_command (thd=0x7fb814000af0) at /data/src/10.4/sql/sql_parse.cc:1360
            #19 0x000055a46f9346a7 in do_handle_one_connection (connect=0x55a4725864c0) at /data/src/10.4/sql/sql_connect.cc:1412
            #20 0x000055a46f9343f6 in handle_one_connection (arg=0x55a4725864c0) at /data/src/10.4/sql/sql_connect.cc:1316
            #21 0x000055a4703367bb in pfs_spawn_thread (arg=0x55a4724f0890) at /data/src/10.4/storage/perfschema/pfs.cc:1862
            #22 0x00007fb82d93a4a4 in start_thread (arg=0x7fb825f97700) at pthread_create.c:456
            #23 0x00007fb82be81d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
            

            elenst Elena Stepanova added a comment - Both MDEV-20497 and MDEV-21144 are closed as duplicates of this one, but similar test cases still crash with the same stack traces as in those bug reports. CREATE TABLE t1 (a INT , s DATE , e DATE , PERIOD FOR app(s,e)); CREATE PROCEDURE sp() UPDATE t1 FOR PORTION OF app FROM '2019-01-01' TO '2019-12-31' SET a = 0; LOCK TABLE t1 READ ; --error ER_TABLE_NOT_LOCKED_FOR_WRITE CALL sp; UNLOCK TABLES; CALL sp;   # Cleanup DROP PROCEDURE sp; DROP TABLE t1; 10.4 0b8b11b0 #3 <signal handler called> #4 0x0000561f65d95963 in check_fields (thd=0x7fd210000af0, table=0x7fd21013edb0, items=..., update_view=false) at /data/src/10.4/sql/sql_update.cc:198 #5 0x0000561f65d96803 in mysql_update (thd=0x7fd210000af0, table_list=0x7fd21013edb0, fields=..., values=..., conds=0x0, order_num=0, order=0x0, limit=18446744073709551615, ignore=false, found_return=0x7fd221ba0cf0, updated_return=0x7fd221ba0db0) at /data/src/10.4/sql/sql_update.cc:483 #6 0x0000561f65c893b9 in mysql_execute_command (thd=0x7fd210000af0) at /data/src/10.4/sql/sql_parse.cc:4377 #7 0x0000561f65b99276 in sp_instr_stmt::exec_core (this=0x7fd21013f648, thd=0x7fd210000af0, nextp=0x7fd221ba16a4) at /data/src/10.4/sql/sp_head.cc:3670 #8 0x0000561f65b985cf in sp_lex_keeper::reset_lex_and_exec_core (this=0x7fd21013f690, thd=0x7fd210000af0, nextp=0x7fd221ba16a4, open_tables=false, instr=0x7fd21013f648) at /data/src/10.4/sql/sp_head.cc:3398 #9 0x0000561f65b98e3a in sp_instr_stmt::execute (this=0x7fd21013f648, thd=0x7fd210000af0, nextp=0x7fd221ba16a4) at /data/src/10.4/sql/sp_head.cc:3576 #10 0x0000561f65b924df in sp_head::execute (this=0x7fd21013de58, thd=0x7fd210000af0, merge_da_on_success=true) at /data/src/10.4/sql/sp_head.cc:1346 #11 0x0000561f65b95313 in sp_head::execute_procedure (this=0x7fd21013de58, thd=0x7fd210000af0, args=0x7fd2100058e8) at /data/src/10.4/sql/sp_head.cc:2351 #12 0x0000561f65c84be9 in do_execute_sp (thd=0x7fd210000af0, sp=0x7fd21013de58) at /data/src/10.4/sql/sql_parse.cc:3015 #13 0x0000561f65c858d0 in Sql_cmd_call::execute (this=0x7fd210013200, thd=0x7fd210000af0) at /data/src/10.4/sql/sql_parse.cc:3257 #14 0x0000561f65c90cc5 in mysql_execute_command (thd=0x7fd210000af0) at /data/src/10.4/sql/sql_parse.cc:6102 #15 0x0000561f65c96387 in mysql_parse (thd=0x7fd210000af0, rawbuf=0x7fd210013158 "CALL sp", length=7, parser_state=0x7fd221ba3160, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7901 #16 0x0000561f65c8152c in dispatch_command (command=COM_QUERY, thd=0x7fd210000af0, packet=0x7fd210008361 "CALL sp", packet_length=7, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1842 #17 0x0000561f65c7fbb9 in do_command (thd=0x7fd210000af0) at /data/src/10.4/sql/sql_parse.cc:1360 #18 0x0000561f65e086a7 in do_handle_one_connection (connect=0x561f68e424c0) at /data/src/10.4/sql/sql_connect.cc:1412 #19 0x0000561f65e083f6 in handle_one_connection (arg=0x561f68e424c0) at /data/src/10.4/sql/sql_connect.cc:1316 #20 0x0000561f6680a7bb in pfs_spawn_thread (arg=0x561f68dac890) at /data/src/10.4/storage/perfschema/pfs.cc:1862 #21 0x00007fd2295474a4 in start_thread (arg=0x7fd221ba4700) at pthread_create.c:456 #22 0x00007fd227a8ed0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97 CREATE TABLE t1 (a INT , s DATE , e DATE , PERIOD FOR app(s,e)); CREATE PROCEDURE sp() UPDATE t1 FOR PORTION OF app FROM '2019-01-01' TO CURDATE SET a = 0; LOCK TABLE t1 READ ; --error ER_TABLE_NOT_LOCKED_FOR_WRITE CALL sp; UNLOCK TABLES; CALL sp;   # Cleanup DROP PROCEDURE sp; DROP TABLE t1; #3 <signal handler called> #4 0x000055a46fb37475 in Item_field::used_tables (this=0x7fb81413ed10) at /data/src/10.4/sql/item.cc:3324 #5 0x000055a46f690ee9 in Item::const_item (this=0x7fb81413ed10) at /data/src/10.4/sql/item.h:1650 #6 0x000055a46f8c26a9 in mysql_update (thd=0x7fb814000af0, table_list=0x7fb81413ee28, fields=..., values=..., conds=0x0, order_num=0, order=0x0, limit=18446744073709551615, ignore=false, found_return=0x7fb825f93cf0, updated_return=0x7fb825f93db0) at /data/src/10.4/sql/sql_update.cc:463 #7 0x000055a46f7b53b9 in mysql_execute_command (thd=0x7fb814000af0) at /data/src/10.4/sql/sql_parse.cc:4377 #8 0x000055a46f6c5276 in sp_instr_stmt::exec_core (this=0x7fb81413f6c0, thd=0x7fb814000af0, nextp=0x7fb825f946a4) at /data/src/10.4/sql/sp_head.cc:3670 #9 0x000055a46f6c45cf in sp_lex_keeper::reset_lex_and_exec_core (this=0x7fb81413f708, thd=0x7fb814000af0, nextp=0x7fb825f946a4, open_tables=false, instr=0x7fb81413f6c0) at /data/src/10.4/sql/sp_head.cc:3398 #10 0x000055a46f6c4e3a in sp_instr_stmt::execute (this=0x7fb81413f6c0, thd=0x7fb814000af0, nextp=0x7fb825f946a4) at /data/src/10.4/sql/sp_head.cc:3576 #11 0x000055a46f6be4df in sp_head::execute (this=0x7fb81413de78, thd=0x7fb814000af0, merge_da_on_success=true) at /data/src/10.4/sql/sp_head.cc:1346 #12 0x000055a46f6c1313 in sp_head::execute_procedure (this=0x7fb81413de78, thd=0x7fb814000af0, args=0x7fb8140058e8) at /data/src/10.4/sql/sp_head.cc:2351 #13 0x000055a46f7b0be9 in do_execute_sp (thd=0x7fb814000af0, sp=0x7fb81413de78) at /data/src/10.4/sql/sql_parse.cc:3015 #14 0x000055a46f7b18d0 in Sql_cmd_call::execute (this=0x7fb814013200, thd=0x7fb814000af0) at /data/src/10.4/sql/sql_parse.cc:3257 #15 0x000055a46f7bccc5 in mysql_execute_command (thd=0x7fb814000af0) at /data/src/10.4/sql/sql_parse.cc:6102 #16 0x000055a46f7c2387 in mysql_parse (thd=0x7fb814000af0, rawbuf=0x7fb814013158 "CALL sp", length=7, parser_state=0x7fb825f96160, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7901 #17 0x000055a46f7ad52c in dispatch_command (command=COM_QUERY, thd=0x7fb814000af0, packet=0x7fb814008361 "CALL sp", packet_length=7, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1842 #18 0x000055a46f7abbb9 in do_command (thd=0x7fb814000af0) at /data/src/10.4/sql/sql_parse.cc:1360 #19 0x000055a46f9346a7 in do_handle_one_connection (connect=0x55a4725864c0) at /data/src/10.4/sql/sql_connect.cc:1412 #20 0x000055a46f9343f6 in handle_one_connection (arg=0x55a4725864c0) at /data/src/10.4/sql/sql_connect.cc:1316 #21 0x000055a4703367bb in pfs_spawn_thread (arg=0x55a4724f0890) at /data/src/10.4/storage/perfschema/pfs.cc:1862 #22 0x00007fb82d93a4a4 in start_thread (arg=0x7fb825f97700) at pthread_create.c:456 #23 0x00007fb82be81d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

            People

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