Commit graph

191360 commits

Author SHA1 Message Date
Otto Kekäläinen
ff36394ccc Deb: Correct documentation about systemd using debian-start
The mariadb.service systemd file indeed does contain:
  ExecStartPost=/etc/mysql/debian-start

So don't claim it does not use debian-start.

Upstreamed from af869e7030
2021-01-03 21:14:32 +02:00
Otto Kekäläinen
16876e47d8 Deb: Unify config file syntax style
- no space after comment
- align equal signs in groups

Upstreamed from: a8c67e15c9
2021-01-03 21:14:32 +02:00
Marko Mäkelä
1bf9acceef MDEV-20386: Allow RDRAND, RDSEED WITH_MSAN
Let us use Intel intrinsic functions in WolfSSL whenever possible.
This allows such code to be compiled WITH_MSAN.
2021-01-01 19:17:03 +02:00
Marko Mäkelä
c1f0afb102 WolfSSL v4.6.0-stable 2021-01-01 19:15:46 +02:00
Otto Kekäläinen
139c85aafd Travis-CI: Optimize rate of false negatives vs true failures
Move 'encryption' tests to another job, since the 'binlog' and 'rpl'
tests are so slow and often make the job timeout (after 50 minutes).

Allow failure in ppc64el as it frequently fails due to out-of-memory.
A simple restart often fixes it, but we can't depend on restarts.

Also re-enable arm64 as MDEV-23955 is now fixed.

MERGING: This commit is OK to merge 10.6 and upwards.
2020-12-26 12:14:12 +02:00
Otto Kekäläinen
7a60bc22fc Deb: Remove PLUGIN_COLUMNSTORE=YES, it will build by default anyway
If PLUGIN_COLUMNSTORE is not defined, ColumnStore will build automatically
by default on supported architectures as defined in its CMakeFile.txt.

Thus there should not be any need to inject this build flag at any point
and it can be removed to keep thing lean and clean.
2020-12-23 15:17:49 +02:00
Otto Kekäläinen
deecc75a02 Fix commit 113f18686d and d180909796: PLUGIN_COLUMNSTORE=NO by default
ColumnStore seems to build by default, so it must be explicitly disabled
with a build flag, so that it does not build at all and thus build machine
disk space and CPU will be spared.

This reverts commit 113f18686d.
2020-12-23 15:17:49 +02:00
Marko Mäkelä
b6be78d4e5 Merge 10.4 into 10.5 2020-12-23 15:07:36 +02:00
Aleksey Midenkov
ed5d675c75 MDEV-24364 Alter rename table does not remove PFS share
Add missed PSI_CALL_drop_table_share().
2020-12-22 16:42:33 +03:00
Otto Kekäläinen
113f18686d Fix previous commit: PLUGIN_COLUMNSTORE=YES can only be active on amd64
Refactor previous commit to fix mistake revealed by Buildbot. We can't
have a structure where PLUGIN_COLUMNSTORE would ever be 'YES' on an arch
that does not support it, as the flag overrides any potential platform
detection code and builds on non-amd64 would all fail.
2020-12-21 23:20:56 +02:00
Otto Kekäläinen
ecb1b8721b Salsa-CI: Copy most of Salsa-CI from Debian 10.5
- Use new Salsa-CI templates just like downstream does
- Also apply adaptations needed for native MariaDB to
  build correctly on Salsa-CI
- Adapt for mysql-8.0 now in Debian Sid, keep also mysql-5.7 test
- Test TLSv1.3 to ensure it does not regress
- Remove Snappy compression from autopkgtest as it not longer works
2020-12-21 19:03:29 +02:00
Otto Kekäläinen
d180909796 Deb: Don't build ColumnStore in native builds, only in autobake-deb.sh
ColumnStore files and debian/control stanza was removed in 1edd2243, and
thus will not be included in a native build. Also adapt the debian/rules
to follow this same policy and only build ColumnStore in builds triggered
from autobake-deb.sh. Avoiding building ColumnStore in vain saves a lot of
build time and disk space.
2020-12-21 19:03:29 +02:00
Otto Kekäläinen
e7c7f5c1bb Deb: Run 'wrap-and-sort -av' to debian/ contents is easier to compare
Maintaining the same deterministic file order in both upstream (this) and
downstream (Debian) repositories makes it easier to compare the delta.
2020-12-21 19:03:29 +02:00
Marko Mäkelä
39378e1366 MDEV-24448 srv_start(): Assertion !buf_pool.any_io_pending()
We are seeing !buf_pool.any_io_pending() assertion failures
in srv_start() ever since MDEV-21452 in 10.6. But, the
problem appears to be older. In 10.5 since MDEV-19514 removed
writes from the precursor of buf_page_read_complete(), it
seems that the debug assertion failure could have been harmless.

