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
Alexander Barkov
MDEV-41246 "Illegal mix of collations" on the mysql.user view

In progress
Dave Gosselin
MDEV-41211 Remove unused index_read_idx() from both Federated engines

ha_federated::index_read_idx() and ha_federatedx::index_read_idx()
have no callers and do not override a handler method.  Remove them,
and remove the sentence in the comment on each index_read() that says
index_read() calls it.  Comments that describe index_read_idx() now
name index_read() or index_read_idx_map(), whichever does that read.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Yuchen Pei
MDEV-39923 tmp
Dave Gosselin
MDEV-41303:  rand() in a semi-join subquery is checked on outer rows

Do not merge a subquery into its parent as a semi-join when it has
the UNCACHEABLE_RAND flag, which RAND() and ROWNUM set.  Derived
tables already follow this rule.  ROWNUM sets the same flag, so this
patch replaces the check for ROWNUM with a check for UNCACHEABLE_RAND.

Previously, converting an IN subquery to a semi-join moved its WHERE
into the parent WHERE.  A condition there such as rand(1) < 0.09
doesn't rely on any columns, so it is attached to the last table of
the join order that is outside any materialized semi-join.  With
SJ-Materialization it was checked once for each outer row instead of
once for each row of the subquery, and the query returned a wrong
count.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Marko Mäkelä
fixup! f02da92fc678477845bf6f541772975e2d49130e
Yuchen Pei
Ask contributors to re-request review when ready

Update COMMUNITY_CONTRIBUTIONS.md to ask external contributors to
explicitly request a review once they have addressed the points
raised in the current review round and the pull request is ready
for another round of review.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Marko Mäkelä
fixup! ea087a30f0b81dbf674d7b1fa2ddb852117818ea

Strip innodb_log_group_home_dir
Dave Gosselin
MDEV-41303:  rand() in a semi-join subquery is checked on outer rows

Do not merge a subquery into its parent as a semi-join when it has
the UNCACHEABLE_RAND flag, which RAND() and ROWNUM set.  Derived
tables already follow this rule.  ROWNUM sets the same flag, so this
patch replaces the check for ROWNUM with a check for UNCACHEABLE_RAND.

Previously, converting an IN subquery to a semi-join moved its WHERE
into the parent WHERE.  A condition there such as rand(1) < 0.09
doesn't rely on any columns, so it is attached to the last table of
the join order that is outside any materialized semi-join.  With
SJ-Materialization it was checked once for each outer row instead of
once for each row of the subquery, and the query returned a wrong
count.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Vladislav Vaintroub
libmariadbd: an embedded server library that starts a private mariadbd

With -DWITH_EMBEDDED_SERVER=ON build libmariadbd (shared and static), the
client library compiled so that

- mysql_server_init() starts a private mariadbd, reachable only through a
  private Unix socket (named pipe on Windows), passing it the arguments
  and option groups of the application;
- mysql_real_connect() to the local host goes to that server;
- mysql_server_end() stops it.

The launcher, ma_embedded_launcher.c, is compiled in only for libmariadbd.
This replaces the hooks (mariadb_set_embedded_hooks) that registered a
launcher at run time: the library is chosen when the application is linked,
as it was with libmysqld. libmariadbd also exports mariadb_embedded_socket()
and mariadb_embedded_error(). The option is WITH_EMBEDDED_SERVER, or
CONC_WITH_EMBEDDED_SERVER when this is a subproject of the server.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Dave Gosselin
MDEV-41211 Remove unused index_read_idx() from both Federated engines

ha_federated::index_read_idx() and ha_federatedx::index_read_idx()
have no callers and do not override a handler method.  Remove them,
and remove the sentence in the comment on each index_read() that says
index_read() calls it.  Comments that describe index_read_idx() now
name index_read() or index_read_idx_map(), whichever does that read.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Vladislav Vaintroub
MDEV-11111: libmariadbd is chosen when linking, not at run time

Replace the run-time registration of the launcher (hooks in libmariadb,
a glue file, mysql and mysqltest calling mariadb_embedded_register()) by
a build option, as it was with libmysqld.

- WITH_EMBEDDED_SERVER builds libmariadbd in Connector/C (the launcher
  lives there, see its commit). The option is restored, and set for the
  RPM and DEB release builds again.
- mysqltest_embedded is mysqltest linked with libmariadbd; mtr
  --embedded-server runs it, and it starts the private mariadbd for the
  --server-arg it is given. The mysql client does not start a server any
  more, so --server-arg is "not supported" again and main.mysql tests
  that. mysql_client_test_embedded and mariadb-embedded are not built, as
  no test uses them.
- libmariadbd/ keeps only two small client programs that use libmariadbd.
- Packaging lists mysqltest_embedded and libmariadbd.a again.
- sys_vars.version finds an embedded run by the name of mysqltest again.

Tested on Linux and Windows, normal and --embedded-server.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Vladislav Vaintroub
MDEV-11111: mysqltest_embedded waits for the generated error headers

mysqltest includes mysqld_ername.h, which GenError generates. The other
client programs depend on GenError, but mariadb-test-embedded did not, so
it failed to compile when it was built first (buildbot, make -j).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Dave Gosselin
MDEV-41211 Federated multi-table DELETE keeps a const table row

A multi-table DELETE on a FEDERATED or FederatedX table went wrong
when a primary key lookup made the target a const table.  The
optimizer reads a const table's row through index_read_idx_map(),
whose default implementation ends the index scan and frees the result
set.  The server asks for the row's position later, during execution,
so the saved position was empty.  FederatedX skipped the row and
FEDERATED crashed in rnd_pos().

Both engines now override index_read_idx_map() so that the lookup
leaves its result set open, as index_read() does.  position() then
records a valid position, and the result set is freed at the end of
the statement.  FEDERATED's reset() now also clears stored_result,
which otherwise pointed at a freed result set and was freed again
when the table was closed.

Tests include a multitable UPDATE with a const target, which crashed
both engines before the fix.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Alexander Barkov
MDEV-41246 "Illegal mix of collations" on the mysql.user view

This SQL script failed:

SET NAMES latin1 COLLATE latin1_swedish_ci;
CREATE OR REPLACE VIEW v1 AS SELECT 'Y' AS c1;
SET NAMES big5 COLLATE big5_chinese_ci;
SELECT * FROM v1 WHERE c1='y';

with the following error:

ERROR 1267 (HY000): Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (big5_chinese_ci,COERCIBLE) for operation '='

Note, latin1_swedish_ci and big5_chinese_ci are used here as examples.
The error also happened with different collation combinations.

Fix main idea:

If two collations have equal comparison rules (known as "tailoring")
on a given character repertoire,
like latin1_swedish_ci and big5_chinese_ci on ASCII letters,
then the "Illegal mix of collation" error can be avoided in a comparison
operator. We can choose any of the sides as the operation effective
collation - the result will be equal.

Most important details:

- Splitting enum_repertoire_t into smaller subsets,
  for better repertoire granularity.
  A variable holding a repertoire value can now have multiple
  MY_REPEROIRE_XXX flags set.

  This patch implements detecting tailoring equality on this reperoires:
  * MY_REPERTOIRE_ASCII_ALNUM - [A..Z,a..z,0..9].
  * MY_REPERTOIRE_ASCII_IDENT - ALNUM + underscore
  * MY_REPERTOIRE_ASCII      - the entire range U+0000..U+007F

- Adding a new virtual function "tailoring" in my_collation_handler_st

  It returns the tailoring on the given repertoire for the given collation.

  If cs1->cset->tailoring(cs1, some_repertoire) returns {0,0},
  it means illegal mix optimization cannot be used for this collation
  on the given repertoire.

  If these calls:
    tr1= cs1->cset->tailoring(cs1, some_repertoire);
    tr2= cs2->cset->tailoring(cs2, some_repertoire);
  return both non-NULL results and tr1.ptr==tr2.ptr,
  then these collations are equal on the given repertoire
  and are mutually replaceable for a comparison operator,
  so "Illegal mix of collations" can be avoided.

- Adding a new method DTCollation::aggregate_by_repertoire().

- Adding a new flag MY_COLL_ALLOW_BY_REPERTOIRE.
  It indicates to DTCollation::aggregate() that the illegal
  mix optimization by repertoire can be used in the given context.

  MY_COLL_CMP_CONV now includes MY_COLL_ALLOW_BY_REPERTOIRE.
  Note, only comparison operators pass this flag.
  Functions returning a string result do not pass this flag,
  because in operations like CONCAT(a,b) we still need to evaluate
  precisely the collation of the result - we cannot just choose a collation
  of one of the sides (even if they are compatible on the given repertoire).

