maria:bb-10.2-MDEV-23564

Last commit made on 2020-10-07
Get this branch:
git clone -b bb-10.2-MDEV-23564 https://git.launchpad.net/maria

Branch merges

Branch information

Name:
bb-10.2-MDEV-23564
Repository:
lp:maria

Recent commits

b92597c... by Dmitry Shulga <email address hidden>

MDEV-23564: CMAKE failing due to deprecated Apple GSS method

Some GSS-API functions like gss_import_name(), gss_release_buffer()
used in plugin/auth_gssapi and libmariadb/plugins/auth are marked
as deprecated in MacOS starting from version 10.14+. It results in
extra warnings output on server building.

To eliminate extra warnings the flag '-Wno-deprecated-declarations'
has been added to compiler invocation string for those source
files that invoke deprecated GSS-API functions.

577c61e... by Marko Mäkelä

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@4d275c89954685e2ed1b368812b3b5a29ddf9389.
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.

01ffccd... by Eugene

UBSAN: UndefinedBehaviorSanitizer: undefined-behavior ../sql/item_cmpfunc.cc:3650:14

0aef658... by Jan Lindström

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

295e2d5... by Marko Mäkelä

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 021212b525e39d332cddd0b9f1656e2fa8044905)
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 0c15d1a6ff0d18da946f050cfeac176387a76112 (MariaDB 10.2.3)
and the parent of
commit 1cc1d0429da14a041a6240c6fce17e0d31cad8e2 (MariaDB 10.2.17, 10.3.9).

199bc67... by Marko Mäkelä

Cleanup: Remove unused SYNC_REC_LOCK

SYNC_REC_LOCK was never used in the public history of InnoDB,
starting with commit 132e667b0bbbe33137b6baeb59f3f22b7524f066.

34cf947... by Eugene

UBSAN UndefinedBehaviorSanitizer: undefined-behavior ../mysys/hash.c:798:9

dab56d5... by Vladislav Vaintroub

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.

b8b1aef... by Marko Mäkelä

Cleanup: Orphan que_thr_mutex declaration

The orphan declaration was added in MySQL 5.6.2
mysql/mysql-server@2915417e026ef9fdd8e36df17938409ccc157d86
and MariaDB commit 1d0f70c2f894b27e98773a282871d32802f67964.

4689034... by Marko Mäkelä

Cleanup: Remove fts_t::bg_threads_mutex, fts_t::bg_threads

The unused fts_t::bg_threads was added in
mysql/mysql-server@4b1049625c00dbfcd9d7a11ad12a84695ab747e3.

Any usage of fts_t::bg_threads_mutex was removed in
mysql/mysql-server@33c2404b397e1077daaf0ef0ff9edba445430f5f.