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
Aleksey Midenkov
MDEV-40821 Wrong result after PORTION OF with subquery (11.4)

Single-table DELETE and UPDATE converted to multi-table (when a
subquery references the target table, or with UPDATE also another
table via semi-join) skipped FOR PORTION OF row splitting and the
constant expression check, so they deleted or updated whole rows
instead of the portion.

The fix prohibits processing DELETE ... FOR PORTION OF and UPDATE ...
FOR PORTION OF as multi-table, like DELETE ... RETURNING.
Rion Bora
MDEV-40839 SET members from the 9th on lost on a pushed-down SELECT

Type_handler_set::make_table_field() built the Field_set with
get_enum_pack_length(), the ENUM rule (1 byte below 256 values), so
a SET with more than 8 members got a 1-byte field in the temporary
table of a select handler (used by the DuckDB engine and by FederatedX
with federated_pushdown=1) and every member from the 9th on was cut
off. Use get_set_pack_length(), as the other Type_handler_set
functions already do.

Tests: duckdb.set_wide_members and federated.federatedx_set_pushdown.
Nikita Malyavin
MDEV-41238 mysqltest: add PS_bind_long command

mysqltest gets a PS_bind_long command. It binds like PS_bind, but
sends every value with mysql_stmt_send_long_data() before each
PS_execute, so a test can reach a parameter in LONG_DATA_VALUE state.
Thirunarayanan Balathandayuthapani
MDEV-41207 Acquire metadata locks for recovered transaction

Problem:
=======
A transaction being rolled back during recovery holds LOCK_IX on the
table(not the metadata locks), and the rollback thread holds
a reference on it.

An online ALTER TABLE on that table falls back to acquiring LOCK_S,
which conflicts and fails. prepare_inplace_alter_table_dict()
asserted that the reference count is 1 before checking whether
the table lock was acquired, so the reference still held by the
rollback thread makes the assertion fail.

Solution:
========
recovery_mdl: New class that holds the metadata locks which
trx_resurrect_table_locks() acquires for recovered transactions,
together with the background connection that owns them.
One MDL_ticket is acquired per table and shared by every recovered
transaction that modified the table, with a reference count, so
that the lock is released once the last of those transactions has
been completed.

trx_sys_t::recovery: Pointer to recovery_mdl, wrapped in
std::atomic, next to rw_trx_hash, which trx_t::free() accesses
anyway. Null pointer means that no recovered transaction holds
metadata locks, which is the normal state once the recovered
transaction have been completed.

trx_lists_init_at_db_start(): Create recovery_mdl and publish it in
trx_sys.recovery before any metadata lock can be acquired, and
delete it again if no recovered transaction acquired any.

recovery_mdl::release(): Drop the references of a transaction,
releasing each metadata lock whose last reference is dropped.
This is the only place that releases them, so that a transaction
which was rolled back by trx_rollback_recovered(false) will
not keep its locks until shutdown.

trx_resurrect_table_locks(): Acquire a shared metadata lock on each
table that the recovered transaction had modified, unless a lock on
the table was acquired for an earlier one, and reference it for this
transaction. Record every table in trx_t::mod_tables, so that
trx_t::commit_in_memory() will find it.

This includes transactions that were recovered in the XA PREPARED
state. They are completed by a user connection, which may issue
XA COMMIT or XA ROLLBACK at any time, or not at all before the next
shutdown. Until then, DDL must be blocked on the tables that they had
modified.

trx_resurrect_table_lock(): Resurrect one table lock and record the
table in trx_t::mod_tables.

trx_sys_t::recovery_release(): Release the metadata locks that were
acquired for a recovered transaction, and delete trx_sys.recovery if
this was the last recovered transaction that held any.
It is invoked by trx_t::commit_in_memory(), while trx_t::mod_tables
and trx_t::is_recovered are still valid. This is the only place that
releases the locks of a transaction, so that a transaction which was
rolled back by trx_rollback_recovered(false) will not keep its locks
until shutdown.

trx_sys_t::recovery_release_table(): Drop the reference that a
recovered transaction holds on the metadata lock of a table,
because its trx_t::mod_tables entry is being removed by
lock_release_on_rollback().

trx_sys_t::recovery_prune_low(): Detach trx_sys.recovery once no
recovered transaction holds metadata locks any longer, so that
neither the locks nor the connection will outlive the recovered
transactions. The caller will delete the object outside
recovery_mutex. This is skipped when the caller has a
current_thd, such as a user connection that is completing a
transaction which was recovered in the XA PREPARED state, and
during shutdown, because destroy_background_thd() would clear
the current_thd of the caller.

trx_sys_t::recovery_shutdown(): Destroy trx_sys.recovery, releasing
anything that is left. It is invoked at the end of trx_sys_t::close()
only, after every transaction has been freed. No other thread can be
accessing trx_sys.recovery, and therefore recovery_mutex need not be
acquired.

trx_sys_t::recovery_thd(): Return the background connection, for the
rollback_wait debug injection in row_undo_mod().

prepare_inplace_alter_table_dict(): Remove the acquisition of an
InnoDB table lock for online ADD INDEX when a recovered transaction
holds a lock on the table.
Otto Kekäläinen
Remove executable bit from files that are not executable

