Home - Waterfall Grid T-Grid Console Builders Recent Builds Buildslaves Changesources - JSON API - About

Console View


Categories: connectors experimental galera main
Legend:   Passed Failed Warnings Failed Again Running Exception Offline No data

connectors experimental galera main
Vladislav Vaintroub
Support multi-factor authentication MySQL way

- Allow to specify password2/password3 via
mysql_optionsv(mysql,MYSQL_OPT_USER_PASSWORD, factor,N)

- Handle 0x2 (AuthNextFactor) server packet
Switch password according to factor

- make sure TLS "trust" works for self-signed certificate
if any of the MFA factors is password-based (e.g
gssapi + mysql_native_password would use second factor's
verification)
Nikita Malyavin
MDEV-40283 Statement restart

Add an api to request statement restart, that can be used by any engine or a
plugin in case of an error (thd_request_statement_restart).
The retry loop runs in dispatch_command(), based on value of
THD::backoff_requested. THD::backoff_dispatch_safe() guards incompatible cases.

Some sql commands and server commands are incompatible with statement restart:
* Statements are filtered based on blacklist (only a few statements cannot
restart), with CF_FORBIDS_BACKOFF flag.
* Server commands are filtered based on whitelist (only a few commands can
restart), with CF_ALLOWS_BACKOFF flag.

This commit enables COM_QUERY only.
Marko Mäkelä
Merge 13.2 into main
Vladislav Vaintroub
MDEV-42698 follow-up: wait for pending operations in ~thd_async_state()

The destructor asserted that there are no pending operations. That
assumption did not hold for a legitimate case: when a connection is
closed, the engine may still have an asynchronous operation in flight,
from InnoDB log flush started by the rollback of the connection's
transaction.
This flush is not needed, this is filed as separate performance
bug MDEV-42859. Until it is fixed, assertion needs to be removed, and
condition wait is right thing to do.
Oleg Smirnov
MDEV-41654 Account cost of subqueries in conditions attached to tables

The optimizer costs the condition attached to a table at WHERE_COST per
row. A correlated subquery in that condition is executed again for
every row that reaches it, and costs far more than WHERE_COST. Plans
that check the condition on many rows, such as a full scan with a join
buffer, therefore look cheaper than they are compared to ref access.

Collect, once per JOIN in make_join_statistics(), the top-level
conjuncts of WHERE and of every ON condition that contain a subquery
executed again for each evaluation: an uncacheable subquery that is
not served by the subquery cache. The cost of one execution is a lower
bound, as correlated subqueries are optimized only after the outer
plan: one lookup into the first table of the subquery,
KEY_LOOKUP_COST + ROW_LOOKUP_COST + ROW_COPY_COST of its engine.

best_access_path() adds the cost of these executions to the access
method of the table where the conjunct is checked. A subquery is
assumed to run only for the rows that pass the cheap conjuncts, as
MDEV-40439 evaluates them first:
- with a join buffer, a conjunct that refers only to the table is in
  the scan filter, checked for the rows that pass the table's
  conditions on constants, once per buffer refill;
- otherwise it is checked for every row combination that passes the
  other conditions;
- in an outer join, the ON condition is checked again on the first
  match, or on every match with a join buffer on the last inner table.
  An ON conjunct on outer tables only is checked once per row
  combination before the inner tables are read, and again for every
  row of the first inner table.
test_if_cheaper_ordering() adds the cost per row read for ORDER BY ...
LIMIT. Row estimates do not change, only costs. The optimizer trace
shows the added cost as subquery_cond_cost.

The fix is OFF by default and enabled by setting FIX_SUBQUERY_COND_COST
flag in @@new_mode. The costs match the executions when
REORDER_EXPENSIVE_CONDS (MDEV-40439) is set as well.

Not covered yet: LooseScan (its cost is saved without the subquery cost).
Nikita Malyavin
MDEV-40283 mysqltest: add PS_bind_array command

PS_bind_array binds every parameter to an array of values, so that
PS_execute sends them in one COM_STMT_BULK_EXECUTE. The new connect
option BULK_UNIT_RESULTS asks for a result per parameter set.

Assisted-by: Fable 5.2
Nikita Malyavin
MDEV-40283 Statement restart: a KILL QUERY is not lost to a restart

