[MDEV-21144] Wrong result or server crash in Item_field::used_tables upon 2nd execution of SP with non-existent period Created: 2019-11-25  Updated: 2019-11-29  Resolved: 2019-11-29

Status: Closed
Project: MariaDB Server
Component/s: Versioned Tables
Affects Version/s: 10.4
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Aleksey Midenkov
Resolution: Duplicate Votes: 0
Labels: None

Issue Links:
Duplicate
duplicates MDEV-18929 2nd execution of SP does not detect E... Closed
Relates
relates to MDEV-20338 Server crashes in check_fields upon 2... Closed
relates to MDEV-20497 Server crashes in Item_field::used_ta... Closed

 Description   

Note: The test case is similar to MDEV-20497 and MDEV-20338. The main difference is that till recently it didn't crash, but returned unexpected success on 2nd execution (see below). Starting from revision 33f55789 (MDEV-18727 improve DML operation of System Versioning) it also crashes.

CREATE TABLE t1 (a INT);
CREATE PROCEDURE pr() UPDATE t1 FOR PORTION OF app FROM '2019-07-16' TO '2019-12-14' SET a = 1;
--error ER_PERIOD_NOT_FOUND
CALL pr;
--error ER_PERIOD_NOT_FOUND
CALL pr;
 
# Cleanup
DROP PROCEDURE pr;
DROP TABLE t1;

10.4 f9528821

CREATE TABLE t1 (a INT);
CREATE PROCEDURE pr() UPDATE t1 FOR PORTION OF app FROM '2019-07-16' TO '2019-12-14' SET a = 1;
CALL pr;
ERROR HY000: Period `app` is not found in table
CALL pr;
bug.threads2                             [ fail ]
        Test ended at 2019-11-26 01:17:33
 
CURRENT_TEST: bug.threads2
mysqltest: At line 6: query 'CALL pr' succeeded - should have failed with errno 4156...

10.4 33f55789

#3  <signal handler called>
#4  0x00005627ea65532f in check_fields (thd=0x7fcf74000af0, table=0x7fcf741392c0, items=..., update_view=false) at /data/src/10.4-bug/sql/sql_update.cc:198
#5  0x00005627ea6561c3 in mysql_update (thd=0x7fcf74000af0, table_list=0x7fcf741392c0, fields=..., values=..., conds=0x0, order_num=0, order=0x0, limit=18446744073709551615, ignore=false, found_return=0x7fcf90177d00, updated_return=0x7fcf90177dc0) at /data/src/10.4-bug/sql/sql_update.cc:480
#6  0x00005627ea548ee9 in mysql_execute_command (thd=0x7fcf74000af0) at /data/src/10.4-bug/sql/sql_parse.cc:4377
#7  0x00005627ea459066 in sp_instr_stmt::exec_core (this=0x7fcf74139b48, thd=0x7fcf74000af0, nextp=0x7fcf901786b4) at /data/src/10.4-bug/sql/sp_head.cc:3670
#8  0x00005627ea4583bf in sp_lex_keeper::reset_lex_and_exec_core (this=0x7fcf74139b90, thd=0x7fcf74000af0, nextp=0x7fcf901786b4, open_tables=false, instr=0x7fcf74139b48) at /data/src/10.4-bug/sql/sp_head.cc:3398
#9  0x00005627ea458c2a in sp_instr_stmt::execute (this=0x7fcf74139b48, thd=0x7fcf74000af0, nextp=0x7fcf901786b4) at /data/src/10.4-bug/sql/sp_head.cc:3576
#10 0x00005627ea4522cf in sp_head::execute (this=0x7fcf74138368, thd=0x7fcf74000af0, merge_da_on_success=true) at /data/src/10.4-bug/sql/sp_head.cc:1346
#11 0x00005627ea455103 in sp_head::execute_procedure (this=0x7fcf74138368, thd=0x7fcf74000af0, args=0x7fcf740058d8) at /data/src/10.4-bug/sql/sp_head.cc:2351
#12 0x00005627ea544719 in do_execute_sp (thd=0x7fcf74000af0, sp=0x7fcf74138368) at /data/src/10.4-bug/sql/sql_parse.cc:3015
#13 0x00005627ea545400 in Sql_cmd_call::execute (this=0x7fcf740131e0, thd=0x7fcf74000af0) at /data/src/10.4-bug/sql/sql_parse.cc:3257
#14 0x00005627ea5507f5 in mysql_execute_command (thd=0x7fcf74000af0) at /data/src/10.4-bug/sql/sql_parse.cc:6102
#15 0x00005627ea555eb7 in mysql_parse (thd=0x7fcf74000af0, rawbuf=0x7fcf74013138 "CALL pr", length=7, parser_state=0x7fcf9017a170, is_com_multi=false, is_next_command=false) at /data/src/10.4-bug/sql/sql_parse.cc:7901
#16 0x00005627ea54105c in dispatch_command (command=COM_QUERY, thd=0x7fcf74000af0, packet=0x7fcf74008341 "CALL pr", packet_length=7, is_com_multi=false, is_next_command=false) at /data/src/10.4-bug/sql/sql_parse.cc:1842
#17 0x00005627ea53f6e9 in do_command (thd=0x7fcf74000af0) at /data/src/10.4-bug/sql/sql_parse.cc:1360
#18 0x00005627ea6c7d5d in do_handle_one_connection (connect=0x5627ede3bd50) at /data/src/10.4-bug/sql/sql_connect.cc:1412
#19 0x00005627ea6c7aac in handle_one_connection (arg=0x5627ede3bd50) at /data/src/10.4-bug/sql/sql_connect.cc:1316
#20 0x00005627eb0c9d97 in pfs_spawn_thread (arg=0x5627edd605b0) at /data/src/10.4-bug/storage/perfschema/pfs.cc:1862
#21 0x00007fcf9731d4a4 in start_thread (arg=0x7fcf9017b700) at pthread_create.c:456
#22 0x00007fcf95864d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

Reproducible on 10.4-10.5.


Generated at Thu Feb 08 09:04:55 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.