Commit Graph

204117 Commits

Author SHA1 Message Date
Georgi Kodinov
3a08a8e3d2 Display the exact amount of data updated by mariadb-secure-installation
Some checks are pending
Build on Windows ARM64 / build (push) Waiting to run
2025-12-19 11:59:26 +02:00
Otto Kekäläinen
69ee922c1c Improve output from mariadb-secure-installation to be more honest
The script is likely misleading to users stating 'SUCCESS' about things
it didn't do anything about, leading to false sense of security. Improve
the output to be more clear about what it is doing or is not doing.
2025-12-19 11:59:26 +02:00
Raghunandan Bhat
d936d36d4f MDEV-30847: HashiCorp Plugin: Provide cache flush for key rotation
Some checks failed
Build on Windows ARM64 / build (push) Has been cancelled
Introduces `FLUSH HASHICORP_KEY_MANAGEMENT_CACHE` command to flush the
cached keys in the HashiCorp Key Management plugin, enabling rotation of
encryption keys without needing to restart the server.

The new `INFORMATION_SCHEMA.HASHICORP_KEY_MANAGEMENT_CACHE` table lists
the key id and key version from the latest version cache. The table's
content can be viewed using `SHOW HASHICORP_KEY_MANAGEMENT_CACHE` or
queried directly.

Executing the `FLUSH` command requires `RELOAD` privilege and access to
INFORMATION_SCHEMA table requires `PROCESS` privilege.

Bugfix (squashed):
MDEV-38111: SIGSEGV when multiple servers use the same Vault KV storage for encrypted tables

Problem:
  A data race between InnoDB background threads reading the cached keys
  and the thread executing FLUSH command clearing it without acquiring
  a lock. This non-synchronized memory write caused InnoDB threads that
  were concurrently reading the cache to access freed memory, leading to
  a crash.

Fix:
  Acquire the lock before clearing the latest version cahce. This
  ensures the cache clearing operation is serialized, preventing
  concurrent access and resolving the data race.
2025-12-16 17:47:34 +05:30
Otto Kekäläinen
5879c85f50 Fix misc spelling in MariaDB Server repository
Some checks failed
Build on Windows ARM64 / build (push) Has been cancelled
This is a combined patch of various spelling fixes originally done in
Debian.

* Fix misc typos in MariaDB Server

* Fix spelling of 'allows one to'

  Fix the following Lintian nags introduced in commit
  c8d040938a:

  I: mariadb-backup: spelling-error-in-binary "allows to" "allows one to" [usr/bin/mariadb-backup]
  I: mariadb-server-core: spelling-error-in-binary "allows to" "allows one to" [usr/sbin/mariadbd]
  I: mariadb-test: spelling-error-in-binary "allows to" "allows one to" [usr/bin/mariadb-client-test-embedded]
  I: mariadb-test: spelling-error-in-binary "allows to" "allows one to" [usr/bin/mariadb-test-embedded]
  I: mariadb-test: spelling-error-in-binary "allows to" "allows one to" [usr/bin/test-connect-t]
2025-12-10 18:08:12 +04:00
Rex Johnston
e85bc65918 MDEV-37220 Allow UPDATE/DELETE to read from a CTE
We extend from the SQL standard to match the functionality of other
databases that allow the inclusion of a CTE definition prior to update
and delete statements.

These CTEs are currently read only, like other derived tables, so
cannot have their columns updated in updates set clause, nor have rows
removed in the delete statement.

Approved by: Oleksandr Byelkin (sanja@mariadb.com)
2025-12-04 07:42:23 +12:00
Monty
797f50d107 Removed not used members in class POSITION
Some checks failed
Build on Windows ARM64 / build (push) Has been cancelled
Removed members:
- records_after_filter
- prev_record_reads
2025-11-25 10:25:01 +02:00
Monty
1e8dddbdbb Fixed failing mysqldump test when there is no internet connection
When no internet, we get a different error from mariadb-dump for unkown
hosts.
2025-11-25 10:25:01 +02:00
bsrikanth-mariadb
f4318f3f3b MDEV-38120: Move Json_string and Json_saved_parser_state into sql_json_lib.h
Move classes Json_string, and Json_saved_parser_state from
opt_histogram_json.cc to the newly created file sql_json_lib.h
Additionally, make the function json_unescape_to_string public earlier
defined as static in opt_histogram_json.cc, by
adding the declaration in sql_json_lib.h

