-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDEV-9690 concurrent queries with virtual columns crash in temporal code
Item_func_le included Arg_comparator. Arg_comparator remembered the current_thd during fix_fields and used that value during execution to allocate Item_cache in get_datetime_value(). But for vcols fix_fields and val_int can happen in different threads. Same bug for Item_func_in using in_datetime or cmp_item_datetime, both also remembered current_thd at fix_fields() to use it later for get_datetime_value(). As a fix, these objects no longer remember the current_thd, and get_datetime_value() uses current_thd at run time. This should not increase the number of current_thd calls much, as Item_cache is created only once anyway.
- Loading branch information
Showing
4 changed files
with
77 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
create table t1 (a datetime, | ||
# get_datetime_value | ||
b int as (a > 1), # Arg_comparator | ||
c int as (a in (1,2,3)), # in_datetime | ||
d int as ((a,a) in ((1,1),(2,1),(NULL,1))) # cmp_item_datetime | ||
); | ||
Warnings: | ||
Warning 1292 Incorrect datetime value: '1' | ||
Warning 1292 Incorrect datetime value: '2' | ||
Warning 1292 Incorrect datetime value: '3' | ||
show create table t1; | ||
Table Create Table | ||
t1 CREATE TABLE `t1` ( | ||
`a` datetime DEFAULT NULL, | ||
`b` int(11) AS (a > 1) VIRTUAL, | ||
`c` int(11) AS (a in (1,2,3)) VIRTUAL, | ||
`d` int(11) AS ((a,a) in ((1,1),(2,1),(NULL,1))) VIRTUAL | ||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 | ||
Warnings: | ||
Warning 1292 Incorrect datetime value: '1' | ||
Warning 1292 Incorrect datetime value: '2' | ||
Warning 1292 Incorrect datetime value: '3' | ||
insert t1 (a) values ('2010-10-10 10:10:10'); | ||
select * from t1; | ||
a b c d | ||
2010-10-10 10:10:10 1 0 0 | ||
Warnings: | ||
Warning 1292 Incorrect datetime value: '1' | ||
Warning 1292 Incorrect datetime value: '1' | ||
Warning 1292 Incorrect datetime value: '2' | ||
Warning 1292 Incorrect datetime value: '1' | ||
select * from t1; | ||
a b c d | ||
2010-10-10 10:10:10 1 0 0 | ||
Warnings: | ||
Warning 1292 Incorrect datetime value: '1' | ||
Warning 1292 Incorrect datetime value: '2' | ||
Warning 1292 Incorrect datetime value: '1' | ||
drop table t1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# | ||
# This tests various issues when vcol items allocate memory (e.g. more items) | ||
# not in the TABLE::expr_arena. | ||
# | ||
|
||
# | ||
# MDEV-9690 concurrent queries with virtual columns crash in temporal code | ||
# | ||
create table t1 (a datetime, | ||
# get_datetime_value | ||
b int as (a > 1), # Arg_comparator | ||
c int as (a in (1,2,3)), # in_datetime | ||
d int as ((a,a) in ((1,1),(2,1),(NULL,1))) # cmp_item_datetime | ||
); | ||
show create table t1; | ||
connect con1, localhost, root; | ||
insert t1 (a) values ('2010-10-10 10:10:10'); | ||
select * from t1; | ||
disconnect con1; | ||
connection default; | ||
select * from t1; | ||
drop table t1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters