Commit graph

192150 commits

Author SHA1 Message Date
Elena Stepanova
9d7dc1f6d0 List of unstable tests for 10.5.9 release
Test code modifications and new failures from buildbot were registered
only for the main suite. The rest was updated partially,
based on the status of existing JIRA items
2021-02-16 16:47:04 +02:00
Marko Mäkelä
067465cd2f MDEV-15641 fixup: Make the test faster
Let us avoid the excessive allocation of explicit record locks
(a work-around of MDEV-24813) so that the test will execute
much faster under AddressSanitizer, MemorySanitizer, Valgrind.
2021-02-16 12:07:48 +02:00
Vladislav Vaintroub
1146e98b3a MDEV-24341 - followup remove assert. 2021-02-16 11:06:36 +01:00
Marko Mäkelä
e5d83ad472 MDEV-20612 fixup: Fix a memory leak in buffer pool resize 2021-02-16 11:27:13 +02:00
Jan Lindström
a5bcec727b MDEV-24865 : Server crashes when truncate mysql user table
For truncate we try to find out possible foreign key tables
using open_tables. However, table_list was not cleaned up
properly and there was no error handling. Fixed by cleaning
table_list and adding proper error handling.
2021-02-16 08:46:14 +02:00
Varun Gupta
3544643f09 MDEV-23291: SUM column from a derived table returns invalid values
The issue here was the read_set bitmap was not set for a field which
was used as a reference in an inner select.
We need to make sure that if we are in an inner select and we have
references from outer select then we update the table bitmaps for
such references.

Introduced a function in the class Item_subselect that would
update bitmaps of table for the references within a
subquery that are defined in outer selects.
2021-02-16 11:53:13 +05:30
Varun Gupta
7e9a6b7f09 MDEV-24779: main.subselect fails in buildbot with --ps-protocol
Follow-up fix to commit 26f5033(MDEV-23449)
The GROUP BY clause inside IN/ALL/ANY subquery is removed
when there is no aggregate function or HAVING clause in the subquery.

When the GROUP BY clause is removed, a subquery can also be removed
if it part of the GROUP BY clause. This is done inside the function
remove_redundant_subquery_clauses. Here we walk over the GROUP BY list
and remove a subselect from its unit via the callback function
eliminate_subselect_processor.

The issue here was that when the query was being re-executed it was trying
to reinitialize the select that was removed as stated above.
This is not required, so the fix would be to remove select_lex
both from tree lex structure and the global list of nodes so that
we don't do the reinitialization again.
2021-02-16 11:53:13 +05:30
Varun Gupta
a461e4d306 MDEV-19474: Histogram statistics are used even with optimizer_use_condition_selectivity=3
The issue here was histogram statistics were being used even when
the level of optimizer_use_condition_selectivity doesn't allow
usage of statistics from histogram.

The histogram statistics are read for a table only when
optimizer_use_condition_selectivity > 3. But the TABLE structure can be
stored in the internal table cache and be reused for the next query.
So in this case the histogram statistics will be available for the next query.

The fix would be to make sure to use the histogram statistics only when
optimizer_use_condition_selectivity > 3.
2021-02-16 11:53:13 +05:30
Sergei Golubchik
ae7989ca20 galera.galera_gra_log crashes
reset thd->lex->query_tables_own_last,
because open_table() uses it and will try to dereference
whatever garbage it might have
2021-02-16 01:11:41 +01:00
Monty
fc5e03f093 Ignore reporting in thd_progress_report() if we cannot lock LOCK_thd_data
The reason for this is that Galera can lock LOCK_thd_data for a long time.

Instead of stalling any long running process, like alter or repair table,
because of progress reporting, ignore the progress reporting for this
call. Progress reporting will continue on the next call after the lock has
been released.
2021-02-15 20:21:29 +02:00
Marko Mäkelä
e926964cb8 Remove useless test innodb.innodb_bug60049
The test innodb.innodb_bug60049 used to check that the record
(ID,NAME)=(12,'SYS_FOREIGN_COLS') is the last record in the
secondary index of the system table SYS_TABLES.
But, ever since commit 2336558423
or mysql/mysql-server@082d59670f
that record no longer is the last one in the table!

