1
0
mirror of https://github.com/MariaDB/server.git synced 2025-04-18 21:44:20 +03:00

202987 Commits

Author SHA1 Message Date
Marko Mäkelä
5ebff6e15a MDEV-36038 ALTER TABLE…SEQUENCE does not work correctly with InnoDB
mysql_alter_table(): Consider ha_sequence::storage_ht() when determining
if the storage engine changed.

ha_sequence::check_if_supported_inplace_alter(): A new function, to
ensure that ha_innobase::check_if_supported_inplace_alter() will be
called on ALTER TABLE name_of_sequence SEQUENCE=0.

ha_innobase::check_if_supported_inplace_alter(): For any change of
the SEQUENCE attribute, always return HA_ALTER_INPLACE_NOT_SUPPORTED,
forcing ALGORITHM=COPY.
2025-02-18 16:38:18 +01:00
Monty
059d06ae07 Fixed compile failure in sql_print_warning in sql_acl.cc
This fixes compilation when using gcc 7.5.0
Apparantly this version of gcc does not support
enum privilege_t: unsigned long long forr printf
argument checking.
2025-02-18 17:00:42 +02:00
Jan Lindström
94ef07d61e MDEV-32631 : galera_2_cluster: before_rollback(): Assertion `0' failed
Test case changes only. Add wait_conditions to make sure
nodes rejoin the cluster. Assertion itself should not be
possible anymore as we do not allow sequences on
Aria tables.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2025-02-18 04:51:16 +01:00
Marko Mäkelä
7e001b2a3c MDEV-36082 Race condition between log_t::resize_start() and log_t::resize_abort()
log_t::writer_update(): Add the parameter bool resizing,
to indicate whether log resizing is in progress.
We must enable log_writer_resizing only if resize_lsn>1,
to ensure that log_t::resize_abort() will not choose the wrong
log_sys.log_writer.

log_t::resize_initiator: The thread that successfully invoked
resize_start().

log_t::resize_start(): Simplify some logic, and assign resize_initiator
if we successfully started log resizing.

log_t::resize_abort(): Abort log resizing if we are the
resize_initiator.

innodb_log_file_size_update(): Clean up some logic.

Reviewed by: Debarun Banerjee
2025-02-17 15:55:58 +02:00
Vladislav Vaintroub
59ad3225ae MDEV-34979 postfix
Do not produce CPE element in SBOM, if mariadb-connector-c commit hash
is not tagged (and thus does not correspond to any released version)
2025-02-17 09:37:35 +01:00
Marko Mäkelä
f1d7e0c17e MDEV-35436 dict_stats_fetch_from_ps() unnecessarily holds exclusive dict_sys.latch
dict_stats_fetch_from_ps(): Acquire dict_sys.latch as few times as
possible, and release dict_sys.latch after invoking pars_sql(),
so that we will not be unnecessarily holding dict_sys.latch while
possibly waiting for data to be read into the buffer pool.
2025-02-13 16:54:17 +01:00
Marko Mäkelä
7587b0ec84 MDEV-36061 Incorrect error handling on DDL with FULLTEXT INDEX
row_create_index_for_mysql(): Tolerate DB_LOCK_TABLE_FULL better.

fts_create_one_common_table(), fts_create_one_index_table():
Do not corrupt the error state of a non-active transaction object.

fts_config_set_value(): Only run another statement if there was
no error yet.
2025-02-13 16:28:06 +01:00
Marko Mäkelä
c07e355c40 MDEV-36015: unrepresentable value in row_parse_int()
row_parse_int(): Refactor the code and define the function static in
one compilation unit. For any negative values, we must return 0.

row_search_get_max_rec(), row_search_max_autoinc(): Moved to the same
compilation unit with row_parse_int().

We also remove a work-around of an internal compiler error when
targeting ARMv8 on GCC 4.8.5, a compiler that is no longer supported.

Reviewed by: Debarun Banerjee
2025-02-13 15:10:53 +01:00
Sergei Petrunia
33e0796e7a MDEV-36080: Assertion on 2nd PS execution with error and Array Binding
The fix for MDEV-35318 has introduced LEX::needs_reprepare and logic in
Prepared_statement::execute_loop() and sp_lex_keeper::
validate_lex_and_exec_core() to re-prepare the statement if it has hit
an error when doing once-per-statement-life optimizations.

But there is also third code path: PS with Array Binding is handled in
Prepared_statement::execute_bulk_loop(). Add handling there as well.
2025-02-13 16:08:03 +02:00
Dave Gosselin
1629435745 MDEV-36074 main.multidelete_engine missing result file
Record the required result file and make the test more interesting, too
2025-02-13 11:58:54 +11:00
Vladislav Vaintroub
d54ec1b377 MDEV-33965 - fix non-determinism in the main.status test
Change the order or queries, so that result of "uptime_since_flush"
comparison does not depend on timing.

Also, improve the execution speed of the test by ca. 25 percent, removing
or reducing the sleeps. There is no need to sleep more than 1 second
in this test.
2025-02-12 13:45:21 +01:00
Julius Goryavsky
573b584eba galera mtr tests: unification of wsrep provider settings 2025-02-12 13:37:03 +01:00
Jan Lindström
bb64a51037 MDEV-35941 : galera_bf_abort_lock_table fails with wait for metadata lock
Problem was missing case from wsrep_handle_mdl_conflict. Test case
was trying to confirm that LOCK TABLE thread is not BF-aborted.
However as case was missing it was BF-aborted. Test case passed
because BF-aborting takes time and used wait condition might
see expected thread status before it was BF-aborted. Test naturally
failed if BF-aborting was done early enough.

Fix is to add missing case for SQLCOM_LOCK_TABLES to
wsrep_handle_mdl_conflict.

Note that using LOCK TABLE is still not recomended on cluster
because it could cause cluster hang.

This is a 10.5 specific commit that will then be overridden by
another one for 10.6+.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2025-02-12 13:35:47 +01:00
Sergei Golubchik
c92add291e 12.0 branch 2025-02-12 12:37:38 +01:00
Julius Goryavsky
7b040e53cc galera mtr tests: fixes for test failures, 'cosmetic' changes and unification between versions 2025-02-12 12:25:09 +01:00
Julius Goryavsky
c35b6f133a galera mtr tests: synchronization between editions/branches (10.5) 2025-02-12 12:25:09 +01:00
Teemu Ollakka
1b146e8220 galera fix: Donor in non-Primary causes assertion in wsrep-lib
Constructed a test which makes donor to go into non-Primary configuration
before `sst_sent()` is called, causing an assertion in wsrep-lib
if the bug is present.

Updated wsrep-lib to version which contains the fix.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2025-02-12 12:25:09 +01:00
Julius Goryavsky
dd5dc92a19 galera_sequences test: post-fix after MDEV-33245 2025-02-12 12:25:09 +01:00
Julius Goryavsky
eb1811c2ce galera: disable problematic test (galera_vote_rejoin_dml) 2025-02-12 12:25:07 +01:00
Julius Goryavsky
1456d9ea0a galera: disable problematic test (MW-329) 2025-02-12 12:23:20 +01:00
Julius Goryavsky
a382b695d2 galera: disable problematic test (galera_vote_rejoin_ddl) 2025-02-12 11:30:15 +01:00
Julius Goryavsky
a7e59c8a54 galera mtr tests: remove unused .result file 2025-02-12 11:30:15 +01:00
Julius Goryavsky
96040fbd53 galera: correction for MENT-2042 test
Removed major part of test because XA transactions
are not supported in galera on 10.5 branch.
2025-02-12 11:30:15 +01:00
Julius Goryavsky
c9a6adba1e galera mtr tests: synchronization of tests between branches 2025-02-12 11:30:14 +01:00
Julius Goryavsky
65545a3df2 galera: root certificate renewed 2025-02-12 11:30:14 +01:00
Jan Lindström
c43d0a015f MDEV-35951 : Complete freeze during MW-329 test
Rewrite test not to use infinite procedure, it is not
necessary to test.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2025-02-12 10:52:21 +01:00
ParadoxV5
1c4aed7c68 Update my_snprintf’s last loose ends to suffixes
Migrate `mysys/errors.c`, `sql-common/errmsg.c` and a couple of
insignificant loose ends to use suffix-based, `-Wformat`-compatible
`my_snprintf` format extensions introduced in MDEV-21978

This commit is the final batch of MDEV-21978’s migration process.

While GCC `-Wformat` (with `ATTRIBUTE_FORMAT`) can catch obsolete or
malformed format string literals, formats originating from other sources
(such as those strings headers) (still) require manual review.
Thus, after all the automatic `-Wformat` complaints fixed in previous
commits, I’ve done a manual `grep` and caught these final matches.
mariadb-11.8.1
2025-02-12 10:17:44 +01:00
ParadoxV5
5de8e2dde3 Update errmsg-utf8.txt re my_snprintf suffixes
* Migrate `sql/share/errmsg-utf8.txt` to use suffix-based, `-Wformat`
  -compatible `my_snprintf` format extensions introduced in MDEV-21978
* Update relevant tests caught by BuildBot as well

While GCC `-Wformat` (with `ATTRIBUTE_FORMAT`) can catch obsolete or
malformed format string literals, formats originating from other sources
(such as this translations file) (still) require manual review.

This commit also escapes the only (1) instance of existing strings
conflicted by the introduction of suffixes:
(Not all `printf`s goes to `my_snprintf`, thus I `grep`ped and
confirmed that this does indeed land on `my_snprintf` eventually.)
    chi "不能%sSLAVE'%.*s'"

This commit also fixes the following: (You’re welcome.)
* Delete extraneous spaces after the `%` (they’re all Swahili)
* Update `extra/comp_err.c`
  * Add the missing standard C/C++ specifiers `c`, `i`, `o`, `p` and `X`
    (Especially `%i`: it otherwise was complaining about the new `%iE`)
  * Removed the old and obsolete extension formats `%b`, `%M` and `%T`
2025-02-12 10:17:44 +01:00
ParadoxV5
202c2fb151 make abi_update
Commits for MDEV-21978 changes ABIs with their introduction of
`__attribute__((format(printf, …))` tags.
2025-02-12 10:17:44 +01:00
ParadoxV5
c8783757d6 Tag rest of my_vsnprintf users w/ ATTRIBUTE_FORMAT
This commit is the final batch of #3360’s `ATTRIBUTE_FORMAT` process,
covering various insignificant (as in, requires few-to-no
changes in addition to gaining this attribute) functions.

One of the main focus of this PR is to enable GCC `-Wformat` (by tagging
`ATTRIBUTE_FORMAT`) on ALL `my_snprintf` utilities. To be throughout,
functions that delegate to `my_vsnprintf` must also inherit this
attribute because `-Wformat` doesn’t trace argument across call stacks.
2025-02-12 10:17:44 +01:00
ParadoxV5
63b0ee26f7 Tag ALL my_error_reporters with ATTRIBUTE_FORMAT
The function pointer typedef `my_error_reporter` is already tagged.
This commit inherits this attribute to all `my_getopt_error_reporter`s
and `my_charset_error_reporter`s for consistency.
(It future-proofs for deliberate direct uses of those functions.)
2025-02-12 10:17:44 +01:00
ParadoxV5
1c315b3fb1 Tag myisamdef.h printers with ATTRIBUTE_FORMAT
Let GCC `-Wformat` check the formats sent to these `my_vsnprintf` users
2025-02-12 10:17:44 +01:00
ParadoxV5
302caa9549 Tag the logger service with ATTRIBUTE_FORMAT
[Breaking]
The `logger` service passes formats and args directly to `my_vsnprintf`.
Just like the `my_snprintf` service,
I increased this service’s major version because:
* Custom suffixes are now a thing
  (and custom specifiers will soon no longer be).
* GCC `-Wformat` now checks formats sent to them.
2025-02-12 10:17:44 +01:00
ParadoxV5
2392bd02d8 Tag the sql/log.h family with ATTRIBUTE_FORMAT
Let GCC `-Wformat` check formats sent to
these users of `my_vsnprintf_ex` users (heh)
2025-02-12 10:17:44 +01:00
ParadoxV5
21dfef474c Reënable ATTRIBUTE_FORMAT on DBUG_PRINT & t/eprint
(Re)ënable the `ATTRIBUTE_FORMAT` on `my_dbug.h`’s `_db_doprnt_`
(better known by its frontend `DBUG_PRINT`) and `ma_recovery_util.h`’s
`tprint` & `eprint` to leverage GCC `-Wformat` checking

c4bf4b7aef introduced `WAITING_FOR_BUGFIX_TO_VSPRINTF` to conditionally
(read: temporarily) disable their `ATTRIBUTE_FORMAT`s.
Whatever that bug was aside, MDEV-21978 Zulip suggested that the
preference for `%b` was probably intended, although c52e62a76f
reverted the one in `storage/maria/ma_recovery.c` back to `%s`.

All extension migrations (e.g., `%b` ➡ `%sB`)
in this commit were on `DBUG_PRINT`.
2025-02-12 10:17:44 +01:00
ParadoxV5
d5ba6f71b9 Tag push_warning_printf with ATTRIBUTE_FORMAT
* Let GCC `-Wformat` check formats sent to these `my_vsnprintf_ex` users
* Migrate them from the old extension specifiers
  to the new `-Wformat`-compatible suffixes
2025-02-12 10:17:44 +01:00
Julius Goryavsky
44e1f7238a MDEV-35941 addendum: additional corrections for mtr tests 2025-02-12 01:29:09 +01:00
Jan Lindström
3009b5439d MDEV-35941 : galera_bf_abort_lock_table fails with wait for metadata lock
Problem was missing case from wsrep_handle_mdl_conflict. Test case
was trying to confirm that LOCK TABLE thread is not BF-aborted.
However as case was missing it was BF-aborted. Test case passed
because BF-aborting takes time and used wait condition might
see expected thread status before it was BF-aborted. Test naturally
failed if BF-aborting was done early enough.

Fix is to add missing case for SQLCOM_LOCK_TABLES to
wsrep_handle_mdl_conflict.

Note that using LOCK TABLE is still not recomended on cluster
because it could cause cluster hang.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2025-02-12 01:23:41 +01:00
ParadoxV5
2047483417 Tag my_printf_error with ATTRIBUTE_FORMAT
[Breaking]
The `my_print_error` service passes formats and args directly
to `my_vsnprintf`. Just like the `my_snprintf` service,
I increased this service’s major version because:
* Custom suffixes are now a thing
  (and custom specifiers will soon no longer be).
* GCC `-Wformat` now checks formats sent to them.
2025-02-11 20:32:55 +01:00
ParadoxV5
618afa32ce Tag mysqltest formatters with ATTRIBUTE_FORMAT
Let GCC `-Wformat` check the formats sent to these `my_vsnprintf`
users and migrate them from the old `%b` to the new `%sB`
2025-02-11 20:32:55 +01:00
ParadoxV5
5100773ab9 Tag my_vsnprintf.c with ATTRIBUTE_FORMAT
[Breaking]
Good news:
GCC now checks your `my_snprintf` (direct) calls (`-Wformat` was on);
Bad news:
The build process no longer lets your incorrect
formats/arguments sneak past (`-Werror` was also on).

As such, this commit also migrates all direct `my_snprintf` calls from
the old specifiers to MDEV-21978’s new `-Wformat`-compatible suffixes.
The next commits will cover non-direct calls to `my_snprintf`.
(I call them “`my_snprintf` descendants”.)

This commit does not update the ABI records because
there’re more ABI “changes” to come – half a dozen
`include/mysql/plugin_*.h.pp`s are now missing the new `__attribute__`s.
2025-02-11 20:32:55 +01:00
ParadoxV5
f3617981ad unittest/mytap/tap.h: Use ATTRIBUTE_FORMAT
Use `my_attribute.h` whereëver available for compatibility with non-GCC
2025-02-11 20:32:55 +01:00
ParadoxV5
ab50aad15d Remove `%s` %b %M %T from my_vsnprintf`
MDEV-21978 introduces more preferrable alternatives to those extensions.
This commit removes the above old and deprecated syntax.

With the code for the old extension formats gone,
this commit also improves the code around the new extension suffixes:
* Remove code for formatting ``%`T``
  * Those code are now dead,
    for the new suffix-based syntax does not recognize `%sQT`/`%sTQ`.
  * `suffix_q= TRUE` now additionally replaces `…|= ESCAPED_ARG`.
* Flatten `flag= true if /%iE/` and `do_iE if flag` code together

[Breaking] This commit removes obsolete features. Although my earlier
work (should have) migrated every usages direct or indirect in the
entire MariaDB/server, other codebases might still be using them. This
final change will break *everything* in those outdated foreign lands.
2025-02-11 20:32:55 +01:00
ParadoxV5
6a182553ce Rename my_snprintf’s %uE to %iE
… and delete `%uU` (just use `%d` for that)

The follow-up #3360 discovered `%M` usages that suggest that it was
designed for `errno` and similar **signed** `int` (“errno_t”) variables.
Besides convenience, if the old `%M` read a `signed int`,
so should the new version to maintain compatibility.

I only added `%iE` (no `%dE`) to keep the new suffix mechanics
away from the popular `%d`. Beïng synonyms (originally),
this decision on preserving `%d` also saves the need for `%iI`/`%dD`.
2025-02-11 20:32:55 +01:00
ParadoxV5
891177418e Make service_my_snprintf.h doc *more professional*
Per https://github.com/MariaDB/server/pull/3309#discussion_r1644436461,
it is crucial that services’ headers have reliable and legible docs.
2025-02-11 20:32:55 +01:00
ParadoxV5
b668a960cd MDEV-21978 Add %sQ, %sB, %uE & %sT to my_vsnprintf
This is the first part of
MDEV-21978 make my_vsnprintf to use gcc-compatible format extensions,
which adds these alternatives to the MySQL extensions.
There’s also the escapes `%sS` & `%uU` for any hippies needing them.
These suffixes are compatible with the C standard and
therefore as well as `printf` tools such as GCC checks.

The old extension formats (e.g., `%M`) are now effectively deprecated,
although they’re left intact for now. For a more sequential
MDEV-21978 process, a separate commit will delete them after we migrate
all `my_vsnprintf` usages to the new preferred syntax. The service’s
major version bumped nonetheless for the new significance of suffixes.

[Breaking] This commit may fail
* on places needing the aforementioned escapes
* because of the major version bump

Reviewed-by: Andrew Hutchings <andrew@mariadb.org>
Reviewed-by: Brandon Nesterenko <brandon.nesterenko@mariadb.com>
2025-02-11 20:32:55 +01:00
ParadoxV5
06851e7f77 Merge vsnprintf %b, %T & %M code into %s/%u
This commit prepares for MDEV-21978 which wants to migrate
extensions from *specifiers* to standard-compatible *suffixes*,
complete with boolean local vars. In this new format,
branches will land on `%s`/`%u` before processing the suffix.
This commit contains non-breaking portions of MDEV-21978 work.

This commit also changes an `if`-`else` chain to
a `switch` block simply because it’s an eyesore.
2025-02-11 20:32:55 +01:00
Sergei Golubchik
9799777992 MDEV-35919 Server crashes in Item_func_vec_distance::fix_length_and_dec upon reading from I_S table 2025-02-11 20:31:42 +01:00
Sergei Golubchik
49821f21ce MDEV-9158 post-merge fixes
* format error messages (spaces, "bytes")
* speed up "length too large" test from 12s to 70ms
* fix it for --parallel
* fix "named pipe" test to actually test a named pipe
* add the standard header to tests, enable result log
* fix for ASAN
* read loop to workaround small (64K) pipe buffer size
* clarified error message for the file too large
2025-02-11 20:31:36 +01:00
dingweiqing
4dee592450 MDEV-9158 Read max size bytes from encryption key file and ignore remain bytes
Previously plugin check aes key file size to make sure its size isn't too large before reading it, this commit change the way to read only max aes key file size bytes. This way can support named pipe as a coproduct .
2025-02-11 20:31:31 +01:00