A statement killed before it failed is refused the restart; a kill that comes
after the request stops the retry, as the kill is reset once per command.
Vladislav Vaintroub
MDEV-33387 - multifactor authentication

Support "AND" between authentication plugins in CREATE/ALTER USER, so
that a user must pass every factor to log in (multi-factor auth), in
addition to the existing "OR" (alternative plugins). Mixing AND and OR
in one user definition is rejected.

  CREATE USER u IDENTIFIED VIA mysql_native_password AS PASSWORD('...')
                      AND some_other_plugin USING '...';

Grammar and storage
  - USER_AUTH gets a logical_operator (NONE/OR/AND) telling how each factor
    combines with the next; the parser tags the factor list and rejects a
    mix of AND/OR.
  - The operator is persisted in mysql.global_priv: the factor array is
    stored under "auth_and" (mirroring the existing "auth_or"). ALTER USER
    that collapses a multi-factor account back to a single plugin removes
    the stale "auth_and"/"auth_or" key.
  - SHOW CREATE USER prints " AND " between factors.
  - Two password-based (hashing) plugins in one AND chain are rejected;
    at most one factor may carry a password hash.

Authentication protocol
  - New client capability CLIENT_MULTI_FACTOR_AUTHENTICATION and an
    AuthNextFactor (0x02) command that tells the client to proceed to the
    next factor after the current one succeeded. send_plugin_request_packet
    becomes send_change_plugin_packet, handling both the auth-switch (0xFE)
    and next-factor (0x02) commands. Clients that do not announce the
    capability fall back to an auth switch.
  - acl_authenticate() runs the factors sequentially for AND (every factor
    must return CR_OK), while OR keeps its "first success wins" behavior.
  - The in-server client (sql-common/client.c, used by mariadb-backup,
    replication, etc.) also handles AuthNextFactor: it advertises the new
    capability, recognises the 0x02 packet in run_plugin_auth(), and uses
    the same is_auth_switch_command() helper (with AUTH_SWITCH_PLUGIN_PACKET
    and AUTH_NEXT_FACTOR_PACKET symbolic constants) as libmariadb does.

TLS server-identity via password hash
  - When the connection uses a self-signed certificate and no CA is
    configured, the server sends a fingerprint challenge in the OK packet,
    computed from the certificate fingerprint and the password hash. For a
    multi-factor account the salt of the first password-hashing factor is
    used. The client recomputes it and, on a match, trusts the certificate
    even with --ssl-verify-server-cert, so password-based verification of
    the server does not raise a certificate error.

Tests
  - New plugins suite tests: mfa (portable machinery: AuthNextFactor round
    trip, non-hashing factor, auth_and persistence and ALTER round-trip,
    distinct per-factor secrets, negative cases, TLS fingerprint),
    mfa_unix (unix_socket + password), mfa_win (named_pipe/gssapi +
    password), mfa_unix_pam (password + PAM PIN).
  - auth_gssapi multiauth trimmed to the OR cases it still owns.

Client side changes are in the bundled libmariadb (submodule bump).

Assisted-by: Claude:claude-haiku-4.5-20251001
Marko Mäkelä
MDEV-42741 test case fixup

Reliably find the first LSN of the archive.

Assisted-by: Claude:claude-opus-5-5
Alexander Barkov
MDEV-42858 Garbage or heap-use-after-free in UPDATE FOR PORTION OF

UPDATE ... FOR PORTION OF could read a freed blob buffer, or return
garbage, if a BEFORE INSERT trigger assigned a blob column and an
AFTER UPDATE trigger then read the updated row.

TABLE::period_make_insert() saves the row with store_record(). This
copies the blob pointers but not the blob data. The BEFORE INSERT
trigger assigns NEW.b, which reallocates Field_blob::value and frees
the buffer that the saved row points to. restore_record() then puts
the pointer to the freed buffer back, and the AFTER UPDATE trigger
reads it through NEW.b.

TABLE::remember_blob_values() protected only generated blob fields,
so normal blob columns were not covered.

Added TABLE::remember_all_blob_values() and restore_all_blob_values().
They move Field_blob::value of every blob field (normal, virtual and
stored) into a temporary String array and back, and
period_make_insert() uses them instead of remember_blob_values().
Susil
MDEV-42244 multi_source.mix_semisync_async: wait for the ACK counter

