Commit graph

196191 commits

Author SHA1 Message Date
Alexander Barkov
4a7e337e5f MDEV-28963 Incompatible data type assignment through SP vars is not consistent with columns 2022-06-27 19:52:48 +04:00
Nayuta Yanagisawa
c4bfb61803 MDEV-28479 fixup: Update spider/bg and spider/handler suites 2022-06-27 22:57:33 +09:00
Marko Mäkelä
1ae8160710 MDEV-26979 heap-use-after-free or SIGSEGV when accessing INNODB_SYS_TABLESTATS during DDL
i_s_dict_fill_sys_tablestats(): Read all fields of dict_table_t
while holding dict_sys.latch.

dict_sys_t::allow_eviction(): Remove.
2022-06-27 16:51:53 +03:00
Marko Mäkelä
20cf63fe8b Merge 10.5 into 10.6 2022-06-27 16:51:27 +03:00
Marko Mäkelä
773f1dad94 Merge 10.4 into 10.5 2022-06-27 16:17:02 +03:00
Marko Mäkelä
b922ae5fc9 Merge 10.3 into 10.4 2022-06-27 16:16:20 +03:00
Marko Mäkelä
f339ef3f97 MDEV-26577 InnoDB: Failing assertion: dict_tf2_is_valid(flags, flags2) during ADD COLUMN
prepare_inplace_alter_table_dict(): If the table will not be rebuilt,
preserve all of the original ROW_FORMAT, including the compressed
page size flags related to ROW_FORMAT=COMPRESSED.
2022-06-27 16:00:34 +03:00
Marko Mäkelä
a75ad73545 MDEV-28389 fixup: Fix compiler warnings
hex_to_ascii(): Add #if around the definition to avoid
clang -Wunused-function. Avoid GCC 5 -Wconversion with a cast.
2022-06-27 14:50:00 +03:00
Marko Mäkelä
39f45f6f89 MDEV-28950 Assertion `*err == DB_SUCCESS' failed in btr_page_split_and_insert
btr_root_raise_and_insert(), btr_lift_page_up(),
rtr_page_split_and_insert(): Reset DB_FAIL from a failure to
copy records on a ROW_FORMAT=COMPRESSED page to DB_SUCCESS
before retrying.

This fixes a regression that was introduced by
commit 0b47c126e3 (MDEV-13542).

btr_root_raise_and_insert(): Remove a redundant condition.
btr_page_split_and_insert() will invoke btr_page_split_and_insert()
if needed.
2022-06-27 12:32:03 +03:00
Alexander Barkov
0bed4d72c0 MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER
Now INSERT, UPDATE, ALTER statements involving incompatible data type pairs, e.g.:

    UPDATE TABLE t1 SET col_inet6=col_int;
    INSERT INTO t1 (col_inet6) SELECT col_in FROM t2;
    ALTER TABLE t1 MODIFY col_inet6 INT;

consistently return an error at the statement preparation time:

    ERROR HY000: Illegal parameter data types inet6 and int for operation 'SET'

and abort the statement before starting interating rows.

This error is the same with what is raised for queries like:
    SELECT col_inet6 FROM t1 UNION SELECT col_int FROM t2;
    SELECT COALESCE(col_inet6, col_int) FROM t1;

Before this change the error was caught only during the execution time,
when a Field_xxx::store_xxx() was called for the very firts row.
The behavior was not consistent between various statements and could do different things:
- abort the statement
- set a column to the data type default value (e.g. '::' for INET6)
- set a column to NULL

A typical old error was:

    ERROR 22007: Incorrect inet6 value: '1' for column `test`.`t1`.`a` at row 1

EXCEPTION:

Note, there is an exception: a multi-row INSERT..VALUES, e.g.:
    INSERT INTO t1 (col_a,col_b) VALUES (a1,b1),(a2,b2);
checks assignment compability at the preparation time for the very first row only:
    (col_a,col_b) vs (a1,b1)

Other rows are still checked at the execution time and return the old warnings
or errors in case of a failure. This is done because catching all rows at the
preparation time would change behavior significantly. So it still works
according to the STRICT_XXX_TABLES sql_mode flags and the table transaction ability.

This is too late to change this behavior in 10.7.
There is no a firm decision yet if a multi-row INSERT..VALUES
behavior will change in later versions.
2022-06-27 12:49:40 +04:00
Marko Mäkelä
7d92c9d212 Suppress a message that may be emitted on slow systems
On FreeBSD, tests run on persistent storage, and no asynchronous I/O
has been implemented. Warnings about 205-second waits on dict_sys.latch
may occur.
2022-06-27 11:03:52 +03:00
Marko Mäkelä
87bd79b1e7 Merge 10.5 into 10.6 2022-06-27 10:59:31 +03:00
Marko Mäkelä
ea847cbeaf Merge 10.4 into 10.5 2022-06-27 10:51:20 +03:00
Marko Mäkelä
03174cabd7 Fix GCC -Og -Wmaybe-uninitialized 2022-06-27 10:49:15 +03:00
Marko Mäkelä
dd7e9fb38a MDEV-28854 after-merge fix: Remove a test for MDEV-26583 2022-06-27 10:47:05 +03:00
Marko Mäkelä
01d757036f Merge 10.3 into 10.4 2022-06-27 10:14:37 +03:00
Marko Mäkelä
c86b1389de MDEV-28389: Simplify the InnoDB corrupted page output
buf_page_print(): Dump the buffer page 32 bytes (64 hexadecimal digits)
per line. In this way, the limitation in mtr
("Data too long for column 'line'") will not be triggered.

Also, do not bother decoding the page contents, because everything
is present in the hexadecimal output.

dict_index_find_on_id_low(): Merge to dict_index_get_if_in_cache_low().
The direct call in buf_page_print() was prone to crashing, in case the
table definition was concurrently evicted or dropped from the
data dictionary cache.
2022-06-27 09:49:49 +03:00
Hirokazu Hata
2c1aaa6664
MDEV-28854 Disallow INSERT DELAYED on Spider table
Spider supports (or at least allows) INSERT DELAYED but the
documentation does not specify spider as a storage engine that supports
"INSERT DELAYED".
Also, although not mentioned in the documentation, "INSERT DELAYED" is
not intended to be executed inside a transaction, as can be seen from
the list of supported storage engines.
The current implementation allows executing a delayed insert on a
remote transactional table and this breaks the consistency ensured by
the transaction.

We too remove "internal_delayed", one of the Spider table parameters.
Documentation says,

> Whether to transmit existence of delay to remote servers when
> executing an INSERT DELAYED statement on local server.

This table parameter is only used for "INSERT DELAYED".

Reviewed by: Nayuta Yanagisawa
2022-06-27 14:58:18 +09:00
Nayuta Yanagisawa
925999bb97 MDEV-28829 Deprecate spider_semi_table_lock and spider_semi_table_lock_connection
When the variable, spider_semi_table_lock, is 1, Spider sends
LOCK TABLES before each SQL execution. The feature is for
non-transactional remote tables and adds some overhead to query
executions.

We change the default value of the plugin variable to 0 and then
deprecate the variable because it is rare to use non-transactional
engines these days and the variable complicates the code.

The variable, spider_semi_table_lock_connection, should be too
deprecated because it is for tweaking the semi-table locking.
2022-06-27 11:14:10 +09:00
Nayuta Yanagisawa
8e6c8967a1 MDEV-28479 Deprecate Spider's high availability feature
Deprecate the high availability feature of Spider as the feature is
beyond the scope of the federated storage engine and it complicates
the implementation of Spider.
2022-06-27 11:11:32 +09:00
Oleksandr Byelkin
5feb60ce18 MDEV-22590 SIGSEGV in flush_all_key_blocks when changing key_buffer_size / ASAN: heap-use-after-free in flush_all_key_blocks
Take into account that in preparation of a simple key cache for resizing no disk blocks might be assigned to it.

Reviewer: IgorBabaev <igor@mariadb.com>
2022-06-24 10:03:23 +02:00
Alexey Botchkov
2c83fc87c2 MDEV-27832 disable binary logging for SQL SERVICE.
Binary logging is now disabled for the queries run by SQL SERVICE.
The binlogging can be turned on with the 'SET SQL_LOG_BIN=On' query.
2022-06-24 09:46:51 +04:00
Vladislav Vaintroub
d96436c999 MDEV-28935 crash in io_slots::release
Revert "TSAN: data race on vptr (ctor/dtor vs virtual call)"

This reverts commit 78084fa747.

This commit was done to please TSAN, which falsely reported an error
where there was none.
Yet as consequence, it could cause a real error, a crash in os_aio_free on
shutdown
2022-06-23 17:42:32 +02:00
Marko Mäkelä
b356309840 Merge 10.7 into 10.8 2022-06-23 13:46:23 +03:00
Marko Mäkelä
5d0496c749 Merge 10.6 into 10.7 2022-06-23 13:20:25 +03:00
Marko Mäkelä
f2f18e20eb MDEV-28923 atomic.rename_table occasionally fails
fil_name_process(): If the recovery of a tablespace was deferred,
do invoke fil_ibd_load() even though the name in recv_spaces is
not changing. This allows us to recover from a situation where
there are many FILE_RENAME records, renaming a tablespace back
and forth, and a FILE_MODIFY record that had been written by
fil_names_clear().

Co-developed with: Thirunarayanan Balathandayuthapani
2022-06-23 13:17:20 +03:00
Vladislav Vaintroub
eb7f46ca1e Merge remote-tracking branch 'origin/10.5' into 10.6 2022-06-23 06:29:57 +02:00
Vladislav Vaintroub
35f2cdcb99 MDEV-28920 Rescheduling of innodb_stats_func() missing
Fixed tpool timer implementation on POSIX.
Prior to this patch, under some specific rare circumstances (concurrency
related), timer callback execution might be skipped.
2022-06-23 05:53:55 +02:00
Marko Mäkelä
0f0a45b2dc MDEV-18976 fixup: encryption.innodb-redo-badkey
When attempting to recover a database with an incorrect encryption key,
the unencrypted page contents should be expected to differ from what
was written before recovery. Let us suppress some more messages.
This caused intermittent failures, depending on when the latest
log checkpoint was triggered.
2022-06-22 17:27:49 +03:00
Marko Mäkelä
3a66c0153a Merge 10.7 into 10.8 2022-06-22 15:40:59 +03:00
Sergei Petrunia
51bce3c59a MDEV-28882: Assertion `tmp >= 0' failed in best_access_path
Histogram_json_hb::range_selectivity() may return small negative
numbers due to rounding errors in the histogram.

