Commit Graph

201456 Commits

Author SHA1 Message Date
791fcea1d7 bump the VERSION 2025-05-13 12:27:36 +03:00
cafd22db79 Code cleanup in mark_common_columns(): nj_col_2 is non-NULL here
Done after fix for MDEV-36592
mariadb-10.11.12
2025-04-28 15:58:16 +03:00
5033da6ed6 Fix rocksdb_sys_vars.rocksdb_stats_level_basic test
The minimum statistics level now is rocksdb::StatsLevel::kDisableAll.
The default remains rocksdb::StatsLevel::kExceptHistogramOrTimers
which is now 1 (it used to be 0).
2025-04-28 15:12:44 +03:00
4d41ec081e Merge branch '10.6' into 10.11 2025-04-26 10:47:03 +02:00
19644f6821 Merge branch '10.5' into 10.6 mariadb-10.6.22 2025-04-26 10:41:52 +02:00
c461188ca6 MDEV-36681 Remove systemd CapabilityBoundingSet as unnecessary
Hopefully, this ends the long story of CapabilityBoundingSet
in mariadb.service.

Started from MDEV-9095 (27e6fd9a59) which was supposed
to let --memlock work without root, but instead of
adding the necessary capability (CAP_IPC_LOCK) by putting it into
AmbientCapabilities it removed all other capabilities,
by putting CAP_IPC_LOCK into CapabilityBoundingSet
(which is the mask of allowed capabilities).

This broke pam plugin, which needed CAP_DAC_OVERRIDE,
it was fixed in MDEV-19878 (dd93028dae) by appending
CAP_DAC_OVERRIDE to CapabilityBoundingSet.

Obviously, memlock still didn't work, this was fixed
in MDEV-33301 (76a27155b4) by moving CAP_IPC_LOCK
to AmbientCapabilities.

Unfortunately, it moved too much (everything), so
MDEV-36229 (85ecb80fa3) fixed it moving CAP_DAC_OVERRIDE
back to CapabilityBoundingSet.

This caused MDEV-36591 (8925877dc8) triggering a bug in old
systemd versions. And it broke pam plugin on CentOS Stream 10,
where CAP_DAC_OVERRIDE alone was apparently not enough.

Let's finally fix this by removing CapabilityBoundingSet
completely and keeping CAP_IPC_LOCK in AmbientCapabilities,
which should've been the correct fix for MDEV-9095 from the start.
mariadb-10.5.29
2025-04-25 17:48:13 +02:00
9579ee4fa2 Revert "MDEV-36591: RHEL8(+compat)/Ubuntu 20.04 cannot start systemd servce (EXIT_CAPABILTIES/218)"
This reverts commit 8925877dc8.
2025-04-25 17:48:13 +02:00
4fc9dc84b0 MDEV-32086 (part 2) Server crash when inserting from derived table containing insert target table
Get rid of need of matherialization for usual INSERT (cache results in
Item_cache* if needed)

- subqueries in VALUE do not see new records in the table we are
  inserting to
- subqueries in RETIRNING prohibited to use the table we are inserting to
2025-04-25 15:10:36 +02:00
9b313d2de1 MDEV-32086 Server crash when inserting from derived table containing insert target table
Use original solution for INSERT ... SELECT - select result buferisation.

Also fix MDEV-36447 and MDEV-33139
2025-04-25 12:58:24 +02:00
9b0294cd12 MDEV-36666 - atomic.alter_table still times out often
According to buildbot cross-reference atomic.alter_table is failing ~10
times a day due to 900 seconds test case timeout. Split it into two
tests: atomic.alter_table_myisam and atomic.alter_table_innodb.
It should reduce failure frequency down to once a day or so, similarly
to atomic.alter_table_aria test.

