Commit graph

202286 commits

Author SHA1 Message Date
Yuchen Pei
e021770667
MDEV-34911 Sargable substr(col, 1, n) = str
Make Item_func_eq of the following forms sargable by updating the relevant range
analysis methods:

1. substr(col, 1, n) = str
2. str = substr(col, 1, n)
3. left(col, n) = str
4. str = left(col, n)

where col is a indexed column and str is a const and inexpensive item
of length n.

We do this by factoring out Item_func_like::get_mm_leaf() and apply it
to a string obtained from escaping str and then appending a wildcard
"%" to it.

The addition of the two Functype enums, LEFT_FUNC and SUBSTR_FUNC,
requires changes in the spider group by handler to continue handling
LEFT and SUBSTR correctly.

Co-authored-by: Yuchen Pei <ycp@mariadb.com>
Co-authored-by: Sergei Petrunia <sergey@mariadb.com>
2024-12-20 13:25:28 +11:00
Eric Herman
ae998c22b2 MDEV-35683: add basic unit test for DYNAMIC_ARRAY
This demonstrates and tests the basic usage of DYNAMIC_ARRAY.

Additional tests could be added to demonstrate and test the
remaining functions and capabilities.

Signed-off-by: Eric Herman <eric@freesa.org>
2024-12-20 11:07:53 +11:00
Eric Herman
7734c85c31 unittest output improvement for json_normalize-t
The ok() function outputs the TAP context string in both the success
and failure cases. The strings were worded to make sense in the
failure case, yet were confusing in the success case. This changes
the strings to be appropriate, and even more informative in either
the success or failure cases.  In the cases where input, expected,
and result values are included in the context string, they have been
adjusted such that expected and actual result values are aligned for
easy visual comparison.

Signed-off-by: Eric Herman <eric@freesa.org>
2024-12-18 10:12:34 +11:00
Marko Mäkelä
f5821aaf77 Merge 11.7 into main 2024-12-04 10:02:00 +02:00
Marko Mäkelä
0796bb8216 Merge 11.4 into 11.7 2024-12-04 09:42:46 +02:00
Marko Mäkelä
e41145f76b Update libmariadb 2024-12-04 09:30:18 +02:00
Thirunarayanan Balathandayuthapani
b24ecd7ca6 MDEV-32250 Enable --no-autocommit by default in mysqldump
- mariadb-dump utility performs logical backups by producing
set of sql statements that can be executed. By enabling this
no-autocommit option, InnoDB can load the data in an efficient
way and writes the only one undo log for the whole operation.
Only first insert statement undergoes bulk insert operation,
remaining insert statement doesn't write undo log and undergoes
normal insert code path.
2024-12-03 20:25:04 +05:30
Marko Mäkelä
f0961301c8 Merge 11.7 into main 2024-12-02 17:55:44 +02:00
Marko Mäkelä
33907f9ec6 Merge 11.4 into 11.7 2024-12-02 17:51:17 +02:00
Marko Mäkelä
2719cc4925 Merge 10.11 into 11.4 2024-12-02 11:35:34 +02:00
Marko Mäkelä
4d9548876e MDEV-31340 fixup: clang++-20 -Wdeprecated-literal-operator 2024-12-02 10:44:06 +02:00
Marko Mäkelä
3d23adb766 Merge 10.6 into 10.11 2024-11-29 13:43:17 +02:00
Marko Mäkelä
7d4077cc11 Merge 10.5 into 10.6 2024-11-29 12:37:46 +02:00
Marko Mäkelä
19acb0257e MDEV-35508 Race condition between purge and secondary index INSERT or UPDATE
row_purge_remove_sec_if_poss_leaf(): If there is an active transaction
that is not newer than PAGE_MAX_TRX_ID, return the bogus value 1
so that row_purge_remove_sec_if_poss_tree() is guaranteed to recheck if
the record needs to be purged. It could be the case that an active
transaction would insert this record between the time this check
completed and row_purge_remove_sec_if_poss_tree() acquired a latch
on the secondary index leaf page again.

row_purge_del_mark_error(), row_purge_check(): Some unlikely code
refactored into separate non-inline functions.

trx_sys_t::find_same_or_older_low(): Move the unlikely and bulky
part of trx_sys_t::find_same_or_older() to a non-inline function.

trx_sys_t::find_same_or_older_in_purge(): A variant of
trx_sys_t::find_same_or_older() for use in the purge subsystem,
with potential concurrent access of the same trx_t object from
multiple threads.

trx_t::max_inactive_id_atomic: An Atomic_relaxed alias of the
regular data field trx_t::max_inactive_id, which we
use on systems that have native 64-bit loads or stores.
On any 64-bit system that seems to be supported by GCC, Clang or MSVC,
relaxed atomic loads and stores use the regular load and store
instructions. On -march=i686 the 64-bit atomic loads and stores
would use an XMM register.