The test multi_source.mix_semisync_async checks that a multi-source
slave with one semi-sync and one async connection sends ACKs only for
the semi-sync one. It failed now and then in buildbot, because SHOW
STATUS showed Rpl_semi_sync_slave_send_ack one lower than the result
file. The test now waits until the slave has counted the ACKs it sent
before it reads the counter. This is a test only change: the server
works as designed and its behavior does not change.

Repl_semi_sync_slave::slave_reply() increments the counter only after
net_flush() has sent the ACK. The master is released by the ACK itself,
and --sync_with_master waits only for the SQL thread, so neither waits
for the slave I/O thread to count the ACK. When the I/O thread was slow
between the send and the increment, the test read the old value.

Before each of the two reads the test now waits, with
include/wait_for_status_var.inc, for the counter to reach the number of
ACKs sent so far. The wait uses >=, so an extra ACK that is already
counted shows up as a result file difference and not as a 60 second
timeout. The expected values are the ones the result file already has,
so the result file does not change.

Assisted-by: Claude:claude-sonnet-5-5
Vladislav Vaintroub
MDEV-42338 macOS: treat the Homebrew include directory as system

Homebrew keeps the headers of all installed libraries in one directory.
libmariadb, which does not inherit include directories from the server,
adds it as a plain -I. That shadows the SYSTEM OpenSSL path, and -Werror
fails on warnings in OpenSSL 4.1 headers.

Add the directory to CMAKE_<LANG>_STANDARD_INCLUDE_DIRECTORIES, which
CMake emits as -isystem for all languages, and which drops a plain -I
of the same directory. IGNORE_HOMEBREW_INCLUDE_PATH opts out.

Assisted-by: Claude:claude-sonnet-5-5
Nikita Malyavin
MDEV-40283 Statement restart: a statement of a stored procedure
Nikita Malyavin
MDEV-40283 Statement restart: a statement of a stored procedure
Khaled Riyad
MDEV-42486 Prepared statement returns incorrect result after subquery data changes

Item_in_optimizer caches the result of "NULL IN (SELECT ...)" for a
non-correlated subquery in result_for_null_param, so that later rows
with a NULL left value do not evaluate the subquery again. The cache
was never reset in Item_in_optimizer::cleanup(), so the next execution
of a prepared statement or stored routine reused the result computed
from the data of an earlier execution.

Reset result_for_null_param to UNKNOWN in cleanup().
Vladislav Vaintroub
Support multi-factor authentication MySQL way

- Allow to specify password2/password3 via
mysql_optionsv(mysql,MYSQL_OPT_USER_PASSWORD, factor,N)

- Handle 0x2 (AuthNextFactor) server packet
Switch password according to factor

- make sure TLS "trust" works for self-signed certificate
if any of the MFA factors is password-based (e.g
gssapi + mysql_native_password would use second factor's
verification)
Alexey Botchkov
MDEV-42643 XMLISVALID: recursive type copies its whole compositor at every nesting level, gigabytes per query, max_session_mem_used ignored.

tests added since the bug was fixed already.
Nikita Malyavin
MDEV-40283 Statement restart

Add an api to request statement restart, that can be used by any engine or a
plugin in case of an error (thd_request_statement_restart).
The retry loop runs in dispatch_command(), based on value of
THD::backoff_requested. THD::backoff_dispatch_safe() guards incompatible cases.

Some sql commands and server commands are incompatible with statement restart:
* Statements are filtered based on blacklist (only a few statements cannot
restart), with CF_FORBIDS_BACKOFF flag.
* Server commands are filtered based on whitelist (only a few commands can
restart), with CF_ALLOWS_BACKOFF flag.

This commit enables COM_QUERY only.
Nikita Malyavin
MDEV-40283 Statement restart: the prepared statement commands

Covered: Prepare, execute and bulk execute.
Nikita Malyavin
MDEV-40283 Statement restart: a KILL QUERY is not lost to a restart

A statement killed before it failed is refused the restart; a kill that comes
after the request stops the retry, as the kill is reset once per command.
Monty
Bug fixes, to be squashed with c750f09e489537cefa44c248afa31a9c79f6d41b

- A statement that fails to open its tables (multi-table UPDATE and
  DELETE, HANDLER OPEN) releases the metadata locks it took, also
  inside a transaction. The statement transaction is rolled back
  first, as opening a GTT instance with ON COMMIT DELETE ROWS
  registers it there.