W: mariadb-server: executable-not-elf-or-script [usr/bin/wsrep_sst_common]
W: mariadb-test-data: executable-not-elf-or-script [usr/share/mariadb/mariadb-test/main/lowercase_table2.result]
W: mariadb-test-data: executable-not-elf-or-script [usr/share/mariadb/mariadb-test/suite/galera/t/MDEV-35511.test]
N:
N:  This executable file is not an ELF format binary, and does not start with
N:  the #! sequence that marks interpreted scripts. It might be a sh script
N:  that fails to name /bin/sh as its shell, or it may be incorrectly marked
N:  as executable. Sometimes upstream files developed on Windows are marked
N:  unnecessarily as executable on other systems.

Origin commits:
- 36eba988: lowercase_table2.result (already fixed once in 3812e1c9)
- 8fab1293: MDEV-35511.test

Additionally confirmed that there are no more test/result files with
executable bit in vain with:

    find mysql-test -executable -name *.test -or -executable -name *.result

The file usr/bin/wsrep_sst_common is a Bash "library" file that can't be
executed stand-alone. The proper long-term fix would be to move this to
a library directory out of the `/usr/bin` path.
Aleksey Midenkov
MDEV-40821 Wrong result after DELETE HISTORY or PORTION OF (10.11)

The parser assigned versioning conditions of DELETE HISTORY ... BEFORE
SYSTEM_TIME and period conditions of DELETE ... FOR PORTION OF to the
table pointed by last_table(). When the BEFORE SYSTEM_TIME or FOR
PORTION OF expression references another table (e.g. via a subquery or
a sequence function), last_table() is already switched to that table,
and the DELETE target gets no conditions.

DELETE HISTORY then deletes current rows permanently instead of
history, keeps the history it had to purge, and is checked for DELETE
privilege instead of DELETE HISTORY. DELETE HISTORY from a
non-versioned table is not rejected with ER_VERS_NOT_VERSIONED.
DELETE ... FOR PORTION OF deletes all rows of the table, ignoring the
period.

The fix assigns the conditions to the TABLE_LIST returned by
delete_single_table, i.e. the DELETE target itself, regardless of
tables added later in the statement.

DBUG_ASSERT in TABLE::vers_switch_partition() is removed. It checked
delete_history on last_table() and assumed no other table is opened
for write by DELETE HISTORY, which is false for the underlying table
of a view or a table locked by SELECT ... FOR UPDATE in the history
point. The DELETE HISTORY target is already skipped there by its own
delete_history check.
Vladislav Vaintroub
MDEV-41800 Flush stdout after mysqld --help

Under load on Windows, the last partial stdout buffer could be lost at
exit, so the --help output was truncated, and mysql-test-run.pl failed
to parse it. Flush explicitly.

Assisted-by: Claude:claude-sonnet-5-5
Nikita Malyavin
MDEV-41238 Bound parameters prevent condition pushdown into a grouped view, while CAST enables it

Item_param::deep_copy() returned NULL, and every rewrite that copies a
condition gives up on what it cannot copy. A conjunct holding a
prepared statement parameter was therefore left out of:
- pushdown into derived tables and views, including UNION branches
  and conditions on a derived table column whose expression holds a
  parameter;
- pushdown from HAVING to WHERE, for the part extracted from an OR;
- pushdown into a materialized IN subquery;
- split materialization, which then found no split key;
- the UPPER(col) IN (...) rewrite, which has skipped such conjuncts
  since MDEV-40006.
When the derived table groups by an expression with a parameter, the
condition was pushed into its HAVING instead of its WHERE.

CAST(? AS ...) worked around this only by accident. Before the
pushdown, constant propagation can replace a constant expression on
one side of = with a literal. A bare parameter already counts as a
basic constant, so propagation leaves it as it is. A client whose
charset differs from the column's got the pushdown by a similar
accident: the charset conversion replaces the parameter with a
literal.

Item_param::shallow_copy() now copies a parameter that holds a value,
NULL included, and deep_copy() calls it, as in other leaf items. Every
such copy is made while optimizing during EXECUTE, and the next
EXECUTE makes a new one, so a copy always carries the value bound for
the EXECUTE that made it. A copy that outlived its EXECUTE would keep
an old value and point into a string buffer that the next binding may
free, so shallow_copy() asserts that it does not allocate on the
statement's arena.

The copy is not added to m_clones. m_clones keeps the parameter's
copies in CTE definitions updated with each new value for the whole
life of the statement, while this copy lives for one execution.

An unbound parameter, DEFAULT and IGNORE still have no copy.
Vladislav Vaintroub
Fix main.grant_repair on Windows when user.MAI ends with Ctrl-Z

The test patches user.MAI from perl, opened in text mode. On Windows
that strips a trailing 0x1A byte on close, so the index file becomes
one byte shorter and the server reports a size mismatch instead of
repairing the table. Open the file with the :raw layer.

Assisted-by: Claude:claude-sonnet-5-5
Aleksey Midenkov
Fix SSL test failures with GnuTLS client (11.4)

