Commit graph

65143 commits

Author SHA1 Message Date
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
Vicențiu Ciorbaru
5fe55b1b02 Fix sys_vars innodb_empty_free_list_algorithm_basic
Post xtradb 5.6.36 merge the output has changed.
2017-05-17 15:44:11 +03:00
Vicențiu Ciorbaru
339a290d22 Merge remote-tracking branch 'origin/5.5' into 10.0 2017-05-17 15:42:36 +03: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
8e1056bce0 MDEV-12216 main.mysqld--help 'unix' test is failing when profiling support is not present 2017-05-16 13:14:03 +02:00
Vicențiu Ciorbaru
f1861297f0 Merge branch 'merge-perfschema-5.6' into 10.0 2017-05-16 14:07:50 +03:00
Vicențiu Ciorbaru
24ff179311 5.6.36 2017-05-16 13:53:15 +03:00
Sergei Golubchik
a65623b3eb MDEV-11883 MariaDB crashes with out-of-memory when query information_schema
CSV engine didn't expect CSM files to be read-only
2017-05-15 22:23:10 +02:00
Sergei Golubchik
f9264280d6 MDEV-12761 Error return from external_lock make the server crash
bunch of bugs when external_lock() fails on unlock:
* mi_lock_database() used mi_mark_crashed() under share->intern_lock,
  but mi_mark_crashed() itself locks this mutex.
* handler::close() required table to be unlocked, but failed
  external_lock didn't count as unlock
* mysql_unlock_tables() ignored all unlock errors, but they still set
  the error status in stmt_da.
2017-05-15 22:23:10 +02:00
Daniel Black
b30311e52a MDEV-12420: pcre recursion overflow test case 2017-05-15 22:23:10 +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
Sergei Golubchik
1c418df722 Merge branch '5.5' into 10.0 2017-05-08 12:12:48 +02:00
Marko Mäkelä
bc5c1d9970 MDEV-12635 innodb.log_file_size fails when run with Valgrind
In MariaDB Server before 10.2, InnoDB will not be shut down properly
if startup fails. So, Valgrind failures are to be expected.
Disable the test under Valgrind. In 10.2, it should pass with Valgrind.
2017-05-05 14:04:18 +03: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
Anushree Prakash B
756b00d80a Bug#25340722 - PRINT BINARY DATA AS HEX IN THE MYSQL
CLIENT (CONTRIBUTION)

DESCRIPTION:
============
Binary data should be printed as hex in the mysql client
when the option binary-as-hex is enabled.

ANALYSIS:
=========
The fix deals only with mysql command line client.
It does not change, at all, the data sent to the
applications. Printing binary data as hex also
allows to use the output in the where clause
of the query.

FIX:
====
A new option 'binary-as-hex' is introduced to print the
binary contents as hex in the mysql client. The option
is disabled by default. When the option is enabled, we
convert the binary data to hex before printing the
contents irrespective of whether it is in tabular,
xml or html format.
2017-05-03 15:16:08 +00:00
Oleksandr Byelkin
49552cf1f7 Merge branch '5.5' into bb-10.0-merge-5.5 2017-04-25 16:30:39 +02: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
Marko Mäkelä
57fea99eeb Add and adjust a test from MySQL:
commit 1198267c331b045b9cad26be72b1a5b4f8930a79
Author: Thirunarayanan Balathandayuthapani <thirunarayanan.balathandayuth@oracle.com>
Date:   Fri Aug 26 11:00:44 2016 +0530

    Bug #20989615   INNODB AUTO_INCREMENT PRODUCES SAME VALUE TWICE

The code fix is already present.
2017-04-24 16:45:40 +03:00
Marko Mäkelä
864548c4ec Add and adjust a test from MySQL:
commit 12343617922cfd9c48ee84ad6ecf53068d822010
Author: Thirunarayanan Balathandayuthapani <thirunarayanan.balathandayuth@oracle.com>
Date:   Fri Jul 15 14:39:37 2016 +0530

    Bug #23475211   COMBINING ALTER OPERATIONS TRIGGERS TABLE REBUILD

The code fix is already present.
2017-04-24 13:40:36 +03:00
Alexander Barkov
fac2a7a85d MDEV-12495 Conditional jump depends on uninitialised value for: SELECT NULL UNION geom_expression 2017-04-22 22:51:43 +04:00
Igor Babaev
97fb1f2679 Fixed bug mdev-10053.
The implementation of the walk method for the class Item_in_subselect
was missing. As a result the method never traversed the left operand
of any IN subquery predicate.

Item_exists_subselect::exists2in_processor() that performs the
Exist-To-In transformation calls the walk method to collect info
on outer references. As the walk method did not traverse the
left operands of the IN subqueries the outer references there
were not taken into account and some subqueries that were actually
correlated were marked as uncorrelated. It could lead to an
attempt of the materialization of such a subquery.

Also added a cleanup for some test cases merged from 5.5.
2017-04-21 14:34:24 -07:00
Sergei Golubchik
8d75a7533e Merge branch '5.5' into 10.0 2017-04-21 18:34:06 +02:00
Marko Mäkelä
87b6df31c4 MDEV-12488 Remove type mismatch in InnoDB printf-like calls
This is a reduced version of an originally much larger patch.
We will keep the definition of the ulint, lint data types unchanged,
and we will not be replacing fprintf() calls with ib_logf().

On Windows, use the standard format strings instead of nonstandard
extensions.

This patch fixes some errors in format strings.
Most notably, an IMPORT TABLESPACE error message in InnoDB was
displaying the number of columns instead of the mismatching flags.
2017-04-21 12:06:29 +03: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
Shishir Jaiswal
788fb5bf67 Bug#25043674 - MYSQLACCESS SCRIPT LOADS AND EXECUTES CODE
FROM THE CURRENT DIRECTORY

DESCRIPTION
===========
When 'mysqlaccess' tool is run, it reads (and executes) the
content of its configuration file 'mysqlaccess.conf' from
the current directory. This is not a recommended behaviour
as someone with ill intentions can insert malicious
instructions into this file which could be executed
whenever this tool is run.

ANALYSIS
========
The configuration file is presently looked for, in the
following folders (in given order):
1. Current directory
2. SYSCONFDIR       //This gets expanded
3. /etc/

Owing to the reasons mentioned above, we should not permit
the file to be in the current directory. Since the other
two folders are assumed to be accessible only to authorized
people, the config file is safe to be read from there.

FIX
===
Modified the script so that it looks for the config file
now in the following two folders (in the given order):
1. SYSCONFDIR
2. /etc/

If it's absent from above locations but present in current
directory, an error is thrown asking the user to move the
file to one of the above locations and retry.

NOTE
====
The location paths and their precedence are not documented
for this tool. It needs to be noted as part of the
associated documentation.
2017-04-17 12:04:14 +05:30
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
Oleksandr Byelkin
57a699b0a0 MDEV-8642: WHERE Clause not applied on View - Empty result set returned
An attempt to mark reference as dependent lead to transfering this property to
original view field and through it to other references of this field which
can't be dependent.
2017-04-05 20:46:19 +02:00
Marko Mäkelä
8e36216a06 Import two ALTER TABLE…ALGORITHM=INPLACE tests from MySQL 5.6.
Also, revert part of MDEV-7685 that added an InnoDB abort when
ALTER TABLE…ALGORITHM=INPLACE is reporting that it ran out of
file space.
2017-04-05 14:46:35 +03: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ä
c51fc679f5 Merge 5.5 into 10.0 2017-03-24 18:19:15 +02: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
0d622bed4f Merge branch '5.5' into 10.0 2017-03-21 11:35:50 +01:00
Marko Mäkelä
4c35dce296 Clean up the test mentioned in MDEV-12052.
The test is not expected to crash. With a non-debug server,
Valgrind completes in reasonable time without any failure.

Also, it does not make sense to store and restore parameters
when the parameters are already being restored by a server restart.
2017-03-18 22:50:14 +02: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
Bharathy Satish
70766bec91 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.
2017-03-17 08:41:31 +01: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
Vicențiu Ciorbaru
06f1f1aa6e Make ELOOP be considered a File Not Found error when it comes from handlerton
Fix symlink-aria && symlink-myisam to account for this possibility.
2017-03-14 00:25:26 +02: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
Ramil Kalimullin
2531c8dcd1 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.
2017-03-10 01:19:50 +04:00
Vicențiu Ciorbaru
1d47bd61d5 Remove leftover merge conflict marker 2017-03-09 16:52:57 +02:00
Marko Mäkelä
e1e04c3d68 Correct a merge error. 2017-03-08 14:40:02 +02:00
Marko Mäkelä
47396ddea9 Merge 5.5 into 10.0
Also, implement MDEV-11027 a little differently from 5.5:

recv_sys_t::report(ib_time_t): Determine whether progress should
be reported.

recv_apply_hashed_log_recs(): Rename the parameter to last_batch.
2017-03-08 11:40:43 +02:00
Vicențiu Ciorbaru
c4f3e64c23 Merge branch 'bb-10.0-vicentiu' into 10.0 2017-03-06 21:50:42 +02:00
Vicențiu Ciorbaru
97041acf7f Fix tokudb.gap_lock_error test
TokuDB testsuite makes use of includes not found in our default 10.0.
Cherry pick them from Percona Server's include directory.
2017-03-05 15:18:26 +02:00
Elena Stepanova
4c3b732d9f Updated list of unstable tests for 10.0.30 release 2017-03-05 12:26:32 +02: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
Vicențiu Ciorbaru
5d0c123007 Add missing sys_var test for innodb_stats_include_delete_marked 2017-03-05 01:00:21 +02:00
Vicențiu Ciorbaru
606a4a4847 Post MDEV-11902 Fix test failures in maria and myisam storage engines
my_readline can fail due to missing file. Make my_readline report this
condition separately so that we can catch it and report an appropriate
error message to the user.
2017-03-03 20:12:48 +02:00
Vicențiu Ciorbaru
1acfa942ed Merge branch '5.5' into 10.0 2017-03-03 01:37:54 +02:00
Sergey Vojtovich
71f53bf72d MDEV-11221 - main.events_restart failed in bb
This is an addition to original fix. Buildbot revealed another sporadic failure
in perfschema.threads_mysql test. Tests relies on data stored in
performance_schema.threads, while performing waits on
information_schema.processlist. These tables are not updated synchronously.