- ALTER TABLE of a GTT waits for metadata locks up to lock_wait_timeout,
  like other DDL.
- Check for GTT instances first in check_pseudo_slave_mode(). Improved
  warning for using pseudo_slave_mode when a GTT instance exists.
- pseudo_slave_mode and pseudo_thread_id can be changed while the
  connection has GTT instances, and GTTs can be used in
  pseudo_slave_mode. A connection always has at most one instance of
  a GTT, independent of pseudo_thread_id.
- XA PREPARE in pseudo_slave_mode detaches the XA transaction from
  the connection. This ends the transaction for GTTs, so ON COMMIT
  DELETE ROWS GTT instances are emptied.
- Removed unneeded temporary table lock when dropping
  ON COMMIT DELETE ROWS GTT instances.
- Moved open_global_temporary_table() to temporary_tables.cc and made
  it a THD method. use_global_tmp_table_tp() is now private.
- Moved all GTT-only functions to the end of temporary_tables.cc
- Removed partial MDEV-37771 fix (pseudo_thread_id default). It is not
  needed for GTTs and belongs to 10.11.
Alexey (Holyfoot) Botchkov
MDEV-42640 XMLISVALID: exponential time in check_type on a schema where groups reference each other twice, KILL QUERY ignored.

Guard check_type() against checking the same or lesser depth twice. That
eliminates exponential calls. Checks for thd->killed added.
Also attributeGroup guarded against exponential search for attribute
name.
Oleg Smirnov
MDEV-41654 Account cost of subqueries in conditions for LooseScan

The LooseScan semi-join strategy costs the first inner table of the
semi-join apart from the other access methods: Loose_scan_opt keeps the
cost of the best index access that enumerates the duplicate groups, and
save_to_position() stores it without the cost of the subqueries in the
condition of the table. With FIX_SUBQUERY_COND_COST, LooseScan therefore
looked cheaper than FirstMatch, DuplicateWeedout and SJ-Materialization,
whose costs include it.

Pass the cost of the subqueries to Loose_scan_opt and add it to each
LooseScan access before they are compared, for the rows the access
reads:
- full index scan: all rows of the index, scaled by the selectivity of
  the conditions of the table on constants;
- ref: the rows per lookup, scaled the same way unless the ref binds a
  key part to a constant, whose selectivity the estimate includes;
- range: the rows of the range, which already pass its conditions on
  constants.
As for FirstMatch, the exit at the first match of a duplicate group is
not modelled: all rows of a group are charged.
Nikita Malyavin
MDEV-40283 SET STATEMENT ... FOR EXECUTE lost its clause in a reprepare

execute() restores the clause at its end, so the reprepare and the execution
after it ran without it, as main.ps_ddl recorded for MDEV-10702 (1025).
Marko Mäkelä
MDEV-42350 fixup: Ensure the minimum log file size

Assisted-by: Claude:claude-opus-5-5
Marko Mäkelä
MDEV-42741 innodb_log_archive=ON debug assertion failure

commit 518761d1d72154d2ca686f2314ad640763f67ced (MDEV-42350)
introduced a bogus debug assertion that would fail when the
checkpoint mini-transaction at the end of a log file comprises
some FILE_MODIFY records.

recv_sys_t::find_checkpoint(): Correct the debug assertion by
referring to the actual end of the FILE_CHECKPOINT mini-transaction.

recv_sys_t::find_checkpoint_archived(): Remember the end of the latest
FILE_CHECKPOINT mini-transaction in the debug-only variable
found_checkpoint_end.

Co-developed by: Thirunarayanan Balathandayuthapani
Assisted-by: Claude:claude-opus-5-5
Vladislav Vaintroub
MDEV-42338 macOS: treat the Homebrew include directory as system

Homebrew keeps the headers of all installed libraries in one directory.
libmariadb, which does not inherit include directories from the server,
adds it as a plain -I. That shadows the SYSTEM OpenSSL path, and -Werror
fails on warnings in OpenSSL 4.1 headers.

Add the directory to CMAKE_<LANG>_STANDARD_INCLUDE_DIRECTORIES, which
CMake emits as -isystem for all languages, and which drops a plain -I
of the same directory. IGNORE_HOMEBREW_INCLUDE_PATH opts out.