- As in my_repertoire_t the value MY_REPERTOIRE_ASCII is now a set of bits
  rather than a single bit, the way how to detect "is only ASCII"
  repertoires has changed in the code.

  For example:
    // repertoire *IS* ascii
    if (repertoire == MY_REPERTOIRE_ASCII)

  has changed in multiple places in the code to

    // repertoire *HAS* only ascii characters
    if (!(repertoire & ~MY_REPERTOIRE_ASCII))

- New flags were added int for CHARSET_INFO::state
  * MY_CS_ASCII_BINARY_CI - for simple 8bit case insensitive collations.
    It means that this collation does not has no irregularities
    on the ASCII range.

  * MY_CS_IDENT_BINARY_CI - for simple 8bit case insensitive collations.
    It means that this collation has not irregularities
    on the IDENT subrange only (but can have irregularities say on
    punctuation).

  * MY_CS_ASCII_STD_UCA - for UCA collations.
    It means that a UCA collation does not reorder ASCII letters.

- strings/conf_to_src.c was modified to detect and print
  MY_CS_ASCII_BINARY_CI and MY_CS_IDENT_BINARY_CI flags.

- strings/ctype-extra.c was regenerated with new flags.

- Adding a number of MTR tests in plugin/func_test/mysql-test/func_test/.
  They display a tailoring by collation name and repertoire as returned by:
    cs->cset->tailoring(cs, some_repertoire)
  A dynamically linked plugin function collation_tailoring() was added
  for the purpose of these tests.

- Adding a number of MTR tests mysql-test/main/ctype_xxx_tailoring.test
  They display two-dimensional charts showing which collations
  are compatible on which repertoires.

- Adding a number of MTR tests in the form of the originally
  reported stript for various collations:

    SELECT Insert_priv FROM mysql.user WHERE Insert_priv='...';
Yuchen Pei
Ask contributors to re-request review when ready

Update COMMUNITY_CONTRIBUTIONS.md to ask external contributors to
explicitly request a review once they have addressed the points
raised in the current review round and the pull request is ready
for another round of review.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Georgi (Joro) Kodinov
Added a reference to the github pull requests docs.
Yuchen Pei
MDEV-39923 tmp
Vladislav Vaintroub
MDEV-11111: mtr gives the private server the [embedded] group again

Like the embedded server before it, the private mariadbd reads the [server]
and [embedded] groups by default, and mtr generates [embedded] from
[mysqld] and [mysqld.1] for --embedded-server. Use it again instead of
passing the groups of mysqld.1 with --embedded-defaults-groups and a
--defaults-group-suffix.

Tested on Linux and Windows with --embedded-server (main, sys_vars,
embedded, encryption and versioning tests).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Marko Mäkelä
fixup! e45cb76bcf6177358d1443bf59db69ca1cb91611
Yuchen Pei
Ask contributors to re-request review when ready

Update COMMUNITY_CONTRIBUTIONS.md to ask external contributors to
explicitly request a review once they have addressed the points
raised in the current review round and the pull request is ready
for another round of review.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Dave Gosselin
MDEV-41211 Federated multi-table DELETE keeps a const table row

A multi-table DELETE on a FEDERATED or FederatedX table went wrong
when a primary key lookup made the target a const table.  The
optimizer reads a const table's row through index_read_idx_map(),
whose default implementation ends the index scan and frees the result
set.  The server asks for the row's position later, during execution,
so the saved position was empty.  FederatedX skipped the row and
FEDERATED crashed in rnd_pos().

Both engines now override index_read_idx_map() so that the lookup
leaves its result set open, as index_read() does.  position() then
records a valid position, and the result set is freed at the end of
the statement.  FEDERATED's reset() now also clears stored_result,
which otherwise pointed at a freed result set and was freed again
when the table was closed.

Tests include a multitable UPDATE with a const target, which crashed
both engines before the fix.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Alexander Barkov
MDEV-41246 "Illegal mix of collations" on the mysql.user view

This SQL script failed:

SET NAMES latin1 COLLATE latin1_swedish_ci;
CREATE OR REPLACE VIEW v1 AS SELECT 'Y' AS c1;
SET NAMES big5 COLLATE big5_chinese_ci;
SELECT * FROM v1 WHERE c1='y';

with the following error:

ERROR 1267 (HY000): Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (big5_chinese_ci,COERCIBLE) for operation '='

