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
c15b3d2d
Commit
c15b3d2d
authored
Jan 11, 2018
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Plain Diff
Merge 10.0 into 10.1
parents
07aa9859
4c147954
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
233 additions
and
68 deletions
+233
-68
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+26
-0
mysql-test/r/subselect_no_exists_to_in.result
mysql-test/r/subselect_no_exists_to_in.result
+26
-0
mysql-test/r/subselect_no_mat.result
mysql-test/r/subselect_no_mat.result
+26
-0
mysql-test/r/subselect_no_opts.result
mysql-test/r/subselect_no_opts.result
+26
-0
mysql-test/r/subselect_no_scache.result
mysql-test/r/subselect_no_scache.result
+26
-0
mysql-test/r/subselect_no_semijoin.result
mysql-test/r/subselect_no_semijoin.result
+26
-0
mysql-test/suite/innodb/t/innodb-master.opt
mysql-test/suite/innodb/t/innodb-master.opt
+2
-0
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+27
-0
sql/opt_subselect.cc
sql/opt_subselect.cc
+48
-16
storage/innobase/trx/trx0purge.cc
storage/innobase/trx/trx0purge.cc
+0
-26
storage/xtradb/trx/trx0purge.cc
storage/xtradb/trx/trx0purge.cc
+0
-26
No files found.
mysql-test/r/subselect.result
View file @
c15b3d2d
...
...
@@ -7210,6 +7210,32 @@ NULL
# SELECT (SELECT MAX(sq.f2) FROM t1) FROM (SELECT * FROM t2) AS sq WHERE f2 = 2;
#
drop table t1, t2;
#
# MDEV-13933: Wrong results in COUNT() query with EXISTS and exists_to_in
# (5.5 test)
#
SET @optimiser_switch_save= @@optimizer_switch;
CREATE TABLE t1 (a INT NOT NULL);
INSERT INTO t1 VALUES (1),(1),(1),(5),(5);
CREATE TABLE t2 (b INT);
INSERT INTO t2 VALUES (5),(1);
CREATE TABLE t3 (c INT, KEY(c));
INSERT INTO t3 VALUES (5),(5);
SET optimizer_switch='semijoin=on';
select t1.a from t1 where t1.a in (select `test`.`t2`.`b` from `test`.`t2`)
and t1.a in (select `test`.`t3`.`c` from `test`.`t3`);
a
5
5
SET optimizer_switch='semijoin=off';
select t1.a from t1 where t1.a in (select `test`.`t2`.`b` from `test`.`t2`)
and t1.a in (select `test`.`t3`.`c` from `test`.`t3`);
a
5
5
SET @@optimizer_switch= @optimiser_switch_save;
DROP TABLE t1, t2, t3;
End of 5.5 tests
# End of 10.0 tests
#
# MDEV-9487: Server crashes in Time_and_counter_tracker::incr_loops
...
...
mysql-test/r/subselect_no_exists_to_in.result
View file @
c15b3d2d
...
...
@@ -7210,6 +7210,32 @@ NULL
# SELECT (SELECT MAX(sq.f2) FROM t1) FROM (SELECT * FROM t2) AS sq WHERE f2 = 2;
#
drop table t1, t2;
#
# MDEV-13933: Wrong results in COUNT() query with EXISTS and exists_to_in
# (5.5 test)
#
SET @optimiser_switch_save= @@optimizer_switch;
CREATE TABLE t1 (a INT NOT NULL);
INSERT INTO t1 VALUES (1),(1),(1),(5),(5);
CREATE TABLE t2 (b INT);
INSERT INTO t2 VALUES (5),(1);
CREATE TABLE t3 (c INT, KEY(c));
INSERT INTO t3 VALUES (5),(5);
SET optimizer_switch='semijoin=on';
select t1.a from t1 where t1.a in (select `test`.`t2`.`b` from `test`.`t2`)
and t1.a in (select `test`.`t3`.`c` from `test`.`t3`);
a
5
5
SET optimizer_switch='semijoin=off';
select t1.a from t1 where t1.a in (select `test`.`t2`.`b` from `test`.`t2`)
and t1.a in (select `test`.`t3`.`c` from `test`.`t3`);
a
5
5
SET @@optimizer_switch= @optimiser_switch_save;
DROP TABLE t1, t2, t3;
End of 5.5 tests
# End of 10.0 tests
#
# MDEV-9487: Server crashes in Time_and_counter_tracker::incr_loops
...
...
mysql-test/r/subselect_no_mat.result
View file @
c15b3d2d
...
...
@@ -7203,6 +7203,32 @@ NULL
# SELECT (SELECT MAX(sq.f2) FROM t1) FROM (SELECT * FROM t2) AS sq WHERE f2 = 2;
#
drop table t1, t2;
#
# MDEV-13933: Wrong results in COUNT() query with EXISTS and exists_to_in
# (5.5 test)
#
SET @optimiser_switch_save= @@optimizer_switch;
CREATE TABLE t1 (a INT NOT NULL);
INSERT INTO t1 VALUES (1),(1),(1),(5),(5);
CREATE TABLE t2 (b INT);
INSERT INTO t2 VALUES (5),(1);
CREATE TABLE t3 (c INT, KEY(c));
INSERT INTO t3 VALUES (5),(5);
SET optimizer_switch='semijoin=on';
select t1.a from t1 where t1.a in (select `test`.`t2`.`b` from `test`.`t2`)
and t1.a in (select `test`.`t3`.`c` from `test`.`t3`);
a
5
5
SET optimizer_switch='semijoin=off';
select t1.a from t1 where t1.a in (select `test`.`t2`.`b` from `test`.`t2`)
and t1.a in (select `test`.`t3`.`c` from `test`.`t3`);
a
5
5
SET @@optimizer_switch= @optimiser_switch_save;
DROP TABLE t1, t2, t3;
End of 5.5 tests
# End of 10.0 tests
#
# MDEV-9487: Server crashes in Time_and_counter_tracker::incr_loops
...
...
mysql-test/r/subselect_no_opts.result
View file @
c15b3d2d
...
...
@@ -7201,6 +7201,32 @@ NULL
# SELECT (SELECT MAX(sq.f2) FROM t1) FROM (SELECT * FROM t2) AS sq WHERE f2 = 2;
#
drop table t1, t2;
#
# MDEV-13933: Wrong results in COUNT() query with EXISTS and exists_to_in
# (5.5 test)
#
SET @optimiser_switch_save= @@optimizer_switch;
CREATE TABLE t1 (a INT NOT NULL);
INSERT INTO t1 VALUES (1),(1),(1),(5),(5);
CREATE TABLE t2 (b INT);
INSERT INTO t2 VALUES (5),(1);
CREATE TABLE t3 (c INT, KEY(c));
INSERT INTO t3 VALUES (5),(5);
SET optimizer_switch='semijoin=on';
select t1.a from t1 where t1.a in (select `test`.`t2`.`b` from `test`.`t2`)
and t1.a in (select `test`.`t3`.`c` from `test`.`t3`);
a
5
5
SET optimizer_switch='semijoin=off';
select t1.a from t1 where t1.a in (select `test`.`t2`.`b` from `test`.`t2`)
and t1.a in (select `test`.`t3`.`c` from `test`.`t3`);
a
5
5
SET @@optimizer_switch= @optimiser_switch_save;
DROP TABLE t1, t2, t3;
End of 5.5 tests
# End of 10.0 tests
#
# MDEV-9487: Server crashes in Time_and_counter_tracker::incr_loops
...
...
mysql-test/r/subselect_no_scache.result
View file @
c15b3d2d
...
...
@@ -7216,6 +7216,32 @@ NULL
# SELECT (SELECT MAX(sq.f2) FROM t1) FROM (SELECT * FROM t2) AS sq WHERE f2 = 2;
#
drop table t1, t2;
#
# MDEV-13933: Wrong results in COUNT() query with EXISTS and exists_to_in
# (5.5 test)
#
SET @optimiser_switch_save= @@optimizer_switch;
CREATE TABLE t1 (a INT NOT NULL);
INSERT INTO t1 VALUES (1),(1),(1),(5),(5);
CREATE TABLE t2 (b INT);
INSERT INTO t2 VALUES (5),(1);
CREATE TABLE t3 (c INT, KEY(c));
INSERT INTO t3 VALUES (5),(5);
SET optimizer_switch='semijoin=on';
select t1.a from t1 where t1.a in (select `test`.`t2`.`b` from `test`.`t2`)
and t1.a in (select `test`.`t3`.`c` from `test`.`t3`);
a
5
5
SET optimizer_switch='semijoin=off';
select t1.a from t1 where t1.a in (select `test`.`t2`.`b` from `test`.`t2`)
and t1.a in (select `test`.`t3`.`c` from `test`.`t3`);
a
5
5
SET @@optimizer_switch= @optimiser_switch_save;
DROP TABLE t1, t2, t3;
End of 5.5 tests
# End of 10.0 tests
#
# MDEV-9487: Server crashes in Time_and_counter_tracker::incr_loops
...
...
mysql-test/r/subselect_no_semijoin.result
View file @
c15b3d2d
...
...
@@ -7201,6 +7201,32 @@ NULL
# SELECT (SELECT MAX(sq.f2) FROM t1) FROM (SELECT * FROM t2) AS sq WHERE f2 = 2;
#
drop table t1, t2;
#
# MDEV-13933: Wrong results in COUNT() query with EXISTS and exists_to_in
# (5.5 test)
#
SET @optimiser_switch_save= @@optimizer_switch;
CREATE TABLE t1 (a INT NOT NULL);
INSERT INTO t1 VALUES (1),(1),(1),(5),(5);
CREATE TABLE t2 (b INT);
INSERT INTO t2 VALUES (5),(1);
CREATE TABLE t3 (c INT, KEY(c));
INSERT INTO t3 VALUES (5),(5);
SET optimizer_switch='semijoin=on';
select t1.a from t1 where t1.a in (select `test`.`t2`.`b` from `test`.`t2`)
and t1.a in (select `test`.`t3`.`c` from `test`.`t3`);
a
5
5
SET optimizer_switch='semijoin=off';
select t1.a from t1 where t1.a in (select `test`.`t2`.`b` from `test`.`t2`)
and t1.a in (select `test`.`t3`.`c` from `test`.`t3`);
a
5
5
SET @@optimizer_switch= @optimiser_switch_save;
DROP TABLE t1, t2, t3;
End of 5.5 tests
# End of 10.0 tests
#
# MDEV-9487: Server crashes in Time_and_counter_tracker::incr_loops
...
...
mysql-test/suite/innodb/t/innodb-master.opt
View file @
c15b3d2d
...
...
@@ -2,3 +2,5 @@
--default-storage-engine=MyISAM
--innodb-strict-mode=0
--innodb-file-per-table=0
--loose-innodb-track-changed-pages
--loose-innodb-log-archive
mysql-test/t/subselect.test
View file @
c15b3d2d
...
...
@@ -6072,6 +6072,33 @@ SELECT (SELECT MAX(sq.f2) FROM t1) FROM (SELECT * FROM t2) AS sq WHERE f2 = 2;
--
echo
#
drop
table
t1
,
t2
;
--
echo
#
--
echo
# MDEV-13933: Wrong results in COUNT() query with EXISTS and exists_to_in
--
echo
# (5.5 test)
--
echo
#
SET
@
optimiser_switch_save
=
@@
optimizer_switch
;
CREATE
TABLE
t1
(
a
INT
NOT
NULL
);
INSERT
INTO
t1
VALUES
(
1
),(
1
),(
1
),(
5
),(
5
);
CREATE
TABLE
t2
(
b
INT
);
INSERT
INTO
t2
VALUES
(
5
),(
1
);
CREATE
TABLE
t3
(
c
INT
,
KEY
(
c
));
INSERT
INTO
t3
VALUES
(
5
),(
5
);
SET
optimizer_switch
=
'semijoin=on'
;
select
t1
.
a
from
t1
where
t1
.
a
in
(
select
`test`
.
`t2`
.
`b`
from
`test`
.
`t2`
)
and
t1
.
a
in
(
select
`test`
.
`t3`
.
`c`
from
`test`
.
`t3`
);
SET
optimizer_switch
=
'semijoin=off'
;
select
t1
.
a
from
t1
where
t1
.
a
in
(
select
`test`
.
`t2`
.
`b`
from
`test`
.
`t2`
)
and
t1
.
a
in
(
select
`test`
.
`t3`
.
`c`
from
`test`
.
`t3`
);
SET
@@
optimizer_switch
=
@
optimiser_switch_save
;
DROP
TABLE
t1
,
t2
,
t3
;
--
echo
End
of
5.5
tests
--
echo
# End of 10.0 tests
--
echo
#
...
...
sql/opt_subselect.cc
View file @
c15b3d2d
...
...
@@ -2704,7 +2704,8 @@ void advance_sj_state(JOIN *join, table_map remaining_tables, uint idx,
LooseScan detector in best_access_path)
*/
remaining_tables
&=
~
new_join_tab
->
table
->
map
;
table_map
dups_producing_tables
;
table_map
dups_producing_tables
,
prev_dups_producing_tables
,
prev_sjm_lookup_tables
;
if
(
idx
==
join
->
const_tables
)
dups_producing_tables
=
0
;
...
...
@@ -2715,7 +2716,7 @@ void advance_sj_state(JOIN *join, table_map remaining_tables, uint idx,
if
((
emb_sj_nest
=
new_join_tab
->
emb_sj_nest
))
dups_producing_tables
|=
emb_sj_nest
->
sj_inner_tables
;
Semi_join_strategy_picker
**
strategy
;
Semi_join_strategy_picker
**
strategy
,
**
prev_strategy
;
if
(
idx
==
join
->
const_tables
)
{
/* First table, initialize pickers */
...
...
@@ -2770,6 +2771,22 @@ void advance_sj_state(JOIN *join, table_map remaining_tables, uint idx,
(
read_time
<
*
current_read_time
&&
!
(
handled_fanout
&
pos
->
inner_tables_handled_with_other_sjs
)))
{
DBUG_ASSERT
(
pos
->
sj_strategy
!=
sj_strategy
);
/*
If the strategy choosen first time or
the strategy replace strategy which was used to exectly the same
tables
*/
if
(
pos
->
sj_strategy
==
SJ_OPT_NONE
||
handled_fanout
==
(
prev_dups_producing_tables
^
dups_producing_tables
))
{
prev_strategy
=
strategy
;
if
(
pos
->
sj_strategy
==
SJ_OPT_NONE
)
{
prev_dups_producing_tables
=
dups_producing_tables
;
prev_sjm_lookup_tables
=
join
->
sjm_lookup_tables
;
}
/* Mark strategy as used */
(
*
strategy
)
->
mark_used
();
pos
->
sj_strategy
=
sj_strategy
;
...
...
@@ -2782,10 +2799,25 @@ void advance_sj_state(JOIN *join, table_map remaining_tables, uint idx,
dups_producing_tables
&=
~
handled_fanout
;
//TODO: update bitmap of semi-joins that were handled together with
// others.
if
(
is_multiple_semi_joins
(
join
,
join
->
positions
,
idx
,
handled_fanout
))
if
(
is_multiple_semi_joins
(
join
,
join
->
positions
,
idx
,
handled_fanout
))
pos
->
inner_tables_handled_with_other_sjs
|=
handled_fanout
;
}
else
{
/* Conflict fall to most general variant */
(
*
prev_strategy
)
->
set_empty
();
dups_producing_tables
=
prev_dups_producing_tables
;
join
->
sjm_lookup_tables
=
prev_sjm_lookup_tables
;
// mark it 'none' to avpoid loops
pos
->
sj_strategy
=
SJ_OPT_NONE
;
// next skip to last;
strategy
=
pickers
+
(
sizeof
(
pickers
)
/
sizeof
(
Semi_join_strategy_picker
*
)
-
3
);
continue
;
}
}
else
{
/* We decided not to apply the strategy. */
(
*
strategy
)
->
set_empty
();
...
...
storage/innobase/trx/trx0purge.cc
View file @
c15b3d2d
...
...
@@ -584,32 +584,6 @@ trx_purge_rseg_get_next_history_log(
mutex_exit
(
&
(
rseg
->
mutex
));
mtr_commit
(
&
mtr
);
mutex_enter
(
&
trx_sys
->
mutex
);
/* Add debug code to track history list corruption reported
on the MySQL mailing list on Nov 9, 2004. The fut0lst.cc
file-based list was corrupt. The prev node pointer was
FIL_NULL, even though the list length was over 8 million nodes!
We assume that purge truncates the history list in large
size pieces, and if we here reach the head of the list, the
list cannot be longer than 2000 000 undo logs now. */
if
(
trx_sys
->
rseg_history_len
>
2000000
)
{
ut_print_timestamp
(
stderr
);
fprintf
(
stderr
,
" InnoDB: Warning: purge reached the"
" head of the history list,
\n
"
"InnoDB: but its length is still"
" reported as %lu! Make a detailed bug
\n
"
"InnoDB: report, and submit it"
" to https://jira.mariadb.org/
\n
"
,
(
ulong
)
trx_sys
->
rseg_history_len
);
ut_ad
(
0
);
}
mutex_exit
(
&
trx_sys
->
mutex
);
return
;
}
...
...
storage/xtradb/trx/trx0purge.cc
View file @
c15b3d2d
...
...
@@ -584,32 +584,6 @@ trx_purge_rseg_get_next_history_log(
mutex_exit
(
&
(
rseg
->
mutex
));
mtr_commit
(
&
mtr
);
mutex_enter
(
&
trx_sys
->
mutex
);
/* Add debug code to track history list corruption reported
on the MySQL mailing list on Nov 9, 2004. The fut0lst.cc
file-based list was corrupt. The prev node pointer was
FIL_NULL, even though the list length was over 8 million nodes!
We assume that purge truncates the history list in large
size pieces, and if we here reach the head of the list, the
list cannot be longer than 2000 000 undo logs now. */
if
(
trx_sys
->
rseg_history_len
>
2000000
)
{
ut_print_timestamp
(
stderr
);
fprintf
(
stderr
,
" InnoDB: Warning: purge reached the"
" head of the history list,
\n
"
"InnoDB: but its length is still"
" reported as %lu! Make a detailed bug
\n
"
"InnoDB: report, and submit it"
" to https://jira.mariadb.org/
\n
"
,
(
ulong
)
trx_sys
->
rseg_history_len
);
ut_ad
(
0
);
}
mutex_exit
(
&
trx_sys
->
mutex
);
return
;
}
...
...
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