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
MDEV-23818 follow-up: main.client fails on Windows with vardir on another drive

Plain "cd" in cmd does not switch drives; use "cd /d" on Windows.

Assisted-by: Claude:claude-sonnet-5-5
Elena Stepanova
MDEV-42521 Replication tests fail with ER_BINLOG_IN_USE when run after another test

12.3 changed RESET MASTER. The binlog-in-engine commit (7081f2a58ec)
added a check in MYSQL_BIN_LOG::reset_logs() in sql/log.cc. RESET MASTER
now fails with ER_BINLOG_IN_USE while any binlog dump thread is still
registered, even an idle one whose slave has already disconnected. Before
12.3, such leftover threads didn't block it, so the test passes there.

That commit also updated the test framework for this:
include/rpl_init.inc and include/rpl_reset.inc now kill dump threads
before RESET MASTER, and there is a new include/reset_master.inc
that kills them and retries. The fix is to use this include.

Assisted-by: Claude:claude-opus-5-5
Reviewed-by: Susil Behera
Elena Stepanova
MDEV-42570 rpl.rpl_start_alter_restart_master fails when run in a chain of tests

The test shows the slave binary log from the beginning, including
the replicated mtr.add_suppression() transaction. How that transaction
ends in the slave binary log depends on the engine of
mysql.gtid_slave_pos, because the slave updates the table within
the same transaction. With Aria (the default under MTR) it ends with
Query COMMIT. With InnoDB, InnoDB takes part in the transaction and
it ends with Xid COMMIT.

Many replication tests change mysql.gtid_slave_pos to InnoDB and
don't restore it, for example rpl_start_alter_mysqlbinlog_1, and
check-testcase does not check table engines. When mtr reuses
the servers after such a test, the result mismatches. The test
passes after a restart or with --repeat, because then the table
is in Aria.

Set the engine of mysql.gtid_slave_pos on the slave to Aria
explicitly at the beginning of the test, so that the result
does not depend on previous tests.

Assisted-by: Claude:claude-opus-5-5
Reviewed-by: Susil Behera
Vladislav Vaintroub
CI: Windows ARM64 - cache winflexbison3 and tolerate choco failures

Cache the choco-installed winflexbison3, refreshed weekly, and save it after a successful build. If choco fails after retries, fall back to an older cached copy.

Assisted-by: Claude:claude-sonnet-5-5
Elena Stepanova
rpl.rpl_corrupted_decimal_precision fails with timeout

Due to MDEV-42580, if an earlier test ever set a replication filter,
the SQL abort expected in rpl.rpl_corrupted_decimal_precision
never happens, and the test fails with a timeout. To avoid it,
temporarily enforce the slave restart at the beginning of the test.
It should be removed when the bug is fixed
Teemu Ollakka
MDEV-42510 Galera: mariabackup and SST copy corrupt Aria tables

On a Galera node, a local write to a TRANSACTIONAL=1 Aria table, or a
TOI such as GRANT, could commit during BACKUP STAGE BLOCK_COMMIT.
mariabackup or the SST joiner then got a corrupt Aria table. Also, with
wsrep_mode=BF_ABORT_MARIABACKUP, FTWRL and BACKUP STAGE could deadlock
with a replicated write. A mariabackup SST donor let DDL run through
the backup locks, and a TOI could fail with ER_UNKNOWN_COM_ERROR at
UNLOCK TABLES or BACKUP STAGE END. Now these writes wait for the
backup locks. A replicated write gets the lock if the holder paused
the provider, because the pause waits for it.

Changes (sql/wsrep_backup.h documents the design):
- ha_commit_trans() takes MDL_BACKUP_COMMIT for a commit that the
  provider does not order, such as a local Aria write or a TOI.
- MDL_lock::can_grant_lock() no longer grants all backup locks to TOI
  and appliers. Such a request skips pending backup lock requests.
  wsrep_handle_mdl_conflict() lets it pass a conflicting backup lock
  only if the holder paused the provider. It reads
  THD::wsrep_backup_paused under the MDL_lock::m_rwlock that the
  holder takes after it sets the flag.
- New sql/wsrep_backup.cc: the pause and resume of FTWRL and BACKUP
  STAGE. The provider resumes before the backup lock is released.
  BACKUP STAGE END clears the stage after the release: until then, a
  TOI or applier that requests the lock waits. UNLOCK TABLES now always
  resumes after a pause, also with wsrep_on=OFF.
- If the BLOCK_DDL pause, or WAIT_DDL after the pause, fails, BLOCK_DDL
  resumes and returns to the FLUSH lock. Before, the node could stay
  paused until BACKUP STAGE END.
- With wsrep_mode=BF_ABORT_MARIABACKUP, BLOCK_COMMIT fails with
  ER_BACKUP_STAGE_FAILED if a TOI or applier DDL or non-transactional
  write requested a conflicting backup lock after BACKUP STAGE START:
  the backup misses that write.

Behavior change: TOI and appliers now wait for the backup lock of a
session with wsrep_on=OFF that runs FTWRL or BACKUP STAGE. Such a
session does not pause the provider, so flow control can stall the
cluster.

Assisted-by: Claude:claude-opus-5-5
zeyad zahran
MDEV-40743 slave does not retry connect in some cases even when master_retry_count=0 is set

try_to_reconnect() compared retry_count with master_retry_count without
exempting 0, so 0 acted like 1. If connecting worked but the setup or
reading after it failed twice with no event in between, the I/O thread
exited without any error.

Skip the limit when master_retry_count is 0, like connect_to_master()
does. Non-zero values keep working as before.
Elena Stepanova
Merge 10.11 into 11.4
Elena Stepanova
MDEV-42567 rpl.rpl_change_master_implicit_gtid_warning fails with "Can't initialize replace" when run after another test

The test stopped the slave right after include/master-slave.inc and
then built CHANGE MASTER coordinates from SHOW SLAVE STATUS. But
master-slave.inc only waits for Slave_IO_Running=Yes, which the IO
thread reports right after sending COM_BINLOG_DUMP, before it has
received anything from the master. If STOP SLAVE arrives before the
master's initial fake Rotate event, Master_Log_File is still empty
and --replace_result fails with
"Can't initialize replace from 'replace_result $io_log_file ...'".

The race is lost reliably when the test runs after another
replication test (e.g. with --repeat) over a non-TLS replication
connection, which is the default in 10.11. There the master's dump
thread from the previous test is still waiting for binlog updates
when the slave reconnects, and kill_zombie_dump_threads() delays the
new dump by at least 100 ms. With TLS replication (the default in
11.4+) the old dump thread is already gone and the test passes;
11.4 with --skip-ssl fails the same way as 10.11.

Fix: sync the slave with the master before stopping it, so that the
IO thread has read the master's initial events and Master_Log_File
and Read_Master_Log_Pos are populated. The result file is unchanged.

Assisted-by: Claude:claude-opus-5-5
Reviewed-by: Susil Behera
forkfun
MDEV-42222 String copy must not share a buffer owned by the original

A copy of a String pointed to the buffer of the original and kept its
capacity without owning the buffer. Condition pushdown copies items
with shallow_copy(): all String members of the copy, and
Arg_comparator::value1/value2 of a copied comparison, shared the
buffers of the original item. When the original item reallocated
a buffer for a longer value, the copy kept using the freed one,
e.g. UPPER, CAST(.. AS CHAR), STR_TO_DATE and JSON_EXTRACT
comparison on 2nd execution of a prepared statement.

The copy constructor of a String that owns a non-empty buffer copies
the data now, and keeps the copy read-only if the original was marked
with mark_as_const(). A moved String is copied the same way:
String(String&&) uses this constructor.

Item_param::value_clone_item() made a local copy of the parameter
value, and the new Item_string pointed into it. It uses the value
directly now.

SFORMAT copied every String argument twice per row. It passes them by
reference now, to avoid copying the data.

Assisted-By: Claude:claude-sonnet-5-5
Elena Stepanova
MDEV-42237 rpl.rpl_read_old_relay_log_info fails on Windows (Linux-style path)

rpl.rpl_read_old_relay_log_info fails because the test overrides
relay-log.info with the Linux-style ./slave-relay-bin.000001,
while Windows uses the format with backslashes, .\slave-relay-bin.000001.
The patch modifies the file contents using a perl block, which keeps
the relay log name intact and only replaces the position. Thus the name
remains valid for whatever system the test is run on.

Assisted-by: Claude:claude-opus-5-5
Reviewed-by: Susil Behera
Elena Stepanova
MDEV-42633 rpl.rpl_row_loaddata_concurrent fails with Wrong offset or I/O error when run after another test

The test saves only the position from SHOW MASTER STATUS and then
sources show_binlog_events.inc without $binlog_file. The resulting
SHOW BINLOG EVENTS FROM <pos> therefore reads the first binlog file.
If an earlier test in the same server run rotated the binlog (for
example, rpl.rpl_parallel_wrong_exec_master_pos runs FLUSH LOGS), the
saved position belongs to a later file. In the first file it does not
start an event, so the test fails with:

  ERROR 1220 (HY000): Error when executing command SHOW BINLOG EVENTS:
  Wrong offset or I/O error

Added RESET MASTER at the start of the test, as
rpl_stm_loaddata_concurrent.test already does.

Assisted-by: Claude:claude-opus-5-5
Reviewed-by: Susil Behera
Hemant Dangi
MDEV-42492: galera_sst_mariabackup_plugin_dir test fragility fixes

Issue:
- the test pins the exact number of times mdev42091_poc appears in
  mariabackup.prepare.log (FOUND 7); that count is incidental to
  mariabackup's own logging and isn't stable across platforms (FreeBSD
  produced 8), failing the result-file diff even though the test's
  actual assertion still held.
- node_2 is forced through a real restart/SST during cleanup, which can
  make Galera reassign auto_increment_offset on the membership change,
  leaking into mtr's end-of-test server-state check.

Solution:
- normalize the count with --replace_regex before the search, since only
  presence/absence matters.
- save/restore auto_increment_offset around the restart, per the existing
  convention used by other galera tests that restart a node.
Elena Stepanova
MDEV-42202 perfschema.relaylog fails when run after other replication tests

The test checks file I/O instrumentation accumulated since server
startup, so it relied on getting freshly started servers. With
duplicate options removed, mtr may now reuse servers left by
a previous replication test, and the test sees binary/relay log
files and statistics from it.

Restart both servers at the beginning of the test, removing
binary and relay logs while the servers are down. RESET MASTER
and RESET SLAVE are not sufficient, as performance schema keeps
instances of files deleted by them, and a restart opens a new
binary log anyway.

Assisted-by: Claude:claude-opus-5-5
Reviewed-by: Susil Behera
Teemu Ollakka
MDEV-42510 Galera: mariabackup and SST copy corrupt Aria tables

On a Galera node, a local write to a TRANSACTIONAL=1 Aria table, or a
TOI such as GRANT, could commit during BACKUP STAGE BLOCK_COMMIT.
mariabackup or the SST joiner then got a corrupt Aria table. Also, with
wsrep_mode=BF_ABORT_MARIABACKUP, FTWRL and BACKUP STAGE could deadlock
with a replicated write. A mariabackup SST donor let DDL run through
the backup locks, and a TOI could fail with ER_UNKNOWN_COM_ERROR at
UNLOCK TABLES or BACKUP STAGE END. Now these writes wait for the
backup locks. A replicated write gets the lock if the holder paused
the provider, because the pause waits for it.

Changes (sql/wsrep_backup.h documents the design):
- ha_commit_trans() takes MDL_BACKUP_COMMIT for a commit that the
  provider does not order, such as a local Aria write or a TOI.
- MDL_lock::can_grant_lock() no longer grants all backup locks to TOI
  and appliers. Such a request skips pending backup lock requests.
  wsrep_handle_mdl_conflict() lets it pass a conflicting backup lock
  only if the holder paused the provider. It reads
  THD::wsrep_backup_paused under the MDL_lock::m_rwlock that the
  holder takes after it sets the flag.
