Commit graph

195337 commits

Author SHA1 Message Date
Sergei Golubchik
10d9b890b0 Merge branch '10.8' into 10.9 2022-03-18 11:14:48 +01:00
Sergei Golubchik
5c11e7eead update test results 2022-03-18 09:47:58 +01:00
Sergei Golubchik
df2a8d728c Merge branch '10.8' into 10.9 2022-03-17 14:38:35 +01:00
Sergei Golubchik
9aea73f74f Merge branch '10.7' into 10.8 2022-03-17 12:18:40 +01:00
Sergei Golubchik
bf8dc0be9e fix columnstore compilation after 33c30da165
normally, one has to include my_global.h before
including psi/psi*.h files. ColumnStore cannot do it,
so it needs a workaround.
2022-03-17 12:13:19 +01:00
Marko Mäkelä
c4c8830709 MDEV-28111 Redo log writes are being buffered on Linux for no good reason
In commit 685d958e38 (MDEV-14425)
we ended up not enabling O_DIRECT writes on the redo log
by default, because back then, it was slightly slower on
some systems.

With commit a635c40648 (MDEV-27774)
the situation changed. A new test on a NVMe device shows 9%
improvement in throughput and over 15% reduction of latency
when O_DIRECT writes are enabled.

With this change, all the following settings will use O_DIRECT
on InnoDB data and log files:

innodb_flush_method=O_DIRECT
innodb_flush_method=O_DIRECT_NO_FSYNC
innodb_flush_method=O_DSYNC

Before MDEV-14425, log writes were always buffered on Linux.
Between MDEV-14425 and this change, unbuffered log writes
were only enabled for innodb_flush_method=O_DSYNC.
2022-03-17 12:00:00 +02:00
Marko Mäkelä
9350945023 Merge 10.8 into 10.9 2022-03-17 09:59:37 +02:00
Marko Mäkelä
86820837cb MDEV-28043 fixup: GCC -m32 -Wconversion 2022-03-17 09:40:46 +02:00
Marko Mäkelä
5be92887c2 Merge 10.8 into 10.9 2022-03-16 09:14:11 +02:00
Marko Mäkelä
f7f7a3238e MDEV-28051 Error compiling libmariadb/plugins/compress/c_zstd.c 2022-03-16 09:10:16 +02:00
Marko Mäkelä
00b88376e1 MDEV-27812 fixup: Use log_sys.get_block_size()
The data member log_sys.block_size is only defined in environments
where we can determine the physical block size of a file
(currently, Linux and Microsoft Windows). The accessor function
get_block_size() is available everywhere.

Thanks to Dmitry Shulga for reporting the build failure.
2022-03-16 08:41:56 +02:00
Marko Mäkelä
1ecf173741 Merge 10.8 into 10.9 2022-03-15 18:26:29 +02:00
Marko Mäkelä
9f5a3e5689 Merge 10.7 into 10.8 2022-03-15 18:18:07 +02:00
Marko Mäkelä
dc4b7f382b Merge 10.6 into 10.7 2022-03-15 15:25:31 +02:00
Marko Mäkelä
4ef44cc2f9 Merge 10.5 into 10.6 2022-03-15 14:49:24 +02:00
Marko Mäkelä
73fee39ea6 MDEV-27985 buf_flush_freed_pages() causes InnoDB to hang
buf_flush_freed_pages(): Assert that neither buf_pool.mutex
nor buf_pool.flush_list_mutex are held. Simplify the loops.
Return the tablespace and the number of pages written or punched.

buf_flush_LRU_list_batch(), buf_do_flush_list_batch():
Release buf_pool.mutex before invoking buf_flush_space().

buf_flush_list_space(): Acquire the mutexes only after invoking
buf_flush_freed_pages().

Reviewed by: Thirunarayanan Balathandayuthapani
2022-03-15 14:44:22 +02:00
Marko Mäkelä
de4ec44b4f Fix clang -Wtypedef-redefinition
Include my_global.h before mysql.h so that the latter will not
redefine my_socket and my_ulonglong.

Fixup for commit 77c184df7c
2022-03-15 12:57:39 +02:00
Marko Mäkelä
8575d2fb39 MDEV-28043 Race condition between mtr_t::commit() and checkpoint
In commit a635c40648 (MDEV-27774)
a race condition was introduced between mtr_t::commit() and
a log checkpoint.

Between the time of assigning the log sequence number and adding
the changed pages to buf_pool.flush_list, the log_sys.latch must
be continuously held by the current thread, or otherwise a
log checkpoint could get the wrong result from
buf_pool.get_oldest_modification().

buf_pool_t::insert_into_flush_list(): Add a debug assertion for
increasing the probability of cathing this type of problem.

mtr_t::m_latch_ex: A flag that indicates whether the mini-transaction
is holding log_sys.latch in exclusive mode.

mtr_t::do_write(), mtr_t::finish_write(): Remove the parameter
"bool ex" and refer to m_latch_ex instead.

