Commit graph

183864 commits

Author SHA1 Message Date
Jan Lindström
222e1b806f Add missing file. 2020-10-10 11:06:59 +03:00
Jan Lindström
a3eddd9f11 MDEV-23659 : Update Galera disabled.def file
Changes to be committed:
	modified:   mysql-test/suite/galera/disabled.def
	modified:   mysql-test/suite/wsrep/disabled.def
2020-10-10 08:50:50 +03:00
Jan Lindström
fc3b5c7db3 MDEV-17585 : wsrep.variables failed in buildbot with deadlock on CREATE USER
Stabilize test by using correct galera library and restore
original galera cluster at end.
2020-10-10 08:50:50 +03:00
Jan Lindström
266bf77bc7 MDEV-19968 : Galera test failure on galera_load_data
Add necessary wait_conditions to stabilize test.
2020-10-10 08:50:50 +03:00
Thirunarayanan Balathandayuthapani
8984d77910 MDEV-21329 InnoDB: Failing assertion: lock->lock_word.load(std::memory_order_relaxed) == X_LOCK_DECR upon server shutdown
Problem is that dropping of fts table and sync of fts table
happens concurrently during fts optimize thread shutdown.
fts_optimize_remove_table() is executed by a user thread that
performs DDL, and that the fts_optimize_wq may be removed if
fts_optimize_shutdown() has started executing.

fts_optimize_remove_table() doesn't remove the table from the queue
and it leads to above scenario. While removing the table from
fts_optimize_wq, if the table can't be removed then wait till
fts_optimize_thread shuts down.

Reviewed-by: Marko Mäkelä
2020-10-08 21:54:11 +05:30
Sergei Golubchik
b18921cfd2 Merge tag 'mariadb-10.2.34' into 10.2 2020-10-07 18:40:50 +02:00
Daniel Bartholomew
4aec143ad8
bump the VERSION 2020-10-07 11:23:43 -04:00
Igor Babaev
291be49474 MDEV-23811: With large number of indexes optimizer chooses an inefficient plan
This bug could manifest itself for a query with WHERE condition containing
top level OR formula such that each conjunct contained a single-range
condition supported by the same index. One of these range conditions must
be fully covered by another range condition that is used later in the OR
formula. Additionally at least one of these condition should be ANDed with
a sargable range condition supported by a different index.

There were several attempts to fix related problems for OR conditions after
the backport of range optimizer code from MySQL (commit
0e19f3e36f). Unfortunately the first of these
fixes contained typo remained unnoticed until recently. This typo bug led
to rejection of valid range accesses. This patch fixed this typo bug.
The fix revealed another two bugs: one in a constructor for SEL_ARG,
the other in the function tree_or(). Both are fixed in this patch.
2020-10-06 13:12:11 -07:00
Marko Mäkelä
1595189250 MDEV-23897 SIGSEGV on commit with innodb_lock_schedule_algorithm=VATS
This regression for debug builds was introduced by
MDEV-23101 (commit 224c950462).

Due to MDEV-16664, the parameter
innodb_lock_schedule_algorithm=VATS
is not enabled by default.

The purpose of the added assertions was to enforce the invariant that
Galera replication cannot be enabled together with VATS due to MDEV-12837.
However, upon closer inspection, it is obvious that the variable 'lock'
may be assigned to the null pointer if no match is found in the
previous->hash list.

lock_grant_and_move_on_page(), lock_grant_and_move_on_rec():
Assert !lock->trx->is_wsrep() only after ensuring that lock
is not a null pointer.
2020-10-06 22:35:43 +03:00
Aleksey Midenkov
2b832151ad MDEV-23787 mtr --rr fixes
1. rr record -h randomizes number of processors. Disable THREAD_POOL_SIZE check.

