maria:bb-10.2-MDEV-23888

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

Branch merges

Branch information

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

Recent commits

d22366a... 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@4d275c8.
MariaDB never defined alloc_and_copy_thd_dynamic_variables(),
because we prefer to avoid overhead during connection creation.

Thanks to Andrei Elkin for debugging the SAFE_MUTEX issue, and to
Sergei Golubchik for the suggestion to invoke THDVAR() early.

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.

d6b33ea... by THIRUNARAYANAN BALATHANDAYUTHAPANI

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 a41d429765c7ddb528b9b438c68b25ff55d3bd55.
Fix should check for fts optimize thread shutdown state
before checking fts_optimize_wq.

cd5f4d2... by Marko Mäkelä

Cleanup: Remove unused fts_cache_t::optimize_lock

This has been unused from the very beginning
(mysql/mysql-server@d5e512ae7e37cd1f70c44a3f12205d70b13118ab).