- New sql/wsrep_backup.cc: the pause and resume of FTWRL and BACKUP
  STAGE. The provider resumes before the backup lock is released.
  BACKUP STAGE END clears the stage after the release: until then, a
  TOI or applier that requests the lock waits. UNLOCK TABLES now always
  resumes after a pause, also with wsrep_on=OFF.
- If the BLOCK_DDL pause, or WAIT_DDL after the pause, fails, BLOCK_DDL
  resumes and returns to the FLUSH lock. Before, the node could stay
  paused until BACKUP STAGE END.
- With wsrep_mode=BF_ABORT_MARIABACKUP, BLOCK_COMMIT fails with
  ER_BACKUP_STAGE_FAILED if a TOI or applier DDL or non-transactional
  write requested a conflicting backup lock after BACKUP STAGE START:
  the backup misses that write.

Behavior change: TOI and appliers now wait for the backup lock of a
session with wsrep_on=OFF that runs FTWRL or BACKUP STAGE. Such a
session does not pause the provider, so flow control can stall the
cluster.

Assisted-by: Claude:claude-opus-5-5
Elena Stepanova
MDEV-42628 rpl.rpl_do_grant incorrectly passes on Linux and fails on Windows

The test opens connection create_rout_db_slave with host "localhost",
the slave port and no socket. mysqltest then uses the default socket,
which is the master's. On Unix a connection to "localhost" goes
through the socket and ignores the port, so this "slave" connection
actually went to the master. On Windows "localhost" means TCP, so the
connection really reached the slave.

Since MDEV-35617, DROP USER emits
ER_ACTIVE_CONNECTIONS_FOR_USER_TO_DROP (4227) when the dropped user
still has an active session. On Windows create_rout_db_slave was still
connected to the slave when DROP USER 'create_rout_db'@'localhost' ran
there, so the note appeared and the result did not match. On Unix the
slave had no such session, so the note never appeared, and the "slave"
part of the test had been running against the master.

Fix:
- pass $MASTER_MYSOCK / $SLAVE_MYSOCK explicitly, so each connection
  reaches the intended server on all platforms;
- disconnect create_rout_db_slave right after its last use, before
  DROP USER on the slave, and wait until the session is gone from
  information_schema.processlist, because the server finishes a
  disconnect only after the client has moved on.

Assisted-by: Claude:claude-opus-5-5
Reviewed-by: Susil Behera
Elena Stepanova
MDEV-42594 rpl.rpl_binlog_directory fails on Windows with wrong result (slashes in the path)

Reviewed-by: Susil Behera
DerZc
MDEV-40972: Apply JSON_TABLE ON ERROR to scalar conversion failures

Propagate Field::store() failures to the column's ON ERROR response.
Combine conversion status with per-column error tracking, using the
existing handler and preserving warnings and successful rounding.

Cover NULL, DEFAULT and ERROR responses, row/column isolation, ON EMPTY,
JSON null and booleans, structural errors and strict SQL mode. Update
existing JSON_TABLE expectations for the changed conversion policy.
Elena Stepanova
MDEV-42238 rpl.rpl_row_mysqlbinlog fails on Windows (charset problem)

rpl.rpl_row_mysqlbinlog fails because apparently the client command
line on Windows cannot interpret the literal cp932 string which is
passed to it. Since the point of the test is not how the original
INSERT happens, but how it further works while replaying the binlog,
it should be acceptable to insert a hex-encoded value

Reviewed-by: Susil Behera
Teemu Ollakka
MDEV-42510 Galera: mariabackup and SST copy corrupt Aria tables

