Commit graph

177635 commits

Author SHA1 Message Date
Oleksandr Byelkin
5cdb3fb25e Merge branch 'merge-tokudb-5.6' into 10.0 2019-01-28 20:15:57 +01:00
Oleksandr Byelkin
724b09d5e7 Version fix after merge 2019-01-28 15:42:16 +01:00
Oleksandr Byelkin
94b68b35f4 Reverting part of da34c7de5d that was already fixed by MDEV-17531 by Marko 2019-01-28 15:39:27 +01:00
Oleksandr Byelkin
959f7415bd Merge branch 'merge-xtradb-5.6' into 10.0 2019-01-28 15:37:01 +01:00
Oleksandr Byelkin
c2197e0cd2 Merge branch 'merge-perfschema-5.6' into 10.0 2019-01-28 13:16:27 +01:00
Oleksandr Byelkin
a3df9bcadc Merge branch '5.5' into 10.0 2019-01-28 10:36:12 +01:00
Jan Lindström
27f1de5cb3
Merge pull request #1139 from tempesta-tech/sysprg/10.1-MDEV-18379
MDEV-18379: Unification of check for IPv6
2019-01-28 09:06:56 +02:00
Sergei Golubchik
2175bfce3e Crude "auto-load-data-local-infile" mode
Disable LOAD DATA LOCAL INFILE suport by default and
auto-enable it for the duration of one query, if the query
string starts with the word "load". In all other cases the application
should enable LOAD DATA LOCAL INFILE support explicitly.
2019-01-27 18:54:12 +01:00
Vicențiu Ciorbaru
21f9037186 MDEV-18360 Prevent set_max_open_files from allocating too many files
If the rlimit.rlim_cur value returned by getrlimit is not the
RLIM_INFINITY magic constant, but a *very* large number, we can allocate
too many open files. Restrict set_max_open_files to only return at most
max_file_limit, as passed via its parameter.
2019-01-27 18:58:48 +02:00
Julius Goryavsky
4aea6b3e3f MDEV-18379: Unification of check for IPv6
This patch contains the port of the MDEV-18379 patch
for 10.1 branch, but also includes a number of changes
made within MDEV-17835, which are necessary for the
normal operation of tests that use IPv6:

1) Fixed flaws in the galera_3nodes mtr suite control scripts,
because of which they could not work with mariabackup.

2) Fixed numerous bugs in the SST scripts and in the mtr test
files (galera_3nodes mtr suite) that prevented the use of Galera
with IPv6 addresses.

3) Fixed flaws in tests for rsync and mysqldump (for galera_3nodes
mtr tests suite). These tests were not performed successfully
without these fixes.

4) Currently, the three-node mtr suite for Galera (galera_3nodes)
uses a separate IPv6 availability check using the "have_ipv6.inc"
file. This check duplicates a more accurate check at suite.pm
level, which can be used by including the file "check_ipv6.inc".
This patch removes this discrepancy between suites.

5) GAL-501 test in the galera_3nodes suite does not contain the
option "--bind-address=::" which is needed for the test to work
correctly with IPv6 (at least on some systems), since without
it the server will not wait for connections on the IPv6 interface.

https://jira.mariadb.org/browse/MDEV-18379
and partially https://jira.mariadb.org/browse/MDEV-17835
2019-01-26 01:15:44 +01:00
Andrei Elkin
ef0b91ea94 MDEV-17803: ulonglongization of table_mapping entry::table_id to fix windows compilation in particular. 2019-01-25 13:42:27 +02:00
Olivier Bertrand
e6fcd72309 Squashed commit of connect/10.0:
commit 6a6a1f37798
Author: Olivier Bertrand <bertrandop@gmail.com>
Date:   Fri Jan 4 12:31:52 2019 +0100

    - Fix a few bug mainly concerning discovery and call from OEM
      (and prepare new table types)

      modified:   storage/connect/tabjson.cpp
      modified:   storage/connect/tabjson.h
      modified:   storage/connect/tabxml.cpp
      modified:   storage/connect/tabxml.h

    - Fix wrong line estimate
      modified:   storage/connect/mysql-test/connect/r/part_table.result
      modified:   storage/connect/mysql-test/connect/t/part_table.test