2. check for kernel.perf_event_paranoid for user-friendly error message.
2020-10-06 15:07:06 +03:00
Oleksandr Byelkin
5933081d8b MDEV-18163 Assertion table_share->tmp_table != NO_TMP_TABLE || m_lock_type != 2' failed in handler::ha_rnd_next(); / Assertion table_list->table' failed in find_field_in_table_ref / ERROR 1901 (on optimized builds)
Add the same check for altering DEFAULT used as for CREATE TABLE.
2020-10-06 13:50:28 +02:00
Daniel Black
b3a9fbdbab travis: 10.2 only - make faster
Remove from debian build:
* tokudb
* mroonga
* spider
* ograph
* embedded server

Add ccache to debian build.

Backport 10.3 changes to autobake-deb
that make travis faster.

Merge instructions:
Drop this commit on merge to 10.3
2020-10-06 22:22:03 +11:00
Eugene Kosov
350c9eb705 MDEV-23894 UBSAN: several call to function show_binlog_vars(THD*, st_mysql_show_var*, char*) through pointer to incorrect function type 'int (*)(THD *, st_mysql_show_var *, void *, system_status_var *, enum_var_type) errors 2020-10-06 13:51:06 +03:00
Jan Lindström
33f19876a2 MDEV-18593 : galera.galera_gcache_recover_full_gcache: Test failure: galera_gcache_recover_full_gcache.test: assert_grep.inc failed
Grep only the fact that we need to fall back to SST.
2020-10-06 12:03:13 +03:00
Marko Mäkelä
577c61e8be MDEV-23888: Potential server hang on replication with InnoDB
In MDEV-21452, SAFE_MUTEX flagged an ordering problem that involved
trx_t::mutex, LOCK_global_system_variables, and LOCK_commit_ordered
when running
./mtr --no-reorder\
 binlog.binlog_checksum,mix binlog.binlog_commit_wait,mix

Because LOCK_commit_ordered is acquired by replication code before
innobase_commit_ordered() is invoked, and because LOCK_commit_ordered
should be below LOCK_global_system_variables in the global latching
order, it turns out that we must avoid acquiring
LOCK_global_system_variables in any low-level code.

It also turns out that lock_rec_lock() acquires lock_sys_t::mutex
and then carries on to call lock_rec_enqueue_waiting(), which may
invoke THDVAR() via thd_lock_wait_timeout(). This call is problematic
if THDVAR() had never been invoked in that thread earlier.

innobase_trx_init(): Let us invoke THDVAR() at the start of an InnoDB
transaction so that future invocations of THDVAR() will avoid
LOCK_global_system_variables acquisition on the same THD. Because
the first call to intern_sys_var_ptr() will initialize all session
variables by not passing the offset to sync_dynamic_session_variables(),
this will indeed make any future THDVAR() invocation mutex-free.

There are some THDVAR() calls in other code (related to indexed virtual
columns, fulltext indexes, and DDL operations). No SAFE_MUTEX warning
was known for those, but there does not appear to be any replication
test coverage for indexed virtual columns or fulltext indexes. DDL should
be covered, and perhaps DDL code paths were already invoking THDVAR()
while not holding any InnoDB mutex.

Side note: MySQL should avoid this type of deadlocks since
mysql/mysql-server@4d275c8995.
MariaDB never defined alloc_and_copy_thd_dynamic_variables(),
because we prefer to avoid overhead during connection creation.

An important part of the deadlock could be the current handling of
SET GLOBAL binlog_checksum=NONE; and similar assignments.
In binlog_checksum_update(), we would hold LOCK_global_system_variables
while potentially acquiring LOCK_commit_ordered in MYSQL_BIN_LOG::open().
Even if that code was changed later to release
LOCK_global_system_variables during the write to mysql_bin_log,
it could be a good idea for performance to avoid invoking the
expensive code path of THDVAR() while holding any InnoDB mutexes,
such as lock_sys.mutex in lock_rec_enqueue_waiting().