On a Galera node, a local write to a TRANSACTIONAL=1 Aria table, or a
TOI such as GRANT, could commit during BACKUP STAGE BLOCK_COMMIT.
mariabackup or the SST joiner then got a corrupt Aria table. Also, with
wsrep_mode=BF_ABORT_MARIABACKUP, FTWRL and BACKUP STAGE could deadlock
with a replicated write. A mariabackup SST donor let DDL run through
the backup locks, and a TOI could fail with ER_UNKNOWN_COM_ERROR at
UNLOCK TABLES or BACKUP STAGE END. Now these writes wait for the
backup locks. A replicated write gets the lock if the holder paused
the provider, because the pause waits for it.

Changes (sql/wsrep_backup.h documents the design):
- ha_commit_trans() takes MDL_BACKUP_COMMIT for a commit that the
  provider does not order, such as a local Aria write or a TOI.
- MDL_lock::can_grant_lock() no longer grants all backup locks to TOI
  and appliers. Such a request skips pending backup lock requests.
  wsrep_handle_mdl_conflict() lets it pass a conflicting backup lock
  only if the holder paused the provider. It reads
  THD::wsrep_backup_paused under the MDL_lock::m_rwlock that the
  holder takes after it sets the flag.
- New sql/wsrep_backup.cc: the pause and resume of FTWRL and BACKUP
  STAGE. The provider resumes before the backup lock is released.
  BACKUP STAGE END clears the stage after the release: until then, a
  TOI or applier that requests the lock waits. UNLOCK TABLES now always
  resumes after a pause, also with wsrep_on=OFF.
- If the BLOCK_DDL pause, or WAIT_DDL after the pause, fails, BLOCK_DDL
  resumes and returns to the FLUSH lock. Before, the node could stay
  paused until BACKUP STAGE END.
- With wsrep_mode=BF_ABORT_MARIABACKUP, BLOCK_COMMIT fails with
  ER_BACKUP_STAGE_FAILED if a TOI or applier DDL or non-transactional
  write requested a conflicting backup lock after BACKUP STAGE START:
  the backup misses that write.

Behavior change: TOI and appliers now wait for the backup lock of a
session with wsrep_on=OFF that runs FTWRL or BACKUP STAGE. Such a
session does not pause the provider, so flow control can stall the
cluster.

Assisted-by: Claude:claude-opus-5-5
Elena Stepanova
MDEV-42198 Options from MTR opt files are added multiple times

Options from .opt files of included files were appended every time
the file was sourced, so they got repeated once per include path.
It caused unnecessary server restarts, and too long server command
lines lead to startup failures on Windows.

Now each file caches only its own .opt options plus an ordered list
of the files (itself and everything it sources) whose options apply,
each file listed once. The test's options are assembled from that list.
Options of included files still precede those of the including file.
If a file is sourced several times, its options are applied at the
place of its last inclusion, so the effective option values stay
the same as before, and a test can still source a file again to
override options set by files sourced in between.

Assisted-by: Claude:claude-opus-5-5
Reviewed-by: Alice Sherepa
Vladislav Vaintroub
CI: Windows ARM64 - run MTR in RUNNER_TEMP and print system info

Run MTR in RUNNER_TEMP, the per-job scratch directory GitHub provides, on the same drive as the workspace, with a shorter path than TEMP. Add a System info step that prints the filesystem of each drive, the RUNNER_TEMP/TEMP/workspace paths, the OS, CPU count and memory.

Assisted-by: Claude:claude-sonnet-5-5
Elena Stepanova
MDEV-41085 Enable MTR tests on Windows: rpl suite

Reviewed-by: Vladislav Vaintroub
Elena Stepanova
Merge 11.4 into 11.8
Vladislav Vaintroub
MDEV-42549 Windows: apply autosized thread_pool_max/min_threads

TP_pool_win::init() set the autosized thread_pool_max_threads
(max_connections + 10) only on the variable and called
SetThreadpoolThreadMaximum() just for a user-given value. The pool kept
the Windows default of 500 threads, so with about 500 blocked sessions
a new connection could not log in. The autosized
thread_pool_min_threads had the same problem.

Always pass the final values to the pool.

Assisted-by: Claude:claude-sonnet-5-5
Vladislav Vaintroub
CI: Windows - make bison caching and system info reusable actions