Diabling InnoDB for MyISAM/Aria/RocksDB tests makes them 20-35% faster.
2025-04-25 10:40:47 +04:00
ddd5ba3a00 MDEV-14432 mysqldump does not preserve case of table names in generated sql
inside the get_lookup_field_values when lower_case_table_names's value
is 2 this should reserve the case for the table's and database's names
so this commit changes the condition to lowercase only when the
lower_case_table_name's value is 1 not just 1 and 2 "any value not equal
0"
2025-04-24 18:10:09 +02:00
05813f54cf MDEV-36648 - main.mdl_sync extra test.t2 row in I_S.metadata_lock_info
SELECT FROM information_schema.metadata_lock_info may sporadically
return MDL_SHARED lock acquired by InnoDB purge thread.

Fix proposed in a7bf0a42d0 wasn't enough to solve this problem:
apparently it did protect against purging old rows, but not against
locking the table.

Reverted a7bf0a42d0 in favour of solution proposed in e996f77cd8.
That is use wait_all_purged.inc to make sure purge is completed.
2025-04-24 14:46:27 +04:00
5f69e18152 MDEV-36682 Conflict between MDEV-36504 and MDEV-16329
Reason:
=======
- MDEV-16239 does apply the DML logs after bulk insert for
ALTER TABLE..ALGORITHM=COPY, but InnoDB fails to reset the bulk_insert
in ha_innobase::extra(HA_EXTRA_END_ALTER_COPY). This leads to crash
while applying DML logs.

Solution:
=======
ha_innobase::extra(HA_EXTRA_END_ALTER_COPY): Reset TRX_DDL_BULK at the
end of bulk insert operation
2025-04-24 14:27:29 +05:30
1d5557d9c0 MDEV-36663 Semi-sync Replica Can't Kill Dump Thread When Using SSL
When a replica stops an established semi-sync connection, it is
supposed to kill the corresponding binlog dump thread on the primary
server.  However, when connections are configured to use SSL, this new
connection created by the replica to kill the dump thread doesn't have
any logic to configure SSL options, and thereby the connection can't be
made, and the dump thread will never be killed.

This patch adds logic to configure the semi-sync kill connection with
SSL. The exising logic to set up the connection options for the regular
connection was extracted into a function that the semi-sync kill
connection invokes.

Co-author: Brandon Nesterenko <brandon.nesterenko@mariadb.com>
2025-04-23 17:20:47 -06:00
2f5c260f55 MDEV-36514 : galera_var_ignore_apply_errors test failure: table doesn't exist
Test changes only. Added proper wait_conditions to wait for expected
replication state.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2025-04-23 18:45:57 +02:00
76938eda9d MDEV-36625 : galera.galera_var_replicate_myisam_on test failure
Test case changes only. Add proper wait_conditions to wait expected
database state.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2025-04-23 18:45:11 +02:00
f1a8b7fe95 MDEV-36646: innodb_buffer_pool_size change aborted
A statement SET GLOBAL innodb_buffer_pool_size=...
could fail for no good reason when the buffer pool contains many
pages that can actually be evicted.

buf_flush_LRU_list_batch(): Keep evicting as long as the buffer pool
is being shrunk, for at most innodb_lru_scan_depth extra blocks.
Disregard the flush limit for pages that are marked as freed in files.

buf_flush_LRU_to_withdraw(): Update the to_withdraw target during
buf_flush_LRU_list_batch().

buf_pool_t::will_be_withdrawn(): Allow also ptr=nullptr (the condition
will not hold for it).

This fixes a regression that was introduced in
commit b6923420f3 (MDEV-29445)
and caught by the test innodb.temp_truncate_freed in MariaDB Server 11.4.

Tested by: Thirunarayanan Balathandayuthapani
Reviewed by: Thirunarayanan Balathandayuthapani
2025-04-23 15:42:12 +03:00
2fa50befbd rpm: restore MariaDB-test dependency on MariaDB-common
after 41b036bff0
2025-04-23 12:57:14 +02:00
8925877dc8 MDEV-36591: RHEL8(+compat)/Ubuntu 20.04 cannot start systemd servce (EXIT_CAPABILTIES/218)
Combined AmbientCapabilities and CapabilityBoundingSet configuration
within a service file we have found by testing aren't supported in the
systemd v245 (Ubuntu 20.04) and v239 (RHEL8) for non-root users. This
resulted in a service start error EXIT_CAPABILITIES, a systemd limitation
of the version that we cannot work around consequences.