mtr_t::commit(): Release log_sys.latch according to m_latch_ex.

mtr_t::commit_shrink(), mtr_t::commit_files(): Set m_latch_ex.

mtr_t::do_write(): Do not release an exclusive log_sys.latch,
but instead set m_latch_ex if needed.
2022-03-15 12:35:40 +02:00
Marko Mäkelä
00896db1c5 MDEV-25214 Crash in fil_space_t::try_to_close
fil_space_t::try_to_close(): Tolerate a tablespace that has no
data files attached. The function fil_ibd_create() initially
creates and attaches a tablespace with no files, and invokes
fil_space_t::add() later.

fil_node_open_file(): After releasing and reacquiring fil_system.mutex,
check if the file was already opened by another thread. This avoids
an assertion failure !node->is_open() in fil_node_open_file_low().

These failures were reproduced with the test
innodb.table_definition_cache_debug and the fix of MDEV-27985.
2022-03-15 10:37:13 +02:00
Marko Mäkelä
e1246775a9 Merge 10.4 into 10.5 2022-03-15 08:32:28 +02:00
Marko Mäkelä
9c6135e81f Merge 10.3 into 10.4 2022-03-15 08:10:35 +02:00
Hugo Wen
dafc5fb9c1 MDEV-27342: Fix issue of recovery failure using new server id
Commit 6c39eaeb1 made the crash recovery dependent on server_id.
The crash recovery could fail when restoring a new instance from
original crashed data directory USING A NEW SERVER ID.

The issue doesn't exist in previous major versions before 10.6.

Root cause is when generating the input XID to be searched in the hash,
server id is populated with the current server id.
So if the server id changed when recovering, the XID couldn't be found
in the hash due to server id doesn't match.

This fix is to use original server id when creating the input XID
object in function `xarecover_do_commit_or_rollback`.

All new code of the whole pull request, including one or several files
that are either new files or modified ones, are contributed under the
BSD-new license. I am contributing on behalf of my employer Amazon Web
Services, Inc.
2022-03-14 19:57:10 -07:00
Thirunarayanan Balathandayuthapani
1c43660aea MDEV-28060 Online DDL fails while checking for instant alter condition
- InnoDB fails to skip newly created column while checking for
change column when table is in redundant row format. This issue
is caused the MDEV-18035 (ccb1acbd3c)
2022-03-14 22:35:11 +05:30
Marko Mäkelä
18bb95b608 Merge 10.7 into 10.8 2022-03-14 11:52:11 +02:00
Marko Mäkelä
e67d46e4a1 Merge 10.6 into 10.7 2022-03-14 11:30:32 +02:00
Marko Mäkelä
572e34304e Merge 10.5 into 10.6 2022-03-14 10:59:46 +02:00
Marko Mäkelä
258c34f17c MDEV-28050: clang -Wtypedef-redefinition when PLUGIN_S3=NO
Let us remove the redundant typedef.
This problem was revealed by
commit 77c184df7c
2022-03-14 10:42:50 +02:00
Marko Mäkelä
c2146ce774 MDEV-24841: More workarounds
For some reason, the tests of the MemorySanitizer build on 10.5 failed
with both clang 13 and clang 14 with SIGSEGV. On 10.6 where it worked
better, some more places to work around were identified.
2022-03-14 10:37:39 +02:00
Sergei Golubchik
f217c76189 mtr: fix --source lines detection
mysqltest allows leading spaces before `--`, so mtr should too
2022-03-14 08:55:59 +01:00
Marko Mäkelä
59359fb44a MDEV-24841 Build error with MSAN use-of-uninitialized-value in comp_err
The MemorySanitizer implementation in clang includes some built-in
instrumentation (interceptors) for GNU libc. In GNU libc 2.33, the
interface to the stat() family of functions was changed. Until the
MemorySanitizer interceptors are adjusted, any MSAN code builds
will act as if that the stat() family of functions failed to initialize
the struct stat.

A fix was applied in
https://reviews.llvm.org/rG4e1a6c07052b466a2a1cd0c3ff150e4e89a6d87a
but it fails to cover the 64-bit variants of the calls.

For now, let us work around the MemorySanitizer bug by defining
and using the macro MSAN_STAT_WORKAROUND().
2022-03-14 09:28:55 +02:00
Marko Mäkelä
3b49967936 MDEV-28049 Error on compiling trx0purge.cc
In commit 83212632e4
the trx_rseg_latch was instrumented for performance_schema,
but some acqusitions of rd_lock() were not adjusted.
Thus, the build would fail on platforms where a futex-based
rw-lock is not available (SUX_LOCK_GENERIC) unless the code
was built with cmake -DPLUGIN_PERFSCHEMA=NO.
2022-03-14 08:01:40 +02:00
Nayuta Yanagisawa
810ed88c65 MDEV-27169 Change default values of Spider plugin variables to default values of table variables
Some Spider table options introduces an unnecessary complication to
Spider settings. For example, the default value of the plugin variable
spider_auto_increment_mode is -1 (use table value) and the default
table option value is 0 (normal mode). Thus, the virtual default value
of the variable is 0. This kind of indirection is confusing.