With WITH_SSL=bundled the server uses wolfSSL and Connector/C is
built with GnuTLS. The GnuTLS backend reports a CA-signed server
certificate with an unknown issuer as MARIADB_TLS_VERIFY_UNKNOWN,
which neither --ssl-fp nor password-based verification can override
(OpenSSL reports it as MARIADB_TLS_VERIFY_TRUST).

The fix:

  main.ssl_fp      skip unless the client uses OpenSSL or LibreSSL
  main.mysql      pass --ssl-ca to a GnuTLS client for the
                  --ssl-verify-server-cert check
  rpl.rpl_semi_sync_no_missed_ack_after_add_slave
                  include default_client.cnf, so check-testcase
                  connects with --disable-ssl-verify-server-cert
                  (also done in 10.11)
Yuchen Pei
Remove unused SELECT_CHECK
Anway Durge
MDEV-41208: stringify non-VARCHAR DuckDB values for MariaDB string fields

Mixed COALESCE is VARCHAR in MariaDB and INTEGER in DuckDB, so GetValueUnsafe<string>() asserted PhysicalType::VARCHAR. Convert with ToString() unless DuckDB actually stored a string.
Oleksandr Byelkin
MDEV-41502 Bulk INSERT: IN list and REGEXP with a parameter use the first parameter set for all rows

Optimized array binding INSERT/REPLACE fixes the items once, and
parameters are constants, so items cache values computed with the first
set of parameters (IN array, compiled REGEXP pattern).

Do not treat parameters as constants during optimized array binding
execution.
Execute LIKE and JSON_SEARCH with a parameter in ESCAPE for every set
of parameters, as ESCAPE must be a constant.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Kristian Nielsen
After-merge fix of compilation failures

Signed-off-by: Kristian Nielsen <[email protected]>
Oleksandr Byelkin
MDEV-23864 Wrong bulk affected rows with triggers and stored functions

In bulk operation reset_diagnostics_area() set DA_OK_BULK before the
first OK, so the affected rows of the previous statement were added,
and OK of trigger and stored function statements were added too.

