Commit graph

189983 commits

Author SHA1 Message Date
Monty
d1bb7f9143 Fixed memory leak in item_sum.cc::report_cut_value_error()
Only affects DBUG builds
2020-06-24 12:51:55 +03:00
Vincent Milum Jr
d09dd5e86c Exclude needs to be on receiving side too
Exclude needs to be on receiving side too

It is possible that other excludes may need to be added to the receiving side too that exist on the sending side.
2020-06-24 08:05:54 +03:00
Vincent Milum Jr
89c3b087a3 MDEV-21709 ZFS snapdir=visible breaks Galera rsync SST replcation
Fix for Galera rsync SST with the specific conditions listed in MDEV-21709
2020-06-24 08:05:54 +03:00
Eugene Kosov
dbe15e9e5a MDEV-19749 MDL scalability regression after backup locks
MDL_lock::Ticket_list::remove_ticket(): reduce algoritmic
complexity from O(N) to O(1)

MDL_lock::Ticket_list::clear_bit_if_not_in_list(): removed

MDL_lock::Ticket_list::m_type_counters: a map of ticket type
to count. Initialization is memset(0) which takes time.
2020-06-23 23:34:54 +03:00
Eugene Kosov
d712956526 MDEV-19749 MDL scalability regression after backup locks
use ilist instread of I_P_List because it's generally
slightly faster on inserting, removing and iterating
2020-06-23 23:34:42 +03:00
Eugene Kosov
e9c389c334 MDEV-22701 InnoDB: encapsulate trx_sys.mutex and trx_sys.trx_list into a separate class
thread_safe_trx_ilist_t: almost generic one

UT_LIST was replaced with ilist<t>

innobase_kill_query: wrong comment removed.
2020-06-23 19:11:57 +03:00
Varun Gupta
ead98fe5d3 Fixing a test 2020-06-22 23:40:56 +05:30
Andrei Elkin
127ed74fd2 MDEV-22420 DDL on temporary object is prohibited when XA is in prepare state
The parser must reject DDL operations on temporary objects when
they may modify or alter such object, including temporary tables and sequences.
The rejection is regardless (has been already in place for bin-loggable DML:s)
of the binlogging capability of the server or connection.

The patch implements the requirement. A binlog test is added.
2020-06-22 20:18:50 +03:00
Varun Gupta
545a6194e8 MDEV-22187: SIGSEGV in ha_innobase::cmp_ref on DELETE
Added a new test file for tests with delete using INNODB.
2020-06-22 20:23:43 +05:30
Sergei Petrunia
9160e4aa95 Post-fix for 0a9633ee: Basic LEX::print function that supports UPDATEs
Backport this fix:
CLX-105: UPDATE query causes crash

LEX::print() should not crash when the UPDATE has no WHERE clause

Fixes CLX-373.
2020-06-19 22:04:02 +03:00
Thirunarayanan Balathandayuthapani
572e53d8cc MDEV-22931 mtr_t::mtr_t() allocates some memory
mtr_t::m_freed_pages: Renamed from m_freed_ranges and made it as
pointer indirection.

mtr_t::add_freed_offset(): Allocates m_freed_pages.

mtr_t:clear_freed_ranges(): Removed.

mtr_t::init(): Added debug assertion to check whether m_freed_pages
is not yet initialized.

btr_page_alloc_low(): Remove #ifdef UNIV_DEBUG_SCRUBBING.

mtr_t::commit(): Delete m_freed_pages, reset m_trim_pages and
m_freed_in_system_tablespace.

fil_space_t::clear_freed_ranges(): Added a comment to explain how
undo log tablespaces uses it.
2020-06-19 21:12:13 +05:30
Julius Goryavsky
451bd32600 MDEV-22922: galera_ftwrl_drain test failed
A new state has been added to the wait condition,
which eliminates the error during the test.
2020-06-19 17:20:36 +02:00
Oleksandr Byelkin
e9f62228ab Server maturity increased 2020-06-19 16:25:59 +02:00
Marko Mäkelä
e341fb0dae MDEV-22871 follow-up fix: AHI corruption & leak
Commit bf3c862faa
accidentally introduced two bugs.

btr_search_update_hash_ref(): Pass the correct parameter part->heap.

btr_search_sys_t::free(): Free all memory.

Thanks to Michael Widenius and Thirunarayanan Balathandayuthapani
for pointing out these bugs.
2020-06-19 12:34:21 +03:00
Oleksandr Byelkin
4243785f28 MDEV-20302 Server hangs upon concurrent SELECT from partitioned S3
Second attempt to fix same bug:

Use the same queue for all READ operations.
Release queues for all used pages.

This fixes a hang in the s3.alter2 test case
2020-06-19 12:03:13 +03:00
Monty
60f08dd555 MDEV-22925 ALTER TABLE s3_table ENGINE=Aria can cause failure on slave
When converting a table (test.s3_table) from S3 to another engine, the
following will be logged to the binary log:

DROP TABLE IF EXISTS test.t1;
CREATE OR REPLACE TABLE test.t1 (...) ENGINE=new_engine
INSERT rows to test.t1 in binary-row-log-format

The bug is that the above statements are logged one by one to the binary
log. This means that a fast slave, configured to use the same S3 storage
as the master, would be able to execute the DROP and CREATE from the
binary log before the master has finished the ALTER TABLE.
In this case the slave would ignore the DROP (as it's on a S3 table) but
it will stop on CREATE of the local tale, as the table is still exists in
S3. The REPLACE part will be ignored by the slave as it can't touch the
S3 table.

The fix is to ensure that all the above statements is written to binary
log AFTER the table has been deleted from S3.
2020-06-19 12:03:13 +03:00
Monty
6a0c05b761 Fixed bugs in s3 test cases 2020-06-19 12:03:13 +03:00
Monty
00bd52b147 Added THD::binlog_table_should_be_logged() to simplify some code
- Added missing test for binlog_filter to ALTER TABLE
2020-06-19 12:03:13 +03:00
Monty
1a49c5eb4d Cleanup's and more DBUG_PRINT's
- Rewrote bool Query_compressed_log_event::write() to make it more readable
  (no logic changes).
- Changed DBUG_PRINT of 'is_error:' to 'is_error():' to make it easier to
  find error: in traces.
- Ensure that 'db' is never null in Query_log_event (Simplified code).
2020-06-19 12:03:13 +03:00
Vladislav Vaintroub
605555fc31 Windows, compiling - use /diagnostics:caret flag, for better diagnostics 2020-06-19 00:09:36 +02:00
Vladislav Vaintroub
98333883ee MDEV-22933 - remove ---source include/not_threadpool.inc from tests 2020-06-18 23:12:54 +02:00
Daniel Black
b2feb03001 INSTALL_UNIX_ADDRDIR for debian to /run/mysqld/mysqld.sock 2020-06-18 20:19:50 +03:00
Marko Mäkelä
5155a300fa MDEV-22871: Reduce InnoDB buf_pool.page_hash contention
The rw_lock_s_lock() calls for the buf_pool.page_hash became a
clear bottleneck after MDEV-15053 reduced the contention on
buf_pool.mutex. We will replace that use of rw_lock_t with a
special implementation that is optimized for memory bus traffic.

The hash_table_locks instrumentation will be removed.

buf_pool_t::page_hash: Use a special implementation whose API is
compatible with hash_table_t, and store the custom rw-locks
directly in buf_pool.page_hash.array, intentionally sharing
cache lines with the hash table pointers.

rw_lock: A low-level rw-lock implementation based on std::atomic<uint32_t>
where read_trylock() becomes a simple fetch_add(1).

buf_pool_t::page_hash_latch: The special of rw_lock for the page_hash.

buf_pool_t::page_hash_latch::read_lock(): Assert that buf_pool.mutex
is not being held by the caller.

buf_pool_t::page_hash_latch::write_lock() may be called while not holding
buf_pool.mutex. buf_pool_t::watch_set() is such a caller.

buf_pool_t::page_hash_latch::read_lock_wait(),
page_hash_latch::write_lock_wait(): The spin loops.
These will obey the global parameters innodb_sync_spin_loops and
innodb_sync_spin_wait_delay.

buf_pool_t::freed_page_hash: A singly linked list of copies of
buf_pool.page_hash that ever existed. The fact that we never
free any buf_pool.page_hash.array guarantees that all
page_hash_latch that ever existed will remain valid until shutdown.

buf_pool_t::resize_hash(): Replaces buf_pool_resize_hash().
Prepend a shallow copy of the old page_hash to freed_page_hash.

buf_pool_t::page_hash_table::n_cells: Declare as Atomic_relaxed.

buf_pool_t::page_hash_table::lock(): Explain what prevents a
race condition with buf_pool_t::resize_hash().
2020-06-18 14:16:01 +03:00
Marko Mäkelä
cfd3d70ccb MDEV-22871: Remove pointer indirection for InnoDB hash_table_t
hash_get_n_cells(): Remove. Access n_cells directly.

hash_get_nth_cell(): Remove. Access array directly.

hash_table_clear(): Replaced with hash_table_t::clear().

hash_table_create(), hash_table_free(): Remove.

hash0hash.cc: Remove.
2020-06-18 14:16:01 +03:00
Marko Mäkelä
bf3c862faa MDEV-22871: Clean up btr_search_sys
btr_search_sys::parts[]: A single structure for the partitions of
the adaptive hash index. Replaces the 3 separate arrays:
btr_search_latches[], btr_search_sys->hash_tables,
btr_search_sys->hash_tables[i]->heap.

hash_table_t::heap, hash_table_t::adaptive: Remove.

ha0ha.cc: Remove. Move all code to btr0sea.cc.
2020-06-18 14:16:01 +03:00
Marko Mäkelä
9159b8976f MDEV-22871: Clean up hash_table_t
HASH_TABLE_SYNC_MUTEX was kind-of used for the adaptive hash index,
even though that hash table is already protected by btr_search_latches[].

HASH_TABLE_SYNC_RWLOCK was only being used for buf_pool.page_hash.
It is cleaner to decouple that synchronization from hash_table_t,
and move it to the actual user.

buf_pool_t::page_hash_latches[]: Synchronization for buf_pool.page_hash.

LATCH_ID_HASH_TABLE_MUTEX: Remove.

hash_table_t::sync_obj, hash_table_t::n_sync_obj: Remove.

hash_table_t::type, hash_table_sync_t: Remove.

HASH_ASSERT_OWN(), hash_get_mutex(), hash_get_nth_mutex(): Remove.

ib_recreate(): Merge to the only caller, buf_pool_resize_hash().

ib_create(): Merge to the callers.

ha_clear(): Merge to the only caller buf_pool_t::close().

buf_pool_t::create(): Merge the ib_create() and
hash_create_sync_obj() invocations.

ha_insert_for_fold_func(): Clarify an assertion.

buf_pool_t::page_hash_lock(): Simplify the logic.

hash_assert_can_search(), hash_assert_can_modify(): Remove.
These predicates were only being invoked for the adaptive hash index,
while they only are effective for buf_pool.page_hash.

HASH_DELETE_AND_COMPACT(): Merge to ha_delete_hash_node().

hash_get_sync_obj_index(): Remove.

hash_table_t::heaps[], hash_get_nth_heap(): Remove. It was actually unused!

hash_get_heap(): Remove. It was only used in ha_delete_hash_node(),
where we always use hash_table_t::heap.

hash_table_t::calc_hash(): Replaces hash_calc_hash().
2020-06-18 14:16:01 +03:00
Daniel Black
08f6513cb2 libutils: merge_archives_unix
MRI scripts cannot handle + in paths, and ubuntu CI makes use of
these.

So we remove the top level build dir from the script and
transform it into a relative path script.
2020-06-18 14:15:36 +03:00
Daniel Black
38774f8dcb libutils: merge static libraries only once
Because of common dependencies between the
static libraries list can contain duplicates.

We reduce these down to the single last one in
the list.

This reduces the relative time of a rebuild from:

$ (cd builddir/; time make -j)
...
real	0m30.789s
user	1m33.477s
sys	0m19.678s

and the LIB entries
$ grep ADDLIB builddir/libmysqld/mysqlserver-\$\<CONFIG\>.mri.tpl  | wc -l
179

$ du -h builddir/libmysqld/libmariadbd.a
4.1G	builddir/libmysqld/libmariadbd.a

To:

$ (cd builddir/; time make -j)
...
real	0m20.139s
user	1m32.423s
sys	0m12.208s

$ grep ADDLIB builddir/libmysqld/mysqlserver-\$\<CONFIG\>.mri.tpl  | wc -l
25

$ du -h builddir/libmysqld/libmariadbd.a
688M	builddir/libmysqld/libmariadbd.a
2020-06-18 14:10:57 +03:00
Marko Mäkelä
c515b1d092 Merge 10.4 into 10.5 2020-06-18 13:58:54 +03:00
Vlad Lesin
205b0ce6ad MDEV-22894: Mariabackup should not read [mariadb-client] option group
from configuration files
2020-06-18 12:19:48 +03:00
Vlad Lesin
0121a9e0bb MDEV-18215: mariabackup does not report unknown command line options
Post-push fix: add mysqd options in backup string in mariabackup sst
script for the case of logging not in syslog.
2020-06-18 12:19:48 +03:00
Marko Mäkelä
01ed614027 Fix the test mariabackup.mdev-14447
The test mariabackup.mdev-14447 started failing due to the option
--apply-log-only that became invalid since
commit 9bdf35e90f
and had been removed in
commit 8c71c6aa8b.
2020-06-18 12:13:31 +03:00
Sergei Golubchik
baff3ba6e3 S3 compilation error on x86 2020-06-18 09:44:05 +02:00
Sergei Golubchik
7c0cf20444 update libmarias3 2020-06-18 09:44:05 +02:00
Sergei Golubchik
7bb32cda05 more "removed" mysqld command-line options
and put them all together in mysqld.cc
2020-06-18 09:44:05 +02:00
Vladislav Vaintroub
083a344760 Fix error in cmake, when trying gcc on Windows. 2020-06-18 00:57:23 +02:00
Vladislav Vaintroub
e54723fa34 When compiling with RelWithDebInfo, always use -fno-omit-frame-pointer
(if this option is present). perf, and other tools that do stack walking
works much better with it.
2020-06-18 00:55:11 +02:00
Thirunarayanan Balathandayuthapani
d33c9ca1b0 MDEV-22902 Assertion `!page_has_siblings(block->frame)' failed in btr_pcur_store_position
- There is a possiblity that metadata record is the only record in
the leftmost leaf page. So change the assertion to check only
previous page.
2020-06-17 22:09:16 +05:30
Sergei Petrunia
b7324e133f Remove redundant code in opt_range.cc: print_key_value() 2020-06-17 19:30:19 +03:00
Thirunarayanan Balathandayuthapani
815fc98732 MDEV-22904 Compressed row format table tries to access freed blob
- This is a regression of MDEV-21174(56f6dab1d0).
InnoDB resets the BTR_EXTERN_LEN value at wrong offset.
2020-06-17 21:04:18 +05:30
Alexey Yurchenko
471d7a9762 Fix include statements in galera_ipv6_mariabackup_section and
galera_ipv6_mariabackup MTR tests
2020-06-17 13:31:46 +03:00
MikkoJaakola
beb1918354 MDEV-21759 galera.galera_parallel_autoinc_manytrx sporadic failures.
The galera.galera_parallel_autoinc_manytrx mtr test opens and runs test
scenario through 3 connections to node 1 and one connection to node 2.
In the test initialization phase, the test creates two tables 't1' and 'ten'
and then creates a stored procedure 'p1' to operate on these tables.
These 3 create DDL statements are issued through same connection to node 1.

In the next test phase, the mtr script uses send command to launch the call
for the p1 stored procedure through all 3 connections to node 1 and through
one connection to node 2. As the mtr send command is asynchronous,
this test phase is non blocking and fast operation.
Now, if the replication between nodes is slow, it may happen that the
initialization phase DDL statements have not been received or have not been
fully applied in node 2. Therefore there is no guarantee that the test tables
and the stored procedure have been created in node 2. Yet, the test is trying
to call p1 in node 2.

In the failure case error logs, there is error message
"MTR failed: query 'reap' failed: 1305: PROCEDURE test.p1 does not exist"

The reap command through connection to node 2, is the first place where test
execution may observe that test tables and/or stored procedure are not yet
created in node 2.

The fix in this commit adds a wait condition in connection to node 2, to wait
until the stored procedure is created before calling the stored procedure.
The wait is implemented by looking in information_schema.routines for the p1
stored procedure.
2020-06-17 13:31:37 +03:00
Jan Lindström
8655d4a202 Add global ignore for Sending JOIN failed warning. 2020-06-17 13:04:15 +03:00
Jan Lindström
bf039b9127 MDEV-22125 : galera.galera_drop_multi MTR failed: InnoDB: MySQL is trying to drop database fts.`` though there are still open handles
MDEV-22140 galera.galera_drop_database MTR failed: InnoDB: MySQL is trying to drop database `fts`.`` though there are still open handles

Add wait conditions to wait that all operations are done in both
nodes.
2020-06-17 12:58:33 +03:00
Vladislav Vaintroub
9c577c2b90 MDEV-22917 wolfssl might crash at startup when both SSL and encryption plugin are enabled
Make sure to initialize SSL early enough, when encryption plugins is loaded
2020-06-17 08:35:03 +02:00
Krunal Bauskar
a0d598a4d2 MDEV-22794: Avoid potential rollback segment contention with
increased scalability through even distribution

Rollback segments are allocated to transactions in round-robin fashion.
This is controlled by incrementing a static-scope counter named rseg_slot.

Said logic is not protected by any mutex or use of atomic for the counter.
This potentially can cause the same rollback segment to get allocated to
N different transactions (requesting allocation at the same time).
While this is not an issue as a rollback segment can host multiple
transactions from contention (performance) perspective it is better to
allocate these rollback segments in round-robin fashion.

Fix for the said issue ports use of atomic for the said counter that would
ensure the original design semantic (even distribution through round-robin)
is retained.
2020-06-17 09:12:56 +03:00
Sachin
592a10d079 MDEV-22370 safe_mutex: Trying to lock uninitialized mutex at /data/src/10.4-bug/sql/rpl_parallel.cc, line 470 upon shutdown during FTWRL
Problem:- When we issue FTWRL with shutdown in parallel, there is race between
FTWRL and shutdown. Shutdown might destroy the mutex (pool->LOCK_rpl_thread_pool)
before FTWRL can lock it. So we can get crash on FTWRL thread

Solution:- mysql_mutex_destroy(pool->LOCK_rpl_thread_pool) should wait for
FTWRL thread to complete its work , and then destroy.
So slave_prepare_for_shutdown will just deactivate the pool, and mutex is destroyed
later in end_slave()
2020-06-17 02:22:46 +05:30
MikkoJaakola
0128e13e62 MDEV-21759 galera.galera_parallel_autoinc_manytrx sporadic failures.
The galera.galera_parallel_autoinc_manytrx mtr test opens and runs test
scenario through 3 connections to node 1 and one connection to node 2.
In the test initialization phase, the test creates two tables 't1' and 'ten'
and then creates a stored procedure 'p1' to operate on these tables.
These 3 create DDL statements are issued through same connection to node 1.

In the next test phase, the mtr script uses send command to launch the call
for the p1 stored procedure through all 3 connections to node 1 and through
one connection to node 2. As the mtr send command is asynchronous,
this test phase is non blocking and fast operation.
Now, if the replication between nodes is slow, it may happen that the
initialization phase DDL statements have not been received or have not been
fully applied in node 2. Therefore there is no guarantee that the test tables
and the stored procedure have been created in node 2. Yet, the test is trying
to call p1 in node 2.

In the failure case error logs, there is error message
"MTR failed: query 'reap' failed: 1305: PROCEDURE test.p1 does not exist"

The reap command through connection to node 2, is the first place where test
execution may observe that test tables and/or stored procedure are not yet
created in node 2.

The fix in this commit adds a wait condition in connection to node 2, to wait
until the stored procedure is created before calling the stored procedure.
The wait is implemented by looking in information_schema.routines for the p1
stored procedure.
2020-06-16 11:43:31 +03:00
Alexey Yurchenko
49ac606a75 Fix include statements in galera_ipv6_mariabackup_section and
galera_ipv6_mariabackup MTR tests
2020-06-15 12:53:16 +03:00
Vlad Lesin
9bdf35e90f MDEV-18215: mariabackup does not report unknown command line options
MDEV-21298: mariabackup doesn't read from the [mariadbd] and [mariadbd-X.Y]
server option groups from configuration files
MDEV-21301: mariabackup doesn't read [mariadb-backup] option group in
configuration file

All three issues require to change the same code, that is why their
fixes are joined in one commit.

The fix is in invoking load_defaults_or_exit() and handle_options() for
backup-specific groups separately from client-server groups to let the last
handle_options() call fail on unknown backup-specific options.

The order of options procesing is the following:
1) Load server groups and process server options, ignore unknown
options
2) Load client groups and process client options, ignore unknown
options
3) Load backup groups and process client-server options, exit on
unknown option
4) Process --mysqld-args command line options, ignore unknown options

New global flag my_handle_options_init_variables was added to have
ability to invoke handle_options() for the same allowed options set
several times without re-initialising previously set option values.

--password value destroying is moved from option processing callback to
mariabackup's handle_options() function to have ability to invoke server's
handle_options() several times for the same possible allowed options
set.

Galera invokes wsrep_sst_mariabackup.sh with mysqld command line
options to configure mariabackup as close to the server as possible.
It is not known what server options are supported by mariabackup when the
script is invoked. That is why new mariabackup option "--mysqld-args" is added,
all unknown options that follow this option will be silently ignored.

wsrep_sst_mariabackup.sh was also changed to:
- use "--mysqld-args" mariabackup option to pass mysqld options,
- remove deprecated innobackupex mode,
- remove unsupported mariabackup options:
    --encrypt
    --encrypt-key
    --rebuild-indexes
    --rebuild-threads
2020-06-14 13:23:07 +03:00