Thanks to Andrei Elkin for debugging the SAFE_MUTEX issue, and to
Sergei Golubchik for the suggestion to invoke THDVAR() early.
2020-10-06 07:47:11 +03:00
Eugene Kosov
01ffccd6a4 UBSAN: UndefinedBehaviorSanitizer: undefined-behavior ../sql/item_cmpfunc.cc:3650:14 2020-10-05 20:02:22 +03:00
Sergei Golubchik
a464917766 Merge branch '10.1' into 10.2 2020-10-05 17:53:10 +02:00
Sergei Golubchik
f4c85ef5ed bump VERSION 2020-10-05 17:52:00 +02:00
Sergei Golubchik
418850b2df MDEV-23884 donor uses invalid SST methods 2020-10-05 17:42:00 +02:00
Jan Lindström
0aef658dfa Remove unnecessary and incorrect add_suppression.
Changes to be committed:
	modified:   mysql-test/suite/sys_vars/r/wsrep_cluster_address_basic.result
	modified:   mysql-test/suite/sys_vars/t/wsrep_cluster_address_basic.test
2020-10-05 10:34:01 +03:00
Marko Mäkelä
295e2d500b MDEV-16664: Add deprecation warning for innodb_lock_schedule_algorithm=VATS
The setting innodb_lock_schedule_algorithm=VATS that was introduced
in MDEV-11039 (commit 021212b525)
causes conflicting exclusive locks to be incorrectly granted to
two transactions. Specifically, in lock_rec_insert_by_trx_age()
the predicate !lock_rec_has_to_wait_in_queue(in_lock) would hold even
though an active transaction is already holding an exclusive lock.
This was observed between two DELETE of the same clustered index record.
The HASH_DELETE invocation in lock_rec_enqueue_waiting() may be related.

Due to lack of progress in diagnosing the problem, we will deprecate the
option and issue a warning that using it may corrupt data. The unsafe
option was enabled between
commit 0c15d1a6ff (MariaDB 10.2.3)
and the parent of
commit 1cc1d0429d (MariaDB 10.2.17, 10.3.9).
2020-10-05 09:34:27 +03:00
Marko Mäkelä
199bc67144 Cleanup: Remove unused SYNC_REC_LOCK
SYNC_REC_LOCK was never used in the public history of InnoDB,
starting with commit 132e667b0b.
2020-10-05 09:12:12 +03:00
Eugene Kosov
34cf947ef2 UBSAN UndefinedBehaviorSanitizer: undefined-behavior ../mysys/hash.c:798:9 2020-10-03 12:38:43 +03:00
Vladislav Vaintroub
dab56d5e8e MDEV-23879 server hangs with threadpool, compression, and client pipelining
Amend check for unread client data in threadpool.

THD::NET will have unread data, in case client uses compression, and
wraps multiple commands into  a single compression packet

MariaDB C/C sends COM_STMT_RESET+COM_STMT_EXECUTE, and wraps it into
a single compressed packet, when compression is on, thus trying to use
compression and prepared statements against a threadpool-enabled server
will result into a hang, before this patch.
2020-10-03 00:24:53 +02:00
Marko Mäkelä
b8b1aef6b1 Cleanup: Orphan que_thr_mutex declaration
The orphan declaration was added in MySQL 5.6.2
mysql/mysql-server@2915417e02
and MariaDB commit 1d0f70c2f8.
2020-10-02 08:40:06 +03:00
Marko Mäkelä
46890349bf Cleanup: Remove fts_t::bg_threads_mutex, fts_t::bg_threads
The unused fts_t::bg_threads was added in
mysql/mysql-server@4b1049625c.

