Skip to content

Commit c49311a

Browse files
committed
Added
1 parent b2b983b commit c49311a

7 files changed

Lines changed: 82 additions & 13 deletions

File tree

mysql-test/main/global_temporary_table.result

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,10 +1007,10 @@ create global temporary table t (t text);
10071007
set max_session_mem_used= 8192;
10081008
insert t values (0);
10091009
ERROR HY000: The MariaDB server is running with the --max-session-mem-used=8192 option so it cannot execute this statement
1010-
set max_session_mem_used= 32768;
10111010
lock table t write;
1011+
ERROR HY000: The MariaDB server is running with the --max-session-mem-used=8192 option so it cannot execute this statement
10121012
alter table t add z int;
1013-
ERROR HY000: The MariaDB server is running with the --max-session-mem-used=32768 option so it cannot execute this statement
1013+
ERROR HY000: The MariaDB server is running with the --max-session-mem-used=8192 option so it cannot execute this statement
10141014
set max_session_mem_used= default;
10151015
drop table t;
10161016
unlock tables;
@@ -1251,7 +1251,6 @@ c
12511251
set max_session_mem_used=8192;
12521252
truncate t;
12531253
ERROR HY000: The MariaDB server is running with the --max-session-mem-used=8192 option so it cannot execute this statement
1254-
set max_session_mem_used= 32768;
12551254
set max_session_mem_used= default;
12561255
unlock tables;
12571256
select * from t;

mysql-test/main/global_temporary_table.test

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -877,9 +877,8 @@ create global temporary table t (t text);
877877
set max_session_mem_used= 8192;
878878
--error ER_OPTION_PREVENTS_STATEMENT
879879
insert t values (0);
880-
set max_session_mem_used= 32768;
880+
--error ER_OPTION_PREVENTS_STATEMENT
881881
lock table t write;
882-
883882
--error ER_OPTION_PREVENTS_STATEMENT
884883
alter table t add z int;
885884
set max_session_mem_used= default;
@@ -1123,7 +1122,6 @@ select * from t;
11231122
set max_session_mem_used=8192;
11241123
--error ER_OPTION_PREVENTS_STATEMENT
11251124
truncate t;
1126-
set max_session_mem_used= 32768;
11271125
set max_session_mem_used= default;
11281126
unlock tables;
11291127
select * from t;
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
--source include/not_embedded.inc
2+
--disable_service_connection
3+
--disable_ps_protocol
4+
5+
# Count my_malloc calls per statement. malloc_calls is a debug-build global
6+
# counter incremented in my_malloc_size_cb_func(), i.e. once per accounted
7+
# allocation. A statement that shows ~0 delta performed no my_malloc at all,
8+
# so the max_session_mem_used check can never fire for it.
9+
10+
let $snap= select variable_value into @mc from information_schema.global_status
11+
where variable_name='malloc_calls';
12+
let $delta= select variable_value - @mc as malloc_calls_delta
13+
from information_schema.global_status
14+
where variable_name='malloc_calls';
15+
16+
--disable_query_log
17+
create global temporary table t (t text);
18+
19+
--echo # --- control: measurement overhead only (no statement in between)
20+
eval $snap;
21+
eval $delta;
22+
23+
--echo # --- select 1
24+
eval $snap;
25+
select 1 as one;
26+
eval $delta;
27+
28+
--echo # --- insert t values (0)
29+
eval $snap;
30+
insert t values (0);
31+
eval $delta;
32+
33+
--echo # --- lock table t write
34+
eval $snap;
35+
lock table t write;
36+
eval $delta;
37+
38+
--echo # --- alter table t add z int
39+
eval $snap;
40+
alter table t add z int;
41+
eval $delta;
42+
43+
--echo # --- set max_session_mem_used= 32768
44+
eval $snap;
45+
set max_session_mem_used= 32768;
46+
eval $delta;
47+
48+
--echo # --- set max_session_mem_used= default
49+
eval $snap;
50+
set max_session_mem_used= default;
51+
eval $delta;
52+
53+
drop table t;
54+
unlock tables;
55+
--enable_query_log