Fixed by performing waits on performance_schema.threads instead.
2017-03-02 12:35:31 +04: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
Sergei Golubchik
370cf70136 MDEV-11757 KEY_BLOCK_SIZE strangeness when UNCOMPRESSing COMPRESSed InnoDB tables
in ALTER TABLE ... DROP KEY, ADD KEY, don't forget to compare old
and new keys' block sizes. If they differ - the key definition has changed.
2017-02-28 16:19:44 +01:00
iangilfillan
ce903428a8 Update MariaDB Foundation sponsors 2017-02-28 17:15:36 +04:00
Sujatha Sivakumar
e619295e1b Bug#24901077: RESET SLAVE ALL DOES NOT ALWAYS RESET SLAVE
Description:
============
If you have a relay log index file that has ended up with
some relay log files that do not exists, then RESET SLAVE
ALL is not enough to get back to a clean state.

Analysis:
=========
In the bug scenario slave server is in stopped state and
some of the relay logs got deleted but the relay log index
file is not updated.

During slave server restart replication initialization fails
as some of the required relay logs are missing. User
executes RESET SLAVE/RESET SLAVE ALL command to start a
clean slave. As per the documentation RESET SLAVE command
clears the master info and relay log info repositories,
deletes all the relay log files, and starts a new relay log
file. But in a scenario where the slave server's
Relay_log_info object is not initialized slave will not
purge the existing relay logs. Hence the index file still
remains in a bad state. Users will not be able to start
the slave unless these files are cleared.

Fix:
===
RESET SLAVE/RESET SLAVE ALL commands should do the cleanup
even in a scenario where Relay_log_info object
initialization failed.

Backported a flag named 'error_on_rli_init_info' which is
required to identify slave's Relay_log_info object
initialization failure. This flag exists in MySQL-5.6
onwards as part of BUG#14021292 fix.

During RESET SLAVE/RESET SLAVE ALL execution this flag
indicates the Relay_log_info initialization failure.
In such a case open the relay log index/relay log files
and do the required clean up.
2017-02-28 10:00:51 +05:30
Daniel Black
b54566d73b MDEV-11619: mtr --mem {no argument of a directory} (#320)
This removes functionality of where ./mtr --mem /tmp/dir could be a directory.

Now MTR_MEM=/tmp/dir ./mtr is needed.

The case where MTR_MEM=/tmp/dir ./mtr --mem has the equivalent effect.

Signed-off-by: Daniel Black <daniel.black@au.ibm.com>

--mem works better as a pure flag, because it can be followed by command-line arguments (test names). If the option is allowed to have a value, the test name which directly follows it will be treated as the option value instead. It is possible to implement workarounds to avoid this, but they would not be completely reliable, and there is no practical purpose of such extension of functionality to justify them.
2017-02-28 01:08:12 +02: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
Sergei Golubchik
199f88cb9c MDEV-5999 MySQL Bug#12766319 - 61865: RENAME USER DOES NOT WORK CORRECTLY - REQUIRES FLUSH PRIVILEGES
use update_hostname() to update the hostname.
test case comes from

  commit 0abdeed1d6d
  Author: gopal.shankar@oracle.com <>
  Date:   Thu Mar 29 00:20:54 2012 +0530

    Bug#12766319 - 61865: RENAME USER DOES NOT WORK CORRECTLY -
                          REQUIRES FLUSH PRIVILEGES
2017-02-27 12:35:10 +01:00
Dmitry Lenev
494a94158a Fix for bug#11759114 - '51401: GRANT TREATS NONEXISTENT
FUNCTIONS/PRIVILEGES DIFFERENTLY'.

The problem was that attempt to grant EXECUTE or ALTER
ROUTINE privilege on stored procedure which didn't exist
succeed instead of returning an appropriate error like
it happens in similar situation for stored functions or
tables.

The code which handles granting of privileges on individual
routine calls sp_exist_routines() function to check if routine
exists and assumes that the 3rd parameter of the latter
specifies whether it should check for existence of stored
procedure or function. In practice, this parameter had
completely different meaning and, as result, this check was
not done properly for stored procedures.

This fix addresses this problem by bringing sp_exist_routines()
signature and code in line with expectation of its caller.
2017-02-27 12:35:10 +01:00
Sergei Golubchik
44534487d4 MDEV-11505 wrong databasename in mysqldump comment
fix_for_comment() uses a static buffer. cannot have two
fix_for_comment() calls as arguments to one printf().
2017-02-27 12:35:10 +01:00
Sergei Golubchik
b27fd90ad3 MDEV-11902 mi_open race condition
TOCTOU bug. The path is checked to be valid, symlinks are resolved.
Then the resolved path is opened. Between the check and the open,
there's a window when one can replace some path component with a
symlink, bypassing validity checks.

Fix: after we resolved all symlinks in the path, don't allow open()
to resolve symlinks, there should be none.

Compared to the old MyISAM/Aria code:
* fastpath. Opening of not-symlinked files is just one open(),
  no fn_format() and lstat() anymore.
* opening of symlinked tables doesn't do fn_format() and lstat() either.
  it also doesn't to realpath() (which was lstat-ing every path
  component), instead if opens every path component with O_PATH.
* share->data_file_name stores realpath(path) not readlink(path). So,
  SHOW CREATE TABLE needs to do lstat/readlink() now (see ::info()),
  and certain error messages (cannot open file "XXX") show the real
  file path with all symlinks resolved.
2017-02-27 12:35:10 +01:00
Sergei Golubchik
8897b50dca MDEV-11525 Assertion `cp + len <= buff + buff_size' failed in JOIN_CACHE::write_record_data
Workaround for join_cache + index on vcols + keyread bug.
Initialize the record to avoid caching garbage in non-read fields.

A proper fix (do not cache non-read fields at all) is done in 10.2
in commits 5d7607f340f..8d99166c697
2017-02-27 12:35:10 +01:00
Oleksandr Byelkin
e5b877ce27 MDEV-11935: Queries in stored procedures with and EXISTS(SELECT * FROM VIEW) crashes and closes hte conneciton.
Use correct start point even for taken out from subselect items in process of exists2in conversion.
2017-02-27 10:12:17 +01:00
Alexey Botchkov
fdeeab01c0 MDEV-6390 CONVERT TO CHARACTER SET utf8 doesn't change DEFAULT CHARSET.
ALTER_CONVERT flag removed and replaced for ALTER_OPTIONS
        for the CONVERT TO CHARACTER SET command.
2017-02-26 23:01:23 +04:00
Igor Babaev
ac78927aef Fixed bug mdev-7992.
'Not exists' optimization can be used for nested outer joins
only if IS NULL predicate from the WHERE condition is activated.
So we have to check that all guards that wrap this predicate
are in the 'open' state.
This patch supports usage of 'Not exists' optimization for any
outer join, no matter how it's nested in other outer joins.

This patch is also considered as a proper fix for bugs
#49322/#58490 and LP #817360.
2017-02-24 09:40:53 -08:00
Arun Kuruvila
18b3aa1123 Bug#25608828: I_MAIN.VARIABLES-BUG21503595 FAILS
SPORADICALLY ON PB2-5.5 FOR LINUX-VALGRIND

Description: Sporadic failure of variables-bug21503595 test
on pb2-5.5 for linux-valgrind platform.

Fix: This is a issue related to libc and not related to
MySQL code. During dlclose few blocks of memory left
unfreed. This is a known issue in libc and needs to be
suppressed.

Fix: Added a valgrind suppression.
2017-02-24 16:04:34 +05:30
Dyre Tjeldvoll
7849a27cfb Bug#25514146: DB_NAME IS IGNORED WHEN CREATING TABLE WITH DATA DIRECTORY
Problem: CREATE TABLE using a fully qualified name with INDEX DIR/DATA DIR
option reports an error when the current database is not SET.

check_access() was incorrectly called with NULL as the database
argument in a situation where the database name was not needed for
the particular privilege being checked. This will cause the current
database to be used, or an error to be reported if there is no current
database.

Fix: Call check_access() with any_db as the database argument in this situation.
2017-02-23 14:48:25 +01:00
Elena Stepanova
ae142c21a5 MDEV-12106 Valgrind tests fail all over in buildbot on 10.0
(with blocks are still reachable).
There was a similar suppression already, but it had an extra line
comparing to failures which we are getting, so it wasn't applied.
Added another variant of the suppression.
2017-02-23 14:32:43 +02:00
Sachin Setiya
32591b750f MDEV-11718 5.5 rpl and federated tests massively fail in buildbot with valgrind
Problem:- When MariaDB is compiled with jemalloc support, And we run mtr valgrind
test, valgrind interferes with libjemalloc and returns false errors.

Solution:- Run valgrind with --soname-synonyms=somalloc=libjemalloc* or
--soname-synonyms=somalloc=NONE depending on whether we are dynamically
linking or statically linking.

Signed-off-by: Sachin Setiya <sachin.setiya@mariadb.com>
2017-02-22 11:40:01 +05:30
Alexey Botchkov
cf673adee2 MDEV-10418 Assertion `m_extra_cache' failed in
ha_partition::late_extra_cache(uint).

        m_extra_prepare_for_update should be cleaned in
        ha_partition::reset()
2017-02-22 01:36:16 +04:00
Oleksandr Byelkin
5ddfcb05ca MDEV-9455: [ERROR] mysqld got signal 11
Switch MEM_ROOT to non-prune_partitions() during optimizing subselect.
2017-02-20 15:49:38 +01:00
Marko Mäkelä
72994d6442 Revert the MDEV-4396 tweak to innodb.innodb_bug14676111.
MDEV-11802 aims to fix the root cause instead.
2017-02-20 12:20:52 +02:00
Elena Stepanova
343ba58562 MDEV-10631 rpl.rpl_mdev6386 failed in buildbot
The failure happens due to a race condition between processing
a row event (INSERT) and an automatically generated event
DROP TEMPORARY TABLE. Even though DROP has a higher GTID, it can
become visible in @@gtid_slave_pos before the row event with
a lower GTID has been committed. Since the test makes the slave
to synchronize with the master using GTID, the waiting stops
as soon as GTID of the DROP TEMPORARY TABLE becomes visible,
and if changes from the previous event haven't been applied yet,
the error occurs.