Note, latin1_swedish_ci and big5_chinese_ci are used here as examples.
The error also happened with different collation combinations.

Fix main idea:

If two collations have equal comparison rules (known as "tailoring")
on a given character repertoire,
like latin1_swedish_ci and big5_chinese_ci on ASCII letters,
then the "Illegal mix of collation" error can be avoided in a comparison
operator. We can choose any of the sides as the operation effective
collation - the result will be equal.

Most important details:

- Splitting enum_repertoire_t into smaller subsets,
  for better repertoire granularity.
  A variable holding a repertoire value can now have multiple
  MY_REPEROIRE_XXX flags set.

  This patch implements detecting tailoring equality on this reperoires:
  * MY_REPERTOIRE_ASCII_ALNUM - [A..Z,a..z,0..9].
  * MY_REPERTOIRE_ASCII_IDENT - ALNUM + underscore
  * MY_REPERTOIRE_ASCII      - the entire range U+0000..U+007F

- Adding a new virtual function "tailoring" in my_collation_handler_st

  It returns the tailoring on the given repertoire for the given collation.

  If cs1->cset->tailoring(cs1, some_repertoire) returns {0,0},
  it means illegal mix optimization cannot be used for this collation
  on the given repertoire.

  If these calls:
    tr1= cs1->cset->tailoring(cs1, some_repertoire);
    tr2= cs2->cset->tailoring(cs2, some_repertoire);
  return both non-NULL results and tr1.ptr==tr2.ptr,
  then these collations are equal on the given repertoire
  and are mutually replaceable for a comparison operator,
  so "Illegal mix of collations" can be avoided.

- Adding a new method DTCollation::aggregate_by_repertoire().

- Adding a new flag MY_COLL_ALLOW_BY_REPERTOIRE.
  It indicates to DTCollation::aggregate() that the illegal
  mix optimization by repertoire can be used in the given context.

  MY_COLL_CMP_CONV now includes MY_COLL_ALLOW_BY_REPERTOIRE.
  Note, only comparison operators pass this flag.
  Functions returning a string result do not pass this flag,
  because in operations like CONCAT(a,b) we still need to evaluate
  precisely the collation of the result - we cannot just choose a collation
  of one of the sides (even if they are compatible on the given repertoire).

- As in my_repertoire_t the value MY_REPERTOIRE_ASCII is now a set of bits
  rather than a single bit, the way how to detect "is only ASCII"
  repertoires has changed in the code.

  For example:
    // repertoire *IS* ascii
    if (repertoire == MY_REPERTOIRE_ASCII)

  has changed in multiple places in the code to

    // repertoire *HAS* only ascii characters
    if (!(repertoire & ~MY_REPERTOIRE_ASCII))

- New flags were added int for CHARSET_INFO::state
  * MY_CS_ASCII_BINARY_CI - for simple 8bit case insensitive collations.
    It means that this collation does not has no irregularities
    on the ASCII range.

  * MY_CS_IDENT_BINARY_CI - for simple 8bit case insensitive collations.
    It means that this collation has not irregularities
    on the IDENT subrange only (but can have irregularities say on
    punctuation).

  * MY_CS_ASCII_STD_UCA - for UCA collations.
    It means that a UCA collation does not reorder ASCII letters.

- strings/conf_to_src.c was modified to detect and print
  MY_CS_ASCII_BINARY_CI and MY_CS_IDENT_BINARY_CI flags.

- strings/ctype-extra.c was regenerated with new flags.

- Adding a number of MTR tests in plugin/func_test/mysql-test/func_test/.
  They display a tailoring by collation name and repertoire as returned by:
    cs->cset->tailoring(cs, some_repertoire)
  A dynamically linked plugin function collation_tailoring() was added
  for the purpose of these tests.

- Adding a number of MTR tests mysql-test/main/ctype_xxx_tailoring.test
  They display two-dimensional charts showing which collations
  are compatible on which repertoires.

- Adding a number of MTR tests in the form of the originally
  reported stript for various collations:

    SELECT Insert_priv FROM mysql.user WHERE Insert_priv='...';
Georgi (Joro) Kodinov
Added a reference to the github pull requests docs.
Yuchen Pei
MDEV-41366 Check prefix key match in partition unordered index scan