Remember DA_OK_BULK/DA_EOF_BULK set by the bulk operation and restore
it when the diagnostics area is reset (also after an error handled in
a trigger or stored function, or a reprepare), and do not set OK status
in sub-statements of bulk operation (my_ok(), GET DIAGNOSTICS).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Rucha Deodhar
MDEV-22675: Assertion `offset < table->s->reclength' failed in dump_leaf_key

Analysis:
The reclength depends on the size of each field of the temporary table plus
the null_bytes. Since null_bytes is 0 (because we’re in non-strict mode and
the source table fields can never be null), there is no need to keep track
of null values. Hence the total record length is just the sum of the sizes
of both fields. The second field will always have size 0 because its value
will always be an empty string. Hence it starts exactly where the first
field ends which equal to reclength. Hence the assertion failure.

Fix:
If pack_length() is 0 (which means the size of field is 0) so assigning the
result as empty string directly, the assertion is not valid in that case.
Vladislav Vaintroub
Fixup be807b2d047: match GnuTLS only, not every non-OpenSSL client

Schannel on Windows is not OpenSSL either, but handles these cases.

Assisted-by: Claude:claude-sonnet-5-5
Thirunarayanan Balathandayuthapani
MDEV-41548 InnoDB: Cannot replay rename … because the target file exists

Problem:
=======
recv_rename_files() replayed the renames in tablespace id order,
because renamed_spaces was a std::map keyed by space id that kept
only the latest file name per tablespace. A multi-table RENAME
such as RENAME TABLE t2 TO t3, t1 TO t2 frees a file name for a
tablespace that may have a lower id, and replaying in id order
then fails with "Cannot replay rename of tablespace … because the
target file exists".

Solution:
========
renamed_spaces: Change to a std::vector of (id, from, to),
retaining every FILE_RENAME record in log order. The records are
appended only while recv_sys.file_checkpoint is set, hence exactly
once and in ascending LSN.

recv_rename_files(): Replay the records in that order, applying
one only when the tablespace currently uses the file name that the
record renames from. The order in which the server executed the
renames is always replayable, because each rename required its
target to be unoccupied.
Otto Kekäläinen
Fix most typos that `lintianspell` found

Before this change `lintianspell` reported:

    ± find * -type f | xargs spellintian
    BUILD/FINISH.sh: fi fi (duplicate word) -> fi
    BUILD/compile-pentium32-gcov: fi fi (duplicate word) -> fi
    BUILD/compile-dist: fi fi (duplicate word) -> fi
    BUILD/SETUP.sh: fi fi (duplicate word) -> fi
    BUILD/compile-solaris-sparc-purify: mysqld mysqld (duplicate word) -> mysqld
    BUILD-CMAKE: remebered -> remembered
    BUILD-CMAKE: "allows to" -> "allows one to"
    BUILD-CMAKE: "Let's you" -> "Lets you"
    client/mysqlbinlog.cc: they they (duplicate word) -> they
    client/mysqldump.c: query query (duplicate word) -> query
    client/mysqldump.c: name name (duplicate word) -> name
    client/mysqldump.c: flags flags (duplicate word) -> flags
    client/mysqldump.c: "allows to" -> "allows one to"
    client/mysqladmin.cc: wait wait (duplicate word) -> wait
    client/mysql_plugin.c: the the (duplicate word) -> the
    client/mysql.cc: comand -> command
    client/mysql.cc: mysql mysql (duplicate word) -> mysql
    client/mysql.cc: type type (duplicate word) -> type
    client/mysql.cc: prompt prompt (duplicate word) -> prompt
    client/mysql.cc: struct struct (duplicate word) -> struct
    client/mysqlslap.c: long long (duplicate word) -> long
    client/mysqlcheck.c: to to (duplicate word) -> to
    client/mysqltest.cc: long long (duplicate word) -> long
    client/mysqltest.cc: string string (duplicate word) -> string
    client/mysqltest.cc: the the (duplicate word) -> the
    client/mysqltest.cc: mysql mysql (duplicate word) -> mysql
    client/mysqltest.cc: flags flags (duplicate word) -> flags
    client/mysqltest.cc: query query (duplicate word) -> query
    client/mysqltest.cc: if if (duplicate word) -> if
    client/mysqltest.cc: not not (duplicate word) -> not
    cmake/ssl.cmake: ENDIF ENDIF (duplicate word) -> ENDIF
    cmake/mysql_version.cmake: ENDIF ENDIF (duplicate word) -> ENDIF
    cmake/aws_sdk.cmake: librairies -> libraries
    cmake/aws_sdk.cmake: ENDIF ENDIF (duplicate word) -> ENDIF
    cmake/submodules.cmake: ENDIF ENDIF (duplicate word) -> ENDIF
    cmake/install_macros.cmake: ENDIF ENDIF (duplicate word) -> ENDIF
    cmake/compile_flags.cmake: ENDFOREACH ENDFOREACH (duplicate word) -> ENDFOREACH
    cmake/dtrace.cmake: ENDIF ENDIF (duplicate word) -> ENDIF
    cmake/dtrace_prelink.cmake: ENDFOREACH ENDFOREACH (duplicate word) -> ENDFOREACH
    cmake/mariadb_connector_c.cmake: ENDIF ENDIF (duplicate word) -> ENDIF
    cmake/check_compiler_flag.cmake: ENDIF ENDIF (duplicate word) -> ENDIF
    cmake/zlib.cmake: ENDIF ENDIF (duplicate word) -> ENDIF
    cmake/versioninfo.rc.in: END END (duplicate word) -> END
    cmake/build_configurations/mysql_release.cmake: ENDIF ENDIF (duplicate word) -> ENDIF
    cmake/libutils.cmake: not not (duplicate word) -> not
    cmake/libutils.cmake: ENDIF ENDIF (duplicate word) -> ENDIF
    cmake/os/HP-UX.cmake: ENDIF ENDIF (duplicate word) -> ENDIF
    cmake/os/Windows.cmake: ENDIF ENDIF (duplicate word) -> ENDIF
    cmake/os/Windows.cmake: ENDFOREACH ENDFOREACH (duplicate word) -> ENDFOREACH
    cmake/os/Windows.cmake: "Allow to" -> "Allow one to"
    cmake/os/SunOS.cmake: ENDIF ENDIF (duplicate word) -> ENDIF
    cmake/numa.cmake: ENDIF ENDIF (duplicate word) -> ENDIF
    cmake/Internal/CPack/CPackRPM.cmake: ENDIF ENDIF (duplicate word) -> ENDIF
    cmake/readline.cmake: ENDIF ENDIF (duplicate word) -> ENDIF
    cmake/cpack_rpm.cmake: build build (duplicate word) -> build
    cmake/cpack_rpm.cmake: ENDIF ENDIF (duplicate word) -> ENDIF
    cmake/systemd.cmake: ENDIF ENDIF (duplicate word) -> ENDIF
    cmake/install_layout.cmake: ENDIF ENDIF (duplicate word) -> ENDIF
    cmake/plugin.cmake: ENDIF ENDIF (duplicate word) -> ENDIF
    cmake/for_clients.cmake: ENDIF ENDIF (duplicate word) -> ENDIF
    cmake/mysql_add_executable.cmake: ENDIF ENDIF (duplicate word) -> ENDIF
    cmake/make_dist.cmake.in: ENDIF ENDIF (duplicate word) -> ENDIF
    cmake/pcre.cmake: libary -> library
    cmake/pcre.cmake: ENDIF ENDIF (duplicate word) -> ENDIF
    cmake/create_initial_db.cmake: ENDFOREACH ENDFOREACH (duplicate word) -> ENDFOREACH
    cmake/cpu_info.cmake: ENDIF ENDIF (duplicate word) -> ENDIF
    cmake/package_name.cmake: ENDIF ENDIF (duplicate word) -> ENDIF
    CMakeLists.txt: hapen -> happen
    CMakeLists.txt: ENDIF ENDIF (duplicate word) -> ENDIF
    CMakeLists.txt: ENDFOREACH ENDFOREACH (duplicate word) -> ENDFOREACH
    configure.cmake: ENDIF ENDIF (duplicate word) -> ENDIF
    configure.cmake: funcion -> function
    dbug/dbug.c: frp frp (duplicate word) -> frp
    dbug/dbug.c: to to (duplicate word) -> to
    debian/salsa-ci.yml: mysql mysql (duplicate word) -> mysql
    debian/mariadb-server-10.6.preinst: fi fi (duplicate word) -> fi
    debian/mariadb-server-10.6.mariadb.init: fi fi (duplicate word) -> fi
    debian/po/ca.po: diferent -> different
    debian/mariadb-server-10.6.postinst: fi fi (duplicate word) -> fi
    debian/mariadb-server-10.6.templates: mysql mysql (duplicate word) -> mysql
    debian/mariadb-server-10.6.postrm: fi fi (duplicate word) -> fi
    debian/autobake-deb.sh: enviroment -> environment
    debian/additions/innotop/innotop.1: ae ae (duplicate word) -> ae
    debian/additions/innotop/innotop.1: Pages Pages (duplicate word) -> Pages
    debian/mariadb-common.postinst: fi fi (duplicate word) -> fi
    Docs/INSTALL-BINARY: mysql mysql (duplicate word) -> mysql
    extra/wolfssl/CMakeLists.txt: ENDIF ENDIF (duplicate word) -> ENDIF
    extra/wolfssl/CMakeLists.txt: endif endif (duplicate word) -> endif
    extra/perror.c: unknow -> unknown
    extra/innochecksum.cc: long long (duplicate word) -> long
    extra/innochecksum.cc: error error (duplicate word) -> error
    extra/innochecksum.cc: page page (duplicate word) -> page
    extra/innochecksum.cc: file file (duplicate word) -> file
    extra/mariabackup/backup_mysql.cc: long long (duplicate word) -> long
    extra/mariabackup/backup_copy.cc: "allows to" -> "allows one to"
    extra/mariabackup/xbcloud.cc: verison -> version
    extra/mariabackup/xbcloud.cc: recieved -> received
    extra/mariabackup/CMakeLists.txt: ENDIF ENDIF (duplicate word) -> ENDIF
    extra/mariabackup/xtrabackup.h: delimiters delimiters (duplicate word) -> delimiters
    extra/mariabackup/fil_cur.cc: tablepsaces -> tablespaces
    extra/mariabackup/fil_cur.h: tablepsaces -> tablespaces
    extra/mariabackup/xtrabackup.cc: neccessary -> necessary
    extra/mariabackup/xtrabackup.cc: delimiters delimiters (duplicate word) -> delimiters
    extra/mariabackup/xtrabackup.cc: loggin -> login
    extra/mariabackup/xtrabackup.cc: possiblity -> possibility
    extra/mariabackup/xtrabackup.cc: suffix suffix (duplicate word) -> suffix
    extra/mariabackup/wsrep.cc: long long (duplicate word) -> long
    extra/aws_sdk/CMakeLists.txt: "Allow to" -> "Allow one to"
    extra/replace.c: convinience -> convenience
    extra/readline/histlib.h: n n (duplicate word) -> n
    extra/readline/parens.c: delimiter delimiter (duplicate word) -> delimiter
    extra/readline/vi_mode.c: wc wc (duplicate word) -> wc
    extra/readline/display.c: e e (duplicate word) -> e
    extra/readline/display.c: v v (duplicate word) -> v
    extra/readline/display.c: postion -> position
    extra/readline/rldefs.h: n n (duplicate word) -> n
    extra/readline/history.c: carefull -> careful
    extra/readline/text.c: pased -> passed
    extra/readline/configure.in: dnl dnl (duplicate word) -> dnl
    extra/readline/configure.in: fi fi (duplicate word) -> fi
    extra/readline/readline.c: Initalize -> Initialize
    extra/readline/histexpand.c: upto -> up to
    extra/readline/histexpand.c: modfiers -> modifiers
    extra/CMakeLists.txt: ENDIF ENDIF (duplicate word) -> ENDIF
    include/mysql/plugin_audit.h.pp: long long (duplicate word) -> long
    include/mysql/service_encryption_scheme.h: long long (duplicate word) -> long
    include/mysql/plugin.h: long long (duplicate word) -> long
    include/mysql/plugin.h: prefix prefix (duplicate word) -> prefix
    include/mysql/psi/psi_base.h: "Allow to" -> "Allow one to"
    include/mysql/psi/psi.h: must must (duplicate word) -> must
    include/mysql/psi/psi.h: length length (duplicate word) -> length
    include/mysql/psi/psi.h: "Allow to" -> "Allow one to"
    include/mysql/service_progress_report.h: long long (duplicate word) -> long
    include/mysql/plugin_audit.h: long long (duplicate word) -> long
    include/mysql/plugin_auth.h.pp: long long (duplicate word) -> long
    include/mysql/auth_dialog_client.h: mysql mysql (duplicate word) -> mysql
    include/mysql/auth_dialog_client.h: type type (duplicate word) -> type
    include/mysql/auth_dialog_client.h: prompt prompt (duplicate word) -> prompt
    include/mysql/plugin_password_validation.h.pp: long long (duplicate word) -> long
    include/mysql/plugin_encryption.h.pp: long long (duplicate word) -> long
    include/mysql/plugin_data_type.h.pp: long long (duplicate word) -> long
    include/mysql/service_logger.h: long long (duplicate word) -> long
    include/mysql/client_plugin.h: type type (duplicate word) -> type
    include/mysql/client_plugin.h: value value (duplicate word) -> value
    include/mysql/service_wsrep.h: long long (duplicate word) -> long
    include/mysql/plugin_ftparser.h.pp: long long (duplicate word) -> long
    include/mysql/plugin_function.h.pp: long long (duplicate word) -> long
    include/my_global.h: long long (duplicate word) -> long
    include/json_lib.h: lenght -> length
    include/my_sys.h: long long (duplicate word) -> long
    include/mysql.h: long long (duplicate word) -> long
    include/myisam.h: dupplicated -> duplicated
    include/my_base.h: dupplicated -> duplicated
    include/big_endian.h: short short (duplicate word) -> short
    include/ma_dyncol.h: long long (duplicate word) -> long
    spellintian: can't decode ill-formed UTF-8 octet sequence <FF> in position 0 at /usr/share/perl5/Path/Tiny.pm line 2087.
    xargs: spellintian: exited with status 255; aborting

Fix all clear and easy to fix typos that have no functional effect,
and thus should be perfectly safe to do on the 10.6 branch.

This is intentionally done in a separate step from other typofixes for
easier patch management between upstream and downstream (Debian) MariaDB.
Oleksandr Byelkin
MDEV-41652 SIGFPE in get_next_time/Event_queue_element::compute_next_execution_time

get_next_time() took the interval value as int, so converting it to
seconds or months could overflow, e.g. 268435456 HOUR wrapped to 0
and the months branch divided by zero.

Pass the interval as longlong and reject month counts that do not
fit INTERVAL::month (32-bit on Windows).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Otto Kekäläinen
Document bashisms in scripts that are supposed to stay POSIX-compliant

Lintian reported bash-term-in-posix-shell for scripts that declare
/bin/sh as their interpreter:

    I: mariadb-client: bash-term-in-posix-shell '`echo "testing\c"' [usr/bin/mariadb-secure-installation:199]
    I: mariadb-server: bash-term-in-posix-shell '${BASH_VERSION' [usr/share/mariadb/wsrep_notify:86]
    I: mariadb-server: bash-term-in-posix-shell '[ "$url" ==' [usr/bin/mariadbd-safe:222]
    I: mariadb-server: bash-term-in-posix-shell 'let' [usr/bin/mariadbd-safe:41]
    I: mariadb-server: bash-term-in-posix-shell 'ulimit' [usr/bin/mariadbd-safe:718]
    I: mariadb-server: bash-term-in-posix-shell 'ulimit' [usr/bin/mariadbd-safe:838]
    I: mariadb-server-core: bash-term-in-posix-shell 'source tree,' [usr/bin/mariadb-install-db:100]

