3256 Joerg Bruehe 2011-07-07 [merge]
Upmerge the 45415 fix from 5.5 to 5.6
modified:
support-files/mysql.spec.sh
3255 Olav Sandstaa 2011-07-07
Fix for bug#11766256, and particularly its
relatives/duplicates bug#11751026 and bug#11765274.
Fixes the problem that complex queries containing a lot of EQ_REF'ed
joined tables takes 'forever' to produce a query plan.
The fix depends on the fact that when a table is
joined by an unique key there is a 1::1 relation
between the rows being joined. Assuming we have multiple
such 1::1 (star-)joined relations in a sequence,
without other join types inbetween. Then all of
these 'eq_ref-joins' will be calculated to return the excact
same #rows and having identical 'cost' (or 'read_time').
This leads to that we can append such a contigous sequence
of eq_ref-joins to a partial plan in any order without
affecting the total cost of the query plan. Exploring the
different permutations of these eq_refs in the 'greedy'
optimizations will simply be a waste of precious CPU cycles.
This chain of eq_refs can further be handled as a single
entity wrt. the full 'greedy' exploration of the possible
join plans. This will reduce the 'N' in the O(N!) complexity
of the full greedy search.
The method ::eq_ref_extension_by_limited_search() has been
implemented doing as described above. Once an EQ_REF joined
table is encountered, it is invoked to append any remaining
EQ_REFs to the join plan. This chain of EQ_REFs will then
act like a single entity in the further exploration of possible
join plans.
It should be noted that ::best_extension_by_limited_search()
will still explore the other plans starting with non-EQ_REF
operations as possibly better alternatives to the EQ_REF-extended
query plan.
Usage of ::eq_ref_extension_by_limited_search() is
controlled by 'optimizer_prune_level=1'.
This fix also introduce the method ::plan_is_complete() which
contains common functionality between ::best_extension_by_limited_search()
and ::eq_ref_extension_by_limited_search()
greedy_optimizer.test has been extensively extended with new testcases
containing lots of EQ_REF's.
No existing test/query plans are expected to change as result of this fix.
It should only produce the 'best' plan (a lot!) faster. - Like the
testcase for bug#58225 which now completes the QEP in ~0.05s in my
DEBUG compiled sandbox (With 'optimizer_search_depth= 62'). This
previously took 63min+42.437s :-o
This extention to the greedy optimizer has been implemented by
Ole John Aske.
@ mysql-test/r/greedy_optimizer.result
Extended test with testcases containing lots of EQ_REFs.
@ mysql-test/t/greedy_optimizer.test
Extended test with testcases containing lots of EQ_REFs.
@ sql/sql_select.cc
Extended greedy optimizer to attempt to chain EQ_REF
joined tables in order to reduce the cost of running
the greedy optimizer.
modified:
mysql-test/r/greedy_optimizer.result
mysql-test/t/greedy_optimizer.test
sql/sql_select.cc
=== modified file 'support-files/mysql.spec.sh'
--- a/support-files/mysql.spec.sh 2011-06-30 15:50:45 +0000
+++ b/support-files/mysql.spec.sh 2011-07-07 15:29:36 +0000
@@ -721,13 +721,12 @@ else
fi
# echo "Analyzed: SERVER_TO_START=$SERVER_TO_START"
if [ ! -d $mysql_datadir/mysql ] ; then
- mkdir $mysql_datadir/mysql;
+ mkdir $mysql_datadir/mysql $mysql_datadir/test
echo "MySQL RPM installation of version $NEW_VERSION" >> $STATUS_FILE
else
# If the directory exists, we may assume it is an upgrade.
echo "MySQL RPM upgrade to version $NEW_VERSION" >> $STATUS_FILE
fi
-if [ ! -d $mysql_datadir/test ] ; then mkdir $mysql_datadir/test; fi
# ----------------------------------------------------------------------
# Make MySQL start/shutdown automatically when the machine does it.
@@ -762,7 +761,12 @@ chown -R %{mysqld_user}:%{mysqld_group}
# ----------------------------------------------------------------------
# Initiate databases if needed
# ----------------------------------------------------------------------
-%{_bindir}/mysql_install_db --rpm --user=%{mysqld_user}
+if ! grep '^MySQL RPM upgrade' $STATUS_FILE >/dev/null 2>&1 ; then
+ # Fix bug#45415: no "mysql_install_db" on an upgrade
+ # Do this as a negative to err towards more "install" runs
+ # rather than to miss one.
+ %{_bindir}/mysql_install_db --rpm --user=%{mysqld_user}
+fi
# ----------------------------------------------------------------------
# Upgrade databases if needed would go here - but it cannot be automated yet
@@ -1126,6 +1130,13 @@ echo "====="
# merging BK trees)
##############################################################################
%changelog
+* Thu Jul 07 2011 Joerg Bruehe <joerg.bruehe@stripped>
+
+- Fix bug#45415: "rpm upgrade recreates test database"
+ Let the creation of the "test" database happen only during a new installation,
+ not in an RPM upgrade.
+ This affects both the "mkdir" and the call of "mysql_install_db".
+
* Thu Feb 09 2011 Joerg Bruehe <joerg.bruehe@stripped>
- Fix bug#56581: If an installation deviates from the default file locations
No bundle (reason: useless for push emails).

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.