Commit graph

186890 commits

Author SHA1 Message Date
Vladislav Vaintroub
d22f8c459f MDEV-20432 : add MYSQL_PLUGIN_IMPORT
Mroonga does not build on Windows due to log_10_int being used
(indirectly) and n ot properly decorated with MYSQL_PLUGIN_IMPORT
2019-08-29 18:33:58 +02:00
Vladislav Vaintroub
5bb8945a3a Fix compress_qpress result file, broken in b5615eff0d 2019-08-27 20:46:05 +02:00
Varun Gupta
77e44282ff MDEV-19705: Assertion `tmp >= 0' failed in best_access_path
The reason for hitting the assert is that rec_per_key estimates have some garbage value.
So the solution to fix this would be for long unique keys to use use rec_per_key for only 1 keypart,
that means rec_per_key[0] would have the estimate.
2019-08-27 08:21:55 +05:30
Sergei Golubchik
6afe013cde always build wsrep libraries static
even if -DBUILD_SHARED_LIBS=ON was used
2019-08-26 23:33:42 +02:00
Sergei Golubchik
58bfe9da54 cleanup: SECURITY_HARDENED in CMakeLists.txt 2019-08-26 23:33:42 +02:00
Sergei Golubchik
eb8f7005bd cleanup: remove few #ifdef's 2019-08-26 23:33:42 +02:00
Sergei Golubchik
4af932e899 remove incorrect #ifdef 2019-08-26 23:33:42 +02:00
Alexander Barkov
72c5a8d39b MDEV-20417 Assertion `(m_ptr == __null) == item->null_value' failed in VDec::VDec(Item*) 2019-08-26 23:42:06 +04:00
Sergei Petrunia
4a490d1a99 MDEV-6111: Optimizer Trace: add tracing for semi-join optimizations
Added:
- "semijoin_strategy_choice" element (actions in advance_sj_state(), name
  matches the name in MySQL)

- semijoin_table_pullout element.
2019-08-25 11:04:39 +03:00
Roman Nozdrin
9fce942878 MDEV-19831 find_select_handler() now tries its best to find a
handlerton that is able to processes the whole query. For that it
traverses tables from subqueries.

Select_handler now cleans up temporary table structures on dctor call.
2019-08-24 20:49:15 +03:00
Marko Mäkelä
efb8485d85 Merge 10.3 into 10.4, except for MDEV-20265
The MDEV-20265 commit e746f451d5
introduces DBUG_ASSERT(right_op == r_tbl) in
st_select_lex::add_cross_joined_table(), and that assertion would
fail in several tests that exercise joins. That commit was skipped
in this merge, and a separate fix of MDEV-20265 will be necessary in 10.4.
2019-08-23 08:06:17 +03:00
Alexander Barkov
235cf969d2 MDEV-20397 Support TIMESTAMP, DATETIME, TIME in ROUND() and TRUNCATE() 2019-08-22 15:09:59 +04:00
Aleksey Midenkov
b96e4424fb MDEV-17613 MIN/MAX Optimization (Select tables optimized away) does not work
Current easy fix is not possible, because SELECT clones ha_partition
and then closes the clone which leads to unclosed transaction in
partitions we forcely prune out. We cound solve this by closing these
partitions (and release from transaction) in
change_partitions_to_open() at versioning conditions stage, but this
is problematic because table lock is acquired for each partition at
open stage and therefore must be released when we close partition
handler in change_partitions_to_open(). More details in MDEV-20376.

This should change after MDEV-20250 where mechanism of opening
partitions will be improved.

This reverts commit cdbac54df0.
2019-08-21 16:08:31 +03:00
Marko Mäkelä
32ec5fb979 Merge 10.2 into 10.3 2019-08-21 15:23:45 +03:00
Aleksey Midenkov
e8de75db88 MDEV-19740 Debug build of 10.3.15 FTBFS
Fix debug build failing with error:

extended initializer lists only available with -std=c++11 or -std=gnu++11
2019-08-21 11:38:39 +03:00
Marko Mäkelä
9de2e60d74 MDEV-17187 table doesn't exist in engine after ALTER of FOREIGN KEY
ha_innobase::open(): Always ignore problems with FOREIGN KEY constraints
(pass DICT_ERR_IGNORE_FK_NOKEY), no matter whether foreign_key_checks
is enabled. Instead, we must report errors when enforcing the FOREIGN KEY
constraints. As a result of ignoring these errors, the tables will be
loaded with dict_foreign_t objects whose foreign_index or referenced_index
will be NULL.

Also, pass DICT_ERR_IGNORE_FK_NOKEY instead of DICT_ERR_IGNORE_NONE
to dict_table_open_on_id_low() in many other cases. Notably, on
CREATE TABLE and ALTER TABLE, we will keep validating the FOREIGN KEY
constraints as before.

dict_table_open_on_name(): If no other flags than
DICT_ERR_IGNORE_FK_NOKEY are set, refuse access to unreadable tables.
Some encryption tests rely on this code path.

For the DML code path, we used to have the problem that when
one of the indexes was missing in dict_foreign_t, we would ignore
the FOREIGN KEY constraint altogether. The following changes
address that.

row_ins_check_foreign_constraints(): Add the parameter pk.
For the primary key, consider also foreign key constraints for which
foreign->foreign_index=NULL (no underlying index is available).

row_ins_check_foreign_constraint(): Report errors also for !check_ref.
Remove a redundant check for srv_read_only_mode.

row_ins_foreign_report_add_err(): Tolerate foreign->foreign_index=NULL.
2019-08-21 11:38:33 +03:00
Marko Mäkelä
e279c0076d MDEV-17187: Code cleanup
fkerr_t: Errors for the foreign key checks. Replaces ulint,
which used #define that looked like dberr_t literals.

wsrep_dict_foreign_find_index(): Remove. Use
dict_foreign_find_index() instead, with default parameters.

dict_foreign_push_index_error(): Do not add redundant quotes
around quoted table names.
2019-08-21 11:38:33 +03:00
Marko Mäkelä
ddaebdd210 dict_table_open_on_index_id(): Remove a redundant parameter 2019-08-21 11:38:33 +03:00
Anel Husakovic
888f685226 MDEV-20210 If you have an INVISIBLE VIRTUAL column, SHOW CREATE TABLE doesn't list it as INVISIBLE 2019-08-21 01:26:06 -07:00
Jan Lindström
1a3c77e524 MDEV-19968: Galera test failure on galera_load_data
Add wait conditions and compare cardinality etc information
between nodes and print something only if they differ.
2019-08-21 09:09:26 +03:00
Sergei Golubchik
6c06defb5f MDEV-15458 Segfault in heap_scan() upon UPDATE after ADD SYSTEM VERSIONING
heap_scan() makes info->next_block to be either an integer number
of share->block.records_in_block's or the total number of
records in the table. So when this total number or records changes,
info->next_block needs to be recalculated to take it into account.

This is a different fix for "Fixes a problem with heap when scanning and insert rows at the same time"
2019-08-20 15:37:08 +02:00
Sergei Golubchik
1ad70bf2fe Revert "Fixes a problem with heap when scanning and insert rows at the same time"
This reverts commit 262927a9e5.
2019-08-20 15:37:08 +02:00
Marko Mäkelä
4438ff07cd MDEV-20389: Refine the test case
Let us invoke wait_all_purged.inc right before the workload.
Starting with MDEV-12288 in MariaDB Server 10.3, also INSERT
generates purge workload. If we do not ensure that purge has
run to completion, the results on 10.3 and later could be
nondeterministic.
2019-08-20 16:03:43 +03:00
Aleksey Midenkov
2850b8d844 MDEV-20389 The test innodb.innodb_bug84958 fails intermittently
* Ensure no background purge is done;
* Better result showing actual number in case of failure;
* Higher and more safe difference threshold.
2019-08-20 15:58:06 +03:00
Monty
6dd1d6cb90 MDEV-20379 Mroonga has memory leak in ha_mroonga::is_foreign_key_field 2019-08-20 15:28:01 +03:00
Monty
262927a9e5 Fixes a problem with heap when scanning and insert rows at the same time
This causes failures in versioning.update-big in 10.3 and above
2019-08-20 12:57:52 +03:00
Jan Lindström
7b4de10477 MDEV-20378: Galera uses uninitialized memory
Problem was that wsrep thread argument was deleted on wrong
place. Furthermore, scan method incorrectly used unsafe c_ptr().
Finally, fixed wsrep thread initialization to correctly set
up thread_id and pass correct argument to functions and
fix signess problem causing compiler errors.
2019-08-20 10:32:04 +03:00
Marko Mäkelä
64c6f2bffc After-merge fixes
main.selectivity_innodb: Re-record the result.

MDEV-18863: Make wsrep_sst_mariabackup use Bash due to the += syntax.
2019-08-20 09:50:35 +03:00
Marko Mäkelä
48c67038b9 Merge 10.1 into 10.2
For MDEV-15955, the fix in create_tmp_field_from_item() would cause a
compilation error. After a discussion with Alexander Barkov, the fix
was omitted and only the test case was kept.

In 10.3 and later, MDEV-15955 is fixed properly by overriding
create_tmp_field() in Item_func_user_var.
2019-08-20 09:15:28 +03:00
Marko Mäkelä
bc89b1c558 MDEV-18863: Fix -Wsign-compare 2019-08-20 07:47:11 +03:00
Marko Mäkelä
a02dd7e614 Merge 5.5 into 10.1 2019-08-20 07:31:44 +03:00
Alexander Barkov
a7e2cd55ab MDEV-19034 ASAN unknown-crash in get_date_time_separator with PAD_CHAR_TO_FULL_LENGTH 2019-08-20 05:28:14 +04:00
Julius Goryavsky
12e3ac04fe MDEV-20185: Windows: Use of uninitialized value $bpath in string eq
The execution of mtr in the Windows environment fails due to
the fact that the new code from MDEV-18565 does not take into
account the need to add the ".exe" extension to the names of
executable files when searching for pre-requisites that are
needed to run SST scripts (especially when using mariabackup)
and when searching paths to some other Galera utilities.
This patch fixes this flaw.

Also adding paths to the PATH environment variable is now
done with the correct delimiter character.
2019-08-20 00:03:03 +02:00
Julius Goryavsky
c93f96e2ec MDEV-20185: Windows: Use of uninitialized value $bpath in string eq
The execution of mtr in the Windows environment fails due to
the fact that the new code from MDEV-18565 does not take into
account the need to add the ".exe" extension to the names of
executable files when searching for pre-requisites that are
needed to run SST scripts (especially when using mariabackup)
and when searching paths to some other Galera utilities.
This patch fixes this flaw.

Also adding paths to the PATH environment variable is now
done with the correct delimiter character.
2019-08-19 23:59:33 +02:00
Julius Goryavsky
c5bc0cedea MDEV-20185: Windows: Use of uninitialized value $bpath in string eq
The execution of mtr in the Windows environment fails due to
the fact that the new code from MDEV-18565 does not take into
account the need to add the ".exe" extension to the names of
executable files when searching for pre-requisites that are
needed to run SST scripts (especially when using mariabackup)
and when searching paths to some other Galera utilities.
This patch fixes this flaw.

Also adding paths to the PATH environment variable is now
done with the correct delimiter character.
2019-08-19 23:56:11 +02:00
Julius Goryavsky
89fb295b1b MDEV-18863: Galera SST scripts can't read [mysqldN] option groups
Some users and some scripts (for example, mysqld_multi.sh) use special
option groups with names like [mysqld1], [mysqld2], ..., [mysqldN].

But SST scripts can't currently fully support these option groups.
The only option group-related value it gets from the server is
--defaults-group-suffix, if that option was set for mysqld when
the server was started.

However, the SST scripts does not get told by the server to read
these option groups, so this means that the SST script will fail
to read options like innodb-data-home-dir when it is in a option
group like [mysqld1]...[mysqldN].

Moreover, SST scripts ignore many parameters that can be passed
to them explicitly and cannot transfer them further, for example,
to the input of mariabackup utility. Ideally, we want to transfer
all the parameters of the original mysqld call to utilities such
as mariabackup, however the SST script does not receive these
parameters from the server and therefore cannot transfer them to
mariabackup.

To correct these shortcomings, we need to transfer to the scripts
all of the parameters of the original mysqld call, and in the SST
scripts themselves provide for the transfer all of these parameters
to utilities such as mariabackup. To prevent these parameters from
mixing with the script's own parameters, they should be transferred
to SST script after the special option "--mysqld-args", followed by
the string argument with the original parameters, as it received by
the mysqld call at the time of launch (further all these parameters
will be passed to mariabackup, for example).

In addition, the SST scripts themselves must be refined so that
they can read the parameters from the user-selected group, not just
from the global mysqld configuration group. And also so that they
can receive the parameters (which important for their work) as
command-line arguments.
2019-08-19 23:52:18 +02:00
Julius Goryavsky
137d8ed3fe MDEV-18863: Galera SST scripts can't read [mysqldN] option groups
Some users and some scripts (for example, mysqld_multi.sh) use special
option groups with names like [mysqld1], [mysqld2], ..., [mysqldN].

But SST scripts can't currently fully support these option groups.
The only option group-related value it gets from the server is
--defaults-group-suffix, if that option was set for mysqld when
the server was started.

However, the SST scripts does not get told by the server to read
these option groups, so this means that the SST script will fail
to read options like innodb-data-home-dir when it is in a option
group like [mysqld1]...[mysqldN].