Only scripts/mysqld_safe.sh really uses non-POSIX shell features (local
variables and the == operator in test), but it should stay using sh
as mentioned in c10bed1.

The other reported scripts do run fine under /bin/sh and are only false
positives of the Lintian check:
- mariadb-secure-installation deliberately probes the shell's echo
  behaviour
- wsrep_notify intentionally checks for a Bash runtime and falls back
  to POSIX code when Bash is not available
- The `let` and `ulimit` hits in mariadbd-safe are respectively a word
  in a comment and a POSIX utility also provided by Dash
- `source tree,` is a word in a comment in mariadb-install-db

Also update the existing overrides to ensure paths and line numbers match.
Aleksey Midenkov
Merge 10.11 into 11.4
Oleksandr Byelkin
MDEV-39306 fix race in versioning.rpl_row

The slave created table t before the master's previous DROP TABLE t
was replicated. Sync the slave after the drops.

Reviewed by [email protected]
bsrikanth-mariadb
MDEV-41293: FederatedX: connection state after a net_read_timeout

Problem:
When reading the reply of the remote server times out, the client
library compiled into the server returns without closing the connection
and without setting a client error. FederatedX took the raw
ER_NET_READ_INTERRUPTED for an error of the remote server and went on
using a connection that still had the reply of the failed statement to
arrive. As a result:
* the next statement on that connection failed in various ways, either
  with ER_QUERY_ON_FOREIGN_DATA_SOURCE ("Server has gone away") or with
  an error packet that mysqltest took for a malformed packet;