The systemd version 247 these combined capabilities have been tested to
work on Debian 11. No other supported major distros run systemd
version 246, and if they did, the missing capability of CAP_IPC_LOCK
won't be noticed as it was a convenience for --memlock users.

As such we disable the AmbientCapabilites for CAP_IPC_LOCK rather
that disabling the CapabilityBoundingSet, because doing the later
will disable authentication for MariaDB users that have configured PAM
with MariaDB.

Should a user require CAP_IPC_LOCK they can append in their own
systemd overlay file this configuration in the CapabilityBoundingSet
and configure the capability file attributes on the mariadbd executable
to have the IPC_LOCK capability. This isn't configured by default as the
presence of a capability in the MariaDB Server is detected by
openssl libraries as "insecure" which will then ignore any user configured TLS
configuration file passed though by the OPENSSL_CONF environment variable.
2025-04-23 12:57:14 +02:00
f5405ef511 RPM fixes for centos
centos can go up to "centosstream10" now
2025-04-23 12:57:14 +02:00
1a044437a3 MDEV-16523 update RocksDB to 6.29fb 2025-04-23 11:12:56 +02:00
fe25a30a92 MDEV-36620 : galera_toi_ddl_nonconflicting test failure
Test changes only. Idea of the test is to test two concurrent
nonconflicting DDL-clauses. Therefore, use debug sync to
really execute two DDL-clauses as concurrently as Galera
allows.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2025-04-23 08:31:10 +02:00
75ad1e9f00 Merge 10.6 into 10.11 2025-04-23 08:53:53 +03:00
67b6f9f285 MDEV-36618 : galera.galera_as_slave_nonprim test: result content mismatch
Remove unnecessary sleeps and use wait_for_slave_to_stop instead.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2025-04-22 20:46:51 +02:00
b1eec9d8af MDEV-36516 : galera_3nodes.galera_gtid_2_cluster test failed on 10.5
Add wait-conditions to verify that INSERTs are replicated
before checking GTIDs.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2025-04-22 20:44:10 +02:00
1ae8c63ba6 Revert "Fix valgrind detection"
This reverts commit 952ffb55f9.
2025-04-22 21:06:55 +03:00
1697717f9b Add -asan to server version suffix if -fsanitize is used
This is to allow mtr tests using --include not_valgrind_build.inc to
also work.

Reviewed-by: monty@mariadb.com
2025-04-22 21:06:55 +03:00
26754e23b2 Typo: HAVE_valgrind should be used, not HAVE_VALGRIND
This caused the MariaDB Server version to not have the -valgrind flag
when compiled with valgrind support.
2025-04-22 21:06:55 +03:00
47e687b109 MDEV-36639 innodb_snapshot_isolation=1 gives error for not committed row changes
Set solution is to check if transaction, which modified a record, is
still active in lock_clust_rec_read_check_and_lock(). if yes, then just
request a lock. If no, then, depending on if the current transaction read
view can see the changes, return eighter DB_RECORD_CHANGED or request a
lock.

We can do the check in lock_clust_rec_read_check_and_lock() because
transaction tries to set a lock on the record which cursor points to after
transaction resuming and cursor position restoring. If the lock already
exists, then we don't request the lock again. But for the current commit
it's important that lock_clust_rec_read_check_and_lock() will be invoked
again for the same record, so we can do the check again after
transaction, which modified a record, was committed or rolled back.

MDEV-33802(4aa9291) is partially reverted. If some transaction holds
implicit lock on some record and transaction with snapshot isolation level
requests conflicting lock on the same record, it should be blocked instead
of returning DB_RECORD_CHANGED to have ability to continue execution when
implicit lock owner is rolled back.