This fixes a regression that had been introduced in
commit b7b9f3ce82 (MDEV-34515).
There would be messages
[ERROR] InnoDB: tried to purge non-delete-marked record in index
in the server error log, and an assertion ut_ad(0) would cause a
crash of debug instrumented builds. This could also cause incorrect
results for MVCC reads and corrupted secondary indexes.

The debug instrumented test case was written by Debarun Banerjee.

Reviewed by: Debarun Banerjee
2024-11-29 10:44:38 +02:00
Daniele Sciascia
1d76fdfcb9 Adapt galera_sr.GCF-572 to make it work with innodb-snapshot-isolation
Make galera_sr.GCF-572 behave the same with and without option
innodb-snapshot-isolation. It is sufficient to remove a SELECT
statement from a transaction to delay the creation of the read
view in innodb. Avoiding the detection of a write-write conflict
under innodb-snapshot-isolation.
2024-11-29 08:06:32 +01:00
Daniele Sciascia
e821c9fa7c MDEV-35281 SR transaction crashes with innodb_snapshot_isolation
Ignore snapshot isolation conflict during fragment removal, before
streaming transaction commits. This happens when a streaming
transaction creates a read view that precedes the INSERTion of
fragments into the streaming_log table. Fragments are INSERTed
using a different transaction. These fragment are then removed
as part of COMMIT of the streaming transaction. This fragment
removal operation could fail when the fragments were not part
the transaction's read view, thus violating snapshot isolation.
2024-11-29 08:06:32 +01:00
Alexander Barkov
fdb6db6b47 MDEV-29462 ASAN: heap-use-after-free in Binary_string::copy on DO CONVERT
Item_char_typecast::val_str_generic() uses Item::str_value as a buffer.
Item::val_str_ascii() also used Item::str_value as a buffer.
As a result, str_value tried to copy to itself.

Fixing val_str_ascii() to use a local buffer instead of str_value.
2024-11-28 16:34:32 +04:00
Daniel Black
27c7e73f9a MDEV-35513 fails to compile on riscv32
Misplaced brace in my_rdtsc.h results in RV32 failing to compile.

ref: https://github.com/MariaDB/server/pull/1981/files#r1859762957

Thanks Jessica Clarke for the note.
2024-11-28 03:13:15 +02:00
Jan Lindström
f39217da0c MDEV-35473 : Sporadic failures in the galera_3nodes.galera_evs_suspect_timeout mtr test
Remove unnecessary sleep and replace it with proper wait_conditions.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2024-11-28 01:02:35 +01:00
Jan Lindström
e7e06b3cb7 MDEV-35481 : ER_LOCK_DEADLOCK instead of ER_NO_SUCH_TABLE in galera_var_ignore_apply_errors
Add wait_condition before select and set wsrep_sync_wait=0 to avoid
possible deadlock.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2024-11-28 01:02:35 +01:00
Jan Lindström
ff45fdac29 MDEV-35440 : Protocol error warning in the galera_wsrep_schema_detached test
Make sure that node_1 remains in primary view by increasing it's
weight. Add suppression on expected warnings because we kill
node_2.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2024-11-28 01:02:35 +01:00
Julius Goryavsky
8bc254dd62 MDEV-26516: WSREP: Record locking is disabled in this thread, but the table being modified
We periodically observe assertion failures in the mtr tests,
specifically in the /storage/innobase/row/row0ins.cc file,
following a WSREP error. The error message is: 'WSREP: record
locking is disabled in this thread, but the table being modified
is not mysql/wsrep_streaming_log: mysql/innodb_table_stats.'"
This issue seems to occur because, upon opening the table,
innodb_stats_auto_recalc may trigger, which Galera does not
anticipate. This commit should fix this bug.
2024-11-28 01:02:35 +01:00
Oleksandr Byelkin
0ea19c12fd MDEV-35507 ed25519 authentication plugin create user statement trigger plain text password in audit log
Mask also all cases of "password(PWD" in CREATE/ALTER USER and GRANT.
(minimal fix)
2024-11-27 19:45:33 +01:00
Ivan Prisyazhnyy
f39a61505f MDEV-33075 [backport/2f5174e556] use more robust self-pipe to wake up poll() in break_connect_loop()
Backport of 2f5174e556:
MDEV-33075 Resolve server shutdown issues on macOS, Solaris, and FreeBSD.

This commit addresses multiple server shutdown problems observed on macOS,
Solaris, and FreeBSD:

1. Corrected a non-portable assumption where socket shutdown was expected
to wake up poll() with listening sockets in the main thread.

Use more robust self-pipe to wake up poll() by writing to the pipe's write
end.

