2742 Georgi Kodinov 2009-01-16 [merge]
merged 5.0-bugteam -> 5.1-bugteam
2741 Georgi Kodinov 2009-01-16 [merge]
merged 5.1-main -> 5.1-bugteam
modified:
scripts/mysql_install_db.sh
2740 Georgi Kodinov 2009-01-16 [merge]
merged 5.1-main -> 5.1-bugteam
modified:
configure.in
2739 Georgi Kodinov 2009-01-16 [merge]
merged 5.0-bugteam -> 5.1-bugtteam
modified:
mysql-test/r/greedy_optimizer.result
mysql-test/t/greedy_optimizer.test
sql/sql_select.cc
2738 Davi Arnaut 2009-01-15
Post-merge fix for Bug#36326
modified:
mysql-test/r/cache_innodb.result
=== modified file 'configure.in'
--- a/configure.in 2009-01-15 05:31:47 +0000
+++ b/configure.in 2009-01-15 18:11:25 +0000
@@ -10,7 +10,7 @@ AC_CANONICAL_SYSTEM
#
# When changing major version number please also check switch statement
# in mysqlbinlog::check_master_version().
-AM_INIT_AUTOMAKE(mysql, 5.1.31)
+AM_INIT_AUTOMAKE(mysql, 5.1.32)
AM_CONFIG_HEADER([include/config.h:config.h.in])
PROTOCOL_VERSION=10
=== modified file 'mysql-test/r/greedy_optimizer.result'
--- a/mysql-test/r/greedy_optimizer.result 2007-05-29 12:58:18 +0000
+++ b/mysql-test/r/greedy_optimizer.result 2009-01-16 10:45:17 +0000
@@ -655,3 +655,80 @@ show status like 'Last_query_cost';
Variable_name Value
Last_query_cost 794.837037
drop table t1,t2,t3,t4,t5,t6,t7;
+CREATE TABLE t1 (a int, b int, d int, i int);
+INSERT INTO t1 VALUES (1,1,1,1);
+CREATE TABLE t2 (b int, c int, j int);
+INSERT INTO t2 VALUES (1,1,1);
+CREATE TABLE t2_1 (j int);
+INSERT INTO t2_1 VALUES (1);
+CREATE TABLE t3 (c int, f int);
+INSERT INTO t3 VALUES (1,1);
+CREATE TABLE t3_1 (f int);
+INSERT INTO t3_1 VALUES (1);
+CREATE TABLE t4 (d int, e int, k int);
+INSERT INTO t4 VALUES (1,1,1);
+CREATE TABLE t4_1 (k int);
+INSERT INTO t4_1 VALUES (1);
+CREATE TABLE t5 (g int, d int, h int, l int);
+INSERT INTO t5 VALUES (1,1,1,1);
+CREATE TABLE t5_1 (l int);
+INSERT INTO t5_1 VALUES (1);
+SET optimizer_search_depth = 3;
+SELECT 1
+FROM t1
+LEFT JOIN (
+t2 JOIN t3 ON t3.c = t2.c
+) ON t2.b = t1.b
+LEFT JOIN (
+t4 JOIN t5 ON t5.d = t4.d
+) ON t4.d = t1.d
+;
+1
+1
+SELECT 1
+FROM t1
+LEFT JOIN (
+t2 LEFT JOIN (t3 JOIN t3_1 ON t3.f = t3_1.f) ON t3.c = t2.c
+) ON t2.b = t1.b
+LEFT JOIN (
+t4 JOIN t5 ON t5.d = t4.d
+) ON t4.d = t1.d
+;
+1
+1
+SELECT 1
+FROM t1
+LEFT JOIN (
+(t2 JOIN t2_1 ON t2.j = t2_1.j) JOIN t3 ON t3.c = t2.c
+) ON t2.b = t1.b
+LEFT JOIN (
+t4 JOIN t5 ON t5.d = t4.d
+) ON t4.d = t1.d
+;
+1
+1
+SELECT 1
+FROM t1
+LEFT JOIN (
+t2 JOIN t3 ON t3.c = t2.c
+) ON t2.b = t1.b
+LEFT JOIN (
+(t4 JOIN t4_1 ON t4.k = t4_1.k) LEFT JOIN t5 ON t5.d = t4.d
+) ON t4.d = t1.d
+;
+1
+1
+SELECT 1
+FROM t1
+LEFT JOIN (
+t2 JOIN t3 ON t3.c = t2.c
+) ON t2.b = t1.b
+LEFT JOIN (
+t4 LEFT JOIN (t5 JOIN t5_1 ON t5.l = t5_1.l) ON t5.d = t4.d
+) ON t4.d = t1.d
+;
+1
+1
+SET optimizer_search_depth = DEFAULT;
+DROP TABLE t1,t2,t2_1,t3,t3_1,t4,t4_1,t5,t5_1;
+End of 5.0 tests
=== modified file 'mysql-test/t/greedy_optimizer.test'
--- a/mysql-test/t/greedy_optimizer.test 2007-06-20 15:05:38 +0000
+++ b/mysql-test/t/greedy_optimizer.test 2009-01-16 10:45:17 +0000
@@ -311,3 +311,76 @@ explain select t1.c11 from t7, t6, t5, t
show status like 'Last_query_cost';
drop table t1,t2,t3,t4,t5,t6,t7;
+
+
+#
+# Bug # 38795: Automatic search depth and nested join's results in server
+# crash
+#
+
+CREATE TABLE t1 (a int, b int, d int, i int); INSERT INTO t1 VALUES (1,1,1,1);
+CREATE TABLE t2 (b int, c int, j int); INSERT INTO t2 VALUES (1,1,1);
+CREATE TABLE t2_1 (j int); INSERT INTO t2_1 VALUES (1);
+CREATE TABLE t3 (c int, f int); INSERT INTO t3 VALUES (1,1);
+CREATE TABLE t3_1 (f int); INSERT INTO t3_1 VALUES (1);
+CREATE TABLE t4 (d int, e int, k int); INSERT INTO t4 VALUES (1,1,1);
+CREATE TABLE t4_1 (k int); INSERT INTO t4_1 VALUES (1);
+CREATE TABLE t5 (g int, d int, h int, l int); INSERT INTO t5 VALUES (1,1,1,1);
+CREATE TABLE t5_1 (l int); INSERT INTO t5_1 VALUES (1);
+
+SET optimizer_search_depth = 3;
+
+SELECT 1
+FROM t1
+LEFT JOIN (
+ t2 JOIN t3 ON t3.c = t2.c
+) ON t2.b = t1.b
+LEFT JOIN (
+ t4 JOIN t5 ON t5.d = t4.d
+) ON t4.d = t1.d
+;
+
+SELECT 1
+FROM t1
+LEFT JOIN (
+ t2 LEFT JOIN (t3 JOIN t3_1 ON t3.f = t3_1.f) ON t3.c = t2.c
+) ON t2.b = t1.b
+LEFT JOIN (
+ t4 JOIN t5 ON t5.d = t4.d
+) ON t4.d = t1.d
+;
+
+SELECT 1
+FROM t1
+LEFT JOIN (
+ (t2 JOIN t2_1 ON t2.j = t2_1.j) JOIN t3 ON t3.c = t2.c
+) ON t2.b = t1.b
+LEFT JOIN (
+ t4 JOIN t5 ON t5.d = t4.d
+) ON t4.d = t1.d
+;
+
+SELECT 1
+FROM t1
+LEFT JOIN (
+ t2 JOIN t3 ON t3.c = t2.c
+) ON t2.b = t1.b
+LEFT JOIN (
+ (t4 JOIN t4_1 ON t4.k = t4_1.k) LEFT JOIN t5 ON t5.d = t4.d
+) ON t4.d = t1.d
+;
+
+SELECT 1
+FROM t1
+LEFT JOIN (
+ t2 JOIN t3 ON t3.c = t2.c
+) ON t2.b = t1.b
+LEFT JOIN (
+ t4 LEFT JOIN (t5 JOIN t5_1 ON t5.l = t5_1.l) ON t5.d = t4.d
+) ON t4.d = t1.d
+;
+
+SET optimizer_search_depth = DEFAULT;
+DROP TABLE t1,t2,t2_1,t3,t3_1,t4,t4_1,t5,t5_1;
+
+--echo End of 5.0 tests
=== modified file 'scripts/mysql_install_db.sh'
--- a/scripts/mysql_install_db.sh 2008-09-02 08:53:30 +0000
+++ b/scripts/mysql_install_db.sh 2009-01-06 15:08:15 +0000
@@ -21,6 +21,7 @@
basedir=""
builddir=""
ldata="@localstatedir@"
+langdir=""
srcdir=""
args=""
@@ -106,7 +107,7 @@ parse_arguments()
# Note that the user will be passed to mysqld so that it runs
# as 'user' (crucial e.g. if log-bin=/some_other_path/
# where a chown of datadir won't help)
- user=`parse_arg "$arg"` ;;
+ user=`parse_arg "$arg"` ;;
--skip-name-resolve) ip_only=1 ;;
--verbose) verbose=1 ;; # Obsolete
--rpm) in_rpm=1 ;;
@@ -171,7 +172,20 @@ find_in_basedir()
cannot_find_file()
{
echo
- echo "FATAL ERROR: Could not find $*"
+ echo "FATAL ERROR: Could not find $1"
+
+ shift
+ if test $# -ne 0
+ then
+ echo
+ echo "The following directories were searched:"
+ echo
+ for dir in "$@"
+ do
+ echo " $dir"
+ done
+ fi
+
echo
echo "If you compiled from source, you need to run 'make install' to"
echo "copy the software into the correct location ready for operation."
@@ -210,6 +224,11 @@ then
elif test -n "$basedir"
then
print_defaults=`find_in_basedir my_print_defaults bin extra`
+ if test -z "$print_defaults"
+ then
+ cannot_find_file my_print_defaults $basedir/bin $basedir/extra
+ exit 1
+ fi
else
print_defaults="@bindir@/my_print_defaults"
fi
@@ -232,7 +251,7 @@ then
bindir="$basedir/client"
extra_bindir="$basedir/extra"
mysqld="$basedir/sql/mysqld"
- mysqld_opt="--language=$srcdir/sql/share/english"
+ langdir="$srcdir/sql/share/english"
pkgdatadir="$srcdir/scripts"
scriptdir="$srcdir/scripts"
elif test -n "$basedir"
@@ -240,7 +259,23 @@ then
bindir="$basedir/bin"
extra_bindir="$bindir"
mysqld=`find_in_basedir mysqld libexec sbin bin`
+ if test -z "$mysqld"
+ then
+ cannot_find_file mysqld $basedir/libexec $basedir/sbin $basedir/bin
+ exit 1
+ fi
+ langdir=`find_in_basedir --dir errmsg.sys share/english share/mysql/english`
+ if test -z "$langdir"
+ then
+ cannot_find_file errmsg.sys $basedir/share/english $basedir/share/mysql/english
+ exit 1
+ fi
pkgdatadir=`find_in_basedir --dir fill_help_tables.sql share share/mysql`
+ if test -z "$pkgdatadir"
+ then
+ cannot_find_file fill_help_tables.sql $basedir/share $basedir/share/mysql
+ exit 1
+ fi
scriptdir="$basedir/scripts"
else
basedir="@prefix@"
@@ -271,6 +306,16 @@ then
exit 1
fi
+if test -n "$langdir"
+then
+ if test ! -f "$langdir/errmsg.sys"
+ then
+ cannot_find_file "$langdir/errmsg.sys"
+ exit 1
+ fi
+ mysqld_opt="--language=$langdir"
+fi
+
# Try to determine the hostname
hostname=`@HOSTNAME@`
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc 2009-01-05 16:10:20 +0000
+++ b/sql/sql_select.cc 2009-01-16 10:45:17 +0000
@@ -109,7 +109,7 @@ static COND* substitute_for_best_equal_f
void *table_join_idx);
static COND *simplify_joins(JOIN *join, List<TABLE_LIST> *join_list,
COND *conds, bool top);
-static bool check_interleaving_with_nj(JOIN_TAB *last, JOIN_TAB *next);
+static bool check_interleaving_with_nj(JOIN_TAB *next);
static void restore_prev_nj_state(JOIN_TAB *last);
static void reset_nj_counters(List<TABLE_LIST> *join_list);
static uint build_bitmap_for_nested_joins(List<TABLE_LIST> *join_list,
@@ -4889,6 +4889,18 @@ greedy_search(JOIN *join,
*/
join->positions[idx]= best_pos;
+ /*
+ Update the interleaving state after extending the current partial plan
+ with a new table.
+ We are doing this here because best_extension_by_limited_search reverts
+ the interleaving state to the one of the non-extended partial plan
+ on exit.
+ */
+ IF_DBUG(bool is_interleave_error= )
+ check_interleaving_with_nj (best_table);
+ /* This has been already checked by best_extension_by_limited_search */
+ DBUG_ASSERT(!is_interleave_error);
+
/* find the position of 'best_table' in 'join->best_ref' */
best_idx= idx;
JOIN_TAB *pos= join->best_ref[best_idx];
@@ -4906,7 +4918,7 @@ greedy_search(JOIN *join,
--size_remain;
++idx;
- DBUG_EXECUTE("opt", print_plan(join, join->tables,
+ DBUG_EXECUTE("opt", print_plan(join, idx,
record_count, read_time, read_time,
"extended"););
} while (TRUE);
@@ -5064,7 +5076,7 @@ best_extension_by_limited_search(JOIN
table_map real_table_bit= s->table->map;
if ((remaining_tables & real_table_bit) &&
!(remaining_tables & s->dependent) &&
- (!idx || !check_interleaving_with_nj(join->positions[idx-1].table, s)))
+ (!idx || !check_interleaving_with_nj(s)))
{
double current_record_count, current_read_time;
@@ -5210,7 +5222,7 @@ find_best(JOIN *join,table_map rest_tabl
{
table_map real_table_bit=s->table->map;
if ((rest_tables & real_table_bit) && !(rest_tables & s->dependent) &&
- (!idx|| !check_interleaving_with_nj(join->positions[idx-1].table, s)))
+ (!idx|| !check_interleaving_with_nj(s)))
{
double records, best;
best_access_path(join, s, thd, rest_tables, idx, record_count,
@@ -8790,9 +8802,6 @@ static void reset_nj_counters(List<TABLE
the partial join order.
@endverbatim
- @param join Join being processed
- @param last_tab Last table in current partial join order (this function is
- not called for empty partial join orders)
@param next_tab Table we're going to extend the current partial join with
@retval
@@ -8802,10 +8811,10 @@ static void reset_nj_counters(List<TABLE
TRUE Requested join order extension not allowed.
*/
-static bool check_interleaving_with_nj(JOIN_TAB *last_tab, JOIN_TAB *next_tab)
+static bool check_interleaving_with_nj(JOIN_TAB *next_tab)
{
TABLE_LIST *next_emb= next_tab->table->pos_in_table_list->embedding;
- JOIN *join= last_tab->join;
+ JOIN *join= next_tab->join;
if (join->cur_embedding_map & ~next_tab->embedding_map)
{
| Thread |
|---|
| • bzr push into mysql-5.1-bugteam branch (joro:2738 to 2742) | Georgi Kodinov | 16 Jan |