Any usage of fts_t::bg_threads_mutex was removed in
mysql/mysql-server@33c2404b39.
2020-10-02 08:36:50 +03:00
Thirunarayanan Balathandayuthapani
d6b33ea237 MDEV-23856 fts_optimize_wq accessed after shutdown of FTS Optimize thread
In fts_optimize_remove_table(), InnoDB tries to access the
fts_optimize_wq after shutting down the fts optimize thread.
This issue caused by the commit a41d429765.
Fix should check for fts optimize thread shutdown state
before checking fts_optimize_wq.
2020-09-30 18:02:29 +05:30
Marko Mäkelä
cd5f4d2a59 Cleanup: Remove unused fts_cache_t::optimize_lock
This has been unused from the very beginning
(mysql/mysql-server@d5e512ae7e).
2020-09-30 13:26:46 +03:00
Marko Mäkelä
aa2f263e59 Cleanup: Remove constant parameters async=false, index_name=NULL 2020-09-29 11:07:34 +03:00
Marko Mäkelä
74bd3683ca MDEV-23839 innodb_fast_shutdown=0 hang on change buffer merge
ibuf_merge_or_delete_for_page(): Do not attempt to invoke
ibuf_delete_recs() on a page of the change buffer itself.
The caller could already be holding ibuf->index->lock,
and an attempt to acquire it in S mode would hang the release server
or cause an assertion failure in rw_lock_s_lock_func() in a debug
server.

This problem was reproducible on 1 out of 2 runs of the following:
./mtr --no-reorder \
innodb.innodb-page_compression_default \
innodb.innodb-page_compression_snappy \
innodb.innodb-page_compression_zip \
innodb.innodb_wl6326_big innodb.xa_recovery
2020-09-29 11:04:12 +03:00
Marko Mäkelä
a441b06489 Merge 10.1 into 10.2 2020-09-29 10:04:37 +03:00
Marko Mäkelä
83a520dbbb Cleanup: Remove unused rw_lock_t::writer_is_wait_ex
This was missed in commit 2c252ba96b
(MySQL 5.5.42, MariaDB 5.5.42).
2020-09-29 09:39:08 +03:00
Jan Lindström
842616532a MDEV-23659 : Update Galera disabled.def file
Fix typo.
2020-09-28 14:40:00 +03:00
Thirunarayanan Balathandayuthapani
fdb3c64e42 MDEV-22277 LeakSanitizer: detected memory leaks in mem_heap_create_block_func after attempt to create foreign key
- During online DDL, prepare phase error handler fails to remove
the memory allocated for newly created foreign keys.
2020-09-28 17:04:02 +05:30
Sujatha
3a5e719e00 Merge branch '10.1' into 10.2 2020-09-28 14:03:46 +05:30
Jan Lindström
c078f55f47 MDEV-23659 : Update Galera disabled.def file
This will update galera_3nodes/disabled.def.
2020-09-28 11:05:09 +03:00
Sujatha
15cd919535 MDEV-22330: mysqlbinlog stops with an error Don't know how to handle column type: 255 meta: 4 (0004)
Analysis:
========
"mysqlbinlog -v" option will reconstruct row events and display them as
commented SQL statements. If this option is given twice, the output includes
comments to indicate column data types and some metadata.
`log_event_print_value` is the function reponsible for printing values and
their types. This function doesn't handle GEOMETRY type. Hence the above error
gets printed.

Fix:
===
Add support for GEOMETRY datatype.
2020-09-28 12:52:09 +05:30
Monty
e0f5e7bc9e Reverted wrong patch for mysql_upgrade
The original code was correct. mysql_upgrade calls the mysql client to
talk with MariaDB. It doesn't call itself!
2020-09-26 08:57:56 +10:00
Daniel Black
1be8ac390d Revert "[MDEV-7978] add show create user"
Appoligies, had a dirty branch before pushing:

This reverts commit 053653a23c.

This reverts commit 0ff897807f.

This reverts commit 85b085972b.

This reverts commit f3f45e46b6.

This reverts commit a470b3570a.

This reverts commit f8b8d202bc.

This reverts commit 6b6f066fdd.

This reverts commit a701e9e6c3.