commit bd7d2e912d9
Author: Olivier Bertrand <bertrandop@gmail.com>
Date:   Tue Dec 4 23:35:09 2018 +0100

    Fix wrong version number

commit 4933680e7ab
Author: Olivier Bertrand <bertrandop@gmail.com>
Date:   Sun Dec 2 00:25:05 2018 +0100

    - Make PlugSubAlloc to be exportable
      Suppress unused parameter from PlugSubSet
      modified:   storage/connect/global.h
      modified:   storage/connect/plugutil.cpp
      modified:   storage/connect/jsonudf.cpp
      modified:   storage/connect/tabjson.cpp
      modified:   storage/connect/user_connect.cc

    - Fix a bug making column catalog XML tables fail
      modified:   storage/connect/tabxml.cpp

    - Comment out wrong message
      modified:   storage/connect/ha_connect.cc

    - Update error message when sorting an ODBC table fails
      modified:   storage/connect/tabodbc.cpp

    - Add error message when gettting an address
      from an OEM fails.
      modified:   storage/connect/reldef.cpp

    - Make some modifications useful for OEM module writting
      Export discovery functions for CSV, JDBC and XML
      Remove unuseful include from tabjson.h
      Move TDBXML::data_charset function from header file to source
      modified:   storage/connect/tabfmt.h
      modified:   storage/connect/tabjson.h
      modified:   storage/connect/tabxml.cpp
      modified:   storage/connect/tabxml.h

    - Update test result
      modified:   storage/connect/mysql-test/connect/r/jdbc_oracle.result
2019-01-25 10:06:16 +01:00
Sergei Golubchik
38ad46e005 cleanup: fill_alter_inplace_info
remove attempts to track "candidate keys", use what was already
decided in create_table_impl().
2019-01-25 10:06:16 +01:00
Sergei Golubchik
013186eb96 compiler warning 2019-01-25 10:06:16 +01:00
Andrei Elkin
5d48ea7d07 MDEV-10963 Fragmented BINLOG query
The problem was originally stated in
  http://bugs.mysql.com/bug.php?id=82212
The size of an base64-encoded Rows_log_event exceeds its
vanilla byte representation in 4/3 times.
When a binlogged event size is about 1GB mysqlbinlog generates
a BINLOG query that can't be send out due to its size.

It is fixed with fragmenting the BINLOG argument C-string into
(approximate) halves when the base64 encoded event is over 1GB size.
The mysqlbinlog in such case puts out

    SET @binlog_fragment_0='base64-encoded-fragment_0';
    SET @binlog_fragment_1='base64-encoded-fragment_1';
    BINLOG @binlog_fragment_0, @binlog_fragment_1;

to represent a big BINLOG.
For prompt memory release BINLOG handler is made to reset the BINLOG argument
user variables in the middle of processing, as if @binlog_fragment_{0,1} = NULL
is assigned.

Notice the 2 fragments are enough, though the client and server still may
need to tweak their @@max_allowed_packet to satisfy to the fragment
size (which they would have to do anyway with greater number of
fragments, should that be desired).

On the lower level the following changes are made:

Log_event::print_base64()
  remains to call encoder and store the encoded data into a cache but
  now *without* doing any formatting. The latter is left for time
  when the cache is copied to an output file (e.g mysqlbinlog output).
  No formatting behavior is also reflected by the change in the meaning
  of the last argument which specifies whether to cache the encoded data.

Rows_log_event::print_helper()
  is made to invoke a specialized fragmented cache-to-file copying function
  which is

copy_cache_to_file_wrapped()
  that takes care of fragmenting also optionally wraps encoded
  strings (fragments) into SQL stanzas.

my_b_copy_to_file()
  is refactored to into my_b_copy_all_to_file(). The former function
  is generalized
  to accepts more a limit argument to constraint the copying and does
  not reinitialize anymore the cache into reading mode.
  The limit does not do any effect on the fully read cache.