The more recent test innodb.purge_secondary covers the purge
functionality much better.
2021-02-15 18:12:31 +02:00
Marko Mäkelä
638ede5bef MDEV-24864 Fatal error in buf_page_get_low() / fseg_page_is_free()
The fix of MDEV-24569 and MDEV-24695 introduced a race condition when
a table is being rebuilt or dropped during the fseg_page_is_free() check.
The server would occasionally crash during the execution of the test
encryption.create_or_replace.

The fil_space_t::STOPPING flag can be set by DDL operations. Normally,
such concurrent operations are prevented by a metadata lock (MDL).
However, neither the change buffer merge nor the fil_crypt_thread() are
protected by MDL.

fil_crypt_read_crypt_data(), xdes_get_descriptor_const(): Pass the
BUF_GET_POSSIBLY_FREED flag to avoid the fatal error in buf_page_get_low()
if a DDL operation was just initiated.
2021-02-15 17:00:19 +01:00
Sergei Golubchik
f13f966304 update PCRE2 ref 2021-02-15 16:46:32 +01:00
Sergei Golubchik
a89b7c1d6a columnstore 5.5.1-2 2021-02-15 16:44:37 +01:00
Sergei Golubchik
25d9d2e37f Merge branch 'bb-10.4-release' into bb-10.5-release 2021-02-15 16:43:15 +01:00
Alice Sherepa
6f14230643 MDEV-11862 rpl.rpl_semi_sync_event_after_sync 'fails if there is no semisync plugin 2021-02-15 13:41:44 +01:00
Aleksey Midenkov
8eaf4bc5ec Comment on assertion in row_rename_table_for_mysql()
Related to commit f0baa864 and MDEV-23632.
2021-02-15 13:57:37 +03:00
Marko Mäkelä
2e84846ec0 MDEV-24861 Assertion `trx->rsegs.m_redo.rseg' failed in innodb_prepare_commit_versioned
trx_t::commit_tables(): Ensure that mod_tables will be empty.
This was broken in commit b08448de64
where the query cache invalidation was moved from lock_release().
2021-02-15 10:19:57 +02:00
Monty
34c654024c MDEV-24855 ER_CRASHED_ON_USAGE or Assertion `length <= column->length'
When creating a summary temporary table with bit fields used in the sum
expression with several parameters, like GROUP_CONCAT(), the counting of
bits needed in the record was wrong.

The reason we got an assert in Aria was because the bug caused a memory
overwrite in the record and Aria noticed that the data was 'impossible.
2021-02-15 01:33:06 +02:00
Sergei Golubchik
2696538723 updating @@wsrep_cluster_address deadlocks
wsrep_cluster_address_update() causes LOCK_wsrep_slave_threads
to be locked under LOCK_wsrep_cluster_config, while normally
the order should be the opposite.

Fix: don't protect @@wsrep_cluster_address value with the
LOCK_wsrep_cluster_config, LOCK_global_system_variables is enough.

Only protect wsrep reinitialization with the LOCK_wsrep_cluster_config.
And make it use a local copy of the global @@wsrep_cluster_address.

