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-38741 mtr: do not suppress the reason of a client disconnect

The global suppressions of "Aborted connection", in mariadb-test-run.pl
and mtr_warnings.sql, hid the line that the client disconnect watcher
writes when it aborts a command: "Aborted connection N to db: 'x' user:
'u' host: 'h' (Client disconnected)". Nothing showed when the watcher
aborted a connection that it should have left alone. main.locale found
one, because its server log is in German and the English entry did not
match.

Make the two entries skip a line that ends in "(Client disconnected)".
Other aborted connections are suppressed as before. The tests that drop
a client on purpose accept the reason with mtr.add_suppression(),
details in PR#6035.

Assisted-by: Claude:claude-sonnet-5-5
Oleksandr Byelkin
Merge branch '11.4' into mariadb-11.4.14
Daniel Bartholomew
bump the VERSION
sjaakola
MDEV-42420 Use two applier threads in tests that pause the applier

Galera periodically delivers a COMMIT_CUT action. It has only a local
seqno and must pass the local monitor in an applier thread. Tests that
paused the only applier of a node, and then waited for a local
transaction on that node to certify or reach a later sync point, could
hang until timeout when a COMMIT_CUT was ordered before the local
transaction. These hangs are sporadic because a COMMIT_CUT comes only
about every 128 transactions.

Fix the affected tests in the same way as galera_sr.mysql-wsrep#215:
set wsrep_slave_threads = 2 on the paused node for the duration of the
test, so the second applier can process the COMMIT_CUT. At the end,
restore the original value and run a DDL from the other node. The
extra applier exits only after it applies a writeset, and that DDL
brings the applier count back down before the next test.

Fixed tests:
  galera.MDEV-29512
  galera.galera_MDEV-29512
  galera.MW-292
  galera.galera_as_slave_replay
  galera.galera_ddl_fk_conflict
  galera.galera_insert_bulk
  galera.galera_savepoint_replay
  galera.galera_sequences_bf_kill
  galera.galera_sequences_bf_kill_sr
  galera.galera_slave_replay
  galera.galera_sp_bf_abort
  galera.galera_transaction_replay
  galera.mysql-wsrep-bugs-607
  galera_sr.MDEV-25717
  galera_sr.galera_sr_bf_abort

In galera.MW-292, also replace the 3 second sleep and the
TIMEDIFF(SYSDATE(), NOW()) < 2 check with two consecutive NOW(6)
reads. A stuck timestamp returns the same value in both, so the test
no longer needs to wait.

Assisted By: Claude Opus 5.5
Alessandro Vetere
MDEV-41939 Rollback may leave a delete-marked secondary index record that purge does not remove

row_undo_mod_sec_is_unsafe() freezes purge_sys.view across the dereference
of externally stored columns, and under the freeze it tests whether purge
can see the transaction whose undo log record rebuilt the older version.
If the view advanced between the walk and the freeze, it reported the
secondary index entry as still needed, and the rollback delete-marked the
entry. No undo log record refers to that entry, so purge does not remove
it, unless a later write of the same key value reuses it.
CHECK TABLE ... EXTENDED reports it as missing its clustered index record
once purge_sys.end_view moves past the transaction that rolled back.

When purge can see that same transaction, trx_undo_prev_version_build()
ends the walk with no older version, and row_purge_is_unsafe() treats the
end of the versions in the same way. Report the entry as not needed in this
case too, so that the rollback removes it: no read view needs the rebuilt
version, and the walk found no match among the newer versions.

row_undo_mod_sec_is_unsafe_keep: a debug keyword that restores the previous
answer, as a negative control. With
--mysqld=--debug-dbug=+d,row_undo_mod_sec_is_unsafe_keep,
innodb.old_blob_purgeable fails with the orphan report.

innodb.old_blob_purgeable: force a purge batch after the rollback, so that
CHECK TABLE ... EXTENDED would report the orphan regardless of purge timing.
Use MEDIUMTEXT, because with innodb_page_size=64k the value
REPEAT('x', @@innodb_page_size) does not fit in TEXT.

innodb.old_blob_updel: wait until the rows that the test inserts first are
purged, before the test holds a purge batch. Otherwise purge_hold_cleanup
can hold the batch that purges the history of those rows, instead of the
batch that the test expects. This failed under Valgrind.