2019-01-24 20:44:50 +02:00
Andrei Elkin
f9ac7032cb MDEV-14605 Changes to "ON UPDATE CURRENT_TIMESTAMP" fields are not
always logged properly with binlog_row_image=MINIMAL

There are two issues fixed in this commit.
The first is an observation of a multi-table UPDATE binlogged
in row-format in binlog_row_image=MINIMAL mode. While the UPDATE aims
at a table with an ON-UPDATE attribute its binlog after-image misses
to record also installed default value.
The reason for that turns out missed marking of default-capable fields
in TABLE::write_set.

This is fixed to mark such fields similarly to 10.2's MDEV-10134 patch (db7edfed17)
that introduced it. The marking follows up 93d1e5ce0b841bed's idea
to exploit TABLE:rpl_write_set introduced there though,
and thus does not mess (in 10.1) with the actual MDEV-10134 agenda.
The patch makes formerly arg-less TABLE::mark_default_fields_for_write()
to accept an argument which would be TABLE:rpl_write_set.

The 2nd issue is extra columns in in binlog_row_image=MINIMAL before-image
while merely a packed primary key is enough. The test main.mysqlbinlog_row_minimal
always had a wrong result recorded.
This is fixed to invoke a function that intended for read_set
possible filtering and which is called (supposed to) in all type of MDL, UPDATE
including; the test results have gotten corrected.

At *merging* from 10.1->10.2 the 1st "main" part of the patch is unnecessary
since the bug is not observed in 10.2, so only hunks from

  sql/sql_class.cc

are required.
2019-01-24 20:07:53 +02:00
Oleksandr Byelkin
13802fef83 5.6.42-84.2 2019-01-24 17:31:13 +01:00
Oleksandr Byelkin
3262afc6c5 5.6.42-84.2 2019-01-24 16:48:39 +01:00
Varun Gupta
036ca990ab MDEV-18255: Server crashes in Bitmap<64u>::intersect
Calling st_select_lex::update_used_tables in JOIN::optimize_unflattened_subqueries
only when we are sure that the join have not been cleaned up.
This can happen for a case when we have a non-merged semi-join and an impossible
where which would lead to the cleanup of the join which has the non-merged semi-join
2019-01-24 20:47:46 +05:30
Oleksandr Byelkin
1abdc0e435 5.6.43 2019-01-24 15:47:27 +01:00
Alexander Barkov
17c75bd272 MDEV-18195 ASAN use-after-poison in my_strcasecmp_utf8 / Item::eq upon prepared statement with ORDER BY NAME_CONST
ASAN noticed a freed memory access during EXECUTE in this script:
  PREPARE stmt FROM "SELECT 'x' ORDER BY NAME_CONST( 'f', 'foo' )";
  EXECUTE stmt;

In case of a PREPARE statement, all Items, including Item_name_const,
are created on Prepared_statement::main_mem_root.
Item_name_const::fix_fields() did not take this into account
and could allocate the value of Item::name on a wrong memory root,
in this code:

  if (is_autogenerated_name)
  {
    set_name(thd, item_name->c_ptr(), (uint) item_name->length(),
             system_charset_info);
  }

When fix_fields() is called in the reported SQL script, THD's arena already
points to THD::main_mem_root rather than to Prepared_statement::main_mem_root,
so Item::name was allocated on THD::main_mem_root.
Then, at the end of the dispatch_command() for the PREPARE statement,
THD::main_mem_root got cleared. So during EXECUTE, Item::name
pointed to an already freed memory.

This patch changes the code to set the implicit name for Item_name_const
at the constructor time rather than at fix_fields time. This guarantees
that Item_name_const and its Item::name always reside on the same memory root.

