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
Dmitry Shulga
MDEV-30645: CREATE TRIGGER FOR { STARTUP | SHUTDOWN }

Extended the system table mysql.event to support creation of
system triggers (startup, shutdown, logon, logoff) and ddl triggers.

The system table mysql.event is extended with three columns
  `kind`, `when`, `ddl_type`.
For the task MDEV-30645 only the column `kind` is required,
the other two columns are required for the tasks
  MENT-2355, MENT-2291
but since it is better to reduce a number of times the system table
is changed and as a consequences a number of upgrades to be run,
the entire set of columns is added at once.

Type of the columns `kind` and `ddl_type` are specified as SET to allow
storing of triggers that handle several events.
Yuchen Pei
MDEV-15621 [wip] Auto add partitions by interval
Thirunarayanan Balathandayuthapani
MDEV-39642 InnoDB FTS: Assertion `doc_id > node->last_doc_id' failed in fts_optimize_encode_node during OPTIMIZE TABLE


fts_optimize_word() could crash with assertion "doc_id > node->last_doc_id"
when source nodes have equal boundary doc_ids.

fts_optimize_word():  Changed condition from '>' to '>=' to
handle legitimate overlapping ranges that occur when nodes
fill to FTS_ILIST_MAX_SIZE at doc_id boundaries.
sjaakola
MDEV-34784 unhandled FK dependency with DML vs DDL

Certain DDL statements (e.g. ALTER TABLE) require innodb table lock
on tables having foreign key constraint reference to the table
under DDL execution. This dependency is not added in write set
key information. However, tables being referenced to will be added
in the key information, so the table locking domain of DDL is only
partially recorded.

One harmful consequence of this missing dependency information happens
when a DML modifies a FK child table's row, which has NULL in the FK
referencing column. In such situation, the FK reference cannot be followed
during DDL execution, and there will be no FK parent table keys recorded
in the write set. Parallel applying (or multi-master access) of such DML
and DDL on the FK parent table will cause applying conflicts.

This  scenario is presented in a new mtr test added in this commit.
The commit has a fix for the DDL FK dependency handling by adding all FK
child table names in the write set key information.
The commit has also fixes for innodb lock0lock.cc error logging to report
lock connflicts of table and record locks correctly.
Thirunarayanan Balathandayuthapani
MDEV-34358  Detect config changes during encryption iteration

Problem:
=======
When innodb_encrypt_tables or innodb_encryption_rotate_key_age is
changed during encryption thread iteration, threads continue with
stale configuration values, potentially missing tablespaces that
should be encrypted or rotated under the new settings.

Solution:
========
Added atomic version counter fil_crypt_settings_version that is
incremented whenever innodb_encrypt_tables or
innodb_encryption_rotate_key_age changes. Encryption threads capture
the version at iteration start and check for changes during iteration.
If config changed, threads immediately restart iteration from the
beginning to ensure complete coverage with new settings.

fil_crypt_settings_version: Atomic counter to track the
innodb_encrypt_tables or innodb_encryption_rotate_key_age changes

rotate_thread_t::settings_version: To compare the
existing fil_crypt_settings_version to restart the
encryption from the beginning
Rex Johnston
MDEV-39492 Parallel Query: Study how to create worker threads

Introduces parallel_worker_threads variable to control the number
of worker threads created by a parallel execution query.

2 new files, sql_parallel_workers.h sql_parallel_workers.cc which
contain structures for the creation, management and deletion of
parallel worker threads (pwt_ in the name).  Main management
class created in the stack in JOIN::exec, implemented for the
top level select.

Current parallel_worker_thread_func sleeps for 10 seconds, generates
a warning, signals the main thread, sleeps 10 seconds, signals the
main thread again, sets it's finished flag and cleans it's THD.

The main thread loops through worker threads, looking for finished
thread and cleans them up if they have finished.
It then waits for a signal, then processes it's message queue.

The thread management data is allocated on the stack in JOIN::exec.
Everything else is allocated using my_malloc() and my_free().

Threads are registed in server_threads, so are visible in
information_schema.processlist and the show processlist command.

We check that a kill query on a parallel worker is passed onto it's
manager and the query is properly aborted, and that a kill connection
is handled properly in parallel_worker.test.
Thirunarayanan Balathandayuthapani
- Add mysql_thd object for trx_t object in i_s file
- Started the transaction for i_s queries.
- Address all lock_wait scenarios too
Jan Lindström
MDEV-39662 : Wrong results sent to client after BF abort

This issue is regression caused by MDEV-38019 Send ok packet
to client earlier.

BF aborts may be detected very late in command exectution,
somewhere near the end of do_command(). If the ok packet has
already been sent and BF abort is detected very late, this
could cause the protocol packets becoming out of sync.

This is a result of reverting order of releasing MDL and
sending ok packet to the client. If it happens in the
opposite order than before, there will remain some time
window where the select is complete and MDL locks still
held. DROP hits that time window, causing a BF abort,
and extra error packet gets injected into client-server
communication stream.

Fixed by not sending ok packet to client earlier
in wsrep case.

There is a repeatable test case that shows failure
if ok packet is sent client earlier by using
debug sync point. However, this fix skips sending ok
packet earlier causing also skipping the sync
point. Therefore, test case is not usable.

Test case galera_sr.mysql-wsrep-features#8 was failing
because of this regression but it is sporadic.

Co-Authored by : Teemu Ollakka <[email protected]>
Vladislav Vaintroub
MDEV-39421 post-fix - query_cache_executable_comments needs query_cache_info

Do not run the test if query_cache_info is missing

Fixes test on appveyor (which does not build any loadable plugins)
Marko Mäkelä
Use directory handles also on Windows

my_mkdir_open(): Create and open a directory handle on Windows
by invoking NtCreateFile().

InnoDB_backup::targetPath(): Determine the target directory path
from a HANDLE.  Yes, this is somewhat awkward, but the basic
operations such as CopyFileEx() work on file names, not file handles.
We may implement lower-level file copying / block cloning primitives
later as well as openat(2) like functionality, as part of implementing
streaming backup.
Marko Mäkelä
Merge mariadb-10.11.17 into 10.11
Thirunarayanan Balathandayuthapani
MDEV-34358: Add debug status variables to verify encryption thread wait behavior

Added debug-only status variables Innodb_encryption_indefinite_waits
to track encryption indefinite thread wait instead of busy-waiting
when idle.

The counters are incremented in rotate_thread_t::wait_for_work()
and exposed via SHOW STATUS in debug builds only. Also added a
debug sync point 'rotate_only_2_timed_waits' to reduce the timed
wait threshold from 5 to 2 for faster testing of the indefinite
wait transition.
Marko Mäkelä
MDEV-39344: trx_disconnect_prepared() uses wrong mutex

trx_t::disconnect_prepared(): Replaces trx_disconnect_prepared().
Protect the data members with trx_t::mutex.

trx_sys.trx_list: Use a plain ilist<trx_t> that is protected
by lock_sys.latch, which was already protecting some traversal of
trx_sys.trx_list. All traversal will now use range for, instead of
callback functions.

fetch_data_into_cache_low(): Return whether we ran out of memory.

fetch_data_into_cache(): Reduce the hold time of lock_sys.latch
and do not wrongly reset the cache->is_truncated flag at the end.

trx_sys_t::clone_oldest_view(): Protect the list traversal with
shared lock_sys.latch.

trx_sys_t::register_trx(), trx_sys_t::deregister_trx():
Protect trx_sys.trx_list with an exclusive lock_sys.latch.
Andrei Elkin
MDEV-36025 Parallel slave concurrent BACKUP MDL locking with ongoing backup..

The problem the patch tackles is that the binlogging parallel slave
can expose prepared state of transactions to the backup process.
That is the latter can enroll such transactions, typically waiting for
prior commits - in other words *undecided* (of whether they are going
to commit at all - sic!), into backup image.

The technical possibility of that owes to earlier deadlocks fixes in this area
that made the parallel slave worker to re-acquire its BACKUP MDL within
the wait-for-prior commit phase (which is post- engine prepare) one.

Note the --skip-log-bin or --log-slave-update=OFF parallel slave is
not vulnerable to the exposure of its prepared transactions.

The fixes this patch provides make sure the backup image contains only
transactions that are (binlog-order) committed, while
parallel slave does not deadlock (MDEV-23586).

The principal part of the fixes implements leapfrogging of a waiting
"high-priority" BACKUP MDL by a slave parallel worker which is
exemplified in the following.  First mind about notations:

  here (as elsewhere in the patch) `Fn` group commit followers
  indexed by the gtid seq-no `n`; `F|xyz` indicates the execution
  status (timing) of the MDL request.  `B` - stands for backup
  thread; `Si,Xk` are BACKUP share and exclusive MDL sequenced by
  `i,k` that are logical times of the MDL acquisition; The
  semi-column separates the granted head of the lock queue from the
  waiters.

The queue below is the BACKUP MDL queue

The decision to allow S3 leapfrog X2 is based on the fact that
the current lock holder F2 has a greater gtid_sub_id (2 > 1).

To implement this scheduling policy requires the following modifications.

P1 sql/mdl.h
    The new method determines whether a BACKUP lock requester is a teammate
    of a group that can share the MDL lock and that there exists at least
    on granted member of the group.

    +MDL_request::bool (*is_teammate_callback)(const THD*, const THD*);

P2. sql/log.cc
    dismantling of mdl_context.{release,acquire}_lock() in the parallel worker
    wait-for-prior commit

P3. sql/handler.cc

    setting the P1 MDL_request::is_teammate_callback to the slave parallel worker
    as hint to try acquiring the MDL lock by team membership.

P4. sql/rpl_rli.cc
    defines the teammate callback for the parallel slave.

    +rpl_group_info::ignore_mdl_priority

P5. sql/handler.cc
    Logics of "careful" release of the MDL lock could not be streamlined.
    The failed parallel slave worker still has to abide with the former policy of
    ``` as there is extra replication
    book-keeping to be done before rolling back and allowing a conflicting
    transaction to continue (MDEV-7458).``` [ha_commit_trans].

    For that reason of MDEV-7458 the BACKUP MDL request's memory is now allocated
    for the worker in THD::st_transaction::mem_root. Also guards are deployed to not let
    the mem-root be be cleaned too early, before the lock gets released. It can be
    released fast to follow with transaction->cleanup() for
    not failing trx:s.
    Failing to commit parallel workers defer that to Relay_log_info::cleanup_context()
    from where now ha_rollback_trans() will make it.

Aslo necessary changes are caused by to the gtid implicit statement's design.

1. sql/sql_class.cc
  Removed earlier backup-on-parallel-slave bugfixes of MDEV-23586.
  The parallel worker does not release anymore BACKUP MDL at its wait-for-prior
  commit stage.

2. sql/sql_lex.h, sql/sql_base.cc, sql/rpl_gtid.cc
  Has to be introduced
    +#define TL_OPTION_GTID_TABLE_SLAVE      64

  as a part of a method to find out (see open_table() hunk) at
  executing record_gtid() by implicit GTID statement that its
  BACKUP MDL lock (however it is necessary - it is not challenged
  here) needs the ignore-priority hint. Note this hint applies for granting
  a "special" S' share locked not yet the commit time  ha_commit_trans()'s
  MDL_BACKUP_COMMIT (denoted as S) lock, which is going to be requested later.

  Let's exemplify it on the following diagrams, calling S' a sort of
  shared lock, compatible with

  *Without* the teammate hint the request for S'3(F2) at record_gtid() time

        S1(F3|wait_for_prior_commit); X2(B) <- S'3(F2|record_gtid)

  would end up to wait behind X2

        S1; /* waiting */ X2, S'3

  and we'd be regress back to hang/deadlock of earlier bugs: F3 would not be
  awaken by F2 who is blocked by B.

Tested with extended set of parallel slave with backup scenarios.
Marko Mäkelä
fixup! 45e79027d5359a930f1c753ecdf57cdfb4475e0e

Fix Windows and macOS
Alexey Botchkov
MDEV-39573 AddressSanitizer: heap-use-after-free in my_mb_wc_latin1/../Field_xmltype::store after invalid xml.

The Field_blob::store can affect the 'from' argument so it can't be used
after it.
Sergei Golubchik
MDEV-39673 group_concat ignores max_allowed_packet

GROUP_CONCAT is limited by group_concat_max_len,
but also, as a string function it must respect max_allowed_packet.

Let's introduce THD::gconcat_max_len() helper to simplify checks.

Also:
* make max group_concat_max_len value the same as max max_allowed_packet
* use the same MY_MIN((ulonglong) ..., UINT_MAX32) in
  Item_func_json_objectagg as in Item_func_group_concat
* use overflow-safe type for lengths in Item_func_quote
  (MAX_MAX_ALLOWED_PACKET is 1G so uint cannot overflow yet, but it's
  a fragile assumption)
bsrikanth-mariadb
MDEV-39405: store the necessary plugin-engines optimizer costs

store the necessary plugin-engines optimizer costs that are used by the query
into the context, so that the replay server uses the same while computing
query cost
Thirunarayanan Balathandayuthapani
MDEV-34358  Encryption threads consume CPU when no work available

Problem:
========
1. Encryption threads busy-wait when no work is available. When reaching
fil_system.space_list.end(), fil_crypt_return_iops() is called with
wake=true, causing pthread_cond_broadcast() to wake all threads
unnecessarily, leading to CPU waste.

2. Tablespaces with CLOSING/STOPPING flags (set during DDL operations)
are skipped during iteration. Since DDL completion doesn't wake
encryption threads, these spaces may never be encrypted if threads
sleep indefinitely.

3. For default_encrypt_list iteration, when spaces exist but none are
acquirable, threads need to wake others for cooperative retry, but
this case was not distinguished from fil_system.space_list.end().

4. IOPS are allocated before searching for tablespaces, wasting resources
during iteration when no I/O occurs.

5. Encryption threads use fil_crypt_threads_cond for two different purposes:
waiting for encryption work and waiting for IOPS allocation. When
fil_crypt_return_iops() or fil_crypt_realloc_iops() broadcasts after
releasing IOPS, it wakes ALL threads including those correctly waiting
for work, causing spurious wakeups and CPU waste.

Solution:
=========
1. Implement timed wait with exponential backoff when space ==
fil_system.space_list.end() (applies to both default_encrypt_list and
space_list iteration when no acquirable spaces are found):
- First timeout: 5 seconds
- Subsequent timeouts: (timed_wait_count + 1) * 5 seconds
  (10s, 20s, 40s, 60s)
- After 5 consecutive timeouts (~135 seconds total), switch to
indefinite wait to avoid CPU waste
- Timeout counter resets to 0 when woken by signal (config change,
new tablespace) or when work is found


2. Add default_encrypt_list flag to fil_space_t::next() to distinguish
between the two iteration modes. Wake other threads only when this
flag is true (spaces exist but unacquirable).

3. Move IOPS allocation from before tablespace search to after finding a
space that needs rotation. Retry IOPS allocation up to 3 times with
20ms delays to handle temporary heavy allocation. If allocation still
fails, set recheck=true to skip waiting and immediately try next space.

4. Handle wake logic explicitly at call site based on default_encrypt_list
flag instead of in fil_crypt_return_iops().

5. Introduce separate condition variable fil_crypt_iops_cond specifically
for IOPS allocation synchronization to prevent spurious wakeups:

- fil_crypt_threads_cond: Used in wait_for_work() for waiting when no
tablespaces need encryption. Signaled when settings change, new
tablespaces are created, or thread count changes.

- fil_crypt_iops_cond (NEW): Used in fil_crypt_alloc_iops() for waiting
when IOPS limit is reached. Signaled when IOPS are returned via
fil_crypt_return_iops(), released via fil_crypt_realloc_iops(), or
when srv_n_fil_crypt_iops is increased.

rotate_thread_t changes:
- default_encrypt_list (bool): Indicates if iterating default_encrypt_list
- timed_wait_count (uint8_t): Counts consecutive timeouts for exponential backoff
- wait_for_work(): Implements timed/indefinite wait strategy
Alexander Barkov
MDEV-39587 Package-wide TYPE for variable declarations

SET sql_mode=ORACLE;
DELIMITER $$
CREATE OR REPLACE PACKAGE pkg AS
  -- Declare a package public data type
  TYPE varchar_array IS TABLE OF VARCHAR(2000) INDEX BY INTEGER;
END;
$$
DELIMITER ;
DELIMITER $$

CREATE OR REPLACE PROCEDURE p1 AS
  v pkg.varchar_array; -- Use the package public data type
BEGIN
  v(0):='test';
  SELECT v(0);
END;
$$
DELIMITER ;

Note, the change is done only for sql_mode=ORACLE, because the TYPE
declaration is not available for the default mode.

Where package-wide types are available
--------------------------------------
- Variabe list type:
    DECLARE var pkg1.type1;

- RETURN type for a package routine:
    CREATE FUNCTION .. RETURN pkg1.type1 ...

- Parameter type for a package routine:
    PROCEDURE p1(param1 pkg1.type1);

- Assoc array element type:
    TYPE assoc1_t IS TABLE OF pkg1.type1 ...

- REF CURSOR RETURN type:
    TYPE cur1_t IS REF CURSOR RETURN pkg1.type1;

Change details
--------------

- Adding a member Lex_length_and_dec_st::m_foreign_module_type
  It's set to true when the data type was initialized from a TYPE
  in foreign routine (e.g. in PACKAGE spec).
  It's needed to prevent use of qualified identifiers in public contexts,
  i.e. in schema public routine parameter types and schema publuc function
  RETURN types.
  Adding a helper method sp_head::check_applicability() which prevents
  use of qualified types in public context.

- Adding a helper method sp_head::raise_unknown_data_type().

- Adding methods LEX::set_field_type_typedef_package_spec() for
  2-step and 3-step qualified indentifiers.
  It's used in field_type_all_with_typedefs which covers cases:
  - Variabe list type        : DECLARE var pkg1.type1;
  - RETURN type              : CREATE FUNCTION .. RETURN pkg1.type1 ...
  - Parameter type          : PROCEDURE p1(param1 pkg1.type1);
  - Assoc array element type : TYPE assoc1_t IS TABLE OF pkg1.type1 ...

- Adding a method LEX::declare_type_ref_cursor_return_typedef().
  It handles cases when a new TYPE REF CURSOR RETURN is declared,
  for both for qualified RETURN types and non-qualified RETURN types:
  - TYPE cur0_t IS REF CURSOR RETURN rec1_t;
  - TYPE cur0_t IS REF CURSOR RETURN pkg1.rec1_t;
  - TYPE cur0_t IS REF CURSOR RETURN db1.pkg1.rec1_t;

  The code was moved from LEX::declare_type_ref_cursor() into
  LEX::declare_type_ref_cursor_return_typedef() and extended
  to cover qualified RETURN types.

- Adding a method Sql_path::find_package_spec_type().
  It iterates through all schemas specified in @@path and searches
  for the given type in the given package.

- Adding a helper method sp_pcontext::type_defs_add_ref_cursor()
  to reuse the code.

- Adding a new method sp_package::get_typedef() to search
  for TYPE definitions in PACKAGE specifications.

- Adding a new method sp_head::get_typedef_package_spec()
  to search for TYPE definitions used by a PROCEDURE or FUNCTION.

- Adding a helper method
    Sp_handler::sp_cache_routine_reentrant_suppress_errors
  Adding a method Sp_handler::find_package_spec().
Arcadiy Ivanov
fixup! 6e9ae08b7ad79885425652bc648f8fc56f7b1177

Fix 32-bit compile: use `sizeof(void*)` for blob pointer memcpy

`portable_sizeof_char_ptr` is always 8 (the record slot width), but
actual pointer size is 4 on 32-bit. The production code (`hp_hash.c`)
uses `HP_PTR_SIZE = sizeof(void*)` for memcpy of pointer values.
The test must do the same to avoid `-Werror=stringop-overflow`.
Alexey Botchkov
MDEV-39653 AddressSanitizer: heap-use-after-free in my_mb_wc_latin1/../Field_xmltype::store after invalid xml.

The Field_blob::store can affect the 'from' argument so it can't be used
after it.
Thirunarayanan Balathandayuthapani
- Add mysql_thd object for trx_t object in i_s file
- Started the transaction for i_s queries.
Arcadiy Ivanov
fixup! 07846d3ef329caca03d26e58e200f3f2d1e4f04b

Replace exact `Created_tmp_%` counts with ON/OFF checks in blob_big tests

Exact temp table counts vary between 32-bit and 64-bit platforms
because view protocol creates additional temp tables whose overflow
behavior depends on pointer size and internal structure sizes.

Replace `SHOW STATUS LIKE 'Created_tmp%'` with a query that reports
ON/OFF for `CREATED_TMP_TABLES` and `CREATED_TMP_DISK_TABLES`. This
preserves the key assertions (disk tables created vs not created)
while being platform-independent.
Marko Mäkelä
squash! 0c52540710a7c05129de49ff6b24b16979bd0c89

backup_target: A structured data type to represent a directory or a
stream. On Microsoft Windows, we must use directory paths because
there is no variant of CopyFileEx() that would work on file handles.

copy_file(): A file copying service for POSIX systems. On Windows,
we will use CopyFileEx().
Marko Mäkelä
fixup! a556b354326d287dede593c0fbaf4ce0cc0c1469
Yuchen Pei
MDEV-15621 [wip] Auto add partitions by interval
Yuchen Pei
MDEV-15621 [wip] Auto add partitions by interval
Dmitry Shulga
MDEV-30645: CREATE TRIGGER FOR { STARTUP | SHUTDOWN }

Core implementation

- Extended the sql grammar to support creation of system triggers
  on startup/shutdown
- System triggers metadata is loaded from the table mysql.event
- Events and system triggers share the same name space since both are stored
  in the table mysql.event declared with the PRIMARY KEY (`db`,`name`).
  In result, attempt to create an event with the same name as existent
  trigger and vice versa results in failure with the new error
  ER_TRG_EVENT_CONFLICTS_NAME
- System triggers can be created only by users with the SUPER privilege
- Added the option --sys_triggers for mysqldump to dump system triggers.
  The option is turned off by default.
Thirunarayanan Balathandayuthapani
MDEV-28730 Remove internal parser usage from InnoDB FTS

InnoDB FTS performed all reads and DML on its auxiliary,
common and CONFIG tables through the InnoDB internal SQL
graph parser. Replace that path with direct B-tree access
via a new query-executor layer, and delete the parser-era
helpers.

row0query.h, row/row0query.cc - new QueryExecutor:
- General MVCC-aware record traversal and basic DML on the
clustered index. Sits on a btr_pcur and a transaction-owned
mtr; record processing goes through a RecordCallback that
bundles two std::functions:
  compare_record() returns SKIP / PROCESS / STOP for a record
  process_record() handles each PROCESS-ed (MVCC-visible) row

Public API:
  read()              scan a clustered index with a search key
  read_all()          full clustered scan (optional start tuple)
  read_by_index()    scan a secondary index, fetch the matching
                      clustered record, deliver it to the callback
  insert_record()    insert a tuple into the clustered index
  delete_record()    delete a row identified by tuple
  delete_all()        delete every row in the clustered index
  select_for_update() position+X-lock the matching clustered row
  update_record()    update the row select_for_update() locked,
                      falling back to optimistic/pessimistic and
                      external storage paths as needed
  replace_record()    upsert: select_for_update()+update_record(),
                      else insert_record()
  lock_table(), handle_wait(), commit_mtr()

fts0exec.h, fts/fts0exec.cc - new FTSQueryExecutor:
Thin wrapper over QueryExecutor specialised for FTS tables.
Opens and locks the required tables once and exposes typed
helpers keyed by table family.

Auxiliary INDEX_[1..6]:
  open_all_aux_tables()
  insert_aux_record(aux_index, fts_aux_data_t)
  delete_aux_record(aux_index, fts_aux_data_t)
  read_aux()        range scan from a given word
  read_from_range()  paginated read that absorbs
                    DB_FTS_EXCEED_RESULT_CACHE_LIMIT internally
                    and resumes from the last word seen

Common deletion tables (DELETED, DELETED_CACHE, BEING_DELETED,
                        BEING_DELETED_CACHE):
  open_all_deletion_tables()
  insert_common_record(), delete_common_record(),
  delete_all_common_records(), read_all_common()

CONFIG table (<key, value>):
  open_config_table() / set_config_table()
  insert_config_record(), update_config_record() (upsert),
  delete_config_record(), read_config_with_lock()

fts_aux_data_t carries the auxiliary row payload.
RecordCallback specialisations live alongside the executor:
  CommonTableReader collects doc_ids from common tables that
    share the <doc_id> schema.
  ConfigReader extracts <key, value> and provides
    compare_config_key() for fast key matching.
  AuxRecordReader scans auxiliary indexes with an
    AuxCompareMode (GREATER_EQUAL / GREATER / LIKE / EQUAL)
      driving the comparator; tracks the last word seen so a
      paginated scan can resume.

fts_query() walks index and common tables via
QueryExecutor::read_by_index() with RecordCallback;

fts_write_node() writes auxiliary rows through
FTSQueryExecutor::insert_aux_record() / delete_aux_record()
with fts_aux_data_t.

fts_optimize_write_word() now goes through the same
insert/delete path.

fts_select_index{,_by_range,_by_hash} return uint8_t (was
ulint) with a simpler control flow.

fts_optimize_table() binds a thd to its transaction whether
invoked from a user thread or the FTS optimize thread.

fts_optimize_t drops its fts_index_table and fts_common_table
fts_table_t fields; fts_query_t drops fts_common_table.

storage/innobase/fts/fts0sql.cc is deleted along with the
commented-out and unreferenced parser-era helpers it held.

dict_sys.latch is now acquired once per fts_sync_table(),
fts_optimize_table() and fts_query() call to open every
auxiliary and common table in one pass, instead of being
re-acquired per table.
Dmitry Shulga
MDEV-30645: CREATE TRIGGER FOR { STARTUP | SHUTDOWN }

Follow-up to fix the issue with starting server on a data dictionary
with broken table mysql.event or on its previous version without
columns required for storing metadata about triggers.
bsrikanth-mariadb
MDEV-39438: Empty optimizer context is noticed after an explain query

When the variable "use_stat_tables" is set to 'preferably', the explain
plan query containing a stored procedure generated no context, even when
the optimizer_record_context flag was set.

The reason being context recorder (for the entire query) was getting cleared
after the stored procedure evaluation was done.

The solution is to not clear the context recorder as soon as the stored
procedure evaluation is finished.
Rex Johnston
MDEV-39492 Parallel Query: Study how to create worker threads

Introduces parallel_worker_threads variable to control the number
of worker threads created by a parallel execution query.

2 new files, sql_parallel_workers.h sql_parallel_workers.cc which
contain structures for the creation, management and deletion of
parallel worker threads (pwt_ in the name).  Main management
class created in the stack in JOIN::exec, implemented for the
top level select.

Current parallel_worker_thread_func sleeps for 10 seconds, generates
a warning, signals the main thread, sleeps 10 seconds, signals the
main thread again, sets it's finished flag and cleans it's THD.

The main thread loops through worker threads, looking for finished
thread and cleans them up if they have finished.
It then waits for a signal, then processes it's message queue.

The thread management data is allocated on the stack in JOIN::exec.
Everything else is allocated using my_malloc() and my_free().

Threads are registed in server_threads, so are visible in
information_schema.processlist and the show processlist command.

We check that a kill query on a parallel worker is passed onto it's
manager and the query is properly aborted, and that a kill connection
is handled properly in parallel_worker.test.
Hemant Dangi
MDEV-39648: wsrep_sst_rsync.sh: apply safe() to joiner-supplied parameters

Issue:
wsrep_sst_rsync.sh interpolated WSREP_SST_OPT_REMOTE_USER and
WSREP_SST_OPT_REMOTE_PSWD verbatim. Because both values originate from
the joiner side of the SST request, a newline in either could splice
an extra directive into the donor-written stunnel.conf (silently
downgrading peer-cert verification) or an extra line into the rsync
magic file. MDEV-39413 had introduced safe() for the same threat class
in wsrep_sst_mariabackup but did not extend it to the rsync script.

Solution:
Routing the rsync interpolations through safe() closes the gap, and
extending safe() to also reject tab and newline ensures multi-line
values cannot survive into a config-file heredoc.
Mohammad Tafzeel Shams
MDEV-38305: Expose adaptive hash index statistics in ANALYZE FORMAT=JSON

Expose InnoDB's Adaptive Hash Index (AHI) statistics through ANALYZE
FORMAT=JSON output to provide query-level visibility into AHI usage
and effectiveness. This allows DBAs and developers to monitor how well
the adaptive hash index is serving their workloads on a per-query basis.

The r_ahi_stats object (nested inside r_engine_stats) now reports four
key metrics: ahi_searches (successful AHI lookups), ahi_searches_btree
(AHI misses requiring B-tree fallback), ahi_rows_added (rows inserted
into AHI), and ahi_pages_added (pages indexed by AHI).

- btr_ahi_inc_searches(): Increment counter when AHI lookup succeeds.
- btr_ahi_inc_searches_btree(): Increment counter when AHI lookup fails
  and falls back to B-tree search.
- btr_ahi_inc_rows_added(): Increment counter when rows are added to
  the adaptive hash index structure.
- btr_ahi_inc_pages_added(): Increment counter when new pages are
  indexed by AHI.
- btr_cur_t::search_leaf(): Call btr_ahi_inc_searches() on successful
  AHI hit and btr_ahi_inc_searches_btree() on AHI miss to track search
  outcomes at the point where AHI is utilized.
- trace_engine_stats(): Output r_ahi_stats object with all four AHI
  counters in JSON format when any AHI activity is detected during query
  execution.
- ha_handler_stats: Added ahi_searches, ahi_searches_btree, ahi_rows_added,
  and ahi_pages_added fields to track per-query AHI statistics.
- ahi_stats.test: Comprehensive verification of AHI statistics reporting
  across different scenarios: insufficient accesses (no AHI build),
  threshold triggering (AHI construction), heavy warmup (full AHI
  utilization), and disabled AHI (verify zero statistics).
- check_ahi_status.inc: Reusable include file for executing queries with
  configurable warmup repetitions and extracting AHI statistics from
  ANALYZE FORMAT=JSON output using JSON path expressions.
Thirunarayanan Balathandayuthapani
Serialize concurrent fulltext optimization

dict_acquire_mdl(): function now supports both MDL_SHARED (default)
and MDL_EXCLUSIVE via the exclusive template parameter.

Updated FTS optimize to acquire MDL_EXCLUSIVE first then downgrade
to MDL_SHARED_UPGRADABLE to serialize concurrent fulltext optimizations.
Rex Johnston
MDEV-39492 Parallel Query: Study how to create worker threads

Introduces parallel_worker_threads variable to control the number
of worker threads created by a parallel execution query.

2 new files, sql_parallel_workers.h sql_parallel_workers.cc which
contain structures for the creation, management and deletion of
parallel worker threads (pwt_ in the name).  Main management
class created in the stack in JOIN::exec, implemented for the
top level select.

Current parallel_worker_thread_func sleeps for 10 seconds, generates
a warning, signals the main thread, sleeps 10 seconds, signals the
main thread again, sets it's finished flag and cleans it's THD.

The main thread loops through worker threads, looking for finished
thread and cleans them up if they have finished.
It then waits for a signal, then processes it's message queue.

The thread management data is allocated on the stack in JOIN::exec.
Everything else is allocated using my_malloc() and my_free().

Threads are registed in server_threads, so are visible in
information_schema.processlist and the show processlist command.

We check that a kill query on a parallel worker is passed onto it's
manager and the query is properly aborted, and that a kill connection
is handled properly in parallel_worker.test.
Arcadiy Ivanov
Use SHA256 integrity checks in blob_fallback test

Store SHA2(blob, 256) on insert and compare on retrieval instead of
direct string comparison. Use non-repeat blob patterns to make
corruption detection more meaningful.
Dmitry Shulga
MDEV-30645: CREATE TRIGGER FOR { STARTUP | SHUTDOWN }

Follow-up to fix building with EMBEDDED server. Since support of
events isn't compiled in for embedded server but some stuff from
implementation of events is used for support of triggers, common
source code used both for events and triggers was extracted into
the separate files event_common.cc/event_common.h