recv_sys_t::apply(): At the end of each batch, wait not only
for all log records to have been processed, but also for all
pending reads to complete, so that the buffer pool will be in
an idle state.
2020-12-21 18:51:35 +02:00
Sergei Golubchik
6529cba2e2 cleanup: plugin.cmake
list all supported options in the comment.
remove wsrep-specific hack of EXPORT_SYMBOLS, wsrep-specific hacks
belong to wsrep
2020-12-21 14:04:32 +01:00
Sergei Golubchik
4fae7b7a3e MDEV-24346 valgrind error in main.precedence
Reverts 10.5 commit 6033cc8587
The fix a587ded283 will be merged from 10.2
2020-12-21 14:04:32 +01:00
Sergei Golubchik
5b90970e87 increase INET6 plugin maturity 2020-12-21 14:04:31 +01:00
Sergei Golubchik
b5174eca7b cleanup: DBUG_ASSERT && log.cc 2020-12-21 14:04:31 +01:00
Marko Mäkelä
e87a8efd32 MDEV-24455 Assertion `!m_freed_space' failed in mtr_t::start
In commit 0c23e32d27 (MDEV-24445)
we forgot to keep m_freed_space in sync with m_freed_pages in one case.
2020-12-21 10:48:51 +02:00
Marko Mäkelä
0c23e32d27 MDEV-24445 Using innodb_undo_tablespaces corrupts system tablespace
In the rewrite of MDEV-8139 (based on MDEV-15528), we introduced a
wrong assumption that any persistent tablespace that is not an .ibd
file is the system tablespace. This assumption is broken when
innodb_undo_tablespaces (files undo001, undo002, ...) are being used.
By default, we have innodb_undo_tablespaces=0 (the persistent undo
log is being stored in the system tablespace).

In MDEV-15528 and MDEV-8139 we rewrote the page scrubbing logic
so that it will follow the tried-and-true write-ahead logging
protocol, first writing FREE_PAGE records and then in the page
flushing, zerofilling or hole-punching freed pages.

Unfortunately, the implementation included a wrong assumption that
that anything that is not in an .ibd file must be the system tablespace.
This wrong assumption would cause overwrites of valid data pages in
the system tablespace.

mtr_t::m_freed_in_system_tablespace: Remove.

mtr_t::m_freed_space: The tablespace associated with m_freed_pages.

buf_page_free(): Take the tablespace and page number as a parameter,
instead of taking a page identifier.
2020-12-18 19:23:34 +02:00
Marko Mäkelä
cd093d79f9 MDEV-24442 Assertion space->referenced() failed in fil_crypt_space_needs_rotation
A race condition between deleting an .ibd file and fil_crypt_thread
marking pages dirty was introduced in
commit 118e258aaa (part of MDEV-23855).

fil_space_t::acquire_if_not_stopped(): Correctly return false
if the STOPPING flag is set, indicating that any further activity
on the tablespace must be avoided. Also, remove the constant parameter
have_mutex=true and move the function declaration to the same
compilation unit with the only callers.

fil_crypt_flush_space(): Remove an unused variable.
2020-12-18 16:53:45 +02:00
Marko Mäkelä
a1974d1991 MDEV-24426 fixup: Assertion failure on shutdown
fil_crypt_find_space_to_rotate(): Always treat the sentinel value
that indicates that we have run out of work, even if at the same
time the thread should shut down due to other reasons.

Thanks to Matthias Leich for reproducing this bug with RQG.
2020-12-18 10:00:57 +02:00
Marko Mäkelä
1fe3dd003a MDEV-24426 fil_crypt_thread keep spinning even if innodb_encryption_rotate_key_age=0
After MDEV-15528, two modes of operation in the fil_crypt_thread
remains, depending on whether innodb_encryption_rotate_key_age=0
(whether key rotation is disabled). If the key rotation is disabled,
the fil_crypt_thread miss the opportunity to sleep, which will result
in lots of wasted CPU usage.

fil_crypt_return_iops(): Add a parameter to specify whether other
fil_crypt_thread should be woken up.

fil_system_t::keyrotate_next(): Return the special value
fil_system.temp_space to indicate that no work is to be done.

fil_space_t::next(): Propagage the special value fil_system.temp_space
to the caller.

fil_crypt_find_space_to_rotate(): If no work is to be done,
do not wake up other threads.
2020-12-17 13:46:21 +02:00
Etienne Guesnet
6bb3949eb3 Contain AIX perror 2020-12-16 08:07:04 +11:00
Etienne Guesnet
2ce48f0678 Fix build on GCC 5 2020-12-16 08:07:04 +11:00
Etienne Guesnet
a6e90992c1 Add LARGE_FILES flag for GCC AIX build 2020-12-16 08:07:04 +11:00
Etienne Guesnet
4fade4da6c Add -berok for head test on AIX 2020-12-16 08:07:04 +11:00
Etienne Guesnet
2dee6a74b2 Parse GSSAPI flags on AIX 2020-12-16 08:07:04 +11:00
Etienne Guesnet
1d7fc7280e Add flags for AIX build 2020-12-16 08:07:04 +11:00
Etienne Guesnet
b23e545773 Remove -Werror for AIX 2020-12-16 08:07:04 +11:00
Etienne Guesnet
1a49619a4c AIX workaround for GCC include bug 2020-12-16 08:07:04 +11:00
Etienne Guesnet
2c7247622a AIX workaround for GCC TOC bug 2020-12-16 08:07:04 +11:00
Etienne Guesnet
77d7de8d47 Support of AIX for auth_socket plugin 2020-12-16 08:07:04 +11:00
Etienne Guesnet
2f5d372444 Add build on AIX 2020-12-16 08:07:04 +11:00
zhaorenhai
ee69c153d9 MDEV-24366 Use environment variables as S3 test case variables
Move the S3 test case variables to suite.pm to use environment variables.

Use minio credentials if a TCP connection to localhost:9000 is accepted
so the current build works corrected.

Reviewer: Daniel Black

closes #1711
2020-12-15 15:39:56 +11:00
Stepan Patryshev
e4c2589517 MDEV-23659 Update Galera disabled.def file 2020-12-14 19:50:45 +02:00
Marko Mäkelä
e8217d070f MDEV-24313 fixup: GCC 8 -Wconversion 2020-12-14 18:01:30 +02:00
Marko Mäkelä
2c226e01a8 MDEV-24313 fixup: GCC -Wparentheses 2020-12-14 17:20:53 +02:00
Marko Mäkelä
f24b738318 MDEV-24313 (2 of 2): Silently ignored innodb_use_native_aio=1
In commit 5e62b6a5e0 (MDEV-16264)
the logic of os_aio_init() was changed so that it will never fail,
but instead automatically disable innodb_use_native_aio (which is
enabled by default) if the io_setup() system call would fail due
to resource limits being exceeded. This is questionable, especially
because falling back to simulated AIO may lead to significantly
reduced performance.

srv_n_file_io_threads, srv_n_read_io_threads, srv_n_write_io_threads:
Change the data type from ulong to uint.

os_aio_init(): Remove the parameters, and actually return an error code.

thread_pool::configure_aio(): Do not silently fall back to simulated AIO.

Reviewed by: Vladislav Vaintroub
2020-12-14 15:27:03 +02:00
Marko Mäkelä
17d3f8560b MDEV-24313 (1 of 2): Hang with innodb_write_io_threads=1
After commit a5a2ef079c (part of MDEV-23855)
implemented asynchronous doublewrite, it is possible that the server will
hang when the following parametes are in effect:

    innodb_doublewrite=1 (default)
    innodb_write_io_threads=1
    innodb_use_native_aio=0

Note: In commit 5e62b6a5e0 (MDEV-16264)
the logic of os_aio_init() was changed so that it will never fail,
but instead automatically disable innodb_use_native_aio (which is
enabled by default) if the io_setup() system call would fail due
to resource limits being exceeded.

Before commit a5a2ef079c, we used
a synchronous write for the doublewrite buffer batches, always at
most 64 pages at a time. So, upon completing a doublewrite batch,
a single thread would submit at most 64 page writes (for the
individual pages that were first written to the doublewrite buffer).
With that commit, we may submit up to 128 page writes at a time.

The maximum number of outstanding requests per thread is 256.
Because the maximum number of asynchronous write submissions per
thread was roughly doubled, it is now possible that
buf_dblwr_t::flush_buffered_writes_completed() will hang in
io_slots::acquire(), called via os_aio() and fil_space_t::io(),
when submitting writes of the individual blocks.

We will prevent this type of hang by increasing the minimum number
of innodb_write_io_threads from 1 to 2, so that this type of hang
would only become possible when 512 outstanding write requests
are exceeded.
2020-12-14 13:11:44 +02:00
Marko Mäkelä
8677c14e65 MDEV-24391 heap-use-after-free in fil_space_t::flush_low()
We observed a race condition that involved two threads
executing fil_flush_file_spaces() and one thread
executing fil_delete_tablespace(). After one of the
fil_flush_file_spaces() observed that
space.needs_flush_not_stopping() is set and was
releasing the fil_system.mutex, the other fil_flush_file_spaces()
would complete the execution of fil_space_t::flush_low() on
the same tablespace. Then, fil_delete_tablespace() would
destroy the object, because the value of fil_space_t::n_pending
did not prevent that. Finally, the fil_flush_file_spaces() would
resume execution and invoke fil_space_t::flush_low() on the freed
object.

This race condition was introduced in
commit 118e258aaa of MDEV-23855.

fil_space_t::flush(): Add a template parameter that indicates
whether the caller is holding a reference to prevent the
tablespace from being freed.

buf_dblwr_t::flush_buffered_writes_completed(),
row_quiesce_table_start(): Acquire a reference for the duration
of the fil_space_t::flush_low() operation. It should be impossible
for the object to be freed in these code paths, but we want to
satisfy the debug assertions.

fil_space_t::flush_low(): Do not increment or decrement the
reference count, but instead assert that the caller is holding
a reference.

fil_space_extend_must_retry(), fil_flush_file_spaces():
Acquire a reference before releasing fil_system.mutex.
This is what will fix the race condition.
2020-12-11 09:05:26 +02:00
Marko Mäkelä
0c7c449267 Remove unused DBUG_EXECUTE_IF "ignore_punch_hole"
Since commit ea21d630be we
conditionally define a variable that only plays a role on
systems that support hole-punching (explicit creation of sparse files).
However, that broke debug builds on such systems.

It turns out that the debug_dbug label "ignore_punch_hole" is
not at all used in MariaDB server. It would be covered by
the MySQL 5.7 test innodb.table_compress. (Note: MariaDB 10.1
implemented page_compressed tables before something comparable
appeared in MySQL 5.7.)
2020-12-09 16:49:52 +02:00
Marko Mäkelä
5eb539555b MDEV-12227 Defer writes to the InnoDB temporary tablespace
The flushing of the InnoDB temporary tablespace is unnecessarily
tied to the write-ahead redo logging and redo log checkpoints,
which must be tied to the page writes of persistent tablespaces.

Let us simply omit any pages of temporary tables from buf_pool.flush_list.
In this way, log checkpoints will never incur any 'collateral damage' of
writing out unmodified changes for temporary tables.

After this change, pages of the temporary tablespace can only be written
out by buf_flush_lists(n_pages,0) as part of LRU eviction. Hopefully,
most of the time, that code will never be executed, and instead, the
temporary pages will be evicted by buf_release_freed_page() without
ever being written back to the temporary tablespace file.

This should improve the efficiency of the checkpoint flushing and
the buf_flush_page_cleaner thread.

Reviewed by: Vladislav Vaintroub
2020-12-09 09:22:13 +02:00
Marko Mäkelä
ea21d630be Fix -Wunused-but-set-variable 2020-12-08 19:07:36 +02:00
Marko Mäkelä
f0c295e2de MDEV-24369 Page cleaner sleeps despite innodb_max_dirty_pages_pct_lwm being exceeded
MDEV-24278 improved the page cleaner so that it will no longer wake up
once per second on an idle server. However, with innodb_adaptive_flushing
(the default) the function page_cleaner_flush_pages_recommendation()
could initially return 0 even if there is work to do.

af_get_pct_for_dirty(): Remove. Based on a comment here, it appears
that an initial intention of innodb_max_dirty_pages_pct_lwm=0.0
(the default value) was to disable something. That ceased to hold in
MDEV-23855: the value is a pure threshold; the page cleaner will not
perform any work unless the threshold is exceeded.

page_cleaner_flush_pages_recommendation(): Add the parameter dirty_blocks
to ensure that buf_pool.flush_list will eventually be emptied.
2020-12-08 19:07:36 +02:00
Sergei Petrunia
6859e80df7 MDEV-24351: S3, same-backend replication: Dropping a table on master...
..causes error on slave.
Cause: if the master doesn't have the frm file for the table,
DROP TABLE code will call ha_delete_table_force() to drop the table
in all available storage engines.
The issue was that this code path didn't check for
HTON_TABLE_MAY_NOT_EXIST_ON_SLAVE flag for the storage engine,
and so did not add "... IF EXISTS" to the statement that's written
to the binary log.  This can cause error on the slave when it tries to
drop a table that's already gone.
2020-12-08 17:58:22 +03:00
Vladislav Vaintroub
3ee24b2306 Simplify clang workarounds. 2020-12-07 10:35:57 +01:00
Marko Mäkelä
83591a23d6 MDEV-24350 buf_dblwr unnecessarily uses memory-intensive srv_stats counters
The counters in srv_stats use std::atomic and multiple cache lines per
counter. This is an overkill in a case where a critical section already
exists in the code. A regular variable will work just fine, with much
smaller memory bus impact.
2020-12-04 17:52:23 +02:00
Marko Mäkelä
aa0e380568 MDEV-24348 InnoDB shutdown hang with innodb_flush_sync=0
This hang was caused by MDEV-23855, and we failed to fix it in
MDEV-24109 (commit 4cbfdeca84).

When buf_flush_ahead() is invoked soon before server shutdown
and the non-default setting innodb_flush_sync=OFF is in effect
and the buffer pool contains dirty pages of temporary tables,
the page cleaner thread may remain in an infinite loop
without completing its work, thus causing the shutdown to hang.

buf_flush_page_cleaner(): If the buffer pool contains no
unmodified persistent pages, ensure that buf_flush_sync_lsn= 0
will be assigned, so that shutdown will proceed.

The test case is not deterministic. On my system, it reproduced
the hang with 95% probability when running multiple instances
of the test in parallel, and 4% when running single-threaded.

Thanks to Eugene Kosov for debugging and testing this.
2020-12-04 14:11:48 +02:00
Monty
6033cc8587 Fixed usage of not initialized memory in LIKE ... ESCAPE
This was noticed wben running "mtr --valgrind main.precedence"

The problem was that Item_func_like::escape could be left unitialized
when used with views combined with UNIONS like in:

create or replace view v1 as select 2 LIKE 1 ESCAPE 3 IN (SELECT 0 UNION SELECT 1), 2 LIKE 1 ESCAPE (3 IN (SELECT 0 UNION SELECT 1)), (2 LIKE 1 ESCAPE 3) IN (SELECT 0 UNION SELECT 1);

The above query causes in fix_escape_item()
escape_item->const_during_execution() to be true
and
escape_item->const_item() to be false

in which case 'escape' is never calculated.

The fix is to make the main logic of fix_escape_item() out to a
separate function and call that function once in Item.

Other things:
- Reorganized fields in Item_func_like class to make it more compact
2020-12-03 15:58:19 +02:00