Note, this change makes the code for Item_name_const symmetric with other
constant-alike items that set their default implicit names at the constructor
call time rather than at fix_fields() time:
- Item_string
- Item_int
- Item_real
- Item_decimal
- Item_null
- Item_param
2019-01-24 17:54:29 +04:00
Geoff Montee
f17c284c57 MDEV-18347: mariabackup doesn't read all server option groups from configuration files 2019-01-24 12:44:55 +01:00
Marko Mäkelä
65350042a4 Merge 10.0 into 10.1 2019-01-24 13:24:13 +02:00
Andrei Elkin
ba1ce3aeae MDEV-17803 side effect resulted in table id advance. A test result file is updated. 2019-01-24 12:01:43 +02:00
Sergei Golubchik
edeba0c873 MDEV-17868 mysqltest fails to link with system PCRE libraries
pcre needs symbols from pcreposix
(but this is only an issue when linking with system static libraries)
2019-01-24 10:34:05 +01:00
Thirunarayanan Balathandayuthapani
a0f3b9f94f MDEV-17376 Server fails to set ADD_PK_INDEX, DROP_PK_INDEX if unique index nominated as PK
Problem:
========
Server fails to notify the engine by not setting the ADD_PK_INDEX and
DROP_PK_INDEX When there is a
 i) Change in candidate for primary key.
 ii) New candidate for primary key.

Fix:
====
Server sets the ADD_PK_INDEX and DROP_PK_INDEX while doing alter for the
above problematic case.
2019-01-24 13:52:51 +05:30
Andrei Elkin
b22354680e merge 10.0 -> 10.1 to resolve MDEV-17803 conflicts. 2019-01-23 20:16:21 +02:00
Sergei Golubchik
c2a4bfad22 MDEV-18119 upgrading from 10.3 to 10.4 can result in the password for a user to be wiped out
10.1 part: SHOW CREATE USER didn't show the password, if plugin was set,
but authentication_string was not
2019-01-23 17:34:22 +01:00
Sergei Golubchik
d24060b179 MDEV-17421: mtr does not restart the server whose parameters were changed
remove tests that rely on specific execution order
2019-01-23 17:20:41 +01:00
Sergei Golubchik
7886a70ef9 MDEV-17421: mtr does not restart the server whose parameters were changed
remove tests that rely on specific execution order
2019-01-23 17:18:57 +01:00
Jan Lindström
2d098933ee
Merge pull request #880 from tempesta-tech/sysprg/MDEV-17421
MDEV-17421: mtr does not restart the server whose parameters were changed
2019-01-23 18:03:51 +02:00
Eugene Kosov
ad220b96fb MDEV-16658 Memory leak in mysqltest on connect failure
Close connection handler on connection failure. This fixes 14 failing tests in
main suite under clang+ASAN build.

ASAN report for main.connect looks like this:
=================================================================
==25495==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 146280 byte(s) in 115 object(s) allocated from:
    #0 0x4fba47 in calloc /fun/cpp_projects/llvm_toolchain/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:138
    #1 0x5a7a02 in mysql_init /work/mariadb/libmariadb/libmariadb/mariadb_lib.c:977:26
    #2 0x570a7a in do_connect(st_command*) /work/mariadb/client/mysqltest.cc:6096:26
    #3 0x584c39 in main /work/mariadb/client/mysqltest.cc:9321:9
    #4 0x7fd15514db96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310

Indirect leak of 7065600 byte(s) in 115 object(s) allocated from:
    #0 0x4fb80f in __interceptor_malloc /fun/cpp_projects/llvm_toolchain/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:129
    #1 0x637a83 in my_context_init /work/mariadb/libmariadb/libmariadb/ma_context.c:367:23
    #2 0x59fd16 in mysql_optionsv /work/mariadb/libmariadb/libmariadb/mariadb_lib.c:2738:9
    #3 0x5bc1d4 in mysql_options /work/mariadb/libmariadb/libmariadb/mariadb_lib.c:3242:10
    #4 0x570b94 in do_connect(st_command*) /work/mariadb/client/mysqltest.cc:6103:7
    #5 0x584c39 in main /work/mariadb/client/mysqltest.cc:9321:9
    #6 0x7fd15514db96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310