* inside a transaction, the following statements continued on a new
  remote session in autocommit mode, so they were committed on the
  remote server one by one even though the local transaction was later
  rolled back. The savepoints of the lost session were also still
  remembered by FederatedX.
The same happened when the connection was lost while reading the reply.

Fix:
* After a timeout FederatedX closes the connection, so that the next
  statement opens a new one. The client still gets the error of the
  timeout, ER_NET_READ_INTERRUPTED.
* Whenever the connection is gone after a failed statement, timeout or
  not, the state of the lost session (autocommit mode, savepoints) is
  forgotten and the local transaction is marked to be rolled back, so a
  new connection starts the transaction again. This includes the case
  where the connection is lost while SET AUTOCOMMIT=0 is sent for the
  first statement of the transaction. The closed connection is also
  freed, which was leaked before.
* Errors of the client library are reported as
  ER_QUERY_ON_FOREIGN_DATA_SOURCE by ha_federatedx::info() as well, the
  same way as by the pushed down multi-table UPDATE/DELETE.
* The error state of ha_federatedx, read by info(), is initialized.

Test: federatedx_pushdown_upd_del covers the timeout of a pushed down
multi-table UPDATE and DELETE and of reading a result, the statements
after it, the same inside a transaction, a connection killed in the
middle of a statement, a connection lost while SET AUTOCOMMIT=0 is sent
(also followed by a disconnect and a transaction in another session),
client library errors in info(), and that an error of the remote server
which merely has the code of ER_NET_READ_INTERRUPTED is not taken for a
timeout.
Oleksandr Byelkin
MDEV-23864 BULK insert wrong values when command contain inner select

Optimized array binding INSERT/REPLACE executes the statement once,
so subqueries are executed with the first set of parameters only.

Execute INSERT/REPLACE, where a subquery result depends on parameters,
for every set of parameters (as not optimized array binding commands
are executed), keeping the first generated id as the result of the
whole operation.
Per-row execution also needs warnings counted once, RETURNING metadata
sent once (also after reprepare), and an error allowed after
successful rows.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
bsrikanth-mariadb
MDEV-41293: FederatedX: connection state after a net_read_timeout

Problem:
When reading the reply of the remote server times out, the client
library compiled into the server returns without closing the connection
and without setting a client error. FederatedX took the raw
ER_NET_READ_INTERRUPTED for an error of the remote server and went on
using a connection that still had the reply of the failed statement to
arrive. As a result:
* the next statement on that connection failed in various ways, either
  with ER_QUERY_ON_FOREIGN_DATA_SOURCE ("Server has gone away") or with
  an error packet that mysqltest took for a malformed packet;
* inside a transaction, the following statements continued on a new
  remote session in autocommit mode, so they were committed on the
  remote server one by one even though the local transaction was later
  rolled back. The savepoints of the lost session were also still
  remembered by FederatedX.
The same happened when the connection was lost while reading the reply.

Fix:
* After a timeout FederatedX closes the connection, so that the next
  statement opens a new one. The client still gets the error of the
  timeout, ER_NET_READ_INTERRUPTED.
* Whenever the connection is gone after a failed statement, timeout or
  not, the state of the lost session (autocommit mode, savepoints) is
  forgotten and the local transaction is marked to be rolled back, so a
  new connection starts the transaction again. This includes the case
  where the connection is lost while SET AUTOCOMMIT=0 is sent for the
  first statement of the transaction. The closed connection is also
  freed, which was leaked before.
* Errors of the client library are reported as
  ER_QUERY_ON_FOREIGN_DATA_SOURCE by ha_federatedx::info() as well, the
  same way as by the pushed down multi-table UPDATE/DELETE.
* The error state of ha_federatedx, read by info(), is initialized.

Test: federatedx_pushdown_upd_del covers the timeout of a pushed down
multi-table UPDATE and DELETE and of reading a result, the statements
after it, the same inside a transaction, a connection killed in the
middle of a statement, a connection lost while SET AUTOCOMMIT=0 is sent
(also followed by a disconnect and a transaction in another session),
client library errors in info(), and that an error of the remote server
which merely has the code of ER_NET_READ_INTERRUPTED is not taken for a
timeout.
Rucha Deodhar
MDEV-33843: Server crashes by stack-overflow with UPDATEXML

Analysis:
The stack size if insufficient and there is no stack overrun check.

Fix:
Add stack overrun check.
Oleksandr Byelkin
MDEV-23864 Bulk INSERT loses rows if a stored function executes DML

A DML statement of a stored function called by an optimized array
binding INSERT consumed the next sets of parameters of the bulk
operation.

Reset THD::bulk_param during the function execution, as it is done
for triggers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sergei Golubchik
userstat: stack overflow on DROP TABLE with many index statistics

del_global_index_stats_for_table() collected all matching entries
into an array of MAX_INDEXES elements. Statistics of renamed indexes
stay in global_index_stats under their old names, so a table can have
more entries than that and DROP TABLE wrote past the array.

Delete the entries in batches of MAX_INDEXES.

Assisted-by: Claude:claude-opus-5-5
Rucha Deodhar
MDEV-23500: Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())'
failed in Diagnostics_area::set_ok_status upon multi-table update

Analysis:
When NULL field from internal temporary table is copied to
NOT-NULL so there is error about truncation  but this error is not
reported so we get the failure.

Fix:
Return the error state.
nada
MDEV-37214 CREATE OR REPLACE USER must not drop the existing account on failure

CREATE OR REPLACE USER used to DROP the existing account before validating the new definition, so a failure after the DROP (e.g. an unknown auth plugin) permanently deleted the account without writing anything to the binlog, diverging master and replicas.