Assisted-by: Claude:claude-sonnet-5-5
Khaled Riyad
MDEV-42486 Prepared statement returns incorrect result after subquery data changes

Item_in_optimizer caches the result of "NULL IN (SELECT ...)" for a
non-correlated subquery in result_for_null_param, so that later rows
with a NULL left value do not evaluate the subquery again. The cache
was never reset in Item_in_optimizer::cleanup(), so the next execution
of a prepared statement or stored routine reused the result computed
from the data of an earlier execution.

Reset result_for_null_param to UNKNOWN in cleanup().
Nikita Malyavin
MDEV-42758 SET STATEMENT ... FOR EXECUTE lost its clause in a reprepare

execute() restores the clause at its end, so the reprepare and the execution
after it ran without it, as main.ps_ddl recorded for MDEV-10702 (1025).
Nikita Malyavin
MDEV-40283 Statement restart: test array binding with PS_bind_array

The two array binding cases of restart.test ran functions that
mysql_client_test does not have. They now use PS_bind_array on a
connection made with BULK_UNIT_RESULTS.
Raghunandan Bhat
MDEV-39095: Fixes to MariaDB Syntax Checker

- Skip initializing stopwords for full-text indexes when checking
  syntax.
- Skip changing data directory when checking syntax.
- Show help message when syntax checker is used in interactive mode.
- Initialize THD with a dummy database name to prevent `No database
  selected` error.
- Rename `PARSER_STATE` in check_syntax.cc to `Syntax_checker_state` to
  avoid confusion with `Parser_state` class.
- Increase max length of delimiter token to 16 to match mariadb client.
- Support many statements in one query, like the client does
  (e.g. `SET @a=1; SELECT @a|` with DELIMITER |). Report correct line
  numbers for errors in them.
- Report only errors, not notes or warnings. A stored function with the
  name of a native function is accepted, a UDF with such a name is an
  error.
- Apply SET statements that change how later statements are parsed:
  - Applied: session sql_mode and character_set_client, SET NAMES,
    SET CHARACTER SET. Values can be constants, DEFAULT, user
    variables, @@sql_mode or @@character_set_client.
  - Tracked: user variables set from such values, so the
    `SET @OLD_SQL_MODE=@@SQL_MODE ... SET SQL_MODE=@OLD_SQL_MODE`
    pattern from dumps works.
  - Ignored: SET GLOBAL, other variables, and values that need
    executing (a user variable set from one is unset).
- Split statements using the current client character set.
- Treat enabled plugins as available, so that partitioning syntax is
  accepted. Initialize data type and function plugins, so that their
  types and functions are known.
- Recognize system variables of enabled plugins (binlog_checksum,
  innodb_*, aria_*) without initializing the plugins.
- Support CREATE PACKAGE BODY when CREATE PACKAGE is earlier in the
  input. DROP PACKAGE removes it. A body without its package is an
  error.
- Refuse to run --check-syntax together with --bootstrap.
- More tests: DDLs, DMLs, Stored Procedures, Views, sql_mode, character
  sets, plugins, packages
Thirunarayanan Balathandayuthapani
MDEV-42713 InnoDB: Cannot replay rename because the target file exists

Problem:
=======
After commit 9759167322ac9c647ca42c3e9e43a3d19fa5b18e(MDEV-41548),
recv_rename_files() replays every FILE_RENAME record in log order,
applying a record whenever the tablespace is currently named after
the record's source file. That cannot tell "not yet executed"
from "executed, then renamed away and back".

If a tablespace was renamed t1->t3->t1 and another tablespace then
took the name t3 (t2->t3), and all the renames had completed before
the crash, the first record (t1->t3) still matches the
current name t1. Replaying it tries to rename onto t3.ibd,
which now belongs to the other tablespace, and
recovery fails with "Cannot replay rename of tablespace
because the target file exists".

Solution:
========
recv_rename_files(): Find the last FILE_RENAME record that was
already executed, that is the latest log position at which file name
of every renamed tablespace equals the destination name that the
records give it. Then replay only the records after that position,
in log order. If no position matches report an error.
Vladislav Vaintroub
MDEV-33387 - multifactor authentication

