Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
f3994b74
Commit
f3994b74
authored
Mar 21, 2018
by
Oleksandr Byelkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-15492: Subquery crash similar to MDEV-10050
Detection of first execution of PS fixed. More debug info.
parent
2dd4e50d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
65 additions
and
1 deletion
+65
-1
mysql-test/r/ps_qc_innodb.result
mysql-test/r/ps_qc_innodb.result
+23
-0
mysql-test/t/ps_qc_innodb.test
mysql-test/t/ps_qc_innodb.test
+35
-0
sql/sql_class.cc
sql/sql_class.cc
+4
-0
sql/sql_prepare.cc
sql/sql_prepare.cc
+3
-1
No files found.
mysql-test/r/ps_qc_innodb.result
0 → 100644
View file @
f3994b74
#
# MDEV-15492: Subquery crash similar to MDEV-10050
#
SET @qcs.save= @@global.query_cache_size, @qct.save= @@global.query_cache_type;
SET GLOBAL query_cache_size= 512*1024*1024, query_cache_type= ON;
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
CREATE TABLE t2 (b INT) ENGINE=InnoDB;
CREATE VIEW v AS select a from t1 join t2;
PREPARE stmt1 FROM "SELECT * FROM t1 WHERE a in (SELECT a FROM v)";
PREPARE stmt2 FROM "SELECT * FROM t1 WHERE a in (SELECT a FROM v)";
EXECUTE stmt2;
a
EXECUTE stmt1;
a
INSERT INTO t2 VALUES (0);
EXECUTE stmt1;
a
START TRANSACTION;
EXECUTE stmt1;
a
DROP VIEW v;
DROP TABLE t1, t2;
SET GLOBAL query_cache_size= @qcs.save, query_cache_type= @qct.save;
mysql-test/t/ps_qc_innodb.test
0 → 100644
View file @
f3994b74
--
source
include
/
have_query_cache
.
inc
--
source
include
/
have_innodb
.
inc
--
echo
#
--
echo
# MDEV-15492: Subquery crash similar to MDEV-10050
--
echo
#
SET
@
qcs
.
save
=
@@
global
.
query_cache_size
,
@
qct
.
save
=
@@
global
.
query_cache_type
;
SET
GLOBAL
query_cache_size
=
512
*
1024
*
1024
,
query_cache_type
=
ON
;
--
connect
(
con1
,
localhost
,
root
,,
test
)
CREATE
TABLE
t1
(
a
INT
)
ENGINE
=
InnoDB
;
CREATE
TABLE
t2
(
b
INT
)
ENGINE
=
InnoDB
;
CREATE
VIEW
v
AS
select
a
from
t1
join
t2
;
PREPARE
stmt1
FROM
"SELECT * FROM t1 WHERE a in (SELECT a FROM v)"
;
--
connect
(
con2
,
localhost
,
root
,,
test
)
PREPARE
stmt2
FROM
"SELECT * FROM t1 WHERE a in (SELECT a FROM v)"
;
EXECUTE
stmt2
;
--
connection
con1
EXECUTE
stmt1
;
INSERT
INTO
t2
VALUES
(
0
);
EXECUTE
stmt1
;
START
TRANSACTION
;
EXECUTE
stmt1
;
# Cleanup
--
disconnect
con1
--
disconnect
con2
--
connection
default
DROP
VIEW
v
;
DROP
TABLE
t1
,
t2
;
SET
GLOBAL
query_cache_size
=
@
qcs
.
save
,
query_cache_type
=
@
qct
.
save
;
sql/sql_class.cc
View file @
f3994b74
...
...
@@ -2252,15 +2252,19 @@ void THD::check_and_register_item_tree_change(Item **place, Item **new_value,
void
THD
::
rollback_item_tree_changes
()
{
DBUG_ENTER
(
"THD::rollback_item_tree_changes"
);
I_List_iterator
<
Item_change_record
>
it
(
change_list
);
Item_change_record
*
change
;
while
((
change
=
it
++
))
{
DBUG_PRINT
(
"info"
,
(
"Rollback: %p (%p) <- %p"
,
*
change
->
place
,
change
->
place
,
change
->
old_value
));
*
change
->
place
=
change
->
old_value
;
}
/* We can forget about changes memory: it's allocated in runtime memroot */
change_list
.
empty
();
DBUG_VOID_RETURN
;
}
...
...
sql/sql_prepare.cc
View file @
f3994b74
...
...
@@ -3819,6 +3819,7 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor)
Statement
stmt_backup
;
Query_arena
*
old_stmt_arena
;
bool
error
=
TRUE
;
bool
qc_executed
=
FALSE
;
char
saved_cur_db_name_buf
[
SAFE_NAME_LEN
+
1
];
LEX_STRING
saved_cur_db_name
=
...
...
@@ -3937,6 +3938,7 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor)
thd
->
lex
->
sql_command
=
SQLCOM_SELECT
;
status_var_increment
(
thd
->
status_var
.
com_stat
[
SQLCOM_SELECT
]);
thd
->
update_stats
();
qc_executed
=
TRUE
;
}
}
...
...
@@ -3960,7 +3962,7 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor)
thd
->
set_statement
(
&
stmt_backup
);
thd
->
stmt_arena
=
old_stmt_arena
;
if
(
state
==
Query_arena
::
STMT_PREPARED
)
if
(
state
==
Query_arena
::
STMT_PREPARED
&&
!
qc_executed
)
state
=
Query_arena
::
STMT_EXECUTED
;
if
(
error
==
0
&&
this
->
lex
->
sql_command
==
SQLCOM_CALL
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment