Permalink
Browse files

Bug #21184091 ASSERT `READ_ROWS >= 0.0'

	      AT COST_MODEL_SERVER::TMPTABLE_READWRITE_COST()

Problem:
While calculating the cost for doing semjoin_dupsweedout strategy
inner_fnout is calculated wrongly when max_outer_fanout becomes 0.
This causes mysql server to exit later.

Solution:
Calculate the inner_fanout only when max_outer_fanout is > 0. Else
there is no need to recalculate inner_fanout w.r.t max_outer_fanout.
  • Loading branch information...
Chaithra Gopalareddy
Chaithra Gopalareddy committed Jun 19, 2015
1 parent de61880 commit bfba2338902a81927d116c30eaa1245eaea025c8
Showing with 710 additions and 1 deletion.
  1. +33 −0 mysql-test/include/subquery_sj.inc
  2. +27 −0 mysql-test/r/subquery_sj_all.result
  3. +27 −0 mysql-test/r/subquery_sj_all_bka.result
  4. +27 −0 mysql-test/r/subquery_sj_all_bka_nixbnl.result
  5. +27 −0 mysql-test/r/subquery_sj_all_bkaunique.result
  6. +27 −0 mysql-test/r/subquery_sj_dupsweed.result
  7. +27 −0 mysql-test/r/subquery_sj_dupsweed_bka.result
  8. +27 −0 mysql-test/r/subquery_sj_dupsweed_bka_nixbnl.result
  9. +27 −0 mysql-test/r/subquery_sj_dupsweed_bkaunique.result
  10. +27 −0 mysql-test/r/subquery_sj_firstmatch.result
  11. +27 −0 mysql-test/r/subquery_sj_firstmatch_bka.result
  12. +27 −0 mysql-test/r/subquery_sj_firstmatch_bka_nixbnl.result
  13. +27 −0 mysql-test/r/subquery_sj_firstmatch_bkaunique.result
  14. +27 −0 mysql-test/r/subquery_sj_loosescan.result
  15. +27 −0 mysql-test/r/subquery_sj_loosescan_bka.result
  16. +27 −0 mysql-test/r/subquery_sj_loosescan_bka_nixbnl.result
  17. +27 −0 mysql-test/r/subquery_sj_loosescan_bkaunique.result
  18. +27 −0 mysql-test/r/subquery_sj_mat.result
  19. +27 −0 mysql-test/r/subquery_sj_mat_bka.result
  20. +27 −0 mysql-test/r/subquery_sj_mat_bka_nixbnl.result
  21. +27 −0 mysql-test/r/subquery_sj_mat_bkaunique.result
  22. +27 −0 mysql-test/r/subquery_sj_mat_nosj.result
  23. +27 −0 mysql-test/r/subquery_sj_none.result
  24. +27 −0 mysql-test/r/subquery_sj_none_bka.result
  25. +27 −0 mysql-test/r/subquery_sj_none_bka_nixbnl.result
  26. +27 −0 mysql-test/r/subquery_sj_none_bkaunique.result
  27. +2 −1 sql/sql_planner.cc
@@ -6566,6 +6566,39 @@ DROP TABLE t1,t2,t3,t4;
--echo # End of test for Bug#18194196
--echo #
--echo # Bug#21184091 ASSERT `READ_ROWS >= 0.0' AT
--echo # COST_MODEL_SERVER::TMPTABLE_READWRITE_COST()
--echo #
CREATE TABLE t1 (
col_int int(11),
pk int(11) NOT NULL,
col_int_key int(11) ,
col_varchar varchar(1),
PRIMARY KEY (pk)
) ENGINE=MyISAM;
CREATE TABLE t2 (
col_int int(11),
col_varchar varchar(1)
) ENGINE=MyISAM;
INSERT INTO t2 VALUES (19,'x');
INSERT INTO t2 VALUES (20,'z');
SELECT table1.col_varchar
FROM (t2 AS table1 RIGHT JOIN
((t2 STRAIGHT_JOIN t1 ON (t1.col_varchar = t2.col_varchar)))
ON (t1.pk = t2.col_int))
WHERE (t1.pk IN (SELECT t1.col_int_key
FROM (t1 INNER JOIN t2 ON (t2.col_int = t1.col_int))))
AND table1.col_varchar != 'q';
DROP TABLE t1,t2;
--echo # End of test for Bug#21184091
set @@optimizer_switch=@old_opt_switch;
# New tests go here.
@@ -10654,6 +10654,33 @@ Handler_read_rnd 0
Handler_read_rnd_next 12
DROP TABLE t1,t2,t3,t4;
# End of test for Bug#18194196
#
# Bug#21184091 ASSERT `READ_ROWS >= 0.0' AT
# COST_MODEL_SERVER::TMPTABLE_READWRITE_COST()
#
CREATE TABLE t1 (
col_int int(11),
pk int(11) NOT NULL,
col_int_key int(11) ,
col_varchar varchar(1),
PRIMARY KEY (pk)
) ENGINE=MyISAM;
CREATE TABLE t2 (
col_int int(11),
col_varchar varchar(1)
) ENGINE=MyISAM;
INSERT INTO t2 VALUES (19,'x');
INSERT INTO t2 VALUES (20,'z');
SELECT table1.col_varchar
FROM (t2 AS table1 RIGHT JOIN
((t2 STRAIGHT_JOIN t1 ON (t1.col_varchar = t2.col_varchar)))
ON (t1.pk = t2.col_int))
WHERE (t1.pk IN (SELECT t1.col_int_key
FROM (t1 INNER JOIN t2 ON (t2.col_int = t1.col_int))))
AND table1.col_varchar != 'q';
col_varchar
DROP TABLE t1,t2;
# End of test for Bug#21184091
set @@optimizer_switch=@old_opt_switch;
# End of 5.6 tests
set optimizer_switch=default;
@@ -10660,6 +10660,33 @@ Handler_read_rnd 11
Handler_read_rnd_next 12
DROP TABLE t1,t2,t3,t4;
# End of test for Bug#18194196
#
# Bug#21184091 ASSERT `READ_ROWS >= 0.0' AT
# COST_MODEL_SERVER::TMPTABLE_READWRITE_COST()
#
CREATE TABLE t1 (
col_int int(11),
pk int(11) NOT NULL,
col_int_key int(11) ,
col_varchar varchar(1),
PRIMARY KEY (pk)
) ENGINE=MyISAM;
CREATE TABLE t2 (
col_int int(11),
col_varchar varchar(1)
) ENGINE=MyISAM;
INSERT INTO t2 VALUES (19,'x');
INSERT INTO t2 VALUES (20,'z');
SELECT table1.col_varchar
FROM (t2 AS table1 RIGHT JOIN
((t2 STRAIGHT_JOIN t1 ON (t1.col_varchar = t2.col_varchar)))
ON (t1.pk = t2.col_int))
WHERE (t1.pk IN (SELECT t1.col_int_key
FROM (t1 INNER JOIN t2 ON (t2.col_int = t1.col_int))))
AND table1.col_varchar != 'q';
col_varchar
DROP TABLE t1,t2;
# End of test for Bug#21184091
set @@optimizer_switch=@old_opt_switch;
# End of 5.6 tests
set optimizer_switch=default;
@@ -10669,6 +10669,33 @@ Handler_read_rnd 22
Handler_read_rnd_next 0
DROP TABLE t1,t2,t3,t4;
# End of test for Bug#18194196
#
# Bug#21184091 ASSERT `READ_ROWS >= 0.0' AT
# COST_MODEL_SERVER::TMPTABLE_READWRITE_COST()
#
CREATE TABLE t1 (
col_int int(11),
pk int(11) NOT NULL,
col_int_key int(11) ,
col_varchar varchar(1),
PRIMARY KEY (pk)
) ENGINE=MyISAM;
CREATE TABLE t2 (
col_int int(11),
col_varchar varchar(1)
) ENGINE=MyISAM;
INSERT INTO t2 VALUES (19,'x');
INSERT INTO t2 VALUES (20,'z');
SELECT table1.col_varchar
FROM (t2 AS table1 RIGHT JOIN
((t2 STRAIGHT_JOIN t1 ON (t1.col_varchar = t2.col_varchar)))
ON (t1.pk = t2.col_int))
WHERE (t1.pk IN (SELECT t1.col_int_key
FROM (t1 INNER JOIN t2 ON (t2.col_int = t1.col_int))))
AND table1.col_varchar != 'q';
col_varchar
DROP TABLE t1,t2;
# End of test for Bug#21184091
set @@optimizer_switch=@old_opt_switch;
# End of 5.6 tests
set optimizer_switch=default;
@@ -10661,6 +10661,33 @@ Handler_read_rnd 9
Handler_read_rnd_next 12
DROP TABLE t1,t2,t3,t4;
# End of test for Bug#18194196
#
# Bug#21184091 ASSERT `READ_ROWS >= 0.0' AT
# COST_MODEL_SERVER::TMPTABLE_READWRITE_COST()
#
CREATE TABLE t1 (
col_int int(11),
pk int(11) NOT NULL,
col_int_key int(11) ,
col_varchar varchar(1),
PRIMARY KEY (pk)
) ENGINE=MyISAM;
CREATE TABLE t2 (
col_int int(11),
col_varchar varchar(1)
) ENGINE=MyISAM;
INSERT INTO t2 VALUES (19,'x');
INSERT INTO t2 VALUES (20,'z');
SELECT table1.col_varchar
FROM (t2 AS table1 RIGHT JOIN
((t2 STRAIGHT_JOIN t1 ON (t1.col_varchar = t2.col_varchar)))
ON (t1.pk = t2.col_int))
WHERE (t1.pk IN (SELECT t1.col_int_key
FROM (t1 INNER JOIN t2 ON (t2.col_int = t1.col_int))))
AND table1.col_varchar != 'q';
col_varchar
DROP TABLE t1,t2;
# End of test for Bug#21184091
set @@optimizer_switch=@old_opt_switch;
# End of 5.6 tests
set optimizer_switch=default;
@@ -10526,6 +10526,33 @@ Handler_read_rnd 0
Handler_read_rnd_next 12
DROP TABLE t1,t2,t3,t4;
# End of test for Bug#18194196
#
# Bug#21184091 ASSERT `READ_ROWS >= 0.0' AT
# COST_MODEL_SERVER::TMPTABLE_READWRITE_COST()
#
CREATE TABLE t1 (
col_int int(11),
pk int(11) NOT NULL,
col_int_key int(11) ,
col_varchar varchar(1),
PRIMARY KEY (pk)
) ENGINE=MyISAM;
CREATE TABLE t2 (
col_int int(11),
col_varchar varchar(1)
) ENGINE=MyISAM;
INSERT INTO t2 VALUES (19,'x');
INSERT INTO t2 VALUES (20,'z');
SELECT table1.col_varchar
FROM (t2 AS table1 RIGHT JOIN
((t2 STRAIGHT_JOIN t1 ON (t1.col_varchar = t2.col_varchar)))
ON (t1.pk = t2.col_int))
WHERE (t1.pk IN (SELECT t1.col_int_key
FROM (t1 INNER JOIN t2 ON (t2.col_int = t1.col_int))))
AND table1.col_varchar != 'q';
col_varchar
DROP TABLE t1,t2;
# End of test for Bug#21184091
set @@optimizer_switch=@old_opt_switch;
# End of 5.6 tests
set optimizer_switch=default;
@@ -10531,6 +10531,33 @@ Handler_read_rnd 0
Handler_read_rnd_next 12
DROP TABLE t1,t2,t3,t4;
# End of test for Bug#18194196
#
# Bug#21184091 ASSERT `READ_ROWS >= 0.0' AT
# COST_MODEL_SERVER::TMPTABLE_READWRITE_COST()
#
CREATE TABLE t1 (
col_int int(11),
pk int(11) NOT NULL,
col_int_key int(11) ,
col_varchar varchar(1),
PRIMARY KEY (pk)
) ENGINE=MyISAM;
CREATE TABLE t2 (
col_int int(11),
col_varchar varchar(1)
) ENGINE=MyISAM;
INSERT INTO t2 VALUES (19,'x');
INSERT INTO t2 VALUES (20,'z');
SELECT table1.col_varchar
FROM (t2 AS table1 RIGHT JOIN
((t2 STRAIGHT_JOIN t1 ON (t1.col_varchar = t2.col_varchar)))
ON (t1.pk = t2.col_int))
WHERE (t1.pk IN (SELECT t1.col_int_key
FROM (t1 INNER JOIN t2 ON (t2.col_int = t1.col_int))))
AND table1.col_varchar != 'q';
col_varchar
DROP TABLE t1,t2;
# End of test for Bug#21184091
set @@optimizer_switch=@old_opt_switch;
# End of 5.6 tests
set optimizer_switch=default;
@@ -10531,6 +10531,33 @@ Handler_read_rnd 0
Handler_read_rnd_next 0
DROP TABLE t1,t2,t3,t4;
# End of test for Bug#18194196
#
# Bug#21184091 ASSERT `READ_ROWS >= 0.0' AT
# COST_MODEL_SERVER::TMPTABLE_READWRITE_COST()
#
CREATE TABLE t1 (
col_int int(11),
pk int(11) NOT NULL,
col_int_key int(11) ,
col_varchar varchar(1),
PRIMARY KEY (pk)
) ENGINE=MyISAM;
CREATE TABLE t2 (
col_int int(11),
col_varchar varchar(1)
) ENGINE=MyISAM;
INSERT INTO t2 VALUES (19,'x');
INSERT INTO t2 VALUES (20,'z');
SELECT table1.col_varchar
FROM (t2 AS table1 RIGHT JOIN
((t2 STRAIGHT_JOIN t1 ON (t1.col_varchar = t2.col_varchar)))
ON (t1.pk = t2.col_int))
WHERE (t1.pk IN (SELECT t1.col_int_key
FROM (t1 INNER JOIN t2 ON (t2.col_int = t1.col_int))))
AND table1.col_varchar != 'q';
col_varchar
DROP TABLE t1,t2;
# End of test for Bug#21184091
set @@optimizer_switch=@old_opt_switch;
# End of 5.6 tests
set optimizer_switch=default;
@@ -10532,6 +10532,33 @@ Handler_read_rnd 0
Handler_read_rnd_next 12
DROP TABLE t1,t2,t3,t4;
# End of test for Bug#18194196
#
# Bug#21184091 ASSERT `READ_ROWS >= 0.0' AT
# COST_MODEL_SERVER::TMPTABLE_READWRITE_COST()
#
CREATE TABLE t1 (
col_int int(11),
pk int(11) NOT NULL,
col_int_key int(11) ,
col_varchar varchar(1),
PRIMARY KEY (pk)
) ENGINE=MyISAM;
CREATE TABLE t2 (
col_int int(11),
col_varchar varchar(1)
) ENGINE=MyISAM;
INSERT INTO t2 VALUES (19,'x');
INSERT INTO t2 VALUES (20,'z');
SELECT table1.col_varchar
FROM (t2 AS table1 RIGHT JOIN
((t2 STRAIGHT_JOIN t1 ON (t1.col_varchar = t2.col_varchar)))
ON (t1.pk = t2.col_int))
WHERE (t1.pk IN (SELECT t1.col_int_key
FROM (t1 INNER JOIN t2 ON (t2.col_int = t1.col_int))))
AND table1.col_varchar != 'q';
col_varchar
DROP TABLE t1,t2;
# End of test for Bug#21184091
set @@optimizer_switch=@old_opt_switch;
# End of 5.6 tests
set optimizer_switch=default;
@@ -10492,6 +10492,33 @@ Handler_read_rnd 0
Handler_read_rnd_next 12
DROP TABLE t1,t2,t3,t4;
# End of test for Bug#18194196
#
# Bug#21184091 ASSERT `READ_ROWS >= 0.0' AT
# COST_MODEL_SERVER::TMPTABLE_READWRITE_COST()
#
CREATE TABLE t1 (
col_int int(11),
pk int(11) NOT NULL,
col_int_key int(11) ,
col_varchar varchar(1),
PRIMARY KEY (pk)
) ENGINE=MyISAM;
CREATE TABLE t2 (
col_int int(11),
col_varchar varchar(1)
) ENGINE=MyISAM;
INSERT INTO t2 VALUES (19,'x');
INSERT INTO t2 VALUES (20,'z');
SELECT table1.col_varchar
FROM (t2 AS table1 RIGHT JOIN
((t2 STRAIGHT_JOIN t1 ON (t1.col_varchar = t2.col_varchar)))
ON (t1.pk = t2.col_int))
WHERE (t1.pk IN (SELECT t1.col_int_key
FROM (t1 INNER JOIN t2 ON (t2.col_int = t1.col_int))))
AND table1.col_varchar != 'q';
col_varchar
DROP TABLE t1,t2;
# End of test for Bug#21184091
set @@optimizer_switch=@old_opt_switch;
# End of 5.6 tests
#
@@ -10493,6 +10493,33 @@ Handler_read_rnd 0
Handler_read_rnd_next 12
DROP TABLE t1,t2,t3,t4;
# End of test for Bug#18194196
#
# Bug#21184091 ASSERT `READ_ROWS >= 0.0' AT
# COST_MODEL_SERVER::TMPTABLE_READWRITE_COST()
#
CREATE TABLE t1 (
col_int int(11),
pk int(11) NOT NULL,
col_int_key int(11) ,
col_varchar varchar(1),
PRIMARY KEY (pk)
) ENGINE=MyISAM;
CREATE TABLE t2 (
col_int int(11),
col_varchar varchar(1)
) ENGINE=MyISAM;
INSERT INTO t2 VALUES (19,'x');
INSERT INTO t2 VALUES (20,'z');
SELECT table1.col_varchar
FROM (t2 AS table1 RIGHT JOIN
((t2 STRAIGHT_JOIN t1 ON (t1.col_varchar = t2.col_varchar)))
ON (t1.pk = t2.col_int))
WHERE (t1.pk IN (SELECT t1.col_int_key
FROM (t1 INNER JOIN t2 ON (t2.col_int = t1.col_int))))
AND table1.col_varchar != 'q';
col_varchar
DROP TABLE t1,t2;
# End of test for Bug#21184091
set @@optimizer_switch=@old_opt_switch;
# End of 5.6 tests
#
Oops, something went wrong.

0 comments on commit bfba233

Please sign in to comment.