Needed this change so that, the classes and functions can be reused in
other pieces of the code.
2025-11-24 17:45:51 +05:30
Sergei Golubchik
809e6f4195 12.3 branch 2025-11-22 22:08:38 +01:00
Sergei Golubchik
b15d1adf85 Merge branch '12.2.1' into 12.2 2025-11-22 19:41:27 +01:00
Sergei Golubchik
277c30fde3 bump the maturity 2025-11-22 19:40:53 +01:00
Daniel Bartholomew
c6f02d6a88
bump the VERSION 2025-11-21 02:44:26 -05:00
Sergei Golubchik
144dead882 (clang20) error: moving a temporary object prevents copy elision 2025-11-18 22:18:59 +01:00
Sergei Golubchik
ddd3a612cf ctype-ascii.h:110:27: runtime error: applying non-zero offset 4 to null pointer
when this->get_name() is {0,0}
2025-11-18 21:20:31 +01:00
Sergei Golubchik
0af24548e5 runtime error: inf is outside the range of representable values of type 'unsigned long long' 2025-11-18 21:04:57 +01:00
Sergei Golubchik
8d6699db90 runtime error: shift exponent 32 is too large for 32-bit type 'int' 2025-11-18 20:58:03 +01:00
Sergei Golubchik
9161270a11 Merge branch '12.1' into 12.2 2025-11-18 15:06:52 +01:00
Rucha Deodhar
8abdcba534 MDEV-37082: Sig 11 in json_normalize_sort
Analysis:
json_valid() does not call any function recursively so insertion in the
table works ok. Since the depth of json is 5000, json_normalize()
recursively calls json_normalize_sort(), json_norm_to_string() and
json_norm_value_free() and we hit the stack limit.
Fix:
Get rid of the recursive nature of the functions and make them iterative.
This way we will never hit stack limit for bigger depths.
2025-11-18 18:36:17 +05:30
Sergei Golubchik
70117463f0 Merge branch '11.8' into 12.1
Some checks failed
Build on Windows ARM64 / build (push) Has been cancelled
2025-11-13 16:46:01 +01:00
Sergei Petrunia
1f7446efdc MDEV-37422: SIGSEGV / Assert for vcol substitution in GROUP BY WITH ROLLUP
Variant 2:
Do not do virtual column substitution in GROUP BY when WITH ROLLUP is
present.

Approved by: Yuchen Pei <ycp@mariadb.com>
2025-11-13 16:45:36 +01:00
Sergei Golubchik
cd3df7142d remove unused new modes constants 2025-11-13 16:38:56 +01:00
Oleg Smirnov
5f845854fb MDEV-36761 Remove @@new_mode=FIX_INDEX_STATS_FOR_ALL_NULLS in 12.1
Remove the FIX_INDEX_STATS_FOR_ALL_NULLS flag from @@new_mode.
The new behavior is now always on.
2025-11-13 22:18:13 +07:00
Sergei Golubchik
a74edc42d0 MDEV-38068 Query doesn't delete all data it should after update to 11.8.4
a fix for MDEV-15990 has unintentionally added
HA_EXTRA_REMEMBER_POS/HA_EXTRA_RESTORE_POS on the code path for normal,
not versioned, deletes.

Let's restore the old logic.