Moreover, SST scripts ignore many parameters that can be passed
to them explicitly and cannot transfer them further, for example,
to the input of mariabackup utility. Ideally, we want to transfer
all the parameters of the original mysqld call to utilities such
as mariabackup, however the SST script does not receive these
parameters from the server and therefore cannot transfer them to
mariabackup.

To correct these shortcomings, we need to transfer to the scripts
all of the parameters of the original mysqld call, and in the SST
scripts themselves provide for the transfer all of these parameters
to utilities such as mariabackup. To prevent these parameters from
mixing with the script's own parameters, they should be transferred
to SST script after the special option "--mysqld-args", followed by
the string argument with the original parameters, as it received by
the mysqld call at the time of launch (further all these parameters
will be passed to mariabackup, for example).

In addition, the SST scripts themselves must be refined so that
they can read the parameters from the user-selected group, not just
from the global mysqld configuration group. And also so that they
can receive the parameters (which important for their work) as
command-line arguments.
2019-08-19 23:48:07 +02:00
Julius Goryavsky
ff6d3075d5 MDEV-18863: Galera SST scripts can't read [mysqldN] option groups
Some users and some scripts (for example, mysqld_multi.sh) use special
option groups with names like [mysqld1], [mysqld2], ..., [mysqldN].

But SST scripts can't currently fully support these option groups.
The only option group-related value it gets from the server is
--defaults-group-suffix, if that option was set for mysqld when
the server was started.

However, the SST scripts does not get told by the server to read
these option groups, so this means that the SST script will fail
to read options like innodb-data-home-dir when it is in a option
group like [mysqld1]...[mysqldN].

Moreover, SST scripts ignore many parameters that can be passed
to them explicitly and cannot transfer them further, for example,
to the input of mariabackup utility. Ideally, we want to transfer
all the parameters of the original mysqld call to utilities such
as mariabackup, however the SST script does not receive these
parameters from the server and therefore cannot transfer them to
mariabackup.

To correct these shortcomings, we need to transfer to the scripts
all of the parameters of the original mysqld call, and in the SST
scripts themselves provide for the transfer all of these parameters
to utilities such as mariabackup. To prevent these parameters from
mixing with the script's own parameters, they should be transferred
to SST script after the special option "--mysqld-args", followed by
the string argument with the original parameters, as it received by
the mysqld call at the time of launch (further all these parameters
will be passed to mariabackup, for example).

In addition, the SST scripts themselves must be refined so that
they can read the parameters from the user-selected group, not just
from the global mysqld configuration group. And also so that they
can receive the parameters (which important for their work) as
command-line arguments.
2019-08-19 23:45:35 +02:00
Julius Goryavsky
457dc9d64d MDEV-18863: Galera SST scripts can't read [mysqldN] option groups
Some users and some scripts (for example, mysqld_multi.sh) use special
option groups with names like [mysqld1], [mysqld2], ..., [mysqldN].

But SST scripts can't currently fully support these option groups.
The only option group-related value it gets from the server is
--defaults-group-suffix, if that option was set for mysqld when
the server was started.

However, the SST scripts does not get told by the server to read
these option groups, so this means that the SST script will fail
to read options like innodb-data-home-dir when it is in a option
group like [mysqld1]...[mysqldN].

Moreover, SST scripts ignore many parameters that can be passed
to them explicitly and cannot transfer them further, for example,
to the input of mariabackup utility. Ideally, we want to transfer
all the parameters of the original mysqld call to utilities such
as mariabackup, however the SST script does not receive these
parameters from the server and therefore cannot transfer them to
mariabackup.

To correct these shortcomings, we need to transfer to the scripts
all of the parameters of the original mysqld call, and in the SST
scripts themselves provide for the transfer all of these parameters
to utilities such as mariabackup. To prevent these parameters from
mixing with the script's own parameters, they should be transferred
to SST script after the special option "--mysqld-args", followed by
the string argument with the original parameters, as it received by
the mysqld call at the time of launch (further all these parameters
will be passed to mariabackup, for example).

In addition, the SST scripts themselves must be refined so that
they can read the parameters from the user-selected group, not just
from the global mysqld configuration group. And also so that they
can receive the parameters (which important for their work) as
command-line arguments.
2019-08-19 23:43:16 +02:00
Igor Babaev
e746f451d5 MDEV-20265 Unknown column in field list
This patch corrects the fix of the patch for mdev-19421 that resolved
the problem of parsing some embedded join expressions such as
  t1 join t2 left join t3 on t2.a=t3.a on t1.a=t2.a.