Validate and prepare the new account first; only wipe the account's privileges from the non-user grant tables once all checks pass, immediately before updating mysql.user/mysql.global_priv in place. A failure now leaves the existing account untouched.

  - CREATE OR REPLACE USER/ROLE now builds the replacement from a default row (as for a new account) instead of updating the old row field by field, so password, resource limits, SSL options and lock status do not survive the replace.
  - Orphan privileges (grant-table rows with no mysql.user row) are also removed.
  - Rebuild the role/user cross-reference arrays after a successful replace; without this, SHOW GRANTS could crash on an account that had been granted a role.
Oleksandr Byelkin
Fix use-after-poison on BINLOG with a Query event in EXECUTE IMMEDIATE

Query_log_event::do_apply_event() freed thd->mem_root, which inside a
BINLOG statement also freed the statement's own memory, e.g. Items of
EXECUTE IMMEDIATE freed later in THD::cleanup_after_query().

Free thd->mem_root only in replication/wsrep appliers, as
Rows_log_event::do_apply_event() does.

Reviewed by [email protected]
Rucha Deodhar
MDEV-36653: main.mysql_upgrade-28915 test case timeout

Analysis:
Concurrent execution of mysql_upgrade and the event scheduler causes a
metadata locking (MDL) deadlock between ALTER TABLE on system tables and
the initial loading/caching of the event table.

Fix:
Disable the event scheduler via 'SET GLOBAL event_scheduler=OFF' prior to
running the upgrade in the test case. This prevents concurrent conflicts
and allows the test to run reliably.
Jan Lindström
MDEV-40348 galera_var_reject_queries fails sporadically

Failure:
- wsrep_reject_queries=ALL_KILL signals node_1a's connection kill
  asynchronously (wsrep_close_client_connections(FALSE, ...)) and
  returns before the kill is processed.
- The test immediately queries node_1a, racing that signal. Most
  of the time the connection is already gone and the query gets a
  connection error, but under scheduler contention (seen on a busy
  CI worker) the query can still land on the live connection and
  get ER_UNKNOWN_COM_ERROR (1047), the same error plain
  wsrep_reject_queries=ALL already returns above, instead of a
  connection error.

Fix:
- Poll node_1a with SELECT * FROM t1 until it returns an actual
  connection error, tolerating 1047 as "not yet killed", the same
  technique include/wait_until_disconnected.inc already uses for
  this class of race.

Assisted-by: https://mariadb.org/governance/governance-ai-policy/
Sergei Golubchik
Wrong table name in the warning about missing statistical table

open_stat_table_for_ddl() printed the global stat_table_name, always
`table_stats`, instead of the name of the table it failed to open.

Assisted-by: Claude:claude-opus-5-5
Sergei Golubchik
userstat: DROP TABLE and DROP INDEX leave stale usage statistics

delete_statistics_for_table() and delete_statistics_for_index()
removed the userstat entries only after opening the statistical
tables, and returned early when that failed.

Delete the userstat entries before opening the statistical tables.

Assisted-by: Claude:claude-opus-5-5
Oleksandr Byelkin
bump version
Thirunarayanan Balathandayuthapani
MDEV-41360  OPTIMIZE TABLE crashes with ib_vector_size(optim->words) > 0 on FULLTEXT index with collation-equal words

Problem:
========
  OPTIMIZE TABLE on a FULLTEXT index crashes when the aux tables hold
two spellings of a word that are equal under the index collation.
The index lookup in fts_index_fetch_nodes() and the DELETE in
fts_optimize_write_word() both compare words by collation,
but fts_optimize_index_fetch_node() compares the bytes,
so each spelling becomes a separate fts_word_t.

fts_optimize_compact() then optimizes and writes back each of them
separately. Writing one deletes the rows of the other, including the
rows that were just written, so index entries can be lost. If all the
documents were deleted, the first write removes both words. The next
word that fts_optimize_words() reads from the zip buffer is the other
spelling, the fetch finds nothing, and the server aborts

Solution:
========
fts_optimize_collation_fetch_node(): New callback used only
by OPTIMIZE. It adds the fetched records whose words are
equal under the index collation to the same fts_word_t,
so the spellings are optimized and written back as one word.
The records arrive ordered by first_doc_id,
so the nodes stay in order.

fts_optimize_fetch_node(): The helper of the fetch callbacks,
which compares the words either by bytes or by the given collation.
fts_optimize_index_fetch_node() still compares by bytes, which is
what the information_schema code expects.

fts_optimize_words(): Use fts_optimize_collation_fetch_node().
The word read from the zip buffer can already
have been optimized together with an earlier spelling, so an empty
fetch is not an error. Skip the word instead of asserting.
Kristian Nielsen
Merge into main 10.11
Otto Kekäläinen
Add executable bit to files that are intended to be executable

Both files start with a #! interpreter line and are meant to be run as
programs. The files had originally correct executable bits, but
regressed in:
- 193ced9b: generate-ssl-certs.sh
- 8fab1293: normalize_query_id.pl

This fixes the following Lintian warnings:

    W: mariadb-test: script-not-executable [usr/share/mariadb/mariadb-test/lib/generate-ssl-certs.sh]
    W: mariadb-test-data: script-not-executable [usr/share/mariadb/mariadb-test/suite/plugins/t/normalize_query_id.pl]