Support "AND" between authentication plugins in CREATE/ALTER USER, so
that a user must pass every factor to log in (multi-factor auth), in
addition to the existing "OR" (alternative plugins). Mixing AND and OR
in one user definition is rejected.

  CREATE USER u IDENTIFIED VIA mysql_native_password AS PASSWORD('...')
                      AND some_other_plugin USING '...';

Grammar and storage
  - USER_AUTH gets a logical_operator (NONE/OR/AND) telling how each factor
    combines with the next; the parser tags the factor list and rejects a
    mix of AND/OR.
  - The operator is persisted in mysql.global_priv: the factor array is
    stored under "auth_and" (mirroring the existing "auth_or"). ALTER USER
    that collapses a multi-factor account back to a single plugin removes
    the stale "auth_and"/"auth_or" key.
  - SHOW CREATE USER prints " AND " between factors.
  - Two password-based (hashing) plugins in one AND chain are rejected;
    at most one factor may carry a password hash.

Authentication protocol
  - New client capability CLIENT_MULTI_FACTOR_AUTHENTICATION and an
    AuthNextFactor (0x02) command that tells the client to proceed to the
    next factor after the current one succeeded. send_plugin_request_packet
    becomes send_change_plugin_packet, handling both the auth-switch (0xFE)
    and next-factor (0x02) commands. Clients that do not announce the
    capability fall back to an auth switch.
  - acl_authenticate() runs the factors sequentially for AND (every factor
    must return CR_OK), while OR keeps its "first success wins" behavior.
  - The in-server client (sql-common/client.c, used by mariadb-backup,
    replication, etc.) also handles AuthNextFactor: it advertises the new
    capability, recognises the 0x02 packet in run_plugin_auth(), and uses
    the same is_auth_switch_command() helper (with AUTH_SWITCH_PLUGIN_PACKET
    and AUTH_NEXT_FACTOR_PACKET symbolic constants) as libmariadb does.

TLS server-identity via password hash
  - When the connection uses a self-signed certificate and no CA is
    configured, the server sends a fingerprint challenge in the OK packet,
    computed from the certificate fingerprint and the password hash. For a
    multi-factor account the salt of the first password-hashing factor is
    used. The client recomputes it and, on a match, trusts the certificate
    even with --ssl-verify-server-cert, so password-based verification of
    the server does not raise a certificate error.

Tests
  - New plugins suite tests: mfa (portable machinery: AuthNextFactor round
    trip, non-hashing factor, auth_and persistence and ALTER round-trip,
    distinct per-factor secrets, negative cases, TLS fingerprint),
    mfa_unix (unix_socket + password), mfa_win (named_pipe/gssapi +
    password), mfa_unix_pam (password + PAM PIN).
  - auth_gssapi multiauth trimmed to the OR cases it still owns.

Client side changes are in the bundled libmariadb (submodule bump).

Assisted-by: Claude:claude-haiku-4.5-20251001
Nikita Malyavin
MDEV-40283 Statement restart: the prepared statement commands

Covered: Prepare, execute and bulk execute.
Vladislav Vaintroub
main.mysql_client_test: show client output on failure

The output goes to var/log/mysql_client_test.out.log, so it is missing
from the test failure report and CI logs. Print it when
mysql_client_test fails.

Assisted-by: Claude:claude-sonnet-5-5
Nikita Malyavin
MDEV-40283 Statement restart: an execute with converted long data

It was refused, as conversion replaces the bytes the client sent.
Jan Lindström
MDEV-33763 : Buffered error logging for Server error log

New read-only system variables (set at startup, need --log-error):
* log_error_file_buffer_size: error log buffer size, default 0 (off)
* log_error_file_rotate_size: rotate the error log above this size,
  default 1073741824
* log_error_file_rotations: number of rotated files kept, default 0

Changes:
* When log_error_file_buffer_size is set, the error log is written
  through the file logger (mysys/file_logger.c), which keeps messages
  in an in-memory buffer. The logger has its own descriptor of the
  error log file. stdout and stderr stay open on the same file for
  direct writes, and are reopened on the new file after each rotation.
* FLUSH ERROR LOGS writes the buffered messages to the old file and
  opens the error log file again.
* At shutdown the buffered messages are written and the logger is
  closed. Later messages go to stderr.
* On a fatal signal the buffered messages are written before the crash
  report.