The idea of Case 2 in can_skip_merging_scans is that when key prefix
is fixed, and the infix that is also the "partition by range" column,
we can scan each partition in order. This relies on accurately
returning EOF when a partition has no (more) matching rows. It is
possible to have no more matching rows at the first index read of a
partition in a LAST_OR_PREV access, in which case we need to check the
prefix match to rule out false positives and return EOF correctly
Brad Smith
crc32c: check elf_aux_info() return value in ppc64 probe

elf_aux_info(3) leaves the output buffer unmodified on failure, so
ignoring the return value could test an uninitialized cpufeatures and
wrongly enable the POWER8 vector-crypto path.

Treat failure as "no features" so the probe falls back to the generic
implementation.
Alexander Barkov
MDEV-41246 "Illegal mix of collations" on the mysql.user view

This SQL script failed:

SET NAMES latin1 COLLATE latin1_swedish_ci;
CREATE OR REPLACE VIEW v1 AS SELECT 'Y' AS c1;
SET NAMES big5 COLLATE big5_chinese_ci;
SELECT * FROM v1 WHERE c1='y';

with the following error:

ERROR 1267 (HY000): Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (big5_chinese_ci,COERCIBLE) for operation '='

Note, latin1_swedish_ci and big5_chinese_ci are used here as examples.
The error also happened with different collation combinations.

Fix main idea:

If two collations have equal comparison rules (known as "tailoring")
on a given character repertoire,
like latin1_swedish_ci and big5_chinese_ci on ASCII letters,
then the "Illegal mix of collation" error can be avoided in a comparison
operator. We can choose any of the sides as the operation effective
collation - the result will be equal.

Most important details:

- Splitting enum_repertoire_t into smaller subsets,
  for better repertoire granularity.
  A variable holding a repertoire value can now have multiple
  MY_REPEROIRE_XXX flags set.

  This patch implements detecting tailoring equality on this reperoires:
  * MY_REPERTOIRE_ASCII_ALNUM - [A..Z,a..z,0..9].
  * MY_REPERTOIRE_ASCII_IDENT - ALNUM + underscore
  * MY_REPERTOIRE_ASCII      - the entire range U+0000..U+007F

- Adding a new virtual function "tailoring" in my_collation_handler_st

  It returns the tailoring on the given repertoire for the given collation.

  If cs1->cset->tailoring(cs1, some_repertoire) returns {0,0},
  it means illegal mix optimization cannot be used for this collation
  on the given repertoire.

  If these calls:
    tr1= cs1->cset->tailoring(cs1, some_repertoire);
    tr2= cs2->cset->tailoring(cs2, some_repertoire);
  return both non-NULL results and tr1.ptr==tr2.ptr,
  then these collations are equal on the given repertoire
  and are mutually replaceable for a comparison operator,
  so "Illegal mix of collations" can be avoided.

- Adding a new method DTCollation::aggregate_by_repertoire().

- Adding a new flag MY_COLL_ALLOW_BY_REPERTOIRE.
  It indicates to DTCollation::aggregate() that the illegal
  mix optimization by repertoire can be used in the given context.

  MY_COLL_CMP_CONV now includes MY_COLL_ALLOW_BY_REPERTOIRE.
  Note, only comparison operators pass this flag.
  Functions returning a string result do not pass this flag,
  because in operations like CONCAT(a,b) we still need to evaluate
  precisely the collation of the result - we cannot just choose a collation
  of one of the sides (even if they are compatible on the given repertoire).

- As in my_repertoire_t the value MY_REPERTOIRE_ASCII is now a set of bits
  rather than a single bit, the way how to detect "is only ASCII"
  repertoires has changed in the code.

  For example:
    // repertoire *IS* ascii
    if (repertoire == MY_REPERTOIRE_ASCII)

  has changed in multiple places in the code to

    // repertoire *HAS* only ascii characters
    if (!(repertoire & ~MY_REPERTOIRE_ASCII))

- New flags were added int for CHARSET_INFO::state
  * MY_CS_ASCII_BINARY_CI - for simple 8bit case insensitive collations.
    It means that this collation does not has no irregularities
    on the ASCII range.

  * MY_CS_IDENT_BINARY_CI - for simple 8bit case insensitive collations.
    It means that this collation has not irregularities
    on the IDENT subrange only (but can have irregularities say on
    punctuation).

  * MY_CS_ASCII_STD_UCA - for UCA collations.
    It means that a UCA collation does not reorder ASCII letters.