Move the winflexbison3 cache/retry/fallback and the system information step into composite actions under .github/actions, and use them in both the Windows ARM64 and the Windows amd64 (rpl) workflows. The cache key includes the runner architecture.

Assisted-by: Claude:claude-sonnet-5-5
forkfun
MDEV-42222 String copy must not share a buffer owned by the original

A copy of a String pointed to the buffer of the original and kept its
capacity without owning the buffer. Condition pushdown copies items
with shallow_copy(): all String members of the copy, and
Arg_comparator::value1/value2 of a copied comparison, shared the
buffers of the original item. When the original item reallocated
a buffer for a longer value, the copy kept using the freed one,
e.g. UPPER, CAST(.. AS CHAR), STR_TO_DATE and JSON_EXTRACT
comparison on 2nd execution of a prepared statement.

The copy constructor of a String that owns a non-empty buffer copies
the data now, and keeps the copy read-only if the original was marked
with mark_as_const(). A moved String is copied the same way:
String(String&&) uses this constructor.

Item_param::value_clone_item() made a local copy of the parameter
value, and the new Item_string pointed into it. It uses the value
directly now.

SFORMAT copied every String argument twice per row. It passes them by
reference now, to avoid copying the data.

Assisted-By: Claude:claude-sonnet-5-5
Elena Stepanova
MDEV-42228 MTR tests fail with "File already exist" for .expect files on Windows

On Windows mtr workers are threads of one process, so a handle opened
while reading the .expect file could be inherited by a server spawned
at the same time by another worker. That kept the file from being
deleted for the lifetime of that server, and the next --write_file of
the .expect file failed with "File already exist".

Read the .expect file under the spawn lock.

Assisted-by: Claude:claude-opus-5-5
Reviewed-by: Vladislav Vaintroub
Georgi (Joro) Kodinov
MDEV-42349: my_json_writer-t.cc fails to compile on MacOSX/clang under maintainer_mode

Converted all the stack JsonObject instances into pointers and dynamically allocated/deallocated these.
Elena Stepanova
MDEV-42590 rpl.rpl_start_alter_restart_master leaves replication setup behind

Reviewed-by: Susil Behera
Aaravkhanal
MDEV-42280 main.x509_oneline_separators skip message is confusing

Name the SSL library family required by the skipped combination and
the family detected on the server.

Assisted-by: OpenAI Codex
Elena Stepanova
MDEV-42595 rpl.rpl_heartbeat modifies master_heartbeat_period, affects following tests

mysql-test/include/rpl_heartbeat.inc does
change master to ..., master_ssl_verify_server_cert=0, master_heartbeat_period= 0.5;
and its cleanup never puts it back.

13.x changed how CHANGE MASTER treats the heartbeat period, which
exposes the leak. In 10.11 any CHANGE MASTER that doesn't mention
MASTER_HEARTBEAT_PERIOD resets it to slave_net_timeout/2. In 13.x
the period is now an optional value. An unmentioned option stays
as it was. The between-test check doesn't catch it.

Assisted-by: Claude:claude-opus-5-5
Reviewed-by: Susil Behera
Elena Stepanova
MDEV-42586 rpl.warn_slaves_not_needed_for_purge fails when run in a chain of tests

The warning about the @@slave_connections_needed_for_purge default is
printed only once per server process: warn_slaves_not_needed_for_purge
is cleared by the first COM_REGISTER_SLAVE and whenever the variable is
set, either on the command line or with SET.

The test assumed the flag was still set when it started. MTR reuses
running servers between tests, so after a previous test whose slave
connected to the master, or after the test itself (it ends with
SET @@GLOBAL.slave_connections_needed_for_purge= DEFAULT), the flag was
already cleared. The warning was then never logged in this test's section
of the error log, and both expected-FOUND checks failed. This happened
with --repeat and when the test ran after another replication test.

Restart the master at the beginning of the test, before the slave
connects, so the test always starts with the flag set.

Assisted-by: Claude:claude-opus-5-5
Reviewed-by: Susil Behera
Elena Stepanova
MDEV-42200 main.mysqlbinlog_stmt_compressed depends on previous tests