The construction
--------------------------------------------------------------------------
let $wait_condition=
  select count(*) = 1 from information_schema.processlist
  where state = 'Updating' and info = 'UPDATE t SET b = 2 WHERE a';
--source include/wait_condition.inc
--------------------------------------------------------------------------

is not reliable enought to make sure transaction is blocked in test
case, the test failed sporadically with
--------------------------------------------------------------------------
./mtr --max-test-fail=1 --parallel=96 lock_isolation{,,,,,,,}{,,,}{,,} \
--repeat=500
--------------------------------------------------------------------------

command. That's why it was replaced with debug sync-points.

Reviewed by: Marko Mäkelä
2025-04-22 20:41:43 +03:00
4bedb222a8 MDEV-36304 InnoDB: Missing FILE_CREATE, FILE_DELETE or FILE_MODIFY error
during mariabackup --prepare

Reason:
======
During --prepare of partial backup, if InnoDB encounters the redo log
for the excluded tablespace then InnoDB stores the space id in dirty
tablespace list during recovery, anticipates that it may encounter
FILE_* redo log records in the future. Even though we encounter FILE_*
record for the partial excluded tablespace then we fail to replace the
name in dirty tablespace list. This lead to missing of
FILE_* redo log records error.

Solution:
========
fil_name_process(): Rename the file name from "" to name encountered
during FILE_* record

recv_init_missing_space(): Correct the condition to print the warning
message of missing tablespace during mariabackup restore process.
2025-04-22 17:53:08 +05:30
8c7c144f19 MDEV-36592: In JOIN ... USING(columns), query plan depends on join order
"t1 JOIN t2 USING(col1,...)" calls mark_common_columns() to mark the
listed columns as used in both used tables, t1 and t2.

Due to a typo bug, it would mark the wrong column in the second table
(t2): instead of t2.col1 it would mark the last column in t2.

The harmful effects included JOIN_TAB(t2)->covering_keys not being
set correctly. This changed the cost to access the table and then
caused different query plans depending on which table was the second
in the JOIN ... USING syntax.
2025-04-22 14:57:57 +03:00
7b0820b8b7 cleanup: redundant my_casedn_str()
hashing/comparison uses case-insensitive collation anyway
2025-04-22 12:03:05 +02:00
ab71860161 cleanup: check_column_name(const Lex_ident &name) 2025-04-22 12:03:05 +02:00
63a69ab936 cleanup: remote automatic conversion char* -> Lex_ident
considered harmful, see e.g. changes in check_period_fields()
2025-04-22 12:03:05 +02:00
dac3d702f7 MDEV-36649 dict_acquire_mdl_shared() aborts when table mode is DICT_TABLE_OP_OPEN_ONLY_IF_CACHED
- InnoDB fails to check the table is being dropped or evicted
while acquiring the MDL for the table when table open operation
mode is DICT_TABLE_OP_OPEN_ONLY_IF_CACHED. This is caused by
the commit 337bf8ac4b (MDEV-36122)

Fix:
===
dict_acquire_mdl_shared(): If the table is evicted or dropped when
table operation mode is DICT_TABLE_OP_OPEN_IF_CACHED then return
nullptr
2025-04-22 15:17:29 +05:30
3393d1064f MDEV-34075 corruption when query cache cannot allocate block
When allocate_block() have failed Query_cache::insert_table() misses
to init node->parent which is then accessed with outdated data. There
is check in Query_cache::register_all_tables():

    if (block_table->parent)
      unlink_table(block_table);