- strings/conf_to_src.c was modified to detect and print
  MY_CS_ASCII_BINARY_CI and MY_CS_IDENT_BINARY_CI flags.

- strings/ctype-extra.c was regenerated with new flags.

- Adding a number of MTR tests in plugin/func_test/mysql-test/func_test/.
  They display a tailoring by collation name and repertoire as returned by:
    cs->cset->tailoring(cs, some_repertoire)
  A dynamically linked plugin function collation_tailoring() was added
  for the purpose of these tests.

- Adding a number of MTR tests mysql-test/main/ctype_xxx_tailoring.test
  They display two-dimensional charts showing which collations
  are compatible on which repertoires.

- Adding a number of MTR tests in the form of the originally
  reported stript for various collations:

    SELECT Insert_priv FROM mysql.user WHERE Insert_priv='...';
Vladislav Vaintroub
MDEV-11111: suppress the plugin maturity warning in the final mtr scan

With --embedded-server mtr starts a private server after each test to run
the warnings check on the datadir. Its start-up goes to the error log of
the test server, after the check, so the final scan of the log
(check_warnings_post_shutdown) saw it: a plugin of maturity below the
server (example_key_management of the encryption tests, test_versioning,
...) gives 'Plugin .* is of maturity level .* while the server is ..',
once per test that restarted a server, 250 lines in one buildbot run.

The warning is not a problem of a test: include/mtr_warnings.sql
suppresses it (MDEV-12501), and the scan is documented to use the same
list, but its Perl copy lacked this entry. Add it.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Yuchen Pei
MDEV-41366 Check prefix key match in partition unordered index scan

The idea of Case 2 in can_skip_merging_scans is that when key prefix
is fixed, and the infix that is also the "partition by range" column,
we can scan each partition in order. This relies on accurately
returning EOF when a partition has no (more) matching rows. It is
possible to have no more matching rows at the first index read of a
partition in a LAST_OR_PREV access, in which case we need to check the
prefix match to rule out false positives and return EOF correctly
Dave Gosselin
MDEV-41211 Federated multi-table DELETE keeps a const table row

A multi-table DELETE on a FEDERATED or FederatedX table went wrong
when a primary key lookup made the target a const table.  The
optimizer reads a const table's row through index_read_idx_map(),
whose default implementation ends the index scan and frees the result
set.  The server asks for the row's position later, during execution,
so the saved position was empty.  FederatedX skipped the row and
FEDERATED crashed in rnd_pos().

Both engines now override index_read_idx_map() so that the lookup
leaves its result set open, as index_read() does.  position() then
records a valid position, and the result set is freed at the end of
the statement.  FEDERATED's reset() now also clears stored_result,
which otherwise pointed at a freed result set and was freed again
when the table was closed.

Tests include a multitable UPDATE with a const target, which crashed
both engines before the fix.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Vladislav Vaintroub
MDEV-39533 my_realpath and MY_NOSYMLINKS on Windows

On Windows, my_realpath() only called GetFullPathName(), which
canonicalizes '.', '..' and drive letters but does not resolve NTFS
symlinks, junctions or mount points, unlike POSIX realpath(). At the
same time, my_open() and my_delete() ignored MY_NOSYMLINKS entirely,
so the symlink-attack protection used for MyISAM/Aria's DATA
DIRECTORY/INDEX DIRECTORY (mi_open()/ma_open(),
my_handler_delete_with_symlink()) was silently absent on Windows.

Fix my_realpath() to actually resolve reparse points: open the
(syntactically canonicalized) path with CreateFile(), which follows
them, and read back the handle's fully resolved path with
GetFinalPathNameByHandle(). A not-found path still gets the same
ENOENT/fallback contract as before.

Make my_open() and my_delete() honor MY_NOSYMLINKS on Windows.
Windows has no per-path-component O_NOFOLLOW equivalent, so instead
this mirrors the realpath()-equality branch of the POSIX
NOSYMLINK_FUNCTION_BODY macro: the caller-supplied name (expected to
already be my_realpath()-resolved) is compared against the actually
opened handle's resolved path, and rejected with ENOTDIR -- the same
errno POSIX uses for this exact "not already canonical" condition --
on a mismatch, whether caused by a TOCTOU symlink swap or by the name
never having been fully resolved to begin with.

Add a my_symlink-t.c test that creates a real NTFS junction to verify
resolution and enforcement.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Yuchen Pei
MDEV-41322 Convert KEY_NOT_FOUND to EOF in "unordered" partition index scans during index_next[_same]/index_prev calls