The test ran mysqlbinlog on the current binlog file from the start,
and if that file still held the previous test's events, it would
cause a mismatch. Additionally, thread_id value depended on the
chain of tests.

The part for thread_id is taken from 11.8, to preserve consistency.

Assisted-by: Claude:claude-sonnet-5-5
Reviewed-by: Kristian Nielsen
Jan Lindström
MDEV-42565 Galera test failure on galera_3nodes.galera_duplicate_primary_value

Two concurrent brute-force (BF) applier transactions on the same node
can conflict on a record lock. MDEV-34836's wsrep_BF_has_to_wait()
dropped the seqno-order exception that the earlier MDEV-31658 fix
relied on: when neither side is streaming replication, an
earlier-ordered requester must not wait for a later-ordered holder,
since the holder is the one that is certified to be BF
aborted/replayed on conflict, never the requester. Without that
exception the two appliers can wait on each other with no resolution,
since neither is ever chosen as a deadlock victim, so the only way
out is a lock wait timeout (ER_LOCK_WAIT_TIMEOUT), matching the
reported test failure.

Restore the order check in wsrep_BF_has_to_wait(). Also add a
wait_condition before galera_duplicate_primary_value's final SELECT
on node_1, so the test does not depend solely on wsrep_sync_wait
causality to see the two appliers' writes.

Assisted-by: Claude:claude-4.6-sonnet
Thirunarayanan Balathandayuthapani
MDEV-32067 InnoDB linear read-ahead had better be logical

The traditional linear read-ahead, enabled by innodb_read_ahead_threshold,
only helps when consecutively accessed pages have adjacent page numbers.
That is rarely true for B-tree leaf pages: after splits, merges and page
reuse, the logical order of leaves has nothing to do with their physical
page numbers. So for a scan of scattered leaves the old read-ahead either
did nothing or read the wrong pages, and a partly cached buffer pool could
switch it off.

This replaces linear read-ahead of index pages with a logical read-ahead
that prefetches the leaf pages a scan is going to visit, discovered from
the B-tree during the traversal. The window starts at 4 leaves and doubles
on every refill, up to 64 leaves, and it is capped at 1/256 of the buffer
pool per scan. records_in_range() reports the first and last leaf page of
a range, and the optimizer forwards that extent to the storage engine, so
that the read-ahead is sized and bounded by the scan. A LIMIT of 2 or less
disables the read-ahead, and a range that fits in one leaf reads only half
of the first batch.

handler::multi_range_read_info_const(), DsMrr_impl::dsmrr_info_const():
Take a page_range parameter. The default MRR implementation aggregates the
per-range leaf extents reported by records_in_range().

handler::advise_page_range(): New virtual function that tells the engine the
estimated leaf extent of an upcoming range scan.

Carry the extent through TRP_RANGE and QUICK_RANGE_SELECT.
QUICK_RANGE_SELECT::reset() calls advise_page_range()
before multi_range_read_init().

buf_read_ahead_linear(): Removed, together with the pending-read throttle.
The read-ahead in flight is bounded by the window, the per-scan cap and the
availability of free blocks.

buf_read_ahead_one(): Read ahead a single leaf page. It cannot be disabled.

buf_read_ahead_pages(): Read ahead a set of known B-tree leaf pages. It
keeps one spare buffer block and allocates another only after the spare
block was used for a posted read, to reduce contention on buf_pool.mutex.
ROW_FORMAT=COMPRESSED tablespaces use a separate instantiation that needs
no spare block.

buf_read_release_count(): Free the spare block and update the read-ahead
statistics in one critical section of buf_pool.mutex.

buf_read_ahead_random(): Split into a decision part and an action part

buf_read_page_low(): No longer invokes buf_LRU_stat_inc_io() for
synchronous reads.

btr_ra_batch: Collects leaf page numbers, and records the level-1 page and
the child page number of the last node pointer collected, so that the
read-ahead can be resumed later.

btr_ra_batch::collect() scans the node pointers of a
PAGE_LEVEL=1 page from a given record in scan order.

btr_ra_batch::resume_rec() finds the record to resume from by locating the
last collected child by value, walking only genuine records so that a
concurrent page reorganization cannot cause an invalid read.

btr_cur_t::search_leaf(), btr_cur_t::open_leaf(): At PAGE_LEVEL=1, after the
descent has located the child to follow, collect the leaf page numbers
starting at that child in the scan direction.

dict_index_t::get_child(), dict_index_t::get_child_offset(): Read the child
page number of a node pointer without rec_get_offsets().

btr_pcur_move_to_next_page(), btr_pcur_move_backward_from_page(): Read ahead
the following or preceding sibling with buf_read_ahead_one(). The backward
move first tries to latch the preceding page without waiting.

btr_copy_blob_prefix(): No longer reads ahead, and no longer relies on
FIL_PAGE_PREV/NEXT.

dict_stats_prefetch_sample_children(): ANALYZE TABLE prefetches the child
pages of the sampled records before diving below them.

ha_innobase::ReadAhead: The per-handler state of the read-ahead.

advise(): Records the estimated leaf extent of the scan. It is used only to
size and bound the read-ahead; it never limits the pages that the scan reads.

window_for_extent(), set_limit(): Derive the largest window from the advised
extent, falling back to an estimate from the LIMIT.

start(): For a just-positioned scan, prefetch the collected batch and set up
the rolling cursor.

refill(): As the scan advances in general_fetch(), resume the level-1
collection under an index S-latch, continue on the sibling level-1 pages,
and prefetch the next batch, bounded by the advised last leaf, or by the end
of the index if the extent is unknown.

ha_innobase::search_with_readahead(): Position the cursor while collecting
the leaf pages, and start the read-ahead. It is used by index_read()
and rnd_init()/general_fetch(). general_fetch() sets active_handler_stats
before reading ahead, so that the prefetched pages are attributed to the query.

btr_cur_t::get_parent(): Replaces btr_page_get_parent(),
btr_page_get_father_block() and btr_page_get_father(). It needs no record
offsets array.

trx_undo_t::get_prev_rec(), trx_undo_t::get_prev_rec_from_prev_page():
Replace trx_undo_get_prev_rec() and its helper. They are members of the undo
log object and always latch shared. Undo log pages no longer invoke linear
read-ahead.

row_search_mvcc(): The row_prebuilt_t* is now the first parameter.
Jan Lindström
MDEV-42493 : Galera test failure on galera_toi_definer_check

Since MDEV-29668 (11.0) only SET USER, not SUPER, satisfies the
DEFINER check, so the error message lists only SET USER. The test
was recorded on 10.11. Update the result file.
Elena Stepanova
MDEV-42236 rpl.rpl_change_master_long_channel_name fails on Windows (too long path)

rpl.rpl_change_master_long_channel_name fails on Windows because it
expects a 252-character name (base name, excluding the path) to be
valid; on Windows the whole path is limited to 260 characters, so
a 252-character name makes it too long. The patch disables the test
for Windows.

Reviewed-by: Susil Behera
youssef-joe
MDEV-42329 Assertion `(mem_root->flags & 4) == 0' failed in mysql_insert_select_prepare() on the second execution of INSERT ... VALUES ... UNION VALUES

SELECT_LEX::first_cond_optimization is cleared by JOIN::optimize(), but
a SELECT_LEX that is a table value constructor has no JOIN, so the flag
stayed set for it forever.

When such a SELECT_LEX was the first one of the source of an INSERT or
REPLACE, every execution of the prepared statement or stored routine
took the "first execution" branch in mysql_insert_select_prepare() and
pushed to leaf_tables_exec on the statement arena. A debug build failed
the assertion that the arena is read-only, a release build leaked a list
node on each execution.

In table_value_constr::optimize() save the leaf tables and clear
first_cond_optimization, as JOIN::optimize_inner() does for a regular
SELECT. The leaf tables are saved together with clearing the flag
because setup_tables() expects leaf_tables_saved to be set on every
execution after the first one.