Commit graph

167676 commits

Author SHA1 Message Date
Igor Babaev
151f4e9b4a Fixed the bug mdev-12963.
This patch corrects the fix for bug mdev-7599.
When the min/max optimization of the function
opt_sum_query() optimizes away all tables of
a subquery it should not ever be rolled back.
2017-06-07 16:29:55 -07:00
Igor Babaev
c258ca2463 Fixed the bug mdev-12838.
If the optimizer chose an execution plan where
a semi-join nest were materialized and the
result of materialization was scanned to access
other tables by ref access it could build a key
over columns of the tables from the nest that
were actually inaccessible.
The patch performs a proper check whether a key
that uses columns of the tables from a materialized
semi-join nest can be employed to access outer tables.
2017-06-07 12:45:32 -07:00
Marko Mäkelä
2cb94aa1b7 MDEV-11626 innodb.innodb-change-buffer-recovery fails for xtradb
buf_page_get_gen(): Remove the error log messages about
page flushing and eviction when
innodb_change_buffering_debug=1 is in effect.
2017-05-29 13:07:23 +03:00
Oleksandr Byelkin
b8405c853f MDEV-11958: LEFT JOIN with stored routine produces incorrect result
Added forgoten method of Item_func_sp to make it correctly work with LEFT/RIGHT JOIN.
Fixed inconsistency with the null table caches.
2017-05-23 11:06:31 +02:00
Sachin Setiya
7d57ba6e28 MDEV-11092 :- Fix Previous commit of MDEV-11092 2017-05-19 13:02:45 +05:30
Oleksandr Byelkin
4a846e018d Make IF clear. 2017-05-18 19:31:44 +02:00
Sachin Setiya
b5cdf01404 MDEV-11092 Assertion `!writer.checksum_len || writer.remains == 0' failed
Problem:-
This crash happens because logged stmt is quite big and while writing
Annotate_rows_log_event it throws EFBIG error  but we ignore this error
and do not call cache_data->set_incident().

Solution:-
When we normally write Binlog_log_event we check for error EFBIG, but we did
do this for Annotate_rows_log_event. We check for this error and call
cache_data->set_incident() accordingly.

# Conflicts:
#	sql/log.cc
2017-05-18 17:13:37 +05:30
Igor Babaev
efb9f2617b Fixed the bug mdev-12812.
This is another correction of the patch for bug mdev-12670.
If a derived table is merged into a select with STRAIGHT_JOIN
modifier all IN subquery predicates contained in the
specification of the derived table cannot be subject to
conversion to semi-joins.
2017-05-17 16:16:54 -07:00
Igor Babaev
7e97163102 Fixed the bug mdev-12817/mdev-12820.
This patch is a correction of the patch for bug mdev-12670.
With the current code handling semi-joins the following must
be taken into account.
Conversion of an IN subquery predicate into semi-join
has to be blocked if the predicate occurs:
(a) in the ON expression of an outer join
(b) in the ON expression of an inner join embedded directly
    or indirectly in the inner nest of an outer join.
The patch for mdev-12670 blocked conversion to semi-joins only
in the case (a), but not in the case (b). This patch blocks
the conversion in both cases.
2017-05-17 14:29:13 -07:00
Igor Babaev
934b831281 Fixed the bug mdev-7791.
When an IN subquery predicate was converted to a semi-join that were
materialized and the result of the materialization happened to be
the last in the execution plan then any conjunctive condition with RAND()
turned out to be lost.

Fixed by attaching this condition to the last top base table.
2017-05-16 08:25:32 -07:00
Sergei Golubchik
2e1428c0b5 MDEV-12799 Buffer overflow
with a specially corrupted master.info one can
get an invalid heartbeat_period that will
trigger a heap overflow.
2017-05-15 22:01:15 +02:00
Igor Babaev
e0352fb079 Fixed the bug mdev-7599.
At some conditions the function opt_sum_query() can apply MIN/MAX
optimizations to to Item_sum objects of a select These optimizations
becomes invalid if this select is the subquery of an IN subquery
predicate that is converted to a EXISTS subquery. Thus in this case
the MIX/MAX optimizations that have been applied in opt_sum_query()
must be rolled back.
This bug appeared in 5.3 when the code for the cost base choice between
materialization and in-to-exists transformation of non-correlated
IN subqueries was introduced. Before this code in-to-exists
transformations were always performed before the call of opt_sum_query().
2017-05-15 10:00:00 -07:00
Sachin Setiya
9495e018fb MDEV-11718 Post-fix
A better way of finding mysqld
2017-05-12 11:09:27 +05:30
Igor Babaev
6b97fe067d Fixed the bugs mdev-12670 and mdev-12675.
The code that blocked conversion of a IN subselect pedicate to a semi-join
if it occurred in the ON expression of an outer join did not do it correctly.
As a result, the conversion was blocked for IN subselect predicates
encountered in ON expressions of INNER joins or in WHERE conditions
of mergeable views / derived tables. This patch fixes this problem.
2017-05-09 15:09:15 -07:00
Igor Babaev
15f9931f6d Fixed the bug mdev-12673.
This patch corrects the fix for the bug mdev-10693.
It is critical for the function get_best_combination() not to call
create_ref_for_key() for constant tables.
This bug could manifest itself only in multi-table subqueries where
one of the tables is accessed by a constant primary key.
2017-05-04 22:45:32 -07:00
Daniel Bartholomew
14fca28ea4 bump the VERSION 2017-05-02 19:11:21 -04:00
Daniel Black
dbe2c3c5f2 mysqld_safe_help - remove warning
/home/travis/build/MariaDB/server/extra/mysqld_safe_helper.c:62:21: warning: too many arguments in call to 'do_usage'
    do_usage(argv[0]);
    ~~~~~~~~        ^
1 warning generated.
2017-04-30 15:06:01 +04:00
Igor Babaev
2e7ba70a94 Fixed the bug mdev-10693.
The code that chooses between materialization of a non-correlated
IN subquery and its transformation into an EXISTS correlated
subquery assumes that the execution plan for the outer select
has been already built. However it was not always so if subqueries
occurred in the expressions used for ref access to tables of
the outer select. A call of the function create_ref_for_key() in
get_best_combination() could trigger a premature execution of
the above mentioned code when the execution plan structures for
the outer select were not fully built. This could cause a crash
of the server.

The fix postpones the calls of create_ref_for_key() until the
structures for the execution plan is fully built.
2017-04-24 11:46:01 -07:00
Sergei Golubchik
c6ee3fe9d4 respect client's desire to force ssl even when WITH_SSL=NO
of course, this combination can never succeed,
we must fail to connect here.
2017-04-20 16:36:23 +02:00
Sergei Golubchik
4fe65ca33a MDEV-12230 include/my_sys.h:600:43: error: unknown type name ‘PSI_file_key’" when -DWITHOUT_SERVER=1
cherry-pick 2c2bd8c155 (MDEV-12261 build failure without P_S) from 10.0
2017-04-20 16:36:23 +02:00
Sergei Golubchik
0001049be0 MDEV-12276 Missing DBUG_RETURN or DBUG_VOID_RETURN macro in function "do_exec" 2017-04-20 16:36:23 +02:00
Sergei Golubchik
036b689f18 MDEV-12310 openat(<directory>, ...O_EXEC) fails on Illumos / Solaris
it could be
* O_SEARCH on Illumos
* O_EXEC on FreeBSD
* O_PATH on Linux
ugh
2017-04-20 16:36:22 +02:00
Sergei Golubchik
786363e89b compiler warning
way-too-smart compilers don't like the "confusing indentation"
2017-04-20 16:36:22 +02:00
Kristian Nielsen
39f1917f46 Attempt to fix strange rpm dependency issue following prior patch 2017-04-20 16:36:22 +02:00
Oleksandr Byelkin
d185f1d68b Fix use of require in mysql-test-run.
The motivation for this is that Perl is moving towards not having
current directory ./ in @INC by default. This is causing
mysql-test-run.pl to fail in latest Debian Unstable:

  https://lists.debian.org/debian-devel-announce/2016/08/msg00013.html

However, we have `use "lib"`, there is no need for current directory
in @INC, except for a gross hack. In mtr_cases.pm, there is a
`require "mtr_misc.pl"`, which hides mtr_misc.pl away in mtr_cases
namespace. And things only work because mysql-test-run.pl loads it
with a different name, `require "lib/mtr_misc.pl"`! (Perl will
`require` only once for each unique filename).

Fix this by only using `require` in main program, and referencing
functions with :: scope from other namespaces. For multi-use in
different namespaces, proper `use` modules should be used.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2017-04-19 14:30:52 +02:00
Daniel Bartholomew
d53b541389 bump the VERSION 2017-04-13 09:35:57 -04:00
Sergei Golubchik
663068c6ee Merge remote-tracking branch 'mysql/5.5' into 5.5 2017-04-11 10:18:04 -04:00
Igor Babaev
5c579482eb Adjusted test results after the fix for mdev-12429. 2017-04-07 16:25:02 -07:00
Igor Babaev
b0395d8701 Fixed the bug mdev-12429 and its duplicates mdev-12145 and mdev-9886.
Also fixed a wrong result for a test case for mdev-7691
(the alternative one).
The test  cases for all these bug have materialized semi-joins used
inside dependent sub-queries.

The patch actually reverts the change inroduced by Monty in 2003.
It looks like this change is not valid anymore after the implementation
of semi-joins.
Adjusted output from EXPLAIN for many other test cases.
2017-04-04 10:04:52 -07:00
Marko Mäkelä
a821ef7605 MDEV-11802 innodb.innodb_bug14676111 fails on buildbot
The test was unnecessarily depending on InnoDB purge, which can
sometimes fail to proceed.

Let us rewrite the test to use BEGIN;INSERT;ROLLBACK to cause the
immediate removal of the desired records.
2017-03-24 18:01:56 +02:00
Sergei Golubchik
577915def8 remove COPYING.LESSER
shouldn't have been added in the first place, MariaDB Server is GPLv2
2017-03-21 08:17:18 +01:00
Bharathy Satish
6fa5e08146 Bug #25717383: MYSQLDUMP MAY EXECUTE ANY ARBITRARY QUERY
While writing comments if database object names has a new
line character, then next line is considered a command, rather
than a comment.
This patch fixes the way comments are constructed in mysqldump.

(cherry picked from commit 1099f9d17b1c697c2760f86556f5bae7d202b444)
2017-03-18 10:12:04 +05:30
Vladislav Vaintroub
8efdf89e42 MDEV-12126 Correct German error message. 2017-03-17 20:07:39 +00:00
Varun Gupta
adbe1c5fe9 MDEV-6486: Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))'
failed with SELECT SQ, TEXT field

The functon find_all_keys does call Item_subselect::walk, which calls walk() for the subquery
The issue is that when a field is represented by Item_outer_ref(Item_direct_ref(Item_copy_string( ...))).
Item_copy_string does have a pointer to an Item_field in Item_copy::item but does not implement Item::walk method, so we are not
able to set the bitmap for that field. This is the reason why the assert fails.

Fixed by adding the walk method to Item_copy class.
2017-03-14 17:31:29 +05:30
Ramil Kalimullin
87e37ee06b BUG#25575605: SETTING --SSL-MODE=REQUIRED SENDS CREDENTIALS BEFORE VERIFYING SSL CONNECTION
Changed MYSQL_OPT_SSL_MODE to be the same as in 5.6 (ABI compatibility).

(cherry picked from commit 47bb4eb5df1629b5d5e30aebfa9d7a6d74388a5d)
2017-03-14 16:02:09 +05:30
Vladislav Vaintroub
3990e55fef Windows : Fix packaging when building with VS2017 2017-03-13 23:31:03 +00:00
Sergei Golubchik
c99d71a29c MDEV-12231 MariaDB fails to restart after 10.0.30-1.el7 update
force SELinux policies to be built in mysql_release RPM packages
2017-03-12 10:30:57 +01:00
Ramil Kalimullin
060b1eadf4 BUG#25575605: SETTING --SSL-MODE=REQUIRED SENDS CREDENTIALS BEFORE VERIFYING SSL CONNECTION
MYSQL_OPT_SSL_MODE option introduced.
It is set in case of --ssl-mode=REQUIRED and permits only SSL connection.

(cherry picked from commit 3b2d28578c526f347f5cfe763681eff365731f99)
2017-03-10 14:11:26 +05:30
Sergei Petrunia
2abc313c37 Use correct function name in DEBUG_ENTER 2017-03-09 12:34:06 +03:00
Vladislav Vaintroub
65ef8ec8aa MDEV-12207 Include windows compatibility manifest into executable to make GetVersionEx work correctly 2017-03-08 11:20:03 +00:00
Vicențiu Ciorbaru
f65c9f825d mysql_client_test_nonblock fails when compiled with clang
mysql_client uses some inline assembly code to switch thread stacks.
This works, however tools that perform backtrace get confused to fix
this we write a specific constant to signify bottom of stack. This
constant is needed when compiling with CLang as well.
2017-03-08 11:56:09 +02:00
Marko Mäkelä
6860a4b556 MDEV-12206 Query_cache::send_result_to_client() may corrupt THD::query_plan_flags
This is essentially a backport of the 10.0
commit 203f4d4193
that fixes a bug and silences a GCC 6.3.0 warning
about a left shift of a signed integer.

Missing parenthesis in a macro definition caused wrong operation
in the Query_cache::send_result_to_client() statement
   thd->query_plan_flags= (thd->query_plan_flags & ~QPLAN_QC_NO) | QPLAN_QC;

This would expand to
   thd->query_plan_flags= (thd->query_plan_flags & ~1) << 6 | 1 << 5;

which would shift the flags by 6 and clear an unrelated flag, instead
of clearing the flag (1 << 6).
2017-03-08 10:31:06 +02:00
Marko Mäkelä
9c47beb8bd MDEV-11027 InnoDB log recovery is too noisy
Provide more useful progress reporting of crash recovery.

recv_sys_t::progress_time: The time of the last report.

recv_scan_print_counter: Remove.

log_group_read_log_seg(): After after each I/O request,
report progress if needed.

recv_apply_hashed_log_recs(): At the start of each batch,
if there are pages to be recovered, issue a message.
2017-03-08 10:07:50 +02:00
Marko Mäkelä
1fd3cc8c1f Fix a compiler warning. 2017-03-08 10:06:34 +02:00
Marko Mäkelä
17a1b194e2 Fix some GCC 6.3.0 warnings in MyISAM and Maria.
The C++ standard does not allow references to be NULL.
Assign the return value of THD::alloc() to a pointer,
not to a reference.
2017-03-08 10:03:35 +02:00
Alexey Botchkov
30cac41c2f MDEV-11084 server_audit does not work with mysql_community 5.7.16.
Server audit plugin version updated.
2017-03-06 23:07:59 +04:00
Varun Gupta
43903745e5 MDEV-11078: NULL NOT IN (non-empty subquery) should never return results
Disabling the cond guards during the creation of Tricond Item for
constant and NULL left expression items
2017-03-05 10:58:05 +05:30
Marko Mäkelä
6b8173b6e9 MDEV-11520: Retry posix_fallocate() after EINTR.
The function posix_fallocate() as well as the Linux system call
fallocate() can return EINTR when the operation was interrupted
by a signal. In that case, keep retrying the operation, except
if InnoDB shutdown has been initiated.
2017-03-03 11:47:31 +02:00
Oleksandr Byelkin
75f6067e89 MDEV-9635: Server crashes in part_of_refkey or assertion `!created && key_to_save < (int)s->keys' failed in TABLE::use_index(int) or with join_cache_level>2
Do not try to create index where ref is for hash join.
2017-02-28 20:52:26 +01:00
Igor Babaev
5a0fff50f8 Fixed bug mdev-12099.
The function mysql_derived_merge() erroneously did not mark newly formed
AND formulas in ON conditions with the flag abort_on_null. As a result
not_null_tables() calculated incorrectly for these conditions. This
could prevent conversion of embedded outer joins into inner joins.

Changed a test case from table_elim.test to preserve the former execution
plan.
2017-02-27 09:02:41 -08:00