ha_partition::handle_unordered_scan_next_partition is called in a
variety of accesses, including index_read, index_prev, and index_next.

ha_partition::handle_unordered_next and
ha_partition::handle_unordered_prev are called from index_next and
index_prev accesses. They check for signs of end of
scan (m_part_spec.start_part == NO_CURRENT_PART_ID) and exit early if
that is the case. HA_ERR_END_OF_FILE (EOF) is commonly paired with
assigning NO_CURRENT_PART_ID to m_part_spec.start_part whenever
possible, to signal the end of scan.

The error HA_ERR_KEY_NOT_FOUND means the requested key is not found.
It should not mean the end of scan, when for example
ha_partition::handle_unordered_scan_next_partition is called from
index_read, because a subsequent index_next[_same] / index_prev call
would then incorrectly return immediately from
ha_partition::handle_unordered_next /
ha_partition::handle_unordered_prev. This is why HA_ERR_KEY_NOT_FOUND
is retained and returned in
ha_partition::handle_unordered_scan_next_partition.

But if the call is from index_next[_same] / index_prev,
HA_ERR_KEY_NOT_FOUND should indeed mean end of scan. In this patch, we
ensure this is the case by converting HA_ERR_KEY_NOT_FOUND to EOF in
ha_partition::handle_unordered_next /
ha_partition::handle_unordered_prev.
Oleksandr Byelkin
MDEV-41175 Fix stack-buffer-overflow in backup_log_ddl()

backup_log_ddl() built its log record in a fixed-size stack buffer,
but add_name_to_buffer() can expand each identifier character to 5
bytes when re-encoding it into my_charset_filename, so a RENAME TABLE
with long, special-character names overflowed the buffer.

Fixed by building the record in a growable String, converting names
directly into it, and setting backup_log_error instead of writing a
partial record if an allocation fails.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Pekka Lampio
MDEV-39143 Merge the type_mysql_json plugin into the server

A PR reviewer suggested folding the read-only type_mysql_json data-type
plugin into the server instead of keeping it a separate, optionally
loaded plugin, since MDEV-39143 now makes it a prerequisite for
replicating JSON from a MySQL master rather than an upgrade-time
convenience.
Alexander Barkov
MDEV-41246 "Illegal mix of collations" on the mysql.user view

In progress
Dave Gosselin
MDEV-41211 Remove unused index_read_idx() from both Federated engines

ha_federated::index_read_idx() and ha_federatedx::index_read_idx()
have no callers and do not override a handler method.  Remove them,
and remove the sentence in the comment on each index_read() that says
index_read() calls it.  Comments that describe index_read_idx() now
name index_read() or index_read_idx_map(), whichever does that read.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Georgi (Joro) Kodinov
more doxygen formatting added.
Dave Gosselin
MDEV-41303:  rand() in a semi-join subquery is checked on outer rows

Do not merge a subquery into its parent as a semi-join when it has
the UNCACHEABLE_RAND flag, which RAND() and ROWNUM set.  Derived
tables already follow this rule.  ROWNUM sets the same flag, so this
patch replaces the check for ROWNUM with a check for UNCACHEABLE_RAND.

Previously, converting an IN subquery to a semi-join moved its WHERE
into the parent WHERE.  A condition there such as rand(1) < 0.09
doesn't rely on any columns, so it is attached to the last table of
the join order that is outside any materialized semi-join.  With
SJ-Materialization it was checked once for each outer row instead of
once for each row of the subquery, and the query returned a wrong
count.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Georgi (Joro) Kodinov
more doxygen formatting added.
Marko Mäkelä
fixup! ea087a30f0b81dbf674d7b1fa2ddb852117818ea

Improve the InnoDB_backup::log_track() performance
Oleksandr Byelkin
MDEV-41175 Fix stack-buffer-overflow in backup_log_ddl()

backup_log_ddl() built its log record in a fixed-size stack buffer,
but add_name_to_buffer() can expand each identifier character to 5
bytes when re-encoding it into my_charset_filename, so a RENAME TABLE
with long, special-character names overflowed the buffer.

Fixed by building the record in a growable String, converting names
directly into it, and setting backup_log_error instead of writing a
partial record if an allocation fails.

Co-Authored-By: Claude Opus 5.5 <[email protected]>