Make sure the returned value is non-negative.
Add an assert to catch negative values that are not small.

(attempt #2)
2022-06-22 13:39:48 +03:00
Marko Mäkelä
6f4d0659dd MDEV-22388 Corrupted undo log record leads to server crash
trx_undo_rec_copy(): Return nullptr if the undo record is corrupted.

trx_undo_rec_get_undo_no(): Define inline with the declaration.

trx_purge_dummy_rec: Replaced with a -1 pointer.

row_undo_rec_get(), UndorecApplier::apply_undo_rec(): Check
if trx_undo_rec_copy() returned nullptr.

trx_purge_get_next_rec(): Return nullptr upon encountering any
corruption, to signal the end of purge.
2022-06-22 10:04:28 +03:00
Marko Mäkelä
8ebff3bcb0 Merge 10.6 into 10.7 2022-06-22 08:34:29 +03:00
Marko Mäkelä
0fa19fdebf MDEV-28836 fixup
On GNU/Linux, even though the C11 aligned_alloc() appeared in
GNU libc early on, some custom memory allocators did not
implement it until recently. For example, before
gperftools/gperftools@d406f22853
the free() in tcmalloc would fail to free memory that was
returned by aligned_alloc(), because the latter would map to the
built-in allocator of libc. The Linux specific memalign() has a
similar interface and is safer to use, because it has been
available for a longer time. For AddressSanitizer, we will use
aligned_alloc() so that the constraint on size can be enforced.

buf_tmp_reserve_compression_buf(): When HAVE_ALIGNED_ALLOC holds,
round up the size to be an integer multiple of the alignment.

pfs_malloc(): In the unit test stub, round up the size to be an
integer multiple of the alignment.
2022-06-22 08:23:32 +03:00
Marko Mäkelä
54ac356dea Merge 10.7 into 10.8 2022-06-21 18:19:24 +03:00
Marko Mäkelä
6680fd8d4b Merge 10.6 into 10.7 2022-06-21 18:02:41 +03:00
Marko Mäkelä
3794673111 MDEV-28836: Memory alignment cleanup
Table_cache_instance: Define the structure aligned at
the CPU cache line, and remove a pad[] data member.
Krunal Bauskar reported this to improve performance on ARMv8.

aligned_malloc(): Wrapper for the Microsoft _aligned_malloc()
and the ISO/IEC 9899:2011 <stdlib.h> aligned_alloc().
Note: The parameters are in the Microsoft order (size, alignment),
opposite of aligned_alloc(alignment, size).
Note: The standard defines that size must be an integer multiple
of alignment. It is enforced by AddressSanitizer but not by GNU libc
on Linux.

aligned_free(): Wrapper for the Microsoft _aligned_free() and
the standard free().

HAVE_ALIGNED_ALLOC: A new test. Unfortunately, support for
aligned_alloc() may still be missing on some platforms.
We will fall back to posix_memalign() for those cases.

HAVE_MEMALIGN: Remove, along with any use of the nonstandard memalign().

PFS_ALIGNEMENT (sic): Removed; we will use CPU_LEVEL1_DCACHE_LINESIZE.

PFS_ALIGNED: Defined using the C++11 keyword alignas.

buf_pool_t::page_hash_table::create(),
lock_sys_t::hash_table::create():
lock_sys_t::hash_table::resize(): Pad the allocation size to an
integer multiple of the alignment.

Reviewed by: Vladislav Vaintroub
2022-06-21 16:59:49 +03:00
Marko Mäkelä
2e43af69e3 MDEV-28870 InnoDB: Missing FILE_CREATE, FILE_DELETE or FILE_MODIFY before FILE_CHECKPOINT
There was a race condition between log_checkpoint_low() and
deleting or renaming data files. The scenario is as follows:

1. The buffer pool does not contain dirty pages.
2. A FILE_DELETE or FILE_RENAME record is written.
3. The checkpoint LSN will be moved ahead of the write of the record.
4. The server is killed before the file is actually renamed or deleted.

We will prevent this race condition by ensuring that a log checkpoint
cannot occur between the durable write and the file system operation:

1. Durably write the FILE_DELETE or FILE_RENAME record.
2. Perform the file system operation.
3. Allow any log checkpoint to proceed.

mtr_t::commit_file(): Implement the DELETE or RENAME logic.

fil_delete_tablespace(): Delegate some of the logic to
mtr_t::commit_file().

fil_space_t::rename(): Delegate some logic to mtr_t::commit_file().
Remove the debug injection point fil_rename_tablespace_failure_2
because we do test RENAME failures without any debug injection.

fil_name_write_rename_low(), fil_name_write_rename(): Remove.

Tested by Matthias Leich
2022-06-21 16:59:21 +03:00
Julius Goryavsky
3e09c6199d MDEV-26562: galera-sst-mariabackup is failing due to missing xtrabackup_checkpoints
This commit contains workaround for a bug known as 'Red Hat issue 1870279'
(connection reset by peer issue in socat versions 1.7.3.3 to 1.7.4.0) which
further causes crashes during SST using mariabackup (when openssl is used).

Also fixed broken logic of automatic generation of the Diffie-Hellman parameters
for socat version less than 1.7.3 (which defaults to 512-bit values instead of
2048-bit ones).
2022-06-21 13:45:20 +02:00
Marko Mäkelä
55f02c24a6 MDEV-28845 fixup: Prevent an infinite loop
buf_page_create_low(): Before retrying, release the exclusive page latch
in order to prevent an infinite loop in buf_pool_t::corrupted_evict().
2022-06-21 14:40:40 +03:00
Marko Mäkelä
3b662c6ebd MDEV-28782 fixup: ./mtr --embedded 2022-06-21 14:40:31 +03:00
Julius Goryavsky
af929146ed MDEV-28583 postfix: fixing .result files after automatic merge 2022-06-21 05:34:37 +02:00
Vladislav Vaintroub
01c0345d44 MDEV-28819 Statically compiled encryption plugins do not work in mariadb-backup
Disable static build for encryption plugin file_key_management
2022-06-20 16:42:41 +02:00
Marko Mäkelä
325e6aa7af MDEV-28879 Assertion `l->lsn <= log_sys.get_lsn()' failed around recv_recover_page
recv_recover_page(): Correct a debug assertion to refer to recv_sys.lsn,
which may be ahead of log_sys.lsn during non-final recovery batches.
In commit 685d958e38 (MDEV-14425)
when some redundant LSN fields were removed,
log_sys.log.scanned_lsn had been replaced with a reference to
log_sys.lsn instead of the more appropriate recv_sys.lsn.

recv_scan_log(): Remove a redundant call to log_sys.set_recovered_lsn().
It suffices to adjust the log_sys.lsn after parsing (and before starting
to apply) records for the last batch.

Note: Normally, log_sys.lsn must be the latest log sequence number.
Before the final recovery batch, this may be safely violated, because
log_write_up_to() will be a no-op. That function will be invoked by the
buf_flush_page_cleaner thread to initiate writes of recovered pages.
2022-06-20 10:07:33 +03:00
Daniel Black
d4539426bc MDEV-28884: include kernel information in crashing signal handler
Recent adventures in liburing and btrfs have shown up some kernel
version dependent bugs. Having a bug report of accurace kernel version
can start to correlate these errors sooner.

On Linux, /proc/version contains the kernel version.

FreeBSD has kern.version (per man 8 sysctl), so include that too.

Example output:

Max nice priority         0                    0
Max realtime priority     0                    0
Max realtime timeout      unlimited            unlimited            us
Core pattern: |/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h

Kernel version: Linux version 5.19.0-0.rc2.21.fc37.x86_64 (mockbuild@bkernel01.iad2.fedoraproject.org) (gcc (GCC) 12.1.1 20220507 (Red Hat 12.1.1-1), GNU ld version 2.38-14.fc37) #1 SMP PREEMPT_DYNAMIC Mon Jun 13 15:27:24 UTC 2022

Segmentation fault (core dumped)
2022-06-18 21:14:04 +03:00
Sergei Golubchik
f299351e1c remove invalid test
it starts an EXPLAIN of a multi-table join and tries to KILL it.
no sync points.
depending on how fast the hareware is and optimizer development
it might kill EXPLAIN at some random point in time (generally unrelated
to the Bug#28598 it was supposed to test) or EXPLAIN might finish
before the KILL and the test will fail.
2022-06-18 15:32:42 +02:00
Daniel Black
0e4cf497ca MDEV-28782 mariadb-tzinfo-to-sql to work in bootstrap mode
Work around MDEV-28718 for now, but also optimize the interation
of information_schema.SYSTEM_VARIABLES.

Add test case to show that tzinfo data into bootstrap is
desired functionality.

Bug report thanks to Dan Lenski of AWS.
2022-06-18 01:16:49 +03:00
Daniel Black
0565dfe490 MDEV-17390: re-neable rpl_semi_sync_after_sync test
The reasons sited for disabling this test in MDEV-16172 where
disputed.
2022-06-17 19:38:43 +03:00
Marko Mäkelä
be99d0ddb6 Fix intermittent failures of innodb.stats_persistent
We do not really care about the exact result; we only care that the
statistics will be accessed. The result could change depending on
when some statistics were updated in the background or when some
committed delete-marked rows were purged from other tables on
which persistent statistics are enabled.
2022-06-17 08:40:51 +03:00
Sergei Golubchik
2643aa43ae fix spider.variable_deprecation test 2022-06-16 22:39:35 +02:00