* The file logger does not call my_error() on a write error, because
  my_error() can write to the error log. A failed buffered write
  returns -1, and the server then writes the message to stderr.
* After a failed rotation the next write opens the log file again.
* print_buffer_to_file() uses one static buffer, allocated on first use
  (MAX_LOG_BUFFER_SIZE+1), grown as needed and freed at shutdown.
* vprint_msg_to_log() writes lines longer than 1024 bytes in full, up
  to 1 MB.
* Galera messages use the same error log path. Debug messages are
  written only if wsrep_debug is set.
* Add a unit test for write errors of the file logger, and mtr tests
  for the three variables, buffered logging, rotation, a crash after
  rotation, FLUSH ERROR LOGS and long lines.

Assisted-by: https://mariadb.org/governance/governance-ai-policy/
Assisted-by: Claude:claude-4.6-sonnet
Nikita Malyavin
MDEV-40283 Statement restart: an execute with converted long data

It was refused, as conversion replaces the bytes the client sent.
Alessandro Vetere
MDEV-21725 Log page reorganization as the ranges by which records moved

btr_page_reorganize_low() logged the payload as one WRITE from the first
to the last changed byte. When the reorganization removes a gap near the
start of the page, it moves all the later records, and this WRITE covers
almost the whole page.

btr_page_reorganize_log_payload(): Log the payload with MEMMOVE for the
runs of records that only moved, and WRITE for the rest. The function
first copies the runs that moved towards the end of the page, in
descending order of destination. Then it copies the runs that moved
towards the start of the page, in ascending order of destination. In
each order, no copy changes the source of a later copy. If a copy of the
first order changed a part of a source, the function does not copy that
part. Instead, it logs with WRITE the bytes at the destination of that
part that differ from the old page. The function does not copy a run
that is shorter than 8 bytes. It also does not copy the shortest runs
that moved towards the end of the page when the working memory is full.
It logs the changed bytes of these runs with WRITE. The log format does
not change. With the debug keyword page_reorganize_log_max_up_2, the
working memory holds at most 2 runs that moved towards the end of the
page.

btr_page_reorganize_low(): Reserve a second scratch frame for the
working memory of btr_page_reorganize_log_payload(). Start a new
same_page chain before the log records of the reorganization, and end
it after them.

mtr_t::reset_last_page(): New function. Make the next log record write
its page identifier.

page_copy_rec_list_end_no_locks(): Add the output parameter extra. If
extra is not nullptr, return DB_CORRUPTION for a record of the source
page that starts below the end of the supremum record or ends above
PAGE_HEAP_TOP. Only btr_page_reorganize_low() passes extra, to log
MEMMOVE records from the old page, and it restores the old page on this
error before it moves the locks or writes log. The other callers trust
a page with a valid checksum and do not change.

In all versions since the 10.8 redo log format, the recovery parser has
an error. For a same_page record that follows a MEMSET or MEMMOVE
record, it calculates an offset that is too low. It can then reject a
valid MEMMOVE whose source is below its destination as "Malformed log
record". The new payload logging avoids this. The reorganization starts
a new same_page chain, and writes only WRITE records before the first
MEMMOVE whose source is below its destination. Each later such MEMMOVE
has its destination below the end of the previous record, so it has the
page identifier, and the parser reads its offset correctly. The next
record for the page after the reorganization also has the page
identifier. Older servers and backup tools can thus recover the log.

recv_sys_t::parse_tail(): Add a FIXME for the parser error.

innodb.page_reorganize_log: Reorganize the index pages of 4 tables with
page_reorganize_log_max_up_2, kill the server before a checkpoint, and
check the recovered tables. The pages contain a record with no data
bytes, runs that the working memory cannot hold, and runs that are
shorter than 8 bytes. In the page of the fourth table, all records after
the first one moved down by the same distance. The test checks that the
INSERT that reorganizes this page writes less redo log than a quarter of
the page size. Before this change, the INSERT writes 3,051 bytes at 4k,
12,297 bytes at 16k and 49,280 bytes at 64k.
innodb.alter_copy and innodb.instant_alter_crash also recover page
reorganizations.

innodb.index_lock_upgrade,on with 4k pages (Debug) writes 2,816,405
bytes of redo log instead of 3,293,565 (shutdown LSN minus startup LSN).

Assisted-by: Claude:claude-opus-5-5