So unlink_table() is avoided when parent is 0.
2025-04-22 08:31:15 +02:00
588f7a5af7 MDEV-35694: Mysqlbinlog --stop-position should warn if EOF not reached with --read-from-remote-server
MDEV-27037 added functionality to warn users that a specified
stop-position or stop-datetime was never reached. It only worked for
local files though. The patch in MDEV-35528 changed the
implementation for stop-datetime to work to provide the warning also
when using --read-from-remote-server. The PR for that MDEV (#3670)
was limited to only the stop-datetime field.

This patch updates the --stop-position warning to also work with
--read-from-remote-server.

Reviewed By:
============
Andrei Elkin <andrei.elkin@mariadb.com>
Jimmy Hu <jimmy.hu@mariadb.com>
2025-04-21 14:21:55 -06:00
837fad6e41 MDEV-31647 Stack looping and SIGSEGV in Item_args::walk_args on UPDATE
The problem is with window function which requires its own sorting but
it is impossible as table is updated while select is
progressing. That's it, multi-update queries do not use temporary
tables to store updated rows and substitute them at the end of the
query. Instead, updates are performed directly on the target table,
row by row, during query execution. MariaDB processes updates in a way
that ensures each row is updated only once, even if it matches
multiple conditions in the query. This behavior avoids redundant
updates and does not require intermediate storage in a temporary table.

The detailed cause of the loop invoked by window function was
explained by Yuchen Pei in MDEV-31647 comments.

The fix disables window functions for multi-update.

Note that MySQL throws ER_UPDATE_TABLE_USED in that case which is the
result of check_unique_table(). But this function is not used for
multi-update in MariaDB and this check cannot be done because some
level of SELECT expressions is allowed (MDEV-13911).
2025-04-21 21:13:52 +02:00
a96c094d1b MDEV-25012 Server crash in find_field_in_tables, Assertion `name'
failed in find_field_in_table_ref

The main crash with segfault in find_field_in_tables() was fixed by
6aa47fae30 (MDEV-35276). This fix is for debug assertion.

Since Item_default_value is also Item_field there is nothing to be
done except adding DEFAULT_VALUE_ITEM type check.
2025-04-21 20:50:24 +02:00
20b818f45e Merge branch '10.6' into 10.11 2025-04-21 11:23:11 +02:00
a135551569 Merge branch '10.5' into 10.6 2025-04-21 10:43:17 +02:00
236dec69b7 new CC 2025-04-20 20:48:21 +02:00
952ffb55f9 Fix valgrind detection 2025-04-20 19:01:49 +02:00
5f6b92a738 New CC 2025-04-20 10:01:52 +02:00
fbec528cbb MDEV-36245 review changes
Closes #3874
2025-04-19 10:16:19 +02:00
35c25cd107 MDEV-36412 Concerns compilation issue on community edition for x86_64 with X32 ABI 2025-04-19 11:03:43 +03:00
51c5b75335 Always call mysql_cond_broadcast(&rli->data_cond) under data_lock
This is a safetly fix to try to fix random failures in
parallel_backup_xa_debug reported as:
sync_slave_with_master failed:
'select master_pos_wait('master-bin.000001', 1034, 300, '')' returned -1

One possible reason could be lost signals, which this patch fixes.
2025-04-19 11:03:43 +03:00
8c6b0d092a MDEV-36245 Long server_audit_file_path causes buffer overflow
Limit size of server_audit_file_path value

Currently, the length of this value is not checked and can cause a buffer
overflow if given a long file path specifying a directory.

In file_logger:logger_open(), there is a check:
```
  if (new_log.path_len+n_dig(rotations)+1 > FN_REFLEN)
    // handle error
```

As n_dig(rotations) may return up to 3, this inherently limits the file path to
FN_REFLEN - 4 characters.

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.
2025-04-19 09:59:29 +02:00
7d9660ed93 item_json*: handle memory allocations
JSON functions append in multiple ways, however there isn't always error
handling, and many time it doesn't make it to the end user.

Made the appending string functions withing item_jsonfunc warn if their
true/false result (did an error occur) isn't handled.

Add error handling to many json functions.

realloc_with_extra_if_needed was also previously lacking OOM handing.
2025-04-19 08:55:05 +10:00
ca144971e1 MDEV-35614: json_unescape for comparison uses utf8mb4_bin 2025-04-19 08:55:05 +10:00