Signed-off-by: Ivan Prisyazhnyy <john.koepi@gmail.com>
2024-11-27 14:59:50 +02:00
Ivan Prisyazhnyy
c4cadb768f MDEV-33075 [backport/2f5174e556] fix rnd crash on macOS from pthread_kill(signal_handler)
Backport of 2f5174e556:
MDEV-33075 Resolve server shutdown issues on macOS, Solaris, and FreeBSD.

This commit addresses multiple server shutdown problems observed on macOS,
Solaris, and FreeBSD:

2. Fixed a random crash on macOS from pthread_kill(signal_handler)
when the signal_handler was detached and the thread had already exited.

Use more robust `kill(getpid(), SIGTERM)` to wake up the signal handler
thread.

Additionally, the shutdown code underwent light refactoring
for better readability and maintainability:

- Modified `break_connect_loop()` to no longer wait for the main thread,
  aligning behavior with Windows (since 10.4).
2024-11-27 14:59:50 +02:00
Ivan Prisyazhnyy
8214707699 MDEV-33075 [backport/2f5174e556] fix signal handler thread exit on abort
Backport of 2f5174e556:
MDEV-33075 Resolve server shutdown issues on macOS, Solaris, and FreeBSD.

This commit addresses multiple server shutdown problems observed on macOS,
Solaris, and FreeBSD:

3. Made sure, that signal handler thread always exits once `abort_loop` is
set, and also calls `my_thread_end()` and clears `signal_thread_in_use`
when exiting.

This fixes warning "1 thread did not exit"  by `my_global_thread_end()`
seen on FreeBSD/macOS when the process is terminated via signal.

Additionally, the shutdown code underwent light refactoring
for better readability and maintainability:

- Removed dead code related to the unused `USE_ONE_SIGNAL_HAND`
  preprocessor constant.

Signed-off-by: Ivan Prisyazhnyy <john.koepi@gmail.com>
2024-11-27 14:59:50 +02:00
Ivan Prisyazhnyy
490274e850 MDEV-33075 [backport/2f5174e556] eliminated support for #ifndef HAVE_POLL
Backport of 2f5174e556:
MDEV-33075 Resolve server shutdown issues on macOS, Solaris, and FreeBSD.

Eliminated support for `#ifndef HAVE_POLL` in `handle_connection_sockets`
This code is also dead, since 10.4

Signed-off-by: Ivan Prisyazhnyy <john.koepi@gmail.com>
2024-11-27 14:59:50 +02:00
Jan Lindström
f5aed74573 MDEV-35486 : MDEV-33997 test failed
Problem was that at wsrep_to_isolation_end saved_lock_wait_timeout
variable was set to thd->variables.lock_wait_timeout when RSU
is used and variable value was 0 leading sporadic lock wait timeout
errors. Fixed by removing incorrect variable set.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2024-11-27 13:00:08 +01:00
Alexander Barkov
8b057889d7 MDEV-34981 Functions missing from INFORMATION_SCHEMA.SQL_FUNCTIONS
Plugin functions are now displayed in I_S.SQL_FUNCTIONS
2024-11-27 14:24:52 +04:00
Thirunarayanan Balathandayuthapani
9ba18d1aa0 MDEV-35394 Innochecksum misinterprets freed pages
- Innochecksum misinterprets the freed pages as active one.
This leads the user to think there are too many valid
pages exist.

- To avoid this confusion, innochecksum introduced one
more option --skip-freed-pages and -r to avoid the freed
pages while dumping or printing the summary of the tablespace.

- Innochecksum can safely assume the page is freed if
the respective extent doesn't belong to a segment and marked as
freed in XDES_BITMAP in extent descriptor page.

- Innochecksum shouldn't assume that zero-filled page as extent
descriptor page.

Reviewed-by: Marko Mäkelä
2024-11-27 13:00:51 +05:30
Yuchen Pei
5be859d52c
MDEV-30649 Adding a spider testcase showing copying from a remote to a local table
Also deleted some trailing whitespace in mdev_30191.test.
2024-11-27 10:25:14 +11:00
Yuchen Pei
a8cc40d9a4
MDEV-35064 Reduce the default spider connect retry counts to 2
The existing default value 1000 is too big and could result in
"hanging" when failing to connect a remote server. Three tries in
total is a more sensible default.
2024-11-27 10:25:14 +11:00
Monty
c34a2feceb MDEV-35509 mariabackup.alter_copy_race crashes with abort in backup_file_op_fail
The bug was that backup_file_op_fail() was using a static variable
initialized by arguments. This does not work as static variables
will only be initialized on the first call and not change for future
calls, even when the arguments changes.

Fixed by removing 'static'.
2024-11-26 22:30:52 +02:00
Nikita Malyavin
e64857c25b Provide a safe range for RocksDB errors
Last time, commit b9f579317 (MDEV-9101) has updated HA_ERR_LAST, breaking the
rocksdb error codes. According to the commit history, this happens each time a
new HA error is added.