Indirect leak of 940240 byte(s) in 115 object(s) allocated from:
    #0 0x4fb80f in __interceptor_malloc /fun/cpp_projects/llvm_toolchain/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:129
    #1 0x64386e in ma_init_dynamic_array /work/mariadb/libmariadb/libmariadb/ma_array.c:49:31
    #2 0x649ead in _hash_init /work/mariadb/libmariadb/libmariadb/ma_hash.c:52:7
    #3 0x5a3080 in mysql_optionsv /work/mariadb/libmariadb/libmariadb/mariadb_lib.c:2938:13
    #4 0x5bc20c in mysql_options4 /work/mariadb/libmariadb/libmariadb/mariadb_lib.c:3248:10
    #5 0x56f63b in connect_n_handle_errors(st_command*, st_mysql*, char const*, char const*, char const*, char const*, int, char const*) /work/mariadb/client/mysqltest.cc:5874:3
    #6 0x57146b in do_connect(st_command*) /work/mariadb/client/mysqltest.cc:6193:7
    #7 0x584c39 in main /work/mariadb/client/mysqltest.cc:9321:9
    #8 0x7fd15514db96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
...

Closes #809
2019-01-23 17:00:33 +01:00
Andrei Elkin
cce2b45c8f MDEV-17803 Row-based event is not applied when table map id is greater
32 bit int

Row-based slave applier could not parse correctly the table id when
the value exceeded the max of 32 bit unsigned int.
The reason turns out in that the being parsed value placeholder
was sized as 4 bytes.

The type is fixed to ulonglong.

Additionally the patch works around Rows_log_event::m_table_id 4 bytes
size on 32 bits platforms. In case of last_table_id value overflows
the 4 byte max, there won't be the zero value for m_table_id generated
and the first wrapped-around value is one, this is thanks to excluding
UINT_MAX32 + 1 from TABLE_SHARE::table_map_id.
2019-01-23 15:48:06 +02:00
Marko Mäkelä
3b6d2efcb1 Merge 10.0 into 10.1 2019-01-23 14:34:23 +02:00
Marko Mäkelä
52d13036d8 MDEV-17933 slow server status - dict_sys_get_size()
dict_sys_get_size(): Replace the time-consuming loop with
a crude estimate that can be computed without holding any mutex.

Even before dict_sys->size was removed in MDEV-13325,
not all memory allocations by the InnoDB data dictionary cache
were being accounted for. One example is foreign key constraints.
Another example is virtual column metadata, starting with 10.2.
2019-01-23 13:44:20 +02:00
Sergei Golubchik
949559285e MDEV-18059 support-files/mysql.server.sh stop must run as root
don't run `su - mysql` is $USER is already mysql
2019-01-23 12:39:17 +01:00
Sergei Golubchik
a8da66f8c5 Bug #28499924: INCORRECT BEHAVIOR WITH UNION IN SUBQUERY
test case
2019-01-23 12:39:17 +01:00
Sreeharsha Ramanavarapu
b20d94da35 Bug #28499924: INCORRECT BEHAVIOR WITH UNION IN SUBQUERY
Issue:
------
When a subquery contains UNION the count of the number of
subquery columns is calculated incorrectly. Only the first
query block in the subquery's UNION is considered and an
array indexing goes out-of-bounds, and this is caught by an
assert.

Solution:
---------
Sum up the columns from all query blocks of the query
expression.

Change specific to 5.6/5.5:
---------------------------
The "child" points to the last query block of the UNION
(as opposed to 5.7+ where it points to the first member of
UNION). So "child->master_unit()->first_select()" is used
to reach the first query block of UNION.
2019-01-23 12:39:17 +01:00
Aditya A
6de2928d5b Bug #28178776 COMPARISON OF UNINITAILIZED MEMORY IN LOG_IN_USE
PROBLEM
-------
Memory sanitizer reports uninitialized comparisons
in log_in_use(), because strings are compared with
memcmp() instead of strncmp.