followup for 8001679af6
2025-11-13 09:40:50 +01:00
Oleksandr Byelkin
a0bdb3b7d0 fix version 2025-11-07 17:22:40 +01:00
Oleksandr Byelkin
c3398a0532 Merge branch '11.8' into mariadb-11.8.4 2025-11-07 11:03:57 +01:00
Daniel Bartholomew
db02a70725
bump the VERSION 2025-11-06 12:31:11 -05:00
Oleksandr Byelkin
fd15fd2765 Merge branch 'bb-12.1-release' into bb-12.2-release 2025-11-06 07:29:30 +01:00
Oleksandr Byelkin
ba00960fda Merge branch 'bb-11.8-release' into bb-12.1-release 2025-11-05 08:58:12 +01:00
Sergei Golubchik
c21d462e6a Merge branch 'bb-11.4-serg' into bb-11.8-serg 2025-11-04 18:27:52 +01:00
Dave Gosselin
101346c3dc MDEV-37905: UNCACHEABLE_RAND inconsistently set on unions
We need to ensure that all the unions are marked as UNCACHEABLE_RAND in
cases like:
  select * from t1 where 1 in (select 1 union select 2 union select RAND());
2025-11-04 08:47:54 -05:00
Sergei Golubchik
aa6a2e6bf0 MDEV-37345 sequences and prelocking (11.4 version)
table->pos_in_table_list is problematic, it can become
dangled when an SP is reparsed. Let's avoid it and directly
prefer TABLEs where a sequence is ready for inserts.

followup for 516f68af9e
2025-11-04 13:44:39 +01:00
Sergei Golubchik
f230c0ff6e Merge branch '10.11' into 11.4 2025-11-04 13:44:16 +01:00
Sergei Golubchik
5ce9a03602 Merge branch '11.4' into 11.8 2025-11-04 12:39:27 +01:00
Sergei Golubchik
152ed78d49 MDEV-37345 sequences and prelocking (11.4 version)
table->pos_in_table_list is problematic, it can become
dangled when an SP is reparsed. Let's avoid it and directly
prefer TABLEs where a sequence is ready for inserts.

followup for 516f68af9e
2025-11-04 01:05:25 +01:00
Sergei Golubchik
d198be392b fix nullptr-with-nonzero-offset UB 2025-11-03 19:56:46 +01:00
Sergei Golubchik
0c94001a32 fix merge test to restore the environment
include/test_db_charset_latin1.inc should be paired with
include/test_db_charset_restore.inc

also fix end-of-version test markers
2025-11-03 16:56:29 +01:00
Sergei Golubchik
1093a2f3b8 Merge branch '10.11' into 11.4 2025-11-03 14:23:51 +01:00
Sergei Golubchik
cb0d6dd835 fix rpm upgrade tests after MDEV-37726
MDEV-37726 moved wsrep-start-position to INSTALL_RUNDATADIR
and made the latter to be created by systemd-tmpfiles.

Now postin scriptlet has to run systemd-tmpfiles explicitly
to make sure INSTALL_RUNDATADIR exists before restarting
the server.

followup for 649216e70d
2025-11-03 14:00:16 +01:00
Sergei Golubchik
9dce783911 fix spider/bugfix.mdev_22979 test
* remove the file to be --repeat friendly
* specify the correct defaults-group-suffix. Spider doesn't use the
  conventional .1 group, so MYSQLD_CMD skips a lot of config options,
  in particular it doesn't read --tmpdir and creates files in /tmp
2025-11-03 13:59:36 +01:00
Oleksandr Byelkin
06cce62200 Merge branch '12.1' into bb-12.2-release 2025-11-02 18:08:29 +01:00
Sergei Petrunia
240b4e83e0 MDEV-37913: disable_index_merge_plans causes SELECT data loss when more than 100 ORs
(Variant 2)
SEL_TREE* tree_or(SEL_TREE *X, SEL_TREE *Y) tries to conserve memory by
reusing object *X for the return value when possible.

MDEV-34620 has added logic to disable construction of index_merge plans
for N-way ORs with large N. That logic interfered with object reuse logic:

for the parameters of:
X = SEL_TREE{ trees=[key1_treeA, key2_treeB]}
Y = SEL_TREE{ trees=[key1_treeC]}

we would decide to reuse object X.
For key1, we would produce key_or(key1_treeA, key1_treeC)
but key2_treeB would be just left there.
Then, we would construct a range scan from key2_treeB.