This patch fixes the range to start from '500', hopefully resolving the problem
for the close future.

In addition, fix incorrect error codes enumeration.
2024-11-26 19:21:12 +01:00
ParadoxV5
0fabe1dc18 Create FUNDING.yml
Configure a Sponsor button to surface a link to mariadb.org/donate
2024-11-26 17:39:37 +02:00
Monty
142851f120 Update my_print_defaults to accept --mariadbd as an option
--mariadbd and --mysqld are now synonymes for my_print_defaults

Other things
- Removed safemalloc warnings when using an unknown argument to
  my_print_defaults
2024-11-26 14:23:31 +02:00
Monty
f09020b3bb Fixed bug in subselect3.inc (not notable) 2024-11-26 14:23:31 +02:00
Alexander Barkov
225c17d35c MDEV-34090 Client allows to set character set to utf32 and crashes on the next command
Disallowing character sets with mbminlen>1 in the client.
2024-11-26 13:57:55 +04:00
Ahmed Ibrahim
a35f744d78 MDEV-31736: format_bytes implementation 2024-11-26 13:10:01 +04:00
Ian Gilfillan
d4d5bce2da Fix typo in description of s3_ssl_no_verify 2024-11-26 13:57:13 +11:00
Alexander Barkov
425d2521ec MDEV-33472 Assertion `0' failed in Item_row::illegal_method_call on CREATE EVENT
Do not accept rows as event parameters.
2024-11-25 18:29:13 +04:00
Alexander Barkov
20eba06d9b MDEV-35489 Assertion `!ldate->neg' or unexpected result upon extracting unit from invalid value
The patch for MDEV-23687 easlier fixed this problem. Adding tests only.
2024-11-25 16:13:16 +04:00
Marko Mäkelä
2255be0395 MDEV-35472 Server crash in ha_storage_put_memlim upon reading from INNODB_LOCKS
ha_storage_put_memlim(): Initialize node->next in order to avoid a
crash on a subsequent invocation, due to dereferencing an uninitialized
pointer.

This fixes a regression that had been introduced in
commit ccb6cd8053 (MDEV-35189).

Reviewed by: Debarun Banerjee
2024-11-25 10:31:57 +02:00
ParadoxV5
ec58fce3da MDEV-35478 Correction for table->space_id in dict_load_tablespace() was mistakenly applied on an earlier branch
It is `ulint` on 10.6 and `uint32_t` on 10.11+, but I included its
format specifier change in 10.6 (MDEV-35430, merged #3493) rather
than 10.11. This commit reverts that change so 10.11 can reapply it.
2024-11-25 18:25:02 +11:00
Alexander Barkov
2e404c9850 MDEV-21029 Incorrect result for expression with the <=> operator and IS NULL
Item_func_equal erroneously derived is_null() from the parent class.
Overriding it to return false because <=> can never return NULL.
2024-11-25 10:37:02 +04:00
ParadoxV5
e81ed928ff MDEV-35478 part 2: Redo space_id format fix
`table->space_id` is `ulint` on 10.6 and `uint32_t` on 10.11+, but
I included its format specifier change in 10.6 rather than 10.11.

PR #3650 reverts the change from 10.6; this commit reapplies it
on 10.11 as a follow up on its batch (MDEV-35431, merged #3518).
2024-11-25 14:53:16 +11:00
Brandon Nesterenko
773cb726a8 MDEV-34348: MariaDB is violating clang-16 -Wcast-function-type-strict
This HEAD commit just makes cast-function-type-strict fatal.
It will stay at the HEAD, and prior commits contain the
actual fixes, organized by the part of the code that the fix
targets. Future changes will be force pushed to have their
fixes come before this HEAD.

This branch cherry-picks patches from daniel@mariadb.org
(in bb-10.5-MDEV-34508-ubsan-errors) which initially
incorporate the flag into the build, as well as fix some of
its findings.
2024-11-23 08:14:23 -07:00
Daniel Black
6456e437f2 MDEV-34348: Add cast-function-type-strict to warnings 2024-11-23 08:14:23 -07:00
Daniel Black
971a0ba23c MDEV-34408: Facilitate the addition of warnings into the build system
Create a MY_WARNING_FLAGS_NON_FATAL for testing warnings

Add -Weffc++ as no-error espect, disabling from rocksdb due
to excessive errors that will be corrected later.
2024-11-23 08:14:23 -07:00
Brandon Nesterenko
78d7bb1d27 MDEV-34348: Miscellaneous fixes
Partial commit of the greater MDEV-34348 scope.
MDEV-34348: MariaDB is violating clang-16 -Wcast-function-type-strict

Various additional fixes, each too small to put into
their own commit.

Reviewed By:
============
Marko Mäkelä <marko.makela@mariadb.com>
2024-11-23 08:14:23 -07:00