FIX
---
Use strncmp() to compare strings
2019-01-23 12:39:17 +01:00
Sergei Golubchik
2a0f1d6132 Bug#28867993: POSSIBLE ISSUE WITH MYSQL SERVER RESTART
on startup innodb is checking whether files "ib_logfileN"
(for N from 1 to 100) exist, and whether they're readable.
A non-existent file aborted the scan.
A directory instead of a file made InnoDB to fail.

Now it treats "directory exists" as "file doesn't exist".
2019-01-23 12:39:03 +01:00
Marko Mäkelä
31d592ba7d MDEV-18349 InnoDB file size changes are not safe when file system crashes
When InnoDB is invoking posix_fallocate() to extend data files, it
was missing a call to fsync() to update the file system metadata.
If file system recovery is needed, the file size could be incorrect.

When the setting innodb_flush_method=O_DIRECT_NO_FSYNC
that was introduced in MariaDB 10.0.11 (and MySQL 5.6) is enabled,
InnoDB would wrongly skip fsync() after extending files.

Furthermore, the merge commit d8b45b0c00
inadvertently removed XtraDB error checking for posix_fallocate()
which this fix is restoring.

fil_flush(): Add the parameter bool metadata=false to request that
fil_buffering_disabled() be ignored.

fil_extend_space_to_desired_size(): Invoke fil_flush() with the
extra parameter. After successful posix_fallocate(), invoke
os_file_flush(). Note: The bookkeeping for fil_flush() would not be
updated the posix_fallocate() code path, so the "redundant"
fil_flush() should be a no-op.
2019-01-23 12:18:00 +02:00
Marko Mäkelä
942a6bd009 MDEV-18349 InnoDB file size changes are not safe when file system crashes
fil_extend_space_to_desired_size(): Invoke fsync() after posix_fallocate()
in order to durably extend the file in a crash-safe file system.
2019-01-23 09:51:06 +02:00
Sergei Golubchik
9c5be7d131 MDEV-14580: mysql_install_db elements based on dirname of mysql_install_db
Avoid introducing new dependencies or new syntax.
That is, don't use $(...) and don't assume dirname is present.

And remove unsighty /foo/bar/../xyz from the path. Use dirname
instead of ../
2019-01-21 17:30:07 +01:00
Daniel Black
50e593386f MDEV-14580: mysql_install_db elements based on dirname of mysql_install_db
Closes #1086
2019-01-21 17:30:07 +01:00
Sergei Golubchik
0d3c49ef5d MDEV-17615 cmake ssl error on musl/libressl
don't shortcut trying to test for openssl version,
test what is actually needed for a code to compile
2019-01-21 17:30:07 +01:00
Sergei Golubchik
6786fb004c MDEV-15925 FRM_MAX_SIZE too low for some use cases
increase to 1M
2019-01-21 17:14:31 +01:00
Jan Lindström
f9cc956065
Merge pull request #1114 from GeoffMontee/10.1-geoff-MDEV-17973
MDEV-17973: Don't overwrite xtrabackup-v2/mariabackup SST logs by def…
2019-01-21 15:06:48 +02:00
Geoff Montee
2084cd5422 MDEV-17973: Don't overwrite xtrabackup-v2/mariabackup SST logs by default 2019-01-21 05:42:00 -05:00
Vladislav Vaintroub
e292d1a800 Avoid noisy Clang 7 warning about unused variable.
Patch by Eugene Kosov.
2019-01-19 14:01:09 +01:00
Varun Gupta
2061e00c20 MDEV-14440: Assertion `inited==RND' failed in handler::ha_rnd_end
In the function QUICK_RANGE_SELECT::init_ror_merged_scan we create a seperate handler if the handler in
head->file cannot be reused. The flag free_file tells us if we have a seperate handler or not.
There are cases where you might create a handler and then there might be a failure(running ALTER)
and then we have to revert the handler back to the original one. The code does that
but it does not reset the flag 'free_file' in this case.
Also backported f2c418079d.
2019-01-18 23:36:47 +05:30