Assisted-by: Claude:claude-opus-5-5
Vladislav Vaintroub
MDEV-38741 mariabackup: run the debug DDL as one statement

The debug thread of mariabackup that emulates a DDL sends several
statements in one query, and closes its connection as soon as the first
of them returned. The server used to run the rest. A server that aborts
the statement of a client that is gone does not, and
mariabackup.innodb_ddl_on_intermediate_table hangs, as the debug sync
signals the main thread waits for do not come. Run the statements in
one BEGIN NOT ATOMIC block, so that the client waits for all of them.
The ALTER of that test fails with a lock wait timeout on purpose, which
the handler of the block ignores, as the thread did before.

Assisted-by: Claude:claude-sonnet-5-5
Daniel Bartholomew
bump the VERSION
Razvan-Liviu Varzaru
MDEV-41266 Add missing procps dependency to the server RPM

The RPM packaging declares no dependency on procps, although several
things shipped in MariaDB-server need it:

  - mariadbd-safe runs ps(1): scripts/CMakeLists.txt substitutes
    @FIND_PROC@ into it, and every platform variant of that string is a
    "ps" invocation. mysqld_safe.sh additionally runs "ps xaww" to reap
    hung mariadbd processes before a restart
  - wsrep_sst_common.sh, wsrep_sst_rsync.sh and wsrep_sst_mariabackup.sh
    poll "ps -p $pid" to check whether the SST parent is still alive
  - mysql.server and mini-benchmark use pgrep(1)

rpm's automatic dependency generation only covers ELF sonames, script
interpreters and perl/python modules, so a command invoked inside a
shell script is never picked up. The Debian packaging has declared
procps for mariadb-server all along (debian/control).

procps is part of the base install on RHEL, Fedora and SLES, so this
goes unnoticed on a normal system; it bites in minimal containers and
chroots, where "ps -p $pid" failing because ps is absent is
indistinguishable from "the process is gone".

Declare it on the server package only, mirroring Debian, where
mariadb-server-galera picks it up transitively via its dependency on
mariadb-server. Depend on the file /usr/bin/ps rather than on a package
name, to avoid the procps-ng (Fedora/RHEL) versus procps (SLES)
difference; pgrep comes from the same package.

Co-Authored-By: Claude Opus 5 <[email protected]>
Vladislav Vaintroub
MDEV-40382 Support --ssl-crl on server builds with WolfSSL

--ssl-crl was silently discarded on WolfSSL: sslopt-case.h nulled
opt_ssl_crl after option parsing, and new_VioSSLFd() skipped CRL
loading for HAVE_WOLFSSL. A revoked certificate could still
authenticate a REQUIRE X509 / REQUIRE SUBJECT account.

WolfSSL's OpenSSL-compat layer already implements
X509_STORE_load_locations/X509_STORE_set_flags with real CRL
enforcement, so remove both restrictions.

Also fix X509_STORE_set_flags()'s success check: unlike OpenSSL,
WolfSSL can return negative error codes on failure, which == 0
missed.

Existing CRL tests were fixed to run with WolfSSL as well.

Note: on Windows, a revoked cert sometimes surfaces as ECONNRESET
instead of a TLS alert; the test's regex handles this too. The
ssl_crl_clients.test GnuTLS restriction was removed once the
underlying client-side crlpath bug was fixed, generalizing the
test's regex to match both backends' wording.
Andrzej Jarzabek
MDEV-31956: Fix extended buffer pool crashes, leaks and test flakiness

Fix several problems in the extended buffer pool (EBP) that showed up
on buildbot:

- IORequest::write_complete() crashed with a sux_lock assertion when an
  EBP write completed after its tablespace was dropped: it called
  x_unlock() on a U-latched page and skipped the rest of the
  completion. The new buf_page_ext_write_discard() releases the
  write-fix and U-latch, returns the EBP page to the free list and tries
  to evict the page.

- buf_page_write_complete() leaked the EBP page slot when the write
  failed, and when the page could not be evicted after a successful
  write (so the copy was never registered in buf_pool.page_hash). Both
  cases now return the slot to the free list. free_ext_page() resets the
  debug in_page_hash flag, because such slots are freed without having
  been inserted into page_hash.