According to Kristian (see the comment to MDEV-10631), the real
problem is that DROP TEMPORARY TABLE is logged in the row mode
at all. For this particular test, since DROP does not do anything,
nothing prevents it from competing with the prior transaction.

The workaround for the test is to add a meaningful event
after DROP TEMPORARY TABLE, so that the slave would wait on its
GTID instead of the one from DROP.

Additionally (unrelated to this problem) removed FLUSH TABLES,
which, as the comment stated, should have been removed after
MDEV-6403 was fixed.
2017-02-20 01:48:26 +02:00
Elena Stepanova
72a822f2ec MDEV-11766 Tests failed in buildbot with semaphore waiting warnings
The standalone warning is not a sign of a problem, just of slowness,
so it should be added to global suppressions. If a real problem
happens, there will be other errors
2017-02-20 01:48:11 +02:00
Daniel Black
5e42c958a5 MDEV-11619: mtr --mem and $MTR_MEM support in sane and consistent manner (10.0) (#289)
* Revert "Make --mem a pure flag. If there is need to specifically set the location"

This reverts commit 716621db3f.

* MDEV-11619: mtr: when --mem is pure flag, conflicts with $MTR_MEM

Conflicts occurs when MTR_MEM=/xxx/yy ./mtr --mem is invoked. Here
the --mem option overrides opt_mem leaving the default path to be chosen.

This change makes when MTR_MEM set, opt_mem, the flag, is also
set. Both the environment and flag can no be set without conflicting.

Signed-off-by: Daniel Black <daniel.black@au.ibm.com>

* MDEV-11619: if opt_mem is a path include it first

* MDEV-11619: MTR_MEM locations - don't follow symlinks

From Bjorn Munch it seems symlinks can confuse some
tests. Lets just avoid those.

(ref: https://github.com/mysql/mysql-server/pull/116#issuecomment-268479774)

Signed-off-by: Daniel Black <daniel.black@au.ibm.com>
2017-02-20 01:43:42 +02:00
Elena Stepanova
6364adb199 MDEV-10621 parts.partition_float_myisam failed with timeout in buildbot
parts.partition_float_myisam, parts.partition_int_myisam,
parts.partition_float_innodb are all known to fail with timeouts
on slow builders. The tests are composed of several independent parts
for corresponding subtypes (float == float + double,
int == tinyint + smallint + mediumint + int + bigint). The solution
is to split them into separate tests. No test logic has been changed.
2017-02-18 20:42:46 +02:00
Igor Babaev
f49375fddf Fixed bug mdev-9028.
This patch is actually a complement for the fix of bug mdev-6892.
The procedure create_tmp_table() now must take into account
Item_direct_refs that wrap up constant fields of derived tables/views
that are used as inner tables in outer join operations.
2017-02-16 23:44:54 -08:00
Elena Stepanova
b70cd26d73 MDEV-11668 rpl.rpl_heartbeat_basic fails sporadically in buildbot
On a slow builder, a delay between binlog events on master could
occur, which would cause a heartbeat which is not expected by the
test. The solution is to monitor the timing of binlog events
on the master and only perform the heartbeat check if no critical
delays have happened.

Additionally, an unused variable was removed (this change is
unrelated to the bugfix).
2017-02-17 00:57:24 +02:00
Nirbhay Choubey
2e8fa1c2b2 MDEV-12058: MariaDB Test Suite issue with test sys_vars.secure_file_priv.test
Try to remove bug50373.txt before using it in SELECT .. OUTFILE
(in case its a leftover from previous test runs).
2017-02-13 17:29:32 -05:00
Marko Mäkelä
f162704570 Rewrite the innodb.log_file_size test with DBUG_EXECUTE_IF.
Remove the debug parameter innodb_force_recovery_crash that was
introduced into MySQL 5.6 by me in WL#6494 which allowed InnoDB
to resize the redo log on startup.

Let innodb.log_file_size actually start up the server, but ensure
that the InnoDB storage engine refuses to start up in each of the
scenarios.
2017-02-05 17:07:16 +02:00
Marko Mäkelä
20e8347447 MDEV-11985 Make innodb_read_only shutdown more robust
If InnoDB is started in innodb_read_only mode such that
recovered incomplete transactions exist at startup
(but the redo logs are clean), an assertion will fail at shutdown,
because there would exist some non-prepared transactions.

logs_empty_and_mark_files_at_shutdown(): Do not wait for incomplete
transactions to finish if innodb_read_only or innodb_force_recovery>=3.
Wait for purge to finish in only one place.

trx_sys_close(): Relax the assertion that would fail first.

trx_free_prepared(): Also free recovered TRX_STATE_ACTIVE transactions
if innodb_read_only or innodb_force_recovery>=3.
2017-02-04 17:33:19 +02:00
Marko Mäkelä
e174d923d9 innodb.innodb-get-fk: Actually test --innodb-read-only. 2017-02-03 19:33:09 +02:00
Elena Stepanova
1d725c8176 Flush suppressions table to prevent corruption when server is killed 2017-02-01 02:16:01 +02:00
Elena Stepanova
b3dac63f9b Produce better diagnostics when backtrace attempt fails 2017-02-01 02:14:37 +02:00
Elena Stepanova
c46d140961 MDEV-11764 perfschema.table_name fails in buildbot
There is only one select that returns a result set in this test.
It needs to be sorted
2017-02-01 02:12:35 +02:00
Nirbhay Choubey
f7e03d4419 MDEV-4774: Fix test case 2017-01-30 18:35:26 -05:00
Marko Mäkelä
4e82aaab2f Clean up a few tests that kill the server.
As noted in MDEV-8841, any test that kills the server must issue
FLUSH TABLES, so that tables of crash-unsafe storage engines will
not be corrupted. Consistently issue this statement after any
call mtr.add_suppression() calls.

Also, do not invoke shutdown_server directly, but use helpers instead.
2017-01-27 16:03:56 +02:00
Marko Mäkelä
ea9caea87e MDEV-11814 test fix
Do not kill the server after call mtr.add_suppression(), because
the procedure modifies a crash-unsafe table, and we do not want to
corrupt that table.
2017-01-27 12:17:03 +02:00
Marko Mäkelä
732672c304 MDEV-11233 CREATE FULLTEXT INDEX with a token longer than 127 bytes
crashes server

This bug is the result of merging the Oracle MySQL follow-up fix
BUG#22963169 MYSQL CRASHES ON CREATE FULLTEXT INDEX
without merging the base bug fix:
Bug#79475 Insert a token of 84 4-bytes chars into fts index causes
server crash.

Unlike the above mentioned fixes in MySQL, our fix will not change
the storage format of fulltext indexes in InnoDB or XtraDB
when a character encoding with mbmaxlen=2 or mbmaxlen=3
and the length of a word is between 128 and 84*mbmaxlen bytes.
The Oracle fix would allocate 2 length bytes for these cases.

Compatibility with other MySQL and MariaDB releases is ensured by
persisting the used maximum length in the SYS_COLUMNS table in the
InnoDB data dictionary.

This fix also removes some unnecessary strcmp() calls when checking
for the legacy default collation my_charset_latin1
(my_charset_latin1.name=="latin1_swedish_ci").

fts_create_one_index_table(): Store the actual length in bytes.
This metadata will be written to the SYS_COLUMNS table.

fts_zip_initialize(): Initialize only the first byte of the buffer.
Actually the code should not even care about this first byte, because
the length is set as 0.

FTX_MAX_WORD_LEN: Define as HA_FT_MAXCHARLEN * 4 aka 336 bytes,
not as 254 bytes.

row_merge_create_fts_sort_index(): Set the actual maximum length of the
column in bytes, similar to fts_create_one_index_table().

row_merge_fts_doc_tokenize(): Remove the redundant parameter word_dtype.
Use the actual maximum length of the column. Calculate the extra_size
in the same way as row_merge_buf_encode() does.
2017-01-27 10:19:39 +02:00
Marko Mäkelä
49fe9bad01 MDEV-11814 Refuse innodb_read_only startup if crash recovery is needed
recv_scan_log_recs(): Remember if redo log apply is needed,
even if starting up in innodb_read_only mode.

recv_recovery_from_checkpoint_start_func(): Refuse
innodb_read_only startup if redo log apply is needed.
2017-01-26 13:58:58 +02:00
Igor Babaev
46eef1ede2 Fixed bug mdev-11859.
As the function Item_subselect::fix_fields does it the function
Item_subselect::update_used_tables must ignore UNCACHEABLE_EXPLAIN
when deciding whether the subquery item should be considered as a
constant item.
2017-01-23 19:40:22 -08:00
Sachin Setiya
18ef02b04d MDEV-4774 Strangeness with max_binlog_stmt_cache_size Settings
Problem:- When setting max_binlog_stmt_cache_size=18446744073709547520
from either command line or .cnf file, server fails to start.

Solution:- Added one more function eval_num_suffix_ull , which uses
strtoull to get unsigned ulonglong from string. And getopt_ull calls this
function instead of eval_num_suffix. Also changed previous eval_num_suffix to
eval_num_suffix_ll to remain consistent.
2017-01-20 21:33:36 +05:30
Igor Babaev
f003cc8a35 Fixed bug mdev-8603.
When building different range and index-merge trees the range optimizer
could build an index-merge tree with an index scan containing less ranges
then needed. This index-merge could be chosen as the best. Following this
index-merge the executioner missed some rows in the result set.
The invalid index scan was built due to an inconsistency in the code
back-ported from mysql into 5.3 that fixed mysql bug #11765831:
the code added to key_or() could change shared keys of the second
ored tree. Partially the problem was fixed in the patch for mariadb
bug #823301, but it turned out that only partially.
2017-01-18 11:42:41 -08:00
Sergei Golubchik
6728aae3b3 Merge branch '5.5' into 10.0 2017-01-17 16:22:25 +01:00
Sergei Golubchik
b948b5f7c6 bugfix: Item_func_min_max stored thd internally
It was used for get_datetime_value() and for thd->is_error().

But in fact, get_datetime_value() never used thd argument, because the
cache ptr argument was NULL. And thd->is_error() check was not needed
at that place at all.
2017-01-15 00:12:16 +01:00
Sergei Golubchik
798fcb5416 bugfix: cmp_item_row::alloc_comparators() allocated on the wrong arena
it used current_thd->alloc() and allocated on the thd's execution arena,
not on table->expr_arena.

Remove THD::arena_for_cached_items that is temporarily set in
update_virtual_fields(), and replaces THD arena in get_datetime_value().
Instead set THD arena to table->expr_arena for the whole  duration
of update_virtual_fields()
2017-01-15 00:11:50 +01:00
Sergei Golubchik
67e2028161 MDEV-9690 concurrent queries with virtual columns crash in temporal code
Item_func_le included Arg_comparator. Arg_comparator remembered
the current_thd during fix_fields and used that value during
execution to allocate Item_cache in get_datetime_value().
But for vcols fix_fields and val_int can happen in different threads.

Same bug for Item_func_in using in_datetime or cmp_item_datetime,
both also remembered current_thd at fix_fields() to use it later
for get_datetime_value().

As a fix, these objects no longer remember the current_thd,
and get_datetime_value() uses current_thd at run time. This
should not increase the number of current_thd calls much, as
Item_cache is created only once anyway.
2017-01-15 00:11:02 +01:00
Vicențiu Ciorbaru
66744f4540 Merge branch '5.5' into 10.0 2017-01-14 19:59:34 +02:00
Sergei Golubchik
20ca1bcf4b MDEV-11527 Virtual columns do not get along well with NO_ZERO_DATE
don't check defaults for vcols
2017-01-12 13:54:21 +01:00
Vicențiu Ciorbaru
4f53384678 Merge branch 'bb-10.0-vicentiu' into 10.0
Extra merge commit due to intermediate commits pushed to 10.0 while
merge was done.
2017-01-12 03:37:35 +02:00
Vicențiu Ciorbaru
1c5ca7c183 Merge branch '5.5' into 10.0 2017-01-12 03:37:13 +02:00
Sergei Golubchik
0d1d0d77f2 MDEV-11706 Assertion `is_stat_field || !table || (!table->write_set || bitmap_is_set(table->write_set, field_index) || (table->vcol_set && bitmap_is_set(table->vcol_set, field_index)))' failed in Field_time::store_TIME_with_warning
vcols and triggers. Revert 094f4cf778,
backport the correct fix (Table_triggers_list::mark_fields_used() not
marking vcols) from 10.2.
2017-01-11 20:24:40 +01:00
Nirbhay Choubey
ab93a4d4df MDEV-11685: sql_mode can't be set with non-ascii connection charset
The supplied sql_mode(s) should be converted to ASCII first,
before comparing it with the sql_mode set.
2017-01-11 09:08:17 -05:00
Elena Stepanova
f516db3500 Updated list of unstable tests for 10.0.29 release 2017-01-11 04:45:47 +02:00
Vicențiu Ciorbaru
d00d46f4ce Merge remote-tracking branch 'origin/5.5' into 10.0 2017-01-10 12:34:51 +02:00
Alexey Botchkov
171e59ed47 MDEV-11548 Reproducible server crash after the 2nd ALTER TABLE ADD FOREIGN KEY IF NOT EXISTS.
Have to use 'keyname' to check the name uniqueness.
2017-01-09 23:37:42 +04:00
Alexander Barkov
3e63fde52e Adding LOAD DATA tests for MDEV-11079 and MDEV-11631
c3cf7f47f0 reverted the patch
for BUG#24487120. After merging the reverting patch from MySQL
to MariaDB the problems described in MDEV-11079 and MDEV-11631 disappeared.
Adding test cases only.
2017-01-09 14:19:02 +04:00
Monty
eed319b6fb MDEV-11317: ! is_set()' or !is_set() || (m_status == DA_OK_BULK && is_bulk_op())' fails in Diagnostics_area::set_ok_status on CREATE OR REPLACE with ARCHIVE table
Problem was with deleting non existing .frm file for a storage engine that
doesn't have .frm files (yet)

Fixed by not giving an error for non existing .frm files for storage engines
that are using discovery
Fixed also valgrind supression related to the given test case
2017-01-08 17:51:36 +02:00
vicentiu
e9aed131ea Merge remote-tracking branch 'origin/5.5' into 10.0 2017-01-06 17:09:59 +02:00
Dmitry Lenev
e4978d26b7 MDEV-9084 Calling a stored function from a nested select from temporary table causes unpredictable behavior
Cherry-pick: f4a0af070ce49abae60040f6f32e1074309c27fb
Author: Dmitry Lenev <dmitry.lenev@oracle.com>
Date:   Mon Jul 25 16:06:52 2016 +0300

  Fix for bug #16672723 "CAN'T FIND TEMPORARY TABLE".

  Attempt to execute prepared CREATE TABLE SELECT statement which used
  temporary table in the subquery in FROM clause and stored function
  failed with unwarranted ER_NO_SUCH_TABLE error. The same happened
  when such statement was used in stored procedure and this procedure
  was re-executed.

  The problem occurred because execution of such prepared statement/its
  re-execution as part of stored procedure incorrectly set
  Query_table_list::query_tables_own_last marker, indicating the last
  table which is directly used by statement. As result temporary table
  used in the subquery was treated as indirectly used/belonging to
  prelocking list and was not pre-opened by open_temporary_tables()
  call before statement execution. Thus causing ER_NO_SUCH_TABLE errors
  since our code assumes that temporary tables need to be correctly
  pre-opened before statement execution.

  This problem became visible only in version 5.6 after patches related to
  bug 11746602/27480 "EXTEND CREATE TEMPORARY TABLES PRIVILEGE TO ALLOW
  TEMP TABLE OPERATIONS" since they have introduced pre-opening of temporary
  tables for statements.

  Incorrect setting of Query_table_list::query_tables_own_last happened
  in LEX::first_lists_tables_same() method which is called by CREATE TABLE
  SELECT implementation as part of LEX::unlink_first_table(), which temporary
  excludes table list element for table being created from the query table
  list before handling SELECT part.

  LEX::first_lists_tables_same() tries to ensure that global table list of
  the statement starts with the first table list element from the first
  statement select. To do this it moves such table list element to the head
  of the global table list. If this table happens to be last directly-used
  table for the statement, query_tables_own_last marker is pointing to it.
  Since this marker was not updated when table list element was moved we
  ended up with all tables except the first table separated by it as if
  they were not directly used by statement (i.e. belonged to prelocked
  tables list).

  This fix changes code of LEX::first_lists_tables_same() to update
  query_tables_own_last marker in cases when it points to the table
  being moved. It is set to the table which precedes table being moved
  in this case.
2017-01-06 10:46:21 +01:00
Elena Stepanova
670b85804c Replication tests fail on valgrind due to waiting-related timeouts
MTR raises default wait_for_pos_timeout from 300 to 1500 when tests
are run with valgrind. The same needs to be done for other
replication-related waits.

The change should fix one of failures mentioned in MDEV-10653
(rpl.rpl_parallel fails in buildbot with timeout), the one
on the valgrind builder; but not all of them
2017-01-06 00:09:50 +02:00
Igor Babaev
ae1b3d1991 Fixed bug mdev-10705.
The fix for bug mdev-5104 did not take into account that
for any call of setup_order the size of ref_array must
be big enough. This patch fixes this problem.
2017-01-05 13:54:31 -08:00
Elena Stepanova
9e528d4fde MDEV-11727 Sequences of tests fail with valgrind warnings in buildbot
The warning is "blocks are still reachable in loss record",
happens in malloc / _dl_close_worker. Suppression added
2017-01-05 17:38:55 +02:00
Elena Stepanova
5302ef2c95 MDEV-11700 funcs_2.innodb_charset fails in buldbot on valgrind builder with timeout
When the test is run as a part of the suite with valgrind,
only allow it to be executed if --big-test is set.
If the test is run by specifying its name explicitly, it
will still be executed, even with valgrind without big-test,
MTR has special logic for that
2017-01-05 17:33:48 +02:00
Elena Stepanova
f1ee011a6c MDEV-11722 main.join_cache fails in buildbot on very slow builders
The guilty part of the test checks for performance degradation on
a query with numerous joins on an empty table. The test expects
the query to take less than 1 second, and fails if it is not so
(which can happen on very slow builders).

The solution is to add more JOINs to the query. On a fixed server,
it should not have any noticeable impact on the query execution,
while on the unfixed version the query would take several times
longer (e.g. 6.5 sec vs 1.5 sec). Thus, we can increase the margin
for the error, and make the test fail when the query takes longer
than 5 seconds.
2017-01-05 17:32:11 +02:00
Elena Stepanova
9bf92706d1 MDEV-8518 rpl.sec_behind_master-5114 fails sporadically in buildbot
- fix the test to avoid false-negatives before MDEV-5114 patch;
- fix the race condition which made the test fail on slow builders
2017-01-04 14:50:10 +02:00
Oleksandr Byelkin
bc4cac358e MDEV-10035: DBUG_ASSERT on CREATE VIEW v1 AS SELECT * FROM t1 FOR UPDATE
Ability to print lock type added.
Restoring correct lock type for CREATE VIEW added.
2017-01-04 13:27:45 +01:00
Elena Stepanova
e5d7fc967e MDEV-10100 main.pool_of_threads fails sporadically in buildbot
Backport the fix to 5.5, because it fails there too

The patch fixes two test failures:
- on slow builders, sometimes a connection attempt which should
  fail due to the exceeded number of thread_pool_max_threads
  actually succeeds;
- on even slow builders, MTR sometimes cannot establish the
  initial connection, and check-testcase fails prior to the
  test start

The problem with check-testcase was caused by connect-timeout=2
which was set for all clients in the test config file. On slow
builders it might be not enough.
There is no way to override it for the pre-test check, so it needed
to be substantially increased or removed.

The other problem was caused by a race condition between sleeps
that the test performs in existing connections and the connect
timeout for the connection attempt which was expected to fail.
If sleeps finished before the connect-timeout was exceeded, it
would allow the connection to succeed.

To solve each problem without making the other one worse,
connect-timeout should be configured dynamically during the test.
Due to the nature of the test (all connections must be busy
at the moment when we need to change the timeout, and cannot execute
SET GLOBAL ...), it needs to be done independently from the server.

The solution:
- recognize 'connect_timeout' as a connection option in mysqltest's
  "connect" command;
- remove connect-timeout from the test configuration file;
- use the new connect_timeout option for those connections which
  are expected to fail;
- re-arrange the test flow to allow running a huge SLEEP
  without affecting the test execution time (because it would be
  interrupted after the main test flow is finished).

The test is still subject to false negatives, e.g. if the connection
fails due to timeout rather than due to the exceeded number of
allowed threads, or if the connection on extra port succeeds due
to a race condition and not because the special logic for the extra
port. But those false negatives have always been possible there
on slow builders, they should not be critical because faster builders
should catch such failures if they appear.

Conflicts:
	client/mysqltest.cc
	mysql-test/r/pool_of_threads.result
	mysql-test/t/pool_of_threads.test
2017-01-04 13:03:30 +02:00
Elena Stepanova
0912fbbce1 MDEV-11719 main.subselect_no_exists_to_in failed in buildbot
main.log_slow might leave mysql.slow_log table non-empty,
and tests which later use it might fail. Make sure that the table
is properly truncated
2017-01-04 03:33:39 +02:00
Horst Hunger
e7a3ccf6b1 Bug#25335897: Modified the year of the date value from 2017 to 2037 in first event. 2017-01-03 09:06:19 +01:00
Elena Stepanova
3871477c40 MDEV-10100 main.pool_of_threads fails sporadically in buildbot
The patch fixes two test failures:
- on slow builders, sometimes a connection attempt which should
  fail due to the exceeded number of thread_pool_max_threads
  actually succeeds;
- on even slow builders, MTR sometimes cannot establish the
  initial connection, and check-testcase fails prior to the
  test start

The problem with check-testcase was caused by connect-timeout=2
which was set for all clients in the test config file. On slow
builders it might be not enough.
There is no way to override it for the pre-test check, so it needed
to be substantially increased or removed.

The other problem was caused by a race condition between sleeps
that the test performs in existing connections and the connect
timeout for the connection attempt which was expected to fail.
If sleeps finished before the connect-timeout was exceeded, it
would allow the connection to succeed.

To solve each problem without making the other one worse,
connect-timeout should be configured dynamically during the test.
Due to the nature of the test (all connections must be busy
at the moment when we need to change the timeout, and cannot execute
SET GLOBAL ...), it needs to be done independently from the server.

The solution:
- recognize 'connect_timeout' as a connection option in mysqltest's
  "connect" command;
- remove connect-timeout from the test configuration file;
- use the new connect_timeout option for those connections which
  are expected to fail;
- re-arrange the test flow to allow running a huge SLEEP
  without affecting the test execution time (because it would be
  interrupted after the main test flow is finished).

The test is still subject to false negatives, e.g. if the connection
fails due to timeout rather than due to the exceeded number of
allowed threads, or if the connection on extra port succeeds due
to a race condition and not because the special logic for the extra
port. But those false negatives have always been possible there
on slow builders, they should not be critical because faster builders
should catch such failures if they appear.
2017-01-01 20:06:03 +02:00
Sachin Setiya
d02a77bc5f MDEV-11636 Extra persistent columns on slave always gets NULL in RBR
Problem:- In replication if slave has extra persistent column then these
column are not computed while applying write-set from master.

Solution:- While applying row events from server, we will generate values
for extra persistent columns.
2017-01-01 16:45:44 +05:30
Elena Stepanova
37f294fec2 Disable the test for valgrind builds
Test is very slow with valgrind, and pointless because it is
initially about a race condition which is hardly achievable
with valgrind
2016-12-27 03:21:13 +02:00
Sergei Golubchik
48655ce698 test case for Bug #23303485 : HANDLE_FATAL_SIGNAL (SIG=11) IN SUBSELECT_UNION_ENGINE::NO_ROWS 2016-12-22 12:49:27 +01:00
Sergei Golubchik
9fefe97336 Merge branch 'mysql/5.5' into 5.5 2016-12-22 12:49:06 +01:00
Varun Gupta
706fb790bc MDEV-10927: Crash When Using sort_union Optimization
In file sql/filesort.cc,when merge_buffers() is called then
- queue_remove(&queue,0) is called
- For the function queue_remove there is assertion states that the element to be removed should have index >=1
- this is causing the assertion to fail.

Fixed by removing the top element.
2016-12-22 15:51:37 +05:30
Alexander Barkov
5e051bfa15 MDEV-10386 Assertion `fixed == 1' failed in virtual String* Item_func_conv_charset::val_str(String*)
The patch b96c196f1c added a new call for
safe_charset_converter() without a corresponding fix_fields().
In case of a sub-query the created Item remained in non-fixed state.
The problem did not show up with literal derived expressions, only
subselects were affected. This patch adds a corresponding fix_fields()
to the previously added safe_charset_converter().
2016-12-21 15:39:45 +04:00
Sergey Vojtovich
ef82fd8ca3 MDEV-11353 - Identical logical conditions
Added test case.
2016-12-20 17:42:08 +04:00
Oleksandr Byelkin
aaff3d6c35 MDEV-10172: UNION query returns incorrect rows outside conditional evaluation
count duplicate of UNION SELECT separately to awoid influence on lokal LIMIT clause.
2016-12-20 11:25:47 +01:00
Sergei Petrunia
f23b41b9b8 MDEV-10148: Database crashes in the query to the View
Fix st_select_lex::is_merged_child_of to work across merged views or
derived tables.
2016-12-19 17:57:43 +03:00
Sergei Petrunia
268bb69bea MDEV-7691: Assertion `outer_context || !*from_field || *from_field == not_found_field' ...
The bug occurred when a subquery
- has a reference to outside, to grand-parent query or further up
- is converted to a semi-join (i.e. merged into its parent).

Then the reference to outside had form Item_ref(Item_field(...)).
- Conversion to semi-join would call item->fix_after_pullout() for the
  outside reference.
- Item_ref::fix_after_pullout would call Item_field->fix_after_pullout
- The Item_field would construct a new Name_resolution_context object
  This process ignored the fact that the Item_field does not belong to
  any of the subselects being flattened.
The result was crash in the next call to Item_field::fix_fields(), where
we would try to use an invalid Name_resolution_context object.

Fixed by not creating Name_resolution_context object if the Item_field's
context does not belong to the subselect(s) that were flattened.
2016-12-19 17:57:43 +03:00
Alexey Botchkov
19896d4b3a MDEV-10274 Bundling insert with create statement for table with unsigned Decimal primary key issues warning 1194.
Flags are important for key_length calculations, so them should
        be set before it, not after.
2016-12-19 16:09:20 +04:00
Alexander Barkov
2f6fede8d5 MDEV-10524 Assertion `arg1_int >= 0' failed in Item_func_additive_op::result_precision()
This change is a backport from 10.0 to 5.5 for:
1. The full patch for:
     MDEV-4841 Wrong character set of ADDTIME() and DATE_ADD()
     9adb6e991e

2. A small fragment of:
     MDEV-5298 Illegal mix of collations on timestamp
     03f6778d61
   which overrides Item_temporal_hybrid_func::cmp_type(),
   and adds a new line into cache_temporal_4265.result.
2016-12-19 14:28:08 +04:00
Sergei Golubchik
b03b38dd65 cleanup: rpl.rpl_row_mysqlbinlog
some trivial simplifications. drinking the ocean,
one drop at a time
2016-12-17 00:16:15 +01:00
Sergei Golubchik
e86580c3dd MDEV-11552 Queries executed by event scheduler are written to slow log incorrectly or not written at all
because thd->update_server_status() is used to measure the query time
for the slow log (not only to set protocol level flags),
it needs to be called also when the server isn't going to send
anything to the client.
2016-12-17 00:16:15 +01:00
Sreeharsha Ramanavarapu
30a59a8d78 Bug #24595937: INCORRECT BEHAVIOR WHEN LOADING DATA TO VIEW
Issue:
------
While using the LOAD statement to insert data into an
updateable view, the check to verify whether a column
is actually updatable is missing.

Solution for 5.5 and 5.6:
-------------------------
For a view whose column-list in specified in the LOAD
command, this check is not performed. This fix adds the
check.

This is a partial backport of Bug#21097485.

Solution for 5.7 and trunk:
---------------------------
For a view whose column-list is specified in the LOAD
command, this check is already performed. This fix adds the
same check when no column-list is specified.
2016-12-13 16:41:05 +05:30
Elena Stepanova
14e1f32894 Follow-up for 02d153c7b9 (str2decimal: don't return a negative zero) 2016-12-11 00:50:00 +02:00
Vicențiu Ciorbaru
eb4f2e063c MDEV-11533: Roles with trailing white spaces are not cleared correctly
Role names with trailing whitespaces are truncated in length as of
956e92d908 to fix MDEV-8609. The problem
is that the code that creates role mappings expects the string to be null
terminated.

Add the null terminator to account for that as well. In the future
the rest of the code can be cleaned up to never assume c style strings
but only LEX_STRINGS.
2016-12-10 22:23:25 +02:00
Sergei Golubchik
3e8155c637 Merge branch '5.5' into 10.0 2016-12-09 16:33:48 +01:00
Sergei Golubchik
03dabfa84d MDEV-10713: signal 11 error on multi-table update - crash in handler::increment_statistics or in make_select or assertion failure pfs_thread == ((PFS_thread*) pthread_getspecific((THR_PFS)))
Different fix. Don't allow Item_func_sp to be evaluated unless
all tables are prelocked.

Extend the test case to make sure Item_func_sp::val_str is called
(the table must have at least one row for that).
2016-12-08 23:19:55 +01:00
Varun Gupta
106664f8e8 MDEV-11162 Assertion `num_records == m_idx_array.size()' failed in Filesort_buffer::alloc_sort_buffer(uint, uint)
Updating result for the group_by_innodb.test
2016-12-08 02:03:34 +05:30
Varun Gupta
822fb79799 MDEV-11162 Assertion `num_records == m_idx_array.size()' failed in Filesort_buffer::alloc_sort_buffer(uint, uint)
When JOIN::destroy() is called for a JOIN object that has
   - join->tmp_join != NULL
   - also has join->table[0]->sort

then the latter was not cleaned up.
This could cause a memory leak and/or asserts in the subsequent queries.

Fixed by adding a cleanup call.
2016-12-08 00:25:48 +05:30
Alexander Barkov
c32d3e16f3 MDEV-10787 Assertion `ltime->neg == 0' failed in void date_to_datetime(MYSQL_TIME*) 2016-12-07 18:05:13 +04:00
Alexey Botchkov
1d702ff07c MDEV-8329 MariaDB crashes when replicate_wild_ignore_table is set to NULL.
Rpl_filter::parse_filter_rule() made NULL-safe.
2016-12-07 14:42:08 +04:00
Oleksandr Byelkin
d67ef7a2fb MDEV-10663: Use of Inline table columns in HAVING clause throws 1463 Error
check for VIEW/DERIVED fields
2016-12-06 19:34:25 +01:00
Oleksandr Byelkin
035a5ac62a MDEV-10713: signal 11 error on multi-table update - crash in handler::increment_statistics or in make_select or assertion failure pfs_thread == ((PFS_thread*) pthread_getspecific((THR_PFS)))
Move expression execution out of Item constructor.
2016-12-06 18:53:46 +01:00
Oleksandr Byelkin
f988bcecfd MDEV-10776: Server crash on query
Exclude untouched in prepare phese subqueries from the select/unit tree
because they became unreachable by execution.
2016-12-06 16:14:56 +01:00
Alexander Barkov
46dee0d184 MDEV-10717 Assertion `!null_value' failed in virtual bool Item::send(Protocol*, String*)
The problem was that null_value was not set to "false" on a well-formed row.
If an ill-formed row was followed by a well-forned row, null_value remained
"true" in the call of Item::send() for the well-formed row.
2016-12-06 06:54:52 +04:00
Sergei Golubchik
02d153c7b9 str2decimal: don't return a negative zero 2016-12-05 10:28:20 +01:00
Pavan Naik
6786caed62 BUG#25147154 : MTR TRIES TO COPY CONTENTS FROM /TMP/DATA
Description :
=============
When a MTR test run is started, it initializes the server and creates
the datadir under '$MYSQL_TEST_DIR/var'('/tmp/var' or '/dev/shm/var'
if --mem option is used) location and then copies it to the datadir
location of server(s).

If $parallel == 1, datadir location of the server is
'$MYSQL_TEST_DIR/var/data'. If $parallel > 1, datadir location of any
server is '$MYSQL_TEST_DIR/var/<thread_num>/data'.

This is the reason MTR searches for the initialized datadir in 2
locations('$opt_vardir' and '$opt_vardir/..') from the current vardir
location..

But this can cause few problems. If a directory with the name 'data'
already exists under '$MYSQL_TEST_DIR' and if the MTR run is started
with parallel value 1, then

1. copytree($install_db, '$opt_vardir/..') command will fail if the
user doesn't have the access permission to '$MYSQL_TEST_DIR/data'
directory.
2. Unnecessary contents from '$MYSQL_TEST_DIR/data' directory will be
copied to server datadir location and this might affect the server
startup.

Fix :
=====
Depending on the $parallel value decide whether the path for the
initialize datadir is "$opt_vardir"(i.e $parallel = 1) or
"$opt_vardir/.."(i.e $parallel > 1).

Reviewed-by: Deepa Dixit <deepa.dixit@oracle.com>
Reviewed-by: Srikanth B R <srikanth.b.r@oracle.com>
RB: 14773
2016-12-05 10:17:40 +05:30
Sergei Golubchik
7f2fd34500 MDEV-11231 Server crashes in check_duplicate_key on CREATE TABLE ... SELECT
be consistent and don't include the table name into the error message,
no other CREATE TABLE error does it.

(the crash happened, because thd->lex->query_tables was NULL)
2016-12-04 01:59:35 +01:00
Sergei Golubchik
c5ef621599 Merge branch 'merge/merge-tokudb-5.6' into 10.0 2016-12-04 01:59:08 +01:00
Sergei Golubchik
e4a0d75a0b import a test case from percona-server-5.6.34-79.1 2016-12-04 01:35:57 +01:00
Sergei Golubchik
4a3acbcfd0 MDEV-11241 Certain combining marks cause MariaDB to crash when doing Full-Text searches
Don't assume that a word of n bytes can match a word of
at most n * charset->mbmaxlen bytes, always go for the worst.
2016-12-03 22:03:38 +01:00
Sergei Golubchik
f640527e65 typo fixed: s/MSYQL/MYSQL/ 2016-12-03 22:02:00 +01:00
Vicențiu Ciorbaru
e99990c631 MDEV-10744: Roles are not fully case sensitive
Due to the collation used on the roles_mapping_hash, key comparison
would work in a case-insensitive manner. This is incorrect from the
roles mapping perspective. Make use of a case-sensitive collation for that hash,
the same one used for the acl_roles hash.
2016-12-01 15:01:33 +01:00
Igor Babaev
748d993cca Fixed bug mdev-11364.
The function Item_func_isnull::update_used_tables() must
handle the case when the predicate is over not nullable
column in a special way.
This is actually a bug of MariaDB 5.3/5.5, but it's probably
hard to demonstrate that it can cause problems there.
2016-11-29 11:29:07 -08:00
Jan Lindström
b209bc3eed MDEV-10427: innodb.innodb-wl5522-debug-zip fails sporadically in buildbot
Test intentionally crashes the server, thus corrupted pages possible.
2016-11-29 09:01:46 +02:00
Alexander Barkov
dd0ff30278 MDEV-11343 LOAD DATA INFILE fails to load data with an escape character followed by a multi-byte character
Partially backporting MDEV-9874 from 10.2 to 10.0

READ_INFO::read_field() raised the ER_INVALID_CHARACTER_STRING error
when reading an escape character followed by a multi-byte character.

Raising wellformedness errors in READ_INFO::read_field() was wrong,
because the main goal of READ_INFO::read_field() is to *unescape* the
data which was presumably escaped using mysql_real_escape_string(),
using the same character set with the one specified in
"LOAD DATA INFILE ... CHARACTER SET ..." (or assumed by default).

During LOAD DATA, multi-byte characters are not always scanned as a single
entity! In case of escaped data, parts of a multi-byte character can be
scanned on different loop iterations. So the old code erroneously tested
welformedness in the middle of a multi-byte character.

Moreover, the data after unescaping can go into a BLOB field, not a text field.
Wellformedness tests are meaningless in this case.

Ater this patch, wellformedness is only checked later, during
Field::store(str,length,cs) time. The loop that scans bytes only
makes sure to revert the changes made by mysql_real_escape_string().

Note, in some cases users can supply data which did not really go through
mysql_real_escape_string() and was escaped by some other means,
or was not escaped at all. The file reported in this MDEV contains
the string "\ä", which is an example of such improperly escaped data, as
- either there should be two backslashes:   "\\ä"
- or there should be no backslashes at all: "ä"
mysql_real_escape_string() could not generate "\ä".
2016-11-29 06:51:12 +04:00
Alexander Barkov
9976223c00 MDEV-11171 Assertion `m_cpp_buf <= ptr && ptr <= m_cpp_buf + m_buf_length' failed in Lex_input_stream::body_utf8_append(const char*, const char*) 2016-11-28 17:28:37 +04:00
Dyre Tjeldvoll
42732cc195 Bug#25092566: CREATE TABLE WITH DATA DIRECTORY CLAUSE DOES NOT REQUIRE SPECIAL
PRIVILEGES

Require FILE privilege when creating tables using external data directory or
index directory.
2016-11-25 14:55:01 +05:30
Dyre Tjeldvoll
e541c41481 Bug#25092566: CREATE TABLE WITH DATA DIRECTORY CLAUSE DOES NOT REQUIRE SPECIAL
PRIVILEGES

Require FILE privilege when creating tables using external data directory or
index directory.
2016-11-24 09:57:54 +01:00
Alexander Barkov
42a398b59b Fixing a typo in the patch for MDEV-10780, which caused default.test failure.
Fixing the "connect" command to use "localhost" instead of "127.0.0.1"
to make it work with both "mtr" and "mtr --embedded".
2016-11-17 12:04:39 +04:00
Kristian Nielsen
9a09072880 Merge branch 'mdev10863' into 10.0 2016-11-15 11:08:01 +01:00
Igor Babaev
96b62b5514 Fixed bug mdev-11161.
The flag TABLE_LIST::fill_me must be reset to false at the prepare
phase for any materialized derived table used in the executed query.
Otherwise if the optimizer decides to generate a key for such a table
it is generated only for the first execution of the query.
2016-11-11 20:55:25 -08:00
Alexander Barkov
1d9b043a1f A join patch for MDEV-10780 and MDEV-11265
MDEV-10780 Server crashes in in create_tmp_table
MDEV-11265 Access defied when CREATE VIIEW v1 AS SELECT DEFAULT(column) FROM t1

Item_default_value and Item_insert_value erroneously derive from Item_field
but forgot to override some methods that apply only to true fields,
so the server code mixes Item_{default|insert}_value instances with real
table fields (i.e. true Item_field) in some cases.
Overriding a few methods to avoid this.

TODO: we should eventually derive Item_default_value (and Item_insert_value)
directly from Item, as they don't really need the entire Item_field,
Item_ident and Item_result_field functionality.
Only the member "Field *field" related functionality is actually needed,
like val_xxx(), is_null(), get_geometry_type(), charset_for_protocol(), etc.
2016-11-10 18:15:36 +04:00
Shipra Jain
2f2103d540 Bug#22874167 : fix for MAIN.LOG_TABLES-BIG UNSTABLE ON LOADED HOSTS 2016-11-09 19:27:35 +01:00
Shipra Jain
b8ec8196c3 Bug#24918325: backport bug11756699 in this patch 2016-11-05 16:52:05 +01:00
Kristian Nielsen
717f212840 MDEV-10863: parallel replication tries to continue from wrong position
This occured when the SQL thread (but not the IO thread) stops while
GTID and parallel replication are used with multiple domain ids in the
GTID position, and is restarted.

In this case, the SQL needs to start some way back in the relay log,
applying or skipping events within each replication domain as
appropriate.

The SQL threads starts at the beginning of an old relay log file, and
this position may be in the middle of an event group. The bug was that
such partial event group could be re-applied, causing replication
corruption.

This patch fixes the issue, by making sure to skip any initial events
that were part of an earlier (already applied) event group.
2016-11-04 12:33:42 +01:00
Thayumanavar S
c3cf7f47f0 BUG#24487120 - SLAVE'S SLAVE_SQL_RUNNING IS STOPPED DURING
LOAD DATA AT MASTER.

Revert "BUG#23080148 - BACKPORT BUG 14653594 AND BUG 20683959 TO"

This reverts commit 1d31f5b3090d129382b50b95512f2f79305715a1.
The commit causes replication incompatibility between minor revisions
and based on discussion with Srinivasarao, the patch is reverted.
2016-10-28 14:45:03 +02:00
Sergei Golubchik
a0795655ab MDEV-10846 Running mysqldump backup twice returns error: Table 'mysql.proc' doesn't exist.
Update test results after 26b87c3
2016-10-27 12:23:31 +02:00
Igor Babaev
d451d772fd Fixed bug mdev-9628.
In the function create_key_parts_for_pseudo_indexes()
the key part structures of pseudo-indexes created for
BLOB fields were set incorrectly.
Also the key parts for long fields must be 'truncated'
up to the maximum length acceptable for key parts.
2016-10-26 20:45:35 -07:00
Igor Babaev
9d4a0dde0a Fixed bug mdev-11096.
1. When min/max value is provided the null flag for it must be set to 0
in the bitmap Culumn_statistics::column_stat_nulls.
2. When the calculation of the selectivity of the range condition
over a column requires min and max values for the column then we
have to check that these values are provided.
2016-10-26 20:45:35 -07:00
Alexey Botchkov
26b87c332f MDEV-10846 Running mysqldump backup twice returns error: Table
'mysql.proc' doesn't exist.

        The mysql_rm_db() doesn't seem to expect the 'mysql' database
        to be deleted. Checks for that added.
        Also fixed the bug MDEV-11105 Table named 'db'
        has weird side effect.
        The db.opt file now removed separately.
2016-10-27 00:04:26 +04:00
Sergei Golubchik
22490a0d70 MDEV-8345 STOP SLAVE should not cause an ERROR to be logged to the error log
cherry-pick from 5.7:
  commit 6b24763
  Author: Manish Kumar <manish.4.kumar@oracle.com>
  Date:   Tue Mar 27 13:10:42 2012 +0530

  BUG#12977988 - ON STOP SLAVE: ERROR READING PACKET FROM SERVER: LOST CONNECTION
                 TO MYSQL SERVER
  BUG#11761457 - ERROR 2013 + "ERROR READING RELAY LOG EVENT" ON STOP SLAVEBUG#12977988 - ON STOP SLAVE: ERROR READING PACKET FROM SERVER: LOST CONNECTION
               TO MYSQL SERVER
2016-10-26 18:44:34 +02:00
Sergei Golubchik
25932708b1 backport include/search_pattern_in_file.inc from 10.1 2016-10-26 18:44:34 +02:00
Jan Lindström
5569ac0059 MDEV-11126: Crash while altering persistent virtual column
Problem was that if old virtual column is computed and stored there
was no check if new column is really virtual column.
2016-10-26 16:46:55 +03:00
Sergey Vojtovich
a3c980b381 MDEV-10824 - Crash in CREATE OR REPLACE TABLE t1 AS SELECT spfunc()
Code flow hit incorrect branch while closing table instances before removal.
This branch expects thread to hold open table instance, whereas CREATE OR
REPLACE doesn't actually hold open table instance.

Before CREATE OR REPLACE TABLE it was impossible to hit this condition in
LTM_PRELOCKED mode, thus the problem didn't expose itself during DROP TABLE
or DROP DATABASE.

Fixed by adjusting condition to take into account LTM_PRELOCKED mode, which can
be set during CREATE OR REPLACE TABLE.
2016-10-26 14:12:02 +04:00
Sergei Golubchik
12c3e16dfa Merge branch '5.5' into 10.0 2016-10-25 16:41:43 +02:00
Elena Stepanova
0c925aa935 MDEV-11097 - Update the list of unstable tests 2016-10-23 18:47:44 +03:00
Kristian Nielsen
998f987eda Upstream MIPS test fixes from Debian Bug 838557.
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=838557

MIPS has a different errno for "directory not empty".
2016-10-21 22:37:51 +02:00
Elena Stepanova
df87be5eda MDEV-11069 main.information_schema test fails if hostname includes 'user'
Patch provided by Honza Horak
2016-10-17 14:04:45 +03:00
Elena Stepanova
4192c46867 MDEV-11061 Valgrind builder produces endless warnings
OpenSSL problems, part II
2016-10-16 04:46:39 +03:00
Elena Stepanova
8a49e00f3f More unstable tests 2016-10-14 23:23:49 +03:00
Elena Stepanova
f6d4f82d6e MDEV-11061 Valgrind builder produces endless warnings after switching to OpenSS 2016-10-14 23:23:16 +03:00
Sergei Golubchik
5a43a31ee8 mysqldump: comments and identifiers with new lines
don't let identifiers with new lines to break a comment
2016-10-14 01:12:04 +02:00
Sergei Golubchik
01b39b7b07 mysqltest: don't eat new lines in --exec
pass them through as is
2016-10-14 01:12:04 +02:00
Sergei Golubchik
383007c75d mysql cli: fix USE command quoting
* use proper sql quoting rules for USE, while preserving
  as much of historical behavior as possible
* short commands (\u) behave as before
2016-10-13 21:38:32 +02:00
Sergei Golubchik
a3f11f7549 Merge branch '5.5' into 10.0 2016-09-29 12:31:46 +02:00
Arun Kuruvila
ac143744a9 Bug#24707666: DEFAULT SETTING FOR SECURE-FILE-PRIV SHOULD BE
RESTRICTED IN ALL GA RELEASES

Back port of WL#6782 to 5.5 and 5.6. This also includes
back port of Bug#20771331, Bug#20741572 and Bug#20770671.
Bug#24695274 and Bug#24679907 are also handled along with
this.
2016-09-28 15:52:05 +05:30
Sergei Golubchik
e3124a8cd7 5.6.33 2016-09-27 17:57:28 +02:00
Vladislav Vaintroub
b38d3c3d8a MDEV-10907 MTR and server writes can interleave in the error log
Ensure atomic appends to the error log by using CreateFile with
FILE_APPEND_DATA flag to open error log file (both MTR and server)
2016-09-27 12:34:15 +00:00
Sergei Golubchik
77ce4ead81 Merge branch '5.5' into 10.0 2016-09-27 09:21:19 +02:00
Sergei Golubchik
d61e5260fb MDEV-10441 Document the server_audit_loc_info variable
fix PLUGIN_VAR_NOSYSVAR | PLUGIN_VAR_NOCMDOPT plugin thdvars to work.
use that for server_audit_loc_info
2016-09-26 17:48:08 +02:00
Vladislav Vaintroub
c91fdb66db Windows , mtr : allow cdb to print core dumps also if --parallel > 1 2016-09-26 13:03:02 +02:00
Sergei Golubchik
677c44f0c3 MDEV-10775 System table in InnoDB format allowed in MariaDB could lead to crash
when opening a system table for a SELECT-like read, pretend
(for the sake of engines) it's SQLCOM_SELECT
2016-09-23 20:27:58 +02:00
iangilfillan
fd0c114c5d Update contributors 2016-09-19 12:31:19 +04:00
Sergei Golubchik
0da39cacee fix BIGINT+MEDIUMINT type aggregation 2016-09-12 16:42:05 +02:00
Sergei Golubchik
a229091953 potential signedness issue
different fix for 07a33cdcef:

Bug #23296299 : HANDLE_FATAL_SIGNAL (SIG=11) IN MY_TOSORT_UTF32
2016-09-12 16:41:54 +02:00
Sergei Golubchik
7ae555c114 Merge branch 'mysql/5.5' into 5.5
80% reverted
2016-09-11 20:51:09 +02:00
Kristian Nielsen
b34d7fba31 Debian bug#837369 - test failures on hppa
ENOTEMPTY is 247 on hppa, not 39 like on Linux, according to this report:

  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=837369

So add another replacement for this to rpl.rpl_drop_db and
binlog.binlog_databasae tests (there were already a couple similar
replacements for other platforms).

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2016-09-11 11:18:27 +02:00
Kristian Nielsen
577f3c1dce 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>
2016-09-10 17:50:32 +02:00
Sergei Petrunia
a14f61ef74 MDEV-7142: main.index_merge_innodb fails sporadically in buildbot
Attempt to stabilize the testcase.
2016-09-05 12:28:35 +03:00
Oleksandr Byelkin
b9631e310b MDEV-8833 Crash of server on prepared statement with conversion to semi-join
Correct context chain made to allow outer fields pullout.
2016-09-02 18:34:37 +02:00
Monty
ee97274ca7 DEV-10595 MariaDB daemon leaks memory with specific query
The issue was that in some extreme cases when doing GROUP BY,
buffers for temporary blobs where not properly cleared.
2016-08-25 09:50:04 +03:00
Elena Stepanova
5bbe929d70 MDEV-10604 Create a list of unstable MTR tests to be disabled in distribution builds
- mysql-test/unstable-tests list is created, it includes
  = tests identified as unstable by Debian;
  = tests which failed in buildbot on 10.0 over the last ~6 months and were not fixed;
  = tests which have been recently modified or newly added
- '*' wildcard is now supported in skip lists
2016-08-24 17:39:57 +03:00
Monty
b51109693e MDEV-10630 rpl.rpl_mdev6020 fails in buildbot with timeout
The issue was that when running with valgrind the wait for master_pos_Wait()
was not long enough.

This patch also fixes two other failures that could affect rpl_mdev6020:
- check_if_conflicting_replication_locks() didn't properly check domains
- 'did_mark_start_commit' was after signals to other threads was sent which could
  get the variable read too early.
2016-08-22 10:16:00 +03:00
Monty
5932fa7890 Fixed "Packets out of order" warning message on stdout in clients,
compiled for debugging, when the server goes down

This happens in the following scenario:
- Server gets a shutdown message
- Servers sends error ER_CONNECTION_KILLED to the clients connection
- The client sends a query to the server, before the server has time to
  close the connection to the client
- Client reads the ER_CONNECTION_KILLED error message

In the above case, the packet number for the reply is one less than
what the client expected and the client prints "Packets out of order".

Fixed the following way:
- The client accepts now error packages with a packet number
  one less than expected.
- To ensure that this issue can be detected early in my_real_read(), error
  messages sent to the client are not compressed, even when compressed protocol is used.
2016-08-21 20:38:47 +03:00
Monty
6f31dd093a Added new status variables to make it easier to debug certain problems:
- Handler_read_retry
- Update_scan
- Delete_scan
2016-08-21 20:18:39 +03:00
Monty
8d5a0d650b Cleanups and minor fixes
- Fixed typos
- Added --core-on-failure to mysql-test-run
- More DBUG_PRINT in viosocket.c
- Don't forget CLIENT_REMEMBER_OPTIONS for compressed slave protocol
- Removed not used stage variables
2016-08-21 20:14:13 +03:00
Sergey Vojtovich
723488bba1 MDEV-10424 - Assertion `ticket == __null' failed in MDL_request::set_type
Reexecution of prepared "ANALYZE TABLE merge_table, table" may miss to
reinitialize "table" for subsequent execution and trigger assertion failure.

This happens because MERGE engine may adjust table->next_global chain, which
gets cleared by close_thread_tables()/ha_myisammrg::detach_children() later.
Since reinitilization iterates next_global chain, it won't see tables following
merge table.

Fixed by appending saved next_global chain after merge children.
2016-08-17 11:12:05 +04:00
Sergei Golubchik
47a1087ff6 Merge branch 'bb-10.0-serg' into 10.0 2016-08-14 09:16:07 +02:00
Jan Lindström
9b23f8054d MDEV-10535: ALTER TABLE causes standalone/wsrep cluster crash
When checking is any of the renamed columns part of the
columns for new indexes we accessed NULL pointer if checked
column used on index was added on same statement. Additionally,
we tried to check too many indexes, added_index_count
is enough here.
2016-08-13 09:27:50 +03:00
Jan Lindström
b3df257cfd MDEV-10469: innodb.innodb-alter-tempfile fails in buildbot: InnoDB: Warning: database page corruption or a failed
Test case intentionally crashes the server and that could lead partially
written pages that are then restored from doublewrite buffer.
2016-08-13 09:27:50 +03:00
Sergei Golubchik
191f7b0fc1 after merge fixes 2016-08-10 21:15:51 +02:00
Sergei Golubchik
309c08c17c Merge branch '5.5' into 10.0 2016-08-10 19:19:05 +02:00
Sergei Golubchik
0098d789c9 MDEV-10465 general_log_file can be abused
Windows!
2016-08-09 13:25:40 +02:00
Sergei Golubchik
a3f642415a MDEV-6128:[PATCH] mysqlcheck wrongly escapes '.' in table names
a correct fix:
* store properly quoted table names in tables4repair/etc lists
* tell handle_request_for_tables whether the name is aalready properly quoted
* test cases for all uses of fix_table_name()
2016-08-08 21:27:30 +02:00
Sergei Golubchik
2a54a530a9 MDEV-10465 general_log_file can be abused
followup
2016-08-08 21:27:30 +02:00
Alexander Barkov
5269d378df MDEV-10468 Assertion `nr >= 0.0' failed in Item_sum_std::val_real() 2016-08-08 18:37:02 +04:00
Alexander Barkov
1b3430a5ae MDEV-10500 CASE/IF Statement returns multiple values and shifts further result values to the next column
We assume all around the code that null_value==true is in sync
with NULL value returned by val_str()/val_decimal().
Item_sum_sum::val_decimal() erroneously returned a non-NULL value together
with null_value set to true. Fixing to return NULL instead.
2016-08-08 16:04:40 +04:00
Sergei Golubchik
5e23b6344f MDEV-10506 Protocol::end_statement(): Assertion `0' failed upon ALTER TABLE
thd->clear_error() destroyed already existing error status
2016-08-07 11:02:42 +02:00
Sergei Petrunia
93d5cdf03f MDEV-9946: main.xtradb_mrr fails sporadically
Make the testcase stable by adding FORCE INDEX
2016-08-04 13:14:45 +03:00
Sergei Golubchik
470f2598cc MDEV-10465 general_log_file can be abused
This issue was discovered by
Dawid Golunski (http://legalhackers.com)
2016-08-03 20:56:24 +02:00
Sergei Golubchik
03dec1aa49 MDEV-10350 "./mtr --report-features" doesn't work
removed
2016-08-03 20:53:04 +02:00
Sergei Golubchik
9d2f892999 MDEV-7329 plugins.pam_cleartext fails sporadically in buildbot
wait until the failed connection thread completely dies
before uninstalling pam plugin
2016-08-03 20:52:58 +02:00
Sergei Golubchik
75891eda11 improve pam_cleartext.test a bit 2016-08-03 20:52:50 +02:00
Sergei Golubchik
a350e53b61 Merge branch 'mysql/5.5' into 5.5
without a fix for Bug#12818255 (MDEV-6581)
2016-08-03 20:38:25 +02:00
Alexander Barkov
ecb7ce7844 MDEV-10467 Assertion `nr >= 0.0' failed in Item_sum_std::val_real()
Backporting MDEV-5781 from 10.0.
2016-08-03 15:55:48 +04:00
Vladislav Vaintroub
6b71a6d2d9 MDEV-10383 Named pipes : multiple servers can listen on the same pipename
Use FILE_FLAG_FIRST_PIPE_INSTANCE with the first CreateNamedPipe()
call to make sure the pipe does not already exist.
2016-08-02 18:52:51 +02:00
Sergey Vojtovich
b5fb2a685b Fixed main.contributors failure 2016-08-02 14:30:21 +04:00
Oleksandr Byelkin
5fdb3cfcd4 MDEV-10419: crash in mariadb 10.1.16-MariaDB-1~trusty
Fixed initialization and usage of THD reference in subselect engines.
2016-07-30 20:13:03 +02:00
Sergei Petrunia
c6aaa2adbe MDEV-10228: update test results 2016-07-30 10:53:01 +03:00
iangilfillan
5d0dfcbecb Update contributors 2016-07-27 15:29:32 +02:00
Sergei Petrunia
15ef38d2ea MDEV-10228: Delete missing rows with OR conditions
Fix get_quick_keys(): When building range tree from a condition
in form

  keypart1=const AND (keypart2 < 0 OR keypart2>=0)

the SEL_ARG for keypart2 represents an interval (-inf, +inf).
However, the logic that sets UNIQUE_RANGE flag fails to recognize
this, and sets UNIQUE_RANGE flag if (keypart1, keypart2) covered
a unique key.
As a result, range access executor assumes the interval can have
at most one row and only reads the first row from it.
2016-07-27 00:38:51 +03:00
Elena Stepanova
df4fddb896 MDEV-10428 main.information_schema_stats fails sporadically in buildbot
Resultsets which contain more than one row need to be sorted
2016-07-25 01:57:00 +03:00
Sreeharsha Ramanavarapu
ac460e584d Bug #23280699: MYSQLD GOT SIGNAL 11 IN IS_NULL ON SELECT
FROM I_S

Issue:
------
There is a difference in the field type created when the
following DDLs are used:

1) CREATE TABLE t0 AS SELECT NULL;
2) CREATE TABLE t0 AS SELECT GREATEST(NULL,NULL);

The first statement creates field of type Field_string and
the second one creates a field of type Field_null.

This creates a problem when the query mentioned in this bug
is used. Since the null_ptr is calculated differently for
Field_null.

Solution:
---------
When there is a function returning null in the select list
as mentioned above, the field should be of type
Field_string.

This was fixed in 5.6+ as part of Bug#14021323. This is a
backport to mysql-5.5.

An incorrect comment in innodb_bug54044.test has been
corrected in all versions.
2016-07-22 07:33:43 +05:30
Sergey Vojtovich
1b5da2ca49 MDEV-10316 - main.type_date fails around midnight sporadically
A better fix for MySQL Bug#41776: use hard timestamp rather than unreliable
sleep.
2016-07-21 15:44:58 +04:00
Alexey Botchkov
bf2e31500c MDEV-8569 build_table_filename() doesn't support temporary tables.
Temporary tables support added for RENAME and ALTER TABLE.
2016-07-18 11:50:08 +04:00
Sergei Golubchik
c6fdb92ca8 Merge branch '5.5' into 10.0 2016-07-12 22:20:46 +02:00
Sergei Golubchik
ef125e232d add a test case vcol.charsets
a test case for a broken vcols behavior with different
charsets. this is fixed in 10.2
2016-07-12 22:18:33 +02:00
Vladislav Vaintroub
3e8ae6ef4f MDEV-10211 postfix - in ssl.test, remove remaining SHOW STATUS LIKE 'Ssl_cipher' 2016-07-12 12:36:11 +02:00
Vladislav Vaintroub
31e763ddc5 MDEV-10211 : fix ssl test not to use specific value of ssl_cipher, as it can change between different openssl/yassl version 2016-07-12 12:21:38 +02:00
Sergei Golubchik
4e19aa3864 MDEV-10318 unset params in --ps --embedded
add a test case
2016-07-12 12:13:31 +02:00
Christopher Powers
6986645c79 Bug#14111584 PB2: PERFSCHEMA.AGGREGATE FAILS ON PB2 SPORADICALLY
Permanently removed test case perfschema.aggregate.

The Performance Schema is generally lock-free, allowing for
race conditions that might arise from multi-threaded operation
which occasionally results in temporary and/or minor variances
when aggregating statistics. This test needs to be redesigned
to accommodate such variances.
2016-06-30 20:42:29 +02:00
Sergey Vojtovich
a7814d44fc MDEV-10311 - funcs_1.processlist_priv_no_prot fails sporadically
State column of SHOW PROCESSLIST can have NULL values for being initialized
threads (between new connection was acknowledged and waiting for network data).

Fixed test case to handle such cases by waiting for State to become empty
string.
2016-06-30 12:59:52 +04:00
Sergey Vojtovich
f289f3ee9c MDEV-9728 - Hard crash in metadata_lock_info
Disable output of MDL lock duration since there is no facility to retreive
it properly.
2016-06-23 12:16:20 +04:00