This reverts commit c169838611.
2020-09-24 13:58:29 +10:00
Daniel Black
3d28d1f3aa MDEV-23697: /usr/bin/perl for debian scripts 2020-09-24 08:16:30 +10:00
Daniel Black
4ddaa571fa MDEV-23697: perl -w -> perl
Leave debian/additions/mysqlreport as #!/usr/bin/perl

Acknowledge that `env perl` is a hack, a complete fix
needs to consider which path perl is at and insert into
these scripts.

The usefulness of these scripts is questionable.
2020-09-24 08:09:56 +10:00
Daniel Black
88c5c319e5 Merge branch '10.1' of https://github.com/MariaDB/server into 10.1 2020-09-24 08:00:41 +10:00
Marko Mäkelä
7c5519c12d MDEV-22387: Do not violate __attribute__((nonnull))
Passing a null pointer to a nonnull argument is not only undefined
behaviour, but it also grants the compiler the permission to optimize
away further checks whether the pointer is null. GCC -O2 at least
starting with version 8 may do that, potentially causing SIGSEGV.
2020-09-23 12:47:49 +03:00
Marko Mäkelä
70960bd33d UBSAN: Fix a bit shift overflow
Shifting a 16-bit type by 16 bits is undefined behaviour.
The result is at least 32 bits, so let us cast the shift operand
to a wider type before shifting.
2020-09-23 12:42:30 +03:00
Marko Mäkelä
af40a2b43e Fix GCC 10.2.0 -Og -fsanitize=undefined -Wmaybe-uninitialized
For some reason, adding -fsanitize=undefined (cmake -DWITH_UBSAN=ON)
to the compilation flags will cause even more warnings to be emitted.
The warnings do look bogus, but the code can be simplified.
2020-09-23 12:27:56 +03:00
Marko Mäkelä
0448558a0d Fix GCC 10.2.0 -Og -fsanitize=undefined -Wformat-overflow
For some reason, adding -fsanitize=undefined (cmake -DWITH_UBSAN=ON)
to the compilation flags will cause even more warnings to be emitted.
The warning was a bogus one:

tests/mysql_client_test.c:8632:22: error: '%d' directive writing between
1 and 11 bytes into a region of size 9 [-Werror=format-overflow=]
 8632 |     sprintf(field, "c%d int", i);
      |                      ^~
tests/mysql_client_test.c:8632:20: note: directive argument
in the range [-2147483648, 999]

The warning does not take into account that the lower bound of the
variable actually is 0. But, we can help the compiler and use an
unsigned variable.
2020-09-23 12:14:05 +03:00
Oleksandr Byelkin
594c11fffc Ukrainian error text translations added. 2020-09-22 15:13:17 +02:00
Marko Mäkelä
9d0ee2dcb7 Merge 10.1 into 10.2 2020-09-22 15:21:43 +03:00
Marko Mäkelä
78efa10930 MDEV-22939: Restore an AUTO_INCREMENT check
It turns out that we must check for DISCARD TABLESPACE both
when the table is being rebuilt and when the AUTO_INCREMENT
value of the table is being added.

This was caught by the test innodb.alter_missing_tablespace.
Somehow I failed to run all tests. Sorry!
2020-09-22 13:55:36 +03:00
Marko Mäkelä
3eb81136e1 MDEV-22939 Server crashes in row_make_new_pathname()
The statement ALTER TABLE...DISCARD TABLESPACE is problematic,
because its designed purpose is to break the referential integrity
of the data dictionary and make a table point to nowhere.

ha_innobase::commit_inplace_alter_table(): Check whether the
table has been discarded. (This is a bit late to check it, right
before committing the change.) Previously, we performed this check
only in a specific branch of the function commit_set_autoinc().

Note: We intentionally allow non-rebuilding ALTER TABLE even if
the tablespace has been discarded, to remain compatible with MySQL.
(See the various tests with "wl5522" in the name, such as
innodb.innodb-wl5522.)

The test case would crash starting with 10.3 only, but it does not hurt
to minimize the code and test difference between 10.2 and 10.3.
2020-09-22 13:40:05 +03:00