In order to delete such confusing table options in a future release,
we first change the default values of some Spider plugin variables
from -1 (use table value) to the corresponding default table values.
The default table values are defined in spider_set_connect_info_default().

At the same time, we also deprecate the option value -1 (use table value).
2022-03-14 14:45:55 +09:00
Nayuta Yanagisawa
332c59a27c MDEV-27923 Deprecate spider_use_handler
Deprecate the plugin variable spider_use_handler and the corresponding
table parameters "uhd" and "use_handler".

Passing a Handler statement to data nodes, without converting it to
SQL sometimes, might improve the performance, while this introduces
some complication to the implementation.

In the first place, only a few people use Handler statements and the
performance gain seems not to be very significant. Further, setting
spider_use_handler > 0 disables the GROUP BY handler. So, we decided
to deprecate the variable.
2022-03-14 14:24:18 +09:00
Nayuta Yanagisawa
00021a92c4 MDEV-27860 SIGSEGV in spider_parse_connect_info on CREATE TABLE
Check if option_struct is NULL in spider_parse_connect_info().
2022-03-14 14:08:22 +09:00
Sergei Golubchik
6789f2cfab MDEV-18304 sql_safe_updates does not work with OR clauses
not every index-using plan sets bits in table->quick_keys.
QUICK_ROR_INTERSECT_SELECT, for example, doesn't.

Use the fact that select->quick is set instead.

Also allow EXPLAIN to work.
2022-03-12 19:13:17 +01:00
Sergei Golubchik
e0dc22b2d4 MDEV-27753 Incorrect ENGINE type of table after crash for CONNECT table
fix two null pointer dereferences
2022-03-12 13:13:58 +01:00
Daniel Black
f4fb6cb3fe MDEV-27900: aio handle partial reads/writes (uring)
MDEV-27900 continued for uring.

Also spell synchronously correctly in sql_parse.cc.

Reviewed by Wlad.
2022-03-12 16:16:47 +11:00
Daniel Black
bd1ba7801f Merge branch 10.5 into 10.6 2022-03-12 16:16:03 +11:00
Daniel Black
d78173828e MDEV-27900: aio handle partial reads/writes
As btrfs showed, a partial read of data in AIO /O_DIRECT circumstances can
really confuse MariaDB.

Filipe Manana (SuSE)[1] showed how database programmers can assume
O_DIRECT is all or nothing.

While a fix was done in the kernel side, we can do better in our code by
requesting that the rest of the block be read/written synchronously if
we do only get a partial read/write.

Per the APIs, a partial read/write can occur before an error, so
reattempting the request will leave the caller with a concrete error to
handle.

[1] https://lore.kernel.org/linux-btrfs/CABVffENfbsC6HjGbskRZGR2NvxbnQi17gAuW65eOM+QRzsr8Bg@mail.gmail.com/T/#mb2738e675e48e0e0778a2e8d1537dec5ec0d3d3a

Also spell synchronously correctly in other files.
2022-03-12 09:47:53 +11:00
Marko Mäkelä
66b5b9214b Merge 10.8 into 10.9 2022-03-11 16:18:39 +02:00
Marko Mäkelä
dc680d2119 Avoid shutdown timeout in innodb.undo_truncate
Let us explicitly wait for purge before invoking a slow shutdown,
so that instrumented builds (such as ASAN or UBSAN) will not
exceed the 60-second timeout during shutdown.
2022-03-11 16:14:06 +02:00
Marko Mäkelä
89cd3da48c Merge 10.7 into 10.8 2022-03-11 15:56:59 +02:00
Marko Mäkelä
33c30da165 Fix clang -Wtypedef-redefinition
Fixup for commit 77c184df7c
2022-03-11 15:33:59 +02:00
Marko Mäkelä
3c9f415e52 Merge 10.6 into 10.7 2022-03-11 14:52:16 +02:00
Marko Mäkelä
77c7390fc8 Merge 10.5 into 10.6 2022-03-11 14:36:50 +02:00
Marko Mäkelä
4cfb6eddcd Merge 10.4 into 10.5 2022-03-11 14:36:28 +02:00
Marko Mäkelä
8afabca6fd MDEV-19577 fixup: galera.galera_binlog_stmt_autoinc 2022-03-11 14:18:17 +02:00
Marko Mäkelä
42cb400562 Merge 10.5 into 10.6 2022-03-11 13:35:35 +02:00
Marko Mäkelä
97d82808b8 Fix clang -Wtypedef-redefinition
This fixes commit 77c184df7c.
2022-03-11 13:29:41 +02:00
Marko Mäkelä
9047a908fe Merge 10.4 into 10.5 2022-03-11 13:03:33 +02:00