Yet the patch contained a bug that prevented proper context analysis
of the queries where such expressions were used together with comma
separated table references in from clauses.
2019-08-19 14:20:41 -07:00
Marko Mäkelä
68e6c2d768 MDEV-20377: Introduce cmake -DWITH_MSAN:BOOL=ON
MemorySanitizer is a compile-time instrumentation layer in clang and GCC.
Together with AddressSanitizer mostly makes the run-time instrumentation
of Valgrind redundant. It is a little more tricky to set up, because
running with uninstrumented libraries will lead into false positives.

You will need an instrumented libc++, and you should use
-stdlib=libc++ instead of the default libstdc++. To build the
instrumented library, you can refer to
https://github.com/google/sanitizers/wiki/MemorySanitizerLibcxxHowTo
or you can adapt these steps that worked for me, for clang-8 version 8.0.1:

cd /mariadb
sudo apt source libc++-8-dev
cd llvm-toolchain-8-8.0.1
mkdir libc++msan; cd libc++msan
cmake ../libcxx -DCMAKE_BUILD_TYPE=Release -DLLVM_USE_SANITIZER=Memory \
-DCMAKE_C_COMPILER=clang-8 -DCMAKE_CXX_COMPILER=clang++-8

Then, in your MariaDB build directory, you have to compile with
libc++ and bundled libraries, such as WITH_SSL=bundled, WITH_ZLIB=bundled.
For uninstrumented system libraries, you will get false positives for
uninitialized values. Like this:

cmake -DWITH_MSAN=ON -DWITH_SSL=bundled -DWITH_ZLIB=bundled \
-DCMAKE_CXX_FLAGS='-stdlib=libc++' ..

Note: you should also add -O2 to the compiler options, or you may
get crashes due to stack overflow.

Finally, to run tests, you must replace libc++ with the instrumented one:

LD_LIBRARY_PATH=/mariadb/llvm-toolchain-8-8.0.1/libc++msan/lib \
MSAN_OPTIONS=abort_on_error=1 \
./mtr --big-test --parallel=auto --force --retry=0

Failure to do so will report numerous false positives related to
operations on std::string and the like.

This is work in progress. Some issues will still have to be fixed
for WITH_MSAN to be usable. See MDEV-20377 for details.
2019-08-19 20:56:26 +03:00
Monty
938925211a MDEV-19254 Server crashes in maria_status with partitioned table
Bug was that storage_engine::info() was called with not opened table in
ha_partition::info(). Fixed by ensuring that we are using an opened table.
2019-08-19 19:49:45 +03:00
Marko Mäkelä
e7fda5db07 MDEV-20377: Fix uninitialized memory in mysqltest 2019-08-19 17:09:59 +03:00
Marko Mäkelä
fcae2a6364 MDEV-20383 Use of uninitialized value in Datafile::find_space_id() for ROW_FORMAT=COMPRESSED
Datafile::find_space_id(): Fix a regression that was introduced
in c0f47a4a58 for MDEV-12026.
Because the function buf_page_is_corrupted() now determines
the physical page size from the fsp_flags, our buffer size must
agree with the fsp_flags.

buf_page_is_corrupted(): Use the correct accessor
fil_space_t::zip_size() for convering the tablespace flags.
ROW_FORMAT=COMPRESSED files never use innodb_checksum_algorithm=full_crc32.
2019-08-19 16:29:36 +03:00
Alexander Barkov
52e276247d MDEV-19961 MIN(timestamp_column) returns a wrong result in a GROUP BY query 2019-08-19 15:11:14 +04:00
Sergei Petrunia
850bf33137 MDEV-20374: innodb.innodb_mysql fails sporadically in BB
Stabilize the test:
- replace Rows column in EXPLAIN output for one query
- Use EITS statistics for another query (in that testcase, the
  query must use LooseScan)
2019-08-19 11:54:26 +03:00
Aleksey Midenkov
6dd3f24090 MDEV-19740 Debug build of 10.3.15 FTBFS
* Replace LINT_INIT for non-struct types with ctor initializers;
* Check BUILD_DEPS list is not empty so REMOVE_DUPLICATES won't throw
  error.
2019-08-19 10:38:24 +03:00
Monty
44150a770f Updated result for rocksdb tests after merge 2019-08-18 13:18:09 +03:00
Alexander Barkov
f987de7122 Merge remote-tracking branch 'origin/5.5' into 10.1 2019-08-16 20:58:14 +04:00
Kentoku SHIBA
6626b10a7a
fix for a compiler warning (#1372) 2019-08-17 00:40:38 +09:00