- On Windows the EBP file was opened through mysys create_temp_file(),
  without FILE_FLAG_OVERLAPPED and without being bound to
  srv_thread_pool, so the first asynchronous EBP write crashed in
  StartThreadpoolIo(). create_ext_file() now creates the file with
  CreateFile(FILE_FLAG_OVERLAPPED | FILE_FLAG_DELETE_ON_CLOSE) and binds
  it. The new close_ext_file() closes the file the right way on each
  platform and is also used when setting the file size fails.

- buf_flush_LRU_list_batch() counted a page in n->evicted without
  having evicted it when the write to the EBP could not be started. It
  invoked buf_LRU_free_page() while the page was still U-latched, so
  can_relocate() was false and the call silently did nothing, leaving
  the page in the buffer pool. Release the U-latch before the call, like
  the path that handles a tablespace that is stopping writes.

- The debug variable innodb_force_LRU_eviction returned before the
  forced eviction had finished: it waited for two done_flush_list
  signals, which other flushing can also send, and did not wait for the
  asynchronous writes. It now waits until two page cleaner LRU batches
  (counted by the new debug-only buf_pool.n_LRU_batches) have completed
  with the flag set, and then for all pending writes. This fixes the
  wrong counts seen in innodb.ext_buf_pool and
  innodb.ext_buf_pool_admission_pct.

  That wait could never end when no page cleaner is running, because
  only buf_flush_page_cleaner() increments n_LRU_batches and srv_start()
  only starts it when !srv_read_only_mode, which innodb_force_recovery=6
  implies as well. The update function now does nothing in read only
  mode, and stops waiting if the page cleaner is no longer running; the
  page cleaner clears buf_page_cleaner_is_active and broadcasts
  done_flush_list while holding buf_pool.flush_list_mutex, so the
  transition cannot be missed. The wait also no longer holds
  LOCK_global_system_variables, like the other InnoDB update functions
  that wait, so that it cannot keep other connections from being
  established.

- The debug flag ib_ext_bp_disable_LRU_eviction_for_t never skipped
  anything, because its continue statement applied to the
  do ... while (0) of DBUG_EXECUTE_IF() and not to the page loop. Set a
  variable inside the DBUG_EXECUTE_IF() and act on it after the macro,
  so that the pages of test/t are really left alone while
  innodb.ext_buf_pool and innodb.ext_buf_pool_admission_pct are still
  filling the table. Without this, those pages can be admitted to the
  EBP and evicted while the tests are inserting, and the exact counts
  that the tests expect after the forced eviction depend on how the page
  cleaner happened to be scheduled.

- The debug flag ib_ext_bp_count_io_only_for_t offered more pages to the
  admission selector than it counted. It let a page through when
  fil_space_t::get() failed, and it did not look at the page type, while
  buf_page_write_complete() counts only the index pages of test/t. The
  pages of the test/t that an earlier part of the test dropped can still
  be resident after their fil_space_t is gone, and the FSP_HDR,
  IBUF_BITMAP and INODE pages are offered as well, so each run of
  innodb.ext_buf_pool_admission_pct put 13 or more pages before the
  selector instead of 10. Those extra pages consumed admissions without
  being counted, and because the selector's accumulator only returns to
  its previous value when the number of candidates times the percentage
  is a multiple of 100, the error also carried over into the following
  runs. The test failed on Debian with 6 instead of 5 pages admitted at
  50 per cent. Offer exactly the pages that are counted.

Run innodb.ext_buf_pool and innodb.ext_buf_pool_admission_pct with
innodb_stats_persistent=0. The inserts make the background statistics
thread recalculate the statistics of test/t asynchronously. When it
samples the index after the forced eviction, it reads the pages back
from the EBP, and when it does so while the forced batch is running, it
changes how many pages that batch admits. This made the tests randomly
fail on Windows with too many reads, and with 8 or 10 instead of 9 pages
flushed.

Add a case to innodb.ext_buf_pool for the n->evicted fix. The new debug
flag ib_ext_bp_alloc_fail makes every EBP page allocation fail, so that
buf_page_t::flush(space, true) returns false with the page still
U-latched.

Also name the buf_page_t::space_type enumerators in
buf_page_write_complete() instead of casting (oldest_modification() == 2)
to the enumeration. That only produces TEMPORARY and PERSISTENT while
they are 1 and 0, so reordering them, or adding an enumerator before
them, would keep compiling and would make write_complete() treat pages
of the temporary tablespace as persistent.