mysql-test/main/gtt_mem_probe.test

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
--disable_ps_protocol
2+
create global temporary table t (t text);
3+
select variable_value into @m0 from information_schema.session_status where variable_name='memory_used';
4+
set max_session_mem_used= 8192;
5+
--error 0,ER_OPTION_PREVENTS_STATEMENT
6+
insert t values (0);
7+
set max_session_mem_used= default;
8+
select variable_value into @m1 from information_schema.session_status where variable_name='memory_used';
9+
select @m0 as before_limit, @m1 as after_failed_insert;
10+
set max_session_mem_used= 8192;
11+
--error 0,ER_OPTION_PREVENTS_STATEMENT
12+
lock table t write;
13+
set max_session_mem_used= default;
14+
unlock tables;
15+
drop table t;
16+
--enable_ps_protocol

mysql-test/suite/binlog/r/global_temporary_table.result

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,10 +1010,10 @@ create global temporary table t (t text);
10101010
set max_session_mem_used= 8192;
10111011
insert t values (0);
10121012
ERROR HY000: The MariaDB server is running with the --max-session-mem-used=8192 option so it cannot execute this statement
1013-
set max_session_mem_used= 32768;
10141013
lock table t write;
1014+
ERROR HY000: The MariaDB server is running with the --max-session-mem-used=8192 option so it cannot execute this statement
10151015
alter table t add z int;
1016-
ERROR HY000: The MariaDB server is running with the --max-session-mem-used=32768 option so it cannot execute this statement
1016+
ERROR HY000: The MariaDB server is running with the --max-session-mem-used=8192 option so it cannot execute this statement
10171017
set max_session_mem_used= default;
10181018
drop table t;
10191019
unlock tables;
@@ -1254,7 +1254,6 @@ c
12541254
set max_session_mem_used=8192;
12551255
truncate t;
12561256
ERROR HY000: The MariaDB server is running with the --max-session-mem-used=8192 option so it cannot execute this statement
1257-
set max_session_mem_used= 32768;
12581257
set max_session_mem_used= default;
12591258
unlock tables;
12601259
select * from t;

mysql-test/suite/rpl/r/global_temporary_table.result

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,10 +1010,10 @@ create global temporary table t (t text);
10101010
set max_session_mem_used= 8192;
10111011
insert t values (0);
10121012
ERROR HY000: The MariaDB server is running with the --max-session-mem-used=8192 option so it cannot execute this statement
1013-
set max_session_mem_used= 32768;
10141013
lock table t write;
1014+
ERROR HY000: The MariaDB server is running with the --max-session-mem-used=8192 option so it cannot execute this statement
10151015
alter table t add z int;
1016-
ERROR HY000: The MariaDB server is running with the --max-session-mem-used=32768 option so it cannot execute this statement
1016+
ERROR HY000: The MariaDB server is running with the --max-session-mem-used=8192 option so it cannot execute this statement
10171017
set max_session_mem_used= default;
10181018
drop table t;
10191019
unlock tables;
@@ -1254,7 +1254,6 @@ c
12541254
set max_session_mem_used=8192;
12551255
truncate t;
12561256
ERROR HY000: The MariaDB server is running with the --max-session-mem-used=8192 option so it cannot execute this statement
1257-
set max_session_mem_used= 32768;
12581257
set max_session_mem_used= default;
12591258
unlock tables;
12601259
select * from t;

sql/sql_parse.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5038,7 +5038,10 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt)
50385038
{
50395039
if (thd->variables.query_cache_wlock_invalidate)
50405040
query_cache_invalidate_locked_for_write(thd, first_table);
5041-
my_ok(thd);
5041+
if (!thd->killed)
5042+
{
5043+
my_ok(thd);
5044+
}
50425045
}
50435046
break;
50445047
case SQLCOM_BACKUP:

0 commit comments

Comments
 (0)