Fixed by moving the "disable building index_merge plans" logic into a
location where it would not interfere with object reuse logic.
2025-11-01 11:04:46 +01:00
Oleg Smirnov
aa70eeac2c MDEV-36761: Put NULL-aware cardinality estimation under new_mode flag
The NULL-aware index statistics fix is now controlled by the
FIX_INDEX_STATS_FOR_ALL_NULLS flag and disabled by default
for preserving execution plan stability in stable versions.

To enable:
  SET @@new_mode = 'FIX_INDEX_STATS_FOR_ALL_NULLS';

Or via command line:
  --new-mode=FIX_INDEX_STATS_FOR_ALL_NULLS

Or in configuration file:
  [mysqld]
  new_mode=FIX_INDEX_STATS_FOR_ALL_NULLS

`all_nulls_key_parts` bitmap is now calculated at set_statistics_for_table()
2025-10-31 19:47:30 +07:00
Sergei Golubchik
292bab3565 cleanup: Sp_caches::sp_caches_swap()
remove the fix for MDEV-25243. It's no longer needed, because
a routine can no longer be re-parsed in the middle of a statement.
2025-10-28 17:49:51 +01:00
Sergei Golubchik
78e474b1a7 cleanup: sp_cache_flush_obsolete
it was only truly used in one place, where it needed to compare
its arguments before removing an entry from the cache. in the second
place it was used, the comparison was redundant, it was only
called to remove, not to compare.

let's replace it with a function that just removes.
2025-10-28 17:49:51 +01:00
Sergei Golubchik
956920816e MDEV-37710 ASAN errors in find_type2 upon executing a procedure from sys schema
don't reload stored routines in the middle of the execution
of a routine. we don't want different iterations of a loop
to see diffefent definitions

For this: remember Cversion in THD on the first sp cache lookup,
after that only compare versions with this value not with Cversion.
2025-10-28 17:49:51 +01:00
Sergei Golubchik
8df3524cf3 MDEV-37345 temporary table, ALTER, recreate sequence
Test case only. The bug is fixed by cherry-pick of 2d5db53584
"Simplify NEXTVAL(sequence) when used with DEFAULT"
2025-10-28 17:49:51 +01:00
Monty
72341bc255 Simplify NEXTVAL(sequence) when used with DEFAULT
Instead of adding another TABLE_LIST to
Item_func_nextval->table_list->next_local, update instead
Item_func_nextval->table_list->table with the correct table.

This removes all checking of table_list->table and table_list->next_local
when using sequences.
2025-10-28 17:49:51 +01:00
Sergei Golubchik
516f68af9e MDEV-37345 sequences and prelocking
if a bunch of tables are prelocked, when a table is actually
needed in the routine, open_tables picks one table out of the
prelocked list with a smallest "distance". Distance is simply
a difference between the actual table lock and the requested
table lock. Say, if the prelocked set contains both t1 write-locked
and t1 read-locked, than an UPDATE will prefer write-locked t1
and SELECT will prefer read-locked. if there's only write-locked
table in the set, both UPDATE and SELECT will use it.

this doesn't distingush between UPDATE and INSERT, but INSERT
marks tables with tables->for_insert_data=1, which causes
prelocking to invoke add_internal_tables() and prepare sequences
for execution.

in this bug there were two prelocked t1's, one for INSERT (with
for_insert_data=1) and one for UPDATE.
INSERT picks the second (they both are write-locked, so the distance is
the same), its sequence is not prepared and crashes.

Let's add for_insert_data as the lowest bit into the distance.
2025-10-28 17:49:51 +01:00
Oleksandr Byelkin
4af88ced48 Merge branch '11.8' into bb-12.1-release 2025-10-28 15:26:26 +01:00
Sergei Golubchik
2bf1d089cf MDEV-37906 Server crash or UBSAN errors in Item_func_nextval::update_table upon INSERT DELAYED
sequences, just as triggers or check constraints, disable DELAYED
2025-10-28 10:49:42 +01:00