Also, introduce a helper function that checks whether
wsrep_cluster_address is set and also asserts that it can be safely
read by the caller.
2021-02-14 23:18:42 +01:00
Vladislav Vaintroub
4df0249b9a MDEV-24341 Innodb - do not block in foreground thread in log_write_up_to( 2021-02-14 18:30:39 +01:00
Monty
d0defd1ea2 In case of an abort, write "handling fatal signal" to DBUG log. 2021-02-14 17:46:14 +02:00
Monty
af31e2c55d MDEV-23843 Assertions in Diagnostics_area upon table operations under FTWRL
2 different problems:
- MYSQL_BIN_LOG::write() did not check if mdl_context.acquire_lock() failed
- Sql_cmd_optimize_table::execute() and Sql_cmd_repair_table::execute()
  called write_bin_log(), which could fail if sql_admin() had already
  called my_eof()

Fixed by adding check for aquire_lock() return status and protect
write_bin_log() in the above two functions with set_overwrite_status().
2021-02-14 17:42:19 +02:00
Monty
3cd32a9baf Remove extra (not needed) error from multi-table-update for killed query
If a multi-update query was killed because of timeout or a kill statement,
there was a chance the query returned the error "An error occurred in
multi-table update" instead of the right error, like
"Query execution was interrupted".
2021-02-14 16:26:14 +02:00
Vlad Lesin
23833dce05 MDEV-24792 Assertion `!newest_lsn || fil_page_get_type(page)' failed upon MariaBackup prepare in buf_flush_init_for_writing with innodb_log_optimize_ddl=off
fsp_free_page() writes MLOG_INIT_FREE_PAGE, but does not update page
type. But fil_crypt_rotate_page() checks the type to understand if the
page is freshly initialized, and writes dummy record(updates space id)
to force rotation during recovery. This dummy record causes assertion
crash when the page is flushed after recovery, as it's supposed
that pages LSN is 0 for freshly initialized pages.

The bug is similiar to MDEV-24695, the difference is that in 10.5 the
assertion crashes during log record applying, but in 10.4 it crashes
during page flushing.

The fix could be in marking page as freed and not writing dummy record
during keys rotation procedure for such marked pages. But
bpage->file_page_was_freed is not consistent enough for release builds in
10.4, and the issue is fixed in 10.5 and does not exist in 10.[23] as
MLOG_INIT_FREE_PAGE was introduced since 10.4.

So the better solution is just to relax the assertion and implement some
additional property for freshly allocated pages, and check this property
during pages flushing.

The test is copied from MDEV-24695, the only change is in forcing pages
flushing after each server start to cause crash in non-fixed code.

There is no need to merge it to 10.5+, as the bug is already fixed by
MDEV-24695.
2021-02-14 10:11:03 +03:00
Jan Lindström
cb4434c44a MDEV-24856 : Server crashes when wsrep_provider_options set to NULL
Null pointer reference to wsrep_provider_options variable. Fixed
by adding condition and error handling.
2021-02-13 10:28:10 +02:00
Jan Lindström
b3df194e31 MDEV-24833 : Signal 11 on wsrep_can_run_in_toi at wsrep_mysqld.cc:1994
Problem was that when engine substitution is allowd (e.g. sql_mode='')
we must also check db_type. Additionally, we did not resolve
default storage engine on that case and used that to check is
TOI possible or not.
2021-02-12 20:43:03 +02:00
Sergei Golubchik
b91e77cff3 fix a 3-way deadlock in galera_sr.galera-features#56
rarely (try --repeat 1000), the following happens:

* from wsrep_bf_abort (when a thread is being killed), wsrep-lib
starts streaming_rollback that wants to
convert_streaming_client_to_applier. wsrep_create_streaming_applier
creates a new THD(). All while the other THD is being killed,
so under LOCK_thd_kill and LOCK_thd_data. In particular, THD::init()
takes LOCK_global_system_variables under LOCK_thd_kill.

* updating @@wsrep_slave_threads takes LOCK_global_system_variables
and LOCK_wsrep_cluster_config (in that order) and invokes
wsrep_slave_threads_update() that takes LOCK_wsrep_slave_threads

* wsrep_replication_process() takes LOCK_wsrep_slave_threads and
invokes wsrep_close_applier(), that does thd->set_killed() which
takes LOCK_thd_kill.

et voilà.

As a fix I copied a workaround from wsrep_cluster_address_update()
to wsrep_slave_threads_update(). It seems to be safe: without mutexes
a race condition is possible and a concurrent SET might change
wsrep_slave_threads, but wsrep_slave_threads_update() always verifies
if there's a need to do something, so it will not run twice in this case,
it'll be a no-op.
2021-02-12 18:51:25 +01:00
Sergei Golubchik
259b945204 remove find_thread_with_thd_data_lock_callback
let the caller take the lock if needed
2021-02-12 18:17:07 +01:00
Sergei Golubchik
eac8341df4 MDEV-23328 Server hang due to Galera lock conflict resolution
adaptation of 29bbcac0ee for 10.4
2021-02-12 18:17:06 +01:00
Sergei Golubchik
9703cffa8c don't take mutexes conditionally 2021-02-12 18:14:20 +01:00
Sergei Golubchik
259a1902a0 cleanup: THD::abort_current_cond_wait()
* reuse the loop in THD::abort_current_cond_wait, don't duplicate it
* find_thread_by_id should return whatever it has found, it's the
  caller's task not to kill COM_DAEMON (if the caller's a killer)

and other minor changes
2021-02-12 18:05:34 +01:00
Elena Stepanova
cbbcc8fa2b List of unstable tests for 10.4.18 release
Test code modifications and new failures from buildbot registered
only for the main suite. The rest was updated partially,
based on the status of existing JIRA items
2021-02-12 17:44:55 +01:00
Sergei Golubchik
00a313ecf3 Merge branch 'bb-10.3-release' into bb-10.4-release
Note, the fix for "MDEV-23328 Server hang due to Galera lock conflict resolution"
was null-merged. 10.4 version of the fix is coming up separately
2021-02-12 17:44:22 +01:00
Marko Mäkelä
a1542f8a57 MDEV-24643: Assertion failed in rw_lock::update_unlock()
mtr_defer_drop_ahi(): Upgrade the U lock to X lock and downgrade
it back to U lock in case the adaptive hash index needs to be dropped.

This regression was introduced in
commit 03ca6495df (MDEV-24142).
2021-02-12 17:44:58 +02:00
Marko Mäkelä
26d6224dd6 MDEV-20612: Enable concurrent lock_release()
lock_release_try(): Try to release locks while only holding
shared lock_sys.latch.

lock_release(): If 5 attempts of lock_release_try() fail,
proceed to acquire exclusive lock_sys.latch.
2021-02-12 17:44:58 +02:00
Marko Mäkelä
b08448de64 MDEV-20612: Partition lock_sys.latch
We replace the old lock_sys.mutex (which was renamed to lock_sys.latch)
with a combination of a global lock_sys.latch and table or page hash lock
mutexes.

The global lock_sys.latch can be acquired in exclusive mode, or
it can be acquired in shared mode and another mutex will be acquired
to protect the locks for a particular page or a table.

This is inspired by
mysql/mysql-server@1d259b87a6
but the optimization of lock_release() will be done in the next commit.
Also, we will interleave mutexes with the hash table elements, similar
to how buf_pool.page_hash was optimized
in commit 5155a300fa (MDEV-22871).

dict_table_t::autoinc_trx: Use Atomic_relaxed.

dict_table_t::autoinc_mutex: Use srw_mutex in order to reduce the
memory footprint. On 64-bit Linux or OpenBSD, both this and the new
dict_table_t::lock_mutex should be 32 bits and be stored in the same
64-bit word. On Microsoft Windows, the underlying SRWLOCK is 32 or 64
bits, and on other systems, sizeof(pthread_mutex_t) can be much larger.

ib_lock_t::trx_locks, trx_lock_t::trx_locks: Document the new rules.
Writers must assert lock_sys.is_writer() || trx->mutex_is_owner().

LockGuard: A RAII wrapper for acquiring a page hash table lock.

LockGGuard: Like LockGuard, but when Galera Write-Set Replication
is enabled, we must acquire all shards, for updating arbitrary trx_locks.

LockMultiGuard: A RAII wrapper for acquiring two page hash table locks.

lock_rec_create_wsrep(), lock_table_create_wsrep(): Special
Galera conflict resolution in non-inlined functions in order
to keep the common code paths shorter.

lock_sys_t::prdt_page_free_from_discard(): Refactored from
lock_prdt_page_free_from_discard() and
lock_rec_free_all_from_discard_page().

trx_t::commit_tables(): Replaces trx_update_mod_tables_timestamp().

lock_release(): Let trx_t::commit_tables() invalidate the query cache
for those tables that were actually modified by the transaction.
Merge lock_check_dict_lock() to lock_release().

We must never release lock_sys.latch while holding any
lock_sys_t::hash_latch. Failure to do that could lead to
memory corruption if the buffer pool is resized between
the time lock_sys.latch is released and the hash_latch is released.
2021-02-12 17:44:32 +02:00
Marko Mäkelä
da3211e487 MDEV-24763 fixup: Use deterministic ORDER BY 2021-02-12 14:03:25 +02:00
Marko Mäkelä
6f3f191cfa MDEV-24763 ALTER TABLE fails to rename a column in SYS_FIELDS
innobase_rename_column_try(): When renaming SYS_FIELDS records
for secondary indexes, try to use both formats of SYS_FIELDS.POS
as keys, in case the PRIMARY KEY includes a column prefix.

Without this fix, an ALTER TABLE that renames a column followed
by a server restart (or LRU eviction of the table definition
from dict_sys) would make the table inaccessible.
2021-02-12 09:48:36 +02:00
Marko Mäkelä
028ba10d0b MDEV-18468 fixup: Make test case robust w.r.t. deferred DROP TABLE 2021-02-12 09:41:15 +02:00
Otto Kekäläinen
7fb528d722 Deb: Remove build depencency libreadline-gplv2-dev no longer available
The Readline library is no longer available in Debian Sid.
See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=980504

Add the dependency on-the-fly in autobake-deb.sh for older distro versions
and keep the native build in a state that works on Debian Sid as-is.
2021-02-11 17:59:09 +02:00
Otto Kekäläinen
2405752855 Salsa-CI: Install readline from Buster as it was removed from Sid
The older MariaDB.org packages were built against libreadline5 and depend
on it to install. As it was removed from Sid (and Bullseye), fetch and
install it from Buster.

This can eventually be removed once we stop backwards compat testing for
older MariaDB versions (new ones don't depend on it).

Upstreamed from Debian packaging repository commit
4b729db7f8
2021-02-11 17:59:09 +02:00
Marko Mäkelä
b01d8e1a33 MDEV-20612: Replace lock_sys.mutex with lock_sys.latch
For now, we will acquire the lock_sys.latch only in exclusive mode,
that is, use it as a mutex.

This is preparation for the next commit where we will introduce
a less intrusive alternative, combining a shared lock_sys.latch
with dict_table_t::lock_mutex or a mutex embedded in
lock_sys.rec_hash, lock_sys.prdt_hash, or lock_sys.prdt_page_hash.
2021-02-11 14:52:10 +02:00
Julius Goryavsky
95003eab45 MDEV-19950: Galera test failure on galera_ssl_upgrade
The test requires adaptation for MariaDB, which is done
in this patch. In addition, this patch includes a fix for
the SST script startup code that adds escaping for special
characters on the command line (in case they are contained
in the arguments to mysqld). The fix does not require
separate tests, as the required tests are already part
of the mtr suite for Galera.
2021-02-11 13:44:01 +01:00
Marko Mäkelä
903464929c MDEV-20612 preparation: LockMutexGuard
Let us use the RAII wrapper LockMutexGuard for most operations where
lock_sys.mutex is acquired.
2021-02-11 14:36:11 +02:00
Marko Mäkelä
2e64513fba MDEV-20612 preparation: Fewer calls to buf_page_t::id() 2021-02-11 12:48:07 +02:00
Igor Babaev
da88e1ec12 MDEV-24840 Crash caused by query with IN subquery containing union
of two table value costructors

This bug affected queries with a [NOT] IN/ANY/ALL subquery whose top level
unit contained several table value constructors.
The problem appeared because the code of the function
Item_subselect::fix_fields() that was responsible for wrapping table
value constructors encountered at the top level unit of a [NOT] IN/ANY/ALL
subquery did not take into account that the chain of the select objects
comprising the unit were not immutable.

Approved by Oleksandr Byelkin <sanja@mariadb.com>
2021-02-10 23:38:52 -08:00
Marko Mäkelä
b19ec8848c Merge 10.5 into 10.6 2021-02-11 09:26:53 +02:00
Jan Lindström
362dcf9e01 Update Galera disabled.def 2021-02-11 08:02:24 +02:00
Daniel Black
c7edbe5bb1 MDEV-24366: s3 test postfix - use default for S3_BUCKET
and S3_HOST_NAME.

Required environment variables are now S3_ACCESS_KEY and S3_SECRET_KEY.

Or a running minio instance on localhost:9000.
2021-02-11 12:51:29 +11:00