Also re-record sys_vars.sysvars_innodb,32bit for
innodb_extended_buffer_pool_size and
rocksdb.innodb_i_s_tables_disabled for the new
INNODB_BUFFER_POOL_STATS columns.
Marko Mäkelä
MDEV-39091 BACKUP SERVER of ENGINE=RocksDB

RocksDB is based on log structured merge trees (LSM trees)
that are immutable files. A consistent point-in-time snapshot
is obtained at BACKUP_LOCK_COMMIT cheaply via rdb_create_checkpoint(),
which is also what mariadb-backup is invoking via
SET GLOBAL rocksdb_create_checkpoint.

Under BACKUP_LOCK_COMMIT, a backup snapshot is created in #rocksdb under
rocksdb_datadir (by default, #rocksdb/#rocksdb in the server datadir).
This snapshot will be made available in #rocksdb subdirectory of the
backup target. The default rocksdb_datadir="./#rocksdb" makes restore
transparent: just point datadir to the backup directory or a restored
copy of it.

The transfer of the snapshot is deferred to BACKUP_FINISHED, after the
backup lock has been released, and finally the checkpoint is removed
from rocksdb_datadir.

Co-developed by: Thirunarayanan Balathandayuthapani
Reviewed by: Alessandro Vetere
Marko Mäkelä
Merge 10.11 into 11.4
Marko Mäkelä
Merge 11.4 into 11.8
Thirunarayanan Balathandayuthapani
MDEV-37708 Assertion `!trx->is_bulk_insert()' failed or HA_ERR_KEY_NOT_FOUND

Problem:
=======
A multi-row REPLACE into an empty InnoDB table, replicated in ROW
format with unique_checks=0 and foreign_key_checks=0, stops the slave
SQL thread with HA_ERR_KEY_NOT_FOUND (error 1032).

The master logs the statement as WRITE_ROWS, DELETE_ROWS, WRITE_ROWS.
On the slave, the first WRITE_ROWS goes to InnoDB's bulk insert
buffer, because the event is applied like a plain INSERT
into an empty table. The buffered row is applied to the table only
at the end of the statement. DELETE_ROWS searches for that row
in the index and cannot find it.

Solution:
========
Added a new flag, HA_EXTRA_FLUSH_BULK_INSERT. The row event applier
sends it before a DELETE_ROWS or UPDATE_ROWS event that continues
a statement, that is, when an earlier row event of the same statement
has already been executed. InnoDB then applies the buffered rows and
stops buffering, so the following search finds them.

The flag is not sent for the first event of a statement, where nothing
can be buffered, so ordinary deletes and updates are not affected.
Oleksandr Byelkin
Merge branch '12.3' into mariadb-12.3.4
forkfun
MDEV-42222 String copy must not share a heap buffer

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 its buffer copies the data
now, and keeps the copy read-only if the original was marked with
mark_as_const(). A copy of a String that doesn't own its buffer points
to the same data and has no capacity.

Assignment still makes the String point to the data of the other one,
but without capacity. No code that writes through an assigned String
was found.

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.

Tests: main.in_subq_cond_pushdown, main.ctype_ucs and
main.derived_cond_pushdown.

Assisted-By: Claude:claude-sonnet-5-5
Marko Mäkelä
MDEV-42350 fixup: innodb_log_recovery_target blocks writes
Kristian Nielsen
Fix help

Signed-off-by: Kristian Nielsen <[email protected]>
Marko Mäkelä
Merge 13.2 into main
Thirunarayanan Balathandayuthapani
MDEV-37708 Assertion `!trx->is_bulk_insert()' failed or HA_ERR_KEY_NOT_FOUND

Problem:
=======
A multi-row REPLACE into an empty InnoDB table loses its rows
when the table has an AFTER DELETE trigger and the session
has unique_checks=0 and foreign_key_checks=0.

Normal REPLACE does not use bulk insert, because the SQL layer
needs the duplicate-key error right away. InnoDB knows it is
a REPLACE only from HA_EXTRA_WRITE_CAN_REPLACE, which sets
trx->duplicates. The server does not send that flag when DELETE
triggers exist. So InnoDB buffers the first row, the duplicate is
never reported for the second row, and the old row is not deleted.
The buffered rows are applied at statement end. In this case,
table ends up empty and the trigger count is 0.

Solution:
========
Added a new flag, HA_EXTRA_WRITE_IS_REPLACE, it is sent only
for a REPLACE on a table that has DELETE triggers.

HA_EXTRA_WRITE_CAN_REPLACE tells the engine that write_row() may
replace a conflicting row by itself, without reporting the duplicate
to the SQL layer. Federated (REPLACE INTO on the remote server),
Spider, Sphinx and Mroonga (storage mode) act on it. The flag is
not sent for tables with DELETE triggers (bug#13479, commit
e08a2b326b1), because such an engine would replace the row
without the SQL layer calling delete_row(), and the DELETE triggers
would not fire. Sending it for these tables would break that,
so the old flag cannot change its meaning. The new flag only says
that the statement is a REPLACE and duplicates must be reported at
once. Engines that do not know it ignore it. Only InnoDB acts on it
and ha_partition forwards it to the partitions.

The flag is sent by the new helper set_replace_mode(), which is used
by REPLACE, REPLACE ... SELECT, CREATE TABLE ... REPLACE SELECT and
LOAD DATA ... REPLACE.
Oleksandr Byelkin
Merge branch '11.8' into mariadb-11.8.10
Kristian Nielsen
Fix build when sizeof(bool) != 1

Signed-off-by: Kristian Nielsen <[email protected]>
Sergei Golubchik
MDEV-42407 usernames with embedded \0 - reject on load too

Privilege tables are loaded into NUL-terminated strings, so a row
inserted directly with a NUL byte in a name, e.g. 'foo\0bar', was
truncated and granted its privileges to foo.

Skip such rows in acl_load() and grant_load() with a warning.

Assisted-by: Claude:claude-opus-5-5
Daniel Bartholomew
bump the VERSION
Vladislav Vaintroub
MDEV-38741 Abort the running statement when its client disconnects

A watcher thread subscribes to the OS notification that a client has
gone (e.g. TCP FIN or RST for a TCP socket, a gone client process for a
named pipe) and aborts the running statement like KILL CONNECTION does.
Controlled by the global variable disconnect_watcher. Details in
PR#6035.

Assisted-by: Claude:claude-sonnet-5-5
Marko Mäkelä
Merge 12.3 into 13.2

Table_triggers_list::check_n_load(): Plug a memory leak that would be
introduced by MDEV-41849. This is a logical conflict between that and
the 13.1 commit 0ee34e07bdc10abf32a535d7234c6f5e0bb9ed55 (MDEV-39587).

Assisted-by: Claude:claude-opus-5-5
Sergei Golubchik
MDEV-42407 usernames with embedded \0

The parser accepted user, role and host names containing \0, but the
in-memory ACL compares them as C strings while the privilege tables
store the full value. 'foo\0bar'@localhost matched the existing
foo@localhost in memory but not in mysql.global_priv, so DROP USER
removed foo from memory only and CREATE USER then wrote a
'foo\0bar' row.

Reject \0 in user, role and host names in the parser.

Assisted-by: Claude:claude-opus-5-5
Oleg Smirnov
MDEV-40439 Evaluate cheap subconditions before expensive ones in WHERE and ON conditions

The arguments of AND and OR are evaluated left to right with
short-circuiting, in the order written in the query. An expensive
subcondition written first is therefore evaluated even for rows that
a cheap one would reject (AND) or accept (OR).

Reorder the arguments of each AND/OR so that the expensive ones come
after the cheap ones, keeping the relative order within each group.
The walk goes down into nested AND/OR and into trigger conditions.
A subcondition is expensive if it contains a subquery, a stored
function call, or an item that marks itself as expensive through
is_expensive_processor() (a UDF, MATCH()).

An AND/OR that has a non-deterministic argument (one with RAND_TABLE_BIT)
keeps its order, to prevent unwanted change of behavior. Nested lists
are still reordered.

The reordering is applied to:
- the conditions attached to tables (select_cond, select->cond,
  on_precond), at the end of make_join_select() and before the
  attached_conditions_summary trace, so the trace shows the final
  order;
- BNL/BNLH scan filters, in make_scan_filter(). They are built from
  the original WHERE/ON, and check_join_cache_usage() may build them
  after make_join_select();
- outer_ref_cond and pseudo_bits_cond, the conditions a subquery
  checks once per execution before running its join.
The steps that later build new conditions from these (index condition
pushdown, removal of duplicate BNL conditions) take subsets and keep
the order.

Not covered yet: HAVING, exec_const_cond, terms added after
make_join_select() (the index condition remainder rejected by an
engine, HAVING moved to a table's condition). Reordering HAVING would
need care with Item_is_not_null_test and Item_ref_null_helper, which
record NULLs for IN->EXISTS.
Oleksandr Byelkin
Merge branch '10.11' into mariadb-10.11.20
Marko Mäkelä
MDEV-42350 fixup: innodb_log_recovery_target blocks writes
Daniel Bartholomew
bump the VERSION
Jan Lindström
MDEV-42284 fix galera_sr.mysql-wsrep#215 ER_LOCK_WAIT_TIMEOUT

Node_1's own causality wait (wsrep_sync_wait, on by default) blocked
its plain SELECT on t1 while the test held node_1's applier paused at
the sync.wsrep_apply_cb debug sync point, so the SELECT could not
reach the GTID the paused applier had not yet reached and timed out
with ER_LOCK_WAIT_TIMEOUT instead of returning.

Set wsrep_sync_wait = 0 on node_1 for that SELECT and the INSERT that
follows it, saved and restored around each of the test's three blocks.
Marko Mäkelä
Merge 11.8 into 12.3
Sergei Golubchik
MDEV-42407 usernames with embedded \0 - reject trailing spaces too

Privilege tables store names in CHAR columns with PAD collations, which
ignore trailing spaces, while in memory names are compared with strcmp.
'foo '@localhost matched foo@localhost in the table but not in memory,
so DROP USER 'foo ' removed the foo row while keeping foo in memory.

Reject user and host names with trailing spaces in the parser, and skip
privilege table rows with such names on load.

Assisted-by: Claude:claude-opus-5-5
Kristian Nielsen
MDEV-42237: Fix integer overflow of relay log position

The off_t type is 32-bit signed on Windows, casting the relay log position
to off_t will overflow when >= 2**31.

Signed-off-by: Kristian Nielsen <[email protected]>
Swayam-code
MDEV-34654: Use a hex literal for backslash in relaylog test

Replace char(92) with 0x5c in the path normalization expressions and
matching expected output, as suggested in review.

Assisted-by: Codex:GPT-6
Sergei Golubchik
MDEV-42425 heap buffer overflow in ha_archive::pack_row

max_row_length() summed blob lengths in a uint32. A row with more than
4GB of blobs wrapped the sum, fix_rec_buff() allocated a too small
buffer and Field_blob::pack() wrote past it.

Compute the length in ulonglong and reject rows that don't fit the
four byte row length header with HA_ERR_TO_BIG_ROW. Return pack_row()
errors separately from the length, so real_write_row() can propagate
them, and don't count rows that failed to be written.

Assisted-by: Claude:claude-opus-5-5
Andrzej Jarzabek
MDEV-31956: Fix extended buffer pool crashes, leaks and test flakiness

Fix several problems in the extended buffer pool (EBP) that showed up
on buildbot:

- IORequest::write_complete() crashed with a sux_lock assertion when an
  EBP write completed after its tablespace was dropped: it called
  x_unlock() on a U-latched page and skipped the rest of the
  completion. The new buf_page_ext_write_discard() releases the
  write-fix and U-latch, returns the EBP page to the free list and tries
  to evict the page.

- buf_page_write_complete() leaked the EBP page slot when the write
  failed, and when the page could not be evicted after a successful
  write (so the copy was never registered in buf_pool.page_hash). Both
  cases now return the slot to the free list. free_ext_page() resets the
  debug in_page_hash flag, because such slots are freed without having
  been inserted into page_hash.

- On Windows the EBP file was opened through mysys create_temp_file(),
  without FILE_FLAG_OVERLAPPED and without being bound to
  srv_thread_pool, so the first asynchronous EBP write crashed in
  StartThreadpoolIo(). create_ext_file() now creates the file with
  CreateFile(FILE_FLAG_OVERLAPPED | FILE_FLAG_DELETE_ON_CLOSE) and binds
  it. The new close_ext_file() closes the file the right way on each
  platform and is also used when setting the file size fails.

- buf_flush_LRU_list_batch() counted a page in n->evicted without
  having evicted it when the write to the EBP could not be started. It
  invoked buf_LRU_free_page() while the page was still U-latched, so
  can_relocate() was false and the call silently did nothing, leaving
  the page in the buffer pool. Release the U-latch before the call, like
  the path that handles a tablespace that is stopping writes.

- The debug variable innodb_force_LRU_eviction returned before the
  forced eviction had finished: it waited for two done_flush_list
  signals, which other flushing can also send, and did not wait for the
  asynchronous writes. It now waits until two page cleaner LRU batches
  (counted by the new debug-only buf_pool.n_LRU_batches) have completed
  with the flag set, and then for all pending writes. This fixes the
  wrong counts seen in innodb.ext_buf_pool and
  innodb.ext_buf_pool_admission_pct.

  That wait could never end when no page cleaner is running, because
  only buf_flush_page_cleaner() increments n_LRU_batches and srv_start()
  only starts it when !srv_read_only_mode, which innodb_force_recovery=6
  implies as well. The update function now does nothing in read only
  mode, and stops waiting if the page cleaner is no longer running; the
  page cleaner clears buf_page_cleaner_is_active and broadcasts
  done_flush_list while holding buf_pool.flush_list_mutex, so the
  transition cannot be missed. The wait also no longer holds
  LOCK_global_system_variables, like the other InnoDB update functions
  that wait, so that it cannot keep other connections from being
  established.

- The debug flag ib_ext_bp_disable_LRU_eviction_for_t never skipped
  anything, because its continue statement applied to the
  do ... while (0) of DBUG_EXECUTE_IF() and not to the page loop. Set a
  variable inside the DBUG_EXECUTE_IF() and act on it after the macro,
  so that the pages of test/t are really left alone while
  innodb.ext_buf_pool and innodb.ext_buf_pool_admission_pct are still
  filling the table. Without this, those pages can be admitted to the
  EBP and evicted while the tests are inserting, and the exact counts
  that the tests expect after the forced eviction depend on how the page
  cleaner happened to be scheduled.

- The debug flag ib_ext_bp_count_io_only_for_t offered more pages to the
  admission selector than it counted. It let a page through when
  fil_space_t::get() failed, and it did not look at the page type, while
  buf_page_write_complete() counts only the index pages of test/t. The
  pages of the test/t that an earlier part of the test dropped can still
  be resident after their fil_space_t is gone, and the FSP_HDR,
  IBUF_BITMAP and INODE pages are offered as well, so each run of
  innodb.ext_buf_pool_admission_pct put 13 or more pages before the
  selector instead of 10. Those extra pages consumed admissions without
  being counted, and because the selector's accumulator only returns to
  its previous value when the number of candidates times the percentage
  is a multiple of 100, the error also carried over into the following
  runs. The test failed on Debian with 6 instead of 5 pages admitted at
  50 per cent. Offer exactly the pages that are counted.

Run innodb.ext_buf_pool and innodb.ext_buf_pool_admission_pct with
innodb_stats_persistent=0. The inserts make the background statistics
thread recalculate the statistics of test/t asynchronously. When it
samples the index after the forced eviction, it reads the pages back
from the EBP, and when it does so while the forced batch is running, it
changes how many pages that batch admits. This made the tests randomly
fail on Windows with too many reads, and with 8 or 10 instead of 9 pages
flushed.

Add a case to innodb.ext_buf_pool for the n->evicted fix. The new debug
flag ib_ext_bp_alloc_fail makes every EBP page allocation fail, so that
buf_page_t::flush(space, true) returns false with the page still
U-latched.

Also name the buf_page_t::space_type enumerators in
buf_page_write_complete() instead of casting (oldest_modification() == 2)
to the enumeration. That only produces TEMPORARY and PERSISTENT while
they are 1 and 0, so reordering them, or adding an enumerator before
them, would keep compiling and would make write_complete() treat pages
of the temporary tablespace as persistent.

Also re-record sys_vars.sysvars_innodb,32bit for
innodb_extended_buffer_pool_size and
rocksdb.innodb_i_s_tables_disabled for the new
INNODB_BUFFER_POOL_STATS columns.
Marko Mäkelä
MDEV-42350 fixup: innodb_log_recovery_target blocks writes