View Bazaar branches
Get this repository:
git clone https://git.launchpad.net/maria

MariaDB has 15 active reviews. See all merge proposals.

Import details

Import Status: Reviewed

This repository is an import of the Git repository at https://github.com/MariaDB/server.git.

The next import is scheduled to run .

Last successful import was .

Import started on juju-98ee42-prod-launchpad-codeimport-1 and finished taking 12 minutes — see the log
Import started on juju-98ee42-prod-launchpad-codeimport-0 and finished taking 13 minutes — see the log
Import started on juju-98ee42-prod-launchpad-codeimport-1 and finished taking 8 minutes — see the log
Import started on juju-98ee42-prod-launchpad-codeimport-0 and finished taking 12 minutes — see the log
Import started on juju-98ee42-prod-launchpad-codeimport-4 and finished taking 13 minutes — see the log
Import started on juju-98ee42-prod-launchpad-codeimport-5 and finished taking 7 minutes — see the log
Import started on juju-98ee42-prod-launchpad-codeimport-0 and finished taking 16 minutes — see the log
Import started on juju-98ee42-prod-launchpad-codeimport-5 and finished taking 11 minutes — see the log
Import started on juju-98ee42-prod-launchpad-codeimport-5 and finished taking 9 minutes — see the log
Import started on juju-98ee42-prod-launchpad-codeimport-1 and finished taking 10 minutes — see the log

Branches

Name Last Modified Last Commit
bb-10.6-MDEV-27871 2024-04-23 15:53:58 UTC
Removing MDEV-27871 from tastcases because it is not a bug

Author: Lena Startseva
Author Date: 2024-04-23 15:53:58 UTC

Removing MDEV-27871 from tastcases because it is not a bug
Fix for v. 10.6

11.5-MDEV-33924 2024-04-23 15:26:08 UTC
MDEV-33924: Gtid_log_event thread_id should be 32-bit

Author: Brandon Nesterenko
Author Date: 2024-04-18 21:45:27 UTC

MDEV-33924: Gtid_log_event thread_id should be 32-bit

In accordance with MDEV-15089, and to be consistent with
Query_log_event::thread_id, the Gtid_log_event::thread_id
should also be 32-bit when writing/reading to the binary
log.

10.6-MDEV-33817 2024-04-23 14:58:30 UTC
Do not blame the compiler for PEBKAC

Author: Marko Mäkelä
Author Date: 2024-04-23 14:58:30 UTC

Do not blame the compiler for PEBKAC

bb-10.5-MDEV-27871 2024-04-23 14:44:42 UTC
Removing MDEV-27871 from tastcases because it is not a bug

Author: Lena Startseva
Author Date: 2024-04-22 10:53:06 UTC

Removing MDEV-27871 from tastcases because it is not a bug

10.5 2024-04-23 14:40:57 UTC
MDEV-29955: Set path for zlib library with pkg-config

Author: Meng-Hsiu Chiang
Author Date: 2024-03-13 20:16:56 UTC

MDEV-29955: Set path for zlib library with pkg-config

`FindZLIB` module uses variable `ZLIB_ROOT`[1] to look for libraries. By
setting the variable, `FindZLIB` is able to search the libraries that
installed in a non-system path (/workspace/mylib for example).

And when using `z` in `LINK_LIBRARIES()` CMake tries to lookup the
library in system path by default. It doesn't work if the library isn't
installed in the path, and use ${ZLIB_LIBRARY} which set by FindZLIB
solve the issue.

All new code of the whole pull request, including one or several files
that are either new files or modified ones, are contributed under the
BSD-new license. I am contributing on behalf of my employer Amazon Web
Services.

[1]: https://cmake.org/cmake/help/latest/module/FindZLIB.html#hints

10.11-MDEV-33974 2024-04-23 13:21:36 UTC
MDEV-33974 STL iterator debugging is not enabled

Author: Marko Mäkelä
Author Date: 2024-04-23 13:21:36 UTC

MDEV-33974 STL iterator debugging is not enabled

Let us try to enable _GLIBCXX_DEBUG as well as _GLIBCXX_ASSERTIONS
which have an impact on the GNU libstdc++. This should catch bugs
like the one that commit 455a15fd06b0f449e72e6b10b0474e4139eeeca2 fixed.

bb-10.4-sst-galera 2024-04-23 13:14:09 UTC
galera SST scripts: parsing CN in certificates

Author: Julius Goryavsky
Author Date: 2024-04-23 13:14:09 UTC

galera SST scripts: parsing CN in certificates

This commit contains a fix for the code that extracts and parses
the CN (common name, domain name) record from certificates using
the openssl utility. This code is also made common to the rsync
and mariabackup scripts. It also introduces new print/println
functions which, when using bash, speed up SST scripts by eliminating
numerous calls to the external "echo" utility.

bb-10.5-serg 2024-04-23 13:11:59 UTC
disable mariabackup.incremental_encrypted,64k on 32bit

Author: Sergei Golubchik
Author Date: 2024-04-23 13:11:52 UTC

disable mariabackup.incremental_encrypted,64k on 32bit

it allocates 1GB of memory, it causes failures in CI

bb-10.5-MDEV-33896-galera 2024-04-23 12:53:15 UTC
MDEV-33896 : Galera test failure on galera_3nodes.MDEV-29171

Author: =?utf-8?q?Jan_Lindstr=C3=B6m?=
Author Date: 2024-04-12 07:10:29 UTC

MDEV-33896 : Galera test failure on galera_3nodes.MDEV-29171

Based on logs we might start SST before donor has reached
Primary state. Because this test shutdowns all nodes we
need to make sure when we start nodes that previous nodes
have reached Primary state and joined the cluster.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>

bb-10.6-MDEV-33896-galera 2024-04-23 12:52:22 UTC
MDEV-33896 : Galera test failure on galera_3nodes.MDEV-29171

Author: =?utf-8?q?Jan_Lindstr=C3=B6m?=
Author Date: 2024-04-12 07:10:29 UTC

MDEV-33896 : Galera test failure on galera_3nodes.MDEV-29171

Based on logs we might start SST before donor has reached
Primary state. Because this test shutdowns all nodes we
need to make sure when we start nodes that previous nodes
have reached Primary state and joined the cluster.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>

10.6 2024-04-23 11:12:31 UTC
Check and remove high stack usage

Author: Monty
Author Date: 2024-04-19 10:10:58 UTC

Check and remove high stack usage

I checked all stack overflow potential problems found with
gcc -Wstack-usage=16384
and
clang -Wframe-larger-than=16384 -no-inline

Fixes:
Added '#pragma clang diagnostic ignored "-Wframe-larger-than="'
  to a lot of function to where stack usage large but resonable.
- Added stack check warnings to BUILD scrips when using clang and debug.

Function changed to use malloc instead allocating things on stack:
- read_bootstrap_query() now allocates line_buffer (20000 bytes) with
  malloc() instead of using stack. This has a small performance impact
  but this is not releant for bootstrap.
- mroonga grn_select() used 65856 bytes on stack. Changed it to use
  malloc().
- Wsrep_schema::replay_transaction() and
  Wsrep_schema::recover_sr_transactions().
- Connect zipOpen3()

Not fixed:
- mroonga/vendor/groonga/lib/expr.c grn_proc_call() uses
  43712 byte on stack. However this is not easy to fix as the stack
  used is caused by a lot of code generated by defines.
- Most changes in mroonga/groonga where only adding of pragmas to disable
  stack warnings.
- rocksdb/options/options_helper.cc uses 20288 of stack space.
  (no reason to fix except to get rid of the compiler warning)
- Causes using alloca() where the allocation size is resonable.
- An issue in libmariadb (reported to connectors).

bb-10.6-monty 2024-04-23 11:12:31 UTC
Check and remove high stack usage

Author: Monty
Author Date: 2024-04-19 10:10:58 UTC

Check and remove high stack usage

I checked all stack overflow potential problems found with
gcc -Wstack-usage=16384
and
clang -Wframe-larger-than=16384 -no-inline

Fixes:
Added '#pragma clang diagnostic ignored "-Wframe-larger-than="'
  to a lot of function to where stack usage large but resonable.
- Added stack check warnings to BUILD scrips when using clang and debug.

Function changed to use malloc instead allocating things on stack:
- read_bootstrap_query() now allocates line_buffer (20000 bytes) with
  malloc() instead of using stack. This has a small performance impact
  but this is not releant for bootstrap.
- mroonga grn_select() used 65856 bytes on stack. Changed it to use
  malloc().
- Wsrep_schema::replay_transaction() and
  Wsrep_schema::recover_sr_transactions().
- Connect zipOpen3()

Not fixed:
- mroonga/vendor/groonga/lib/expr.c grn_proc_call() uses
  43712 byte on stack. However this is not easy to fix as the stack
  used is caused by a lot of code generated by defines.
- Most changes in mroonga/groonga where only adding of pragmas to disable
  stack warnings.
- rocksdb/options/options_helper.cc uses 20288 of stack space.
  (no reason to fix except to get rid of the compiler warning)
- Causes using alloca() where the allocation size is resonable.
- An issue in libmariadb (reported to connectors).

10.11 2024-04-23 10:56:02 UTC
MDEV-33970 Assertion `!m.first->second.is_bulk_insert()' failed in trx_undo_...

Author: THIRUNARAYANAN BALATHANDAYUTHAPANI
Author Date: 2024-04-23 10:53:14 UTC

MDEV-33970 Assertion `!m.first->second.is_bulk_insert()' failed in trx_undo_report_row_operation()

In case of partition insert, InnoDB fails to end the bulk insert
for one of the partition. It leads to bulk insert operation for
the consecutive delete statement.

trx_t::bulk_insert_apply_for_table(): Irrespective of bulk insert
value, InnoDB should end the bulk insert for the table.

bb-11.2-serg 2024-04-23 10:31:41 UTC
MDEV-32973 SHOW TABLES LIKE shows temporary tables with non-matching names

Author: Sergei Golubchik
Author Date: 2024-04-22 20:51:23 UTC

MDEV-32973 SHOW TABLES LIKE shows temporary tables with non-matching names

* compare both db and table name
* use the correct charset

bb-10.4-MDEV-33790 2024-04-23 09:37:11 UTC
MDEV-33790 Incorrect DEFAULT expression evaluated in UPDATE

Author: Oleksandr "Sanja" Byelkin
Author Date: 2024-04-23 09:37:11 UTC

MDEV-33790 Incorrect DEFAULT expression evaluated in UPDATE

The problem was that Item_default_value::associate_with_target_field
assigned passed as argument field as an argument which changed argument
in case of default() call with certain field (i.e. deault(field)).

There is no way to get wrong field in constructor so we will not reassign
parameter.

bb-10.4-mdev-31766-hf 2024-04-23 09:27:44 UTC
check if it breaks tests.

Author: Alexey Botchkov
Author Date: 2024-04-23 09:27:44 UTC

check if it breaks tests.

10.11-MDEV-33334 2024-04-23 08:57:56 UTC
MDEV-33334 mariabackup does not always write encrypted files to backup location

Author: THIRUNARAYANAN BALATHANDAYUTHAPANI
Author Date: 2024-04-23 08:22:44 UTC

MDEV-33334 mariabackup does not always write encrypted files to backup location

Problem:
========
mariabackup --prepare fails to write the pages in encrypted
format. This issue happens only for default encrypted table
when innodb_encrypt_tables variable is enabled.

Fix:
====
backup process should write the value of innodb_encrypt_tables
variable in configuration file. prepare should enable the
variable based on configuration file.

bb-11.5-MDEV-18478 2024-04-23 08:29:01 UTC
Alternative solution: introduce @@optimizer_track_timings

Author: Sergey Petrunia
Author Date: 2024-04-22 18:07:36 UTC

Alternative solution: introduce @@optimizer_track_timings

It is =1 by default, which means ICP counters are counted and also
engine stats are counted. This is done for *any* query, but the
extra overhead is expected to be negligible.

To verify this, one can set @@optimizer_track_timings=0 which will cause
engine stats and ICP counters to be NOT collected by default.
When LOG_SLOW_VERBOSITY_ENGINE is set or the statement is ANALYZE or
EXPLAIN, they will be still collected).

bb-10.5-bar-MDEV-21076 2024-04-23 06:45:39 UTC
MDEV-21076 NOT NULL and UNIQUE constraints cause SUM() to yield an incorrect ...

Author: Alexander Barkov
Author Date: 2024-04-23 05:55:49 UTC

MDEV-21076 NOT NULL and UNIQUE constraints cause SUM() to yield an incorrect result

This problem was earlier fixed by the patch for MDEV 33344.
Adding a test case only.

bb-10.6-MDEV-33769 2024-04-23 03:46:53 UTC
MDEV-33769: Memory leak found in the test main.rownum run with --ps-protocol ...

Author: Dmitry Shulga
Author Date: 2024-04-23 03:46:53 UTC

MDEV-33769: Memory leak found in the test main.rownum run with --ps-protocol against a server built with the option -DWITH_PROTECT_STATEMENT_MEMROOT

bb-10.5-MDEV-33967-handersocket-binlog-pkgtest 2024-04-23 01:18:01 UTC
MDEV-33967 hander socket writes do not result in binary log entries

Author: Daniel Black
Author Date: 2024-04-23 01:17:59 UTC

MDEV-33967 hander socket writes do not result in binary log entries

As handlersocket bypasses the sql layer that prepares and causes
binary log entries to be created, we need to do this in the
plugin directly to create binary log entries.

Reported thanks to Yutaro Iwasaki on Zulip.

bb-10.5-mdev-24610-memory-se 2024-04-23 00:56:19 UTC
MDEV-24610 MEMORY SE: check overflow in info calls with HA_STATUS_AUTO

Author: Yuchen Pei
Author Date: 2024-04-23 00:56:19 UTC

MDEV-24610 MEMORY SE: check overflow in info calls with HA_STATUS_AUTO

bb-10.5-bar-MDEV-21034 2024-04-22 22:38:26 UTC
MDEV-21034 GREATEST() and LEAST() malfunction for NULL

Author: Alexander Barkov
Author Date: 2024-04-22 16:22:03 UTC

MDEV-21034 GREATEST() and LEAST() malfunction for NULL

There is a convention that Item::val_int() and Item::val_real() return
SQL NULL doing effectively what this code does:
  null_value= true;
  return 0; // Always return 0 for SQL NULL

This is done to optimize boolean value evaluation:
if Item::val_int() or Item::val_real() returned 1 -
that always means TRUE and never can means SQL NULL.
This convention helps to avoid unnecessary testing
Item::null_value after getting a non-zero return value.

Item_func_min_max did not follow this convention.
It could return a non-zero value together with null_value==true.
This made evaluate_join_record() erroneously misinterpret
SQL NULL as TRUE in this call:

  select_cond_result= MY_TEST(select_cond->val_int());

Fixing Item_func_min_max to follow the convention.

bb-11.5-MDEV-32188-timestamps 2024-04-22 19:27:24 UTC
fixup! f551fa75e13dd57b057117c570f2e2414ec6d500

Author: Monty
Author Date: 2024-04-22 14:42:09 UTC

fixup! f551fa75e13dd57b057117c570f2e2414ec6d500

bb-10.11-serg 2024-04-22 19:02:11 UTC
sporadic failures of rpl.rpl_rewrite_db_sys_vars

Author: Sergei Golubchik
Author Date: 2024-04-22 19:02:11 UTC

sporadic failures of rpl.rpl_rewrite_db_sys_vars

first stop the slave, then run commands on the master that are
supposed to fail on the slave, then start the slave.

if you swap first two steps, the slave might get and execute those
commands before it's stopped, which will fail the test.

also, improve debugability

bb-11.5-MDEV-33501-query-response-time 2024-04-22 15:26:15 UTC
squash! ddab8e0840f1b11c44bb05accae1291b1191aa1a

Author: Monty
Author Date: 2024-04-22 07:01:04 UTC

squash! ddab8e0840f1b11c44bb05accae1291b1191aa1a

- Use drop_table() instead of ha_drop_table() for internal temporary
  tables to avoid information_schema queries to be categorized as
  write queries.

bb-10.6-serg 2024-04-22 15:22:11 UTC
fix failing large_tests.maria_recover_encrypted

Author: Sergei Golubchik
Author Date: 2024-04-22 15:22:11 UTC

fix failing large_tests.maria_recover_encrypted

update results

bb-10.5-MDEV-33928-galera 2024-04-22 14:59:16 UTC
MDEV-33928 : Assertion failure on wsrep_thd_is_aborting

Author: =?utf-8?q?Jan_Lindstr=C3=B6m?=
Author Date: 2024-04-18 12:41:30 UTC

MDEV-33928 : Assertion failure on wsrep_thd_is_aborting

Problem was assertion assuming we always hold
THD::LOCK_thd_data mutex that is not true.
In most cases this is true but function is
also used from InnoDB lock manager and
there we can't take THD::LOCK_thd_data to
obey mutex ordering. Removed assertion as
wsrep transaction state can't change even
that case.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>

bb-10.4-MDEV-33928-galera 2024-04-22 14:57:48 UTC
MDEV-33928 : Assertion failure on wsrep_thd_is_aborting

Author: =?utf-8?q?Jan_Lindstr=C3=B6m?=
Author Date: 2024-04-18 12:41:30 UTC

MDEV-33928 : Assertion failure on wsrep_thd_is_aborting

Problem was assertion assuming we always hold
THD::LOCK_thd_data mutex that is not true.
In most cases this is true but function is
also used from InnoDB lock manager and
there we can't take THD::LOCK_thd_data to
obey mutex ordering. Removed assertion as
wsrep transaction state can't change even
that case.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>

10.4 2024-04-22 14:57:48 UTC
MDEV-33928 : Assertion failure on wsrep_thd_is_aborting

Author: =?utf-8?q?Jan_Lindstr=C3=B6m?=
Author Date: 2024-04-18 12:41:30 UTC

MDEV-33928 : Assertion failure on wsrep_thd_is_aborting

Problem was assertion assuming we always hold
THD::LOCK_thd_data mutex that is not true.
In most cases this is true but function is
also used from InnoDB lock manager and
there we can't take THD::LOCK_thd_data to
obey mutex ordering. Removed assertion as
wsrep transaction state can't change even
that case.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>

bb-11.5-timestamp 2024-04-22 14:42:09 UTC
fixup! f551fa75e13dd57b057117c570f2e2414ec6d500

Author: Monty
Author Date: 2024-04-22 14:42:09 UTC

fixup! f551fa75e13dd57b057117c570f2e2414ec6d500

bb-11.5-MDEV-33145-flush-global-status 2024-04-22 14:15:22 UTC
fixup MDEV-33145 Add FLUSH GLOBAL STATUS

Author: Elena Stepanova
Author Date: 2024-04-22 14:15:22 UTC

fixup MDEV-33145 Add FLUSH GLOBAL STATUS

Transferring commit c2213a6aae1ddc1cca5390e8b6eef9e102c2298e

bb-11.5-bar-MDEV-20610 2024-04-22 13:58:09 UTC
MDEV-20610 Assertion failed or btr_validate_index(..) in row_upd_sec_index_en...

Author: Alexander Barkov
Author Date: 2024-04-12 05:25:13 UTC

MDEV-20610 Assertion failed or btr_validate_index(..) in row_upd_sec_index_entry on a time_zone change

bb-11.5-monty 2024-04-22 13:41:25 UTC
fixup! 3a7a3e9b3be3504e1bfc32c931e14ed47a317d9b

Author: Monty
Author Date: 2024-04-22 13:41:25 UTC

fixup! 3a7a3e9b3be3504e1bfc32c931e14ed47a317d9b

11.5 2024-04-22 12:59:05 UTC
mysqltest: support MARIADB_OPT_RESTRICTED_AUTH

Author: Sergei Golubchik
Author Date: 2024-03-15 17:42:06 UTC

mysqltest: support MARIADB_OPT_RESTRICTED_AUTH

C/C 3.4 disables mysql_old_password by default, so

add an option for the `connect` command to support specifying
allowed authentication plugins (MARIADB_OPT_RESTRICTED_AUTH).

use it to enable mysql_old_password when needed for testing

bb-11.5-serg 2024-04-22 12:59:05 UTC
mysqltest: support MARIADB_OPT_RESTRICTED_AUTH

Author: Sergei Golubchik
Author Date: 2024-03-15 17:42:06 UTC

mysqltest: support MARIADB_OPT_RESTRICTED_AUTH

C/C 3.4 disables mysql_old_password by default, so

add an option for the `connect` command to support specifying
allowed authentication plugins (MARIADB_OPT_RESTRICTED_AUTH).

use it to enable mysql_old_password when needed for testing

bb-10.4-mdev-33892-hf 2024-04-22 12:47:33 UTC
Test case showing the problem.

Author: Alexey Botchkov
Author Date: 2024-04-22 12:47:33 UTC

Test case showing the problem.

bb-10.4-mdev-24610 2024-04-22 06:21:45 UTC
MDEV-24610 Check for partition auto increment overflow

Author: Yuchen Pei
Author Date: 2024-04-22 04:52:39 UTC

MDEV-24610 Check for partition auto increment overflow

When ha_partition::info() is called with a flag containing
HA_STATUS_AUTO, it may iterate partitions and call info() on them with
HA_STATUS_AUTO, and update its own auto increment value with the
maximum of the partitions.

When info() is called on the MEMORY SE, it could cause an overflow
when its internal auto increment value is already ULONGLONG_MAX,
thereby setting the table stats auto increment value to 0.

If such an overflow happens, we return an error in
ha_partition::info() indicating so.

Note that callsites of ha_partition::update_next_auto_inc_val(), which
calls ha_partition::info() with HA_STATUS_AUTO, do not handle any
returned error.

10.11-MDEV-33087 2024-04-22 05:45:46 UTC
MDEV-33087 ALTER TABLE...ALGORITHM=COPY should build indexes more efficiently

Author: THIRUNARAYANAN BALATHANDAYUTHAPANI
Author Date: 2024-04-19 09:18:21 UTC

MDEV-33087 ALTER TABLE...ALGORITHM=COPY should build indexes more efficiently

- During copy algorithm, InnoDB should use bulk insert operation
for row by row insert operation. By doing this, copy algorithm
can effectively build indexes. This optimization is disabled
for temporary table, versioning table and table which has
foreign key relation.

Introduced the variable innodb_allow_bulk_insert to avoid
the bulk insert operation inside InnoDB

ha_innobase::extra(): HA_EXTRA_END_ALTER_COPY mode tries to apply
the buffered bulk insert operation, updates the non-persistent
table stats.

row_merge_bulk_t::write_to_index(): Update stat_n_rows after
applying the bulk insert operation

row_ins_clust_index_entry_low(): In case of copy algorithm,
switch to bulk insert operation.

copy_data_error_ignore(): Handles the error while copying
the data from source to target file.

bb-10.5-mdev-24610 2024-04-22 04:52:39 UTC
MDEV-24610 Check for partition auto increment overflow

Author: Yuchen Pei
Author Date: 2024-04-22 04:52:39 UTC

MDEV-24610 Check for partition auto increment overflow

When ha_partition::info() is called with a flag containing
HA_STATUS_AUTO, it may iterate partitions and call info() on them with
HA_STATUS_AUTO, and update its own auto increment value with the
maximum of the partitions.

When info() is called on the MEMORY SE, it could cause an overflow
when its internal auto increment value is already ULONGLONG_MAX,
thereby setting the table stats auto increment value to 0.

If such an overflow happens, we return an error in
ha_partition::info() indicating so.

Note that callsites of ha_partition::update_next_auto_inc_val(), which
calls ha_partition::info() with HA_STATUS_AUTO, do not handle any
returned error.

bb-10.6-all-builders 2024-04-20 20:02:12 UTC
MDEV-33622 Server crashes when the UPDATE statement (which has duplicate key)...

Author: Elena Stepanova
Author Date: 2024-04-20 20:02:12 UTC

MDEV-33622 Server crashes when the UPDATE statement (which has duplicate key) is run after setting a low thread_stack

Added the missing test case

bb-10.5-bar-MDEV-20610 2024-04-20 19:49:09 UTC
MDEV-20610 Assertion failed or btr_validate_index(..) in row_upd_sec_index_en...

Author: Alexander Barkov
Author Date: 2024-04-12 05:25:13 UTC

MDEV-20610 Assertion failed or btr_validate_index(..) in row_upd_sec_index_entry on a time_zone change

bb-10.11-merge 2024-04-20 12:30:25 UTC
WIP merge 10.6 into 10.11

Author: Marko Mäkelä
Author Date: 2024-04-20 12:30:25 UTC

WIP merge 10.6 into 10.11

Failing test(s): galera.galera_wsrep_new_cluster galera.MDEV-29142 galera.MDEV-26597

st-10.5-knielsen 2024-04-20 11:41:08 UTC
MDEV-19415: use-after-free on charsets_dir from slave connect

Author: Kristian Nielsen
Author Date: 2024-04-16 10:39:54 UTC

MDEV-19415: use-after-free on charsets_dir from slave connect

The slave IO thread sets MYSQL_SET_CHARSET_DIR. The code for this option
however is not thread-safe in sql-common/client.c. The value set is
temporarily written to mysys global variable `charsets-dir` and can be seen
by other threads running in parallel, which can result in use-after-free
error.

Problem was visible as random failures of test cases in suite multi_source
with Valgrind or MSAN.

Work-around by not setting this option for slave connect, it is redundant
anyway as it is just setting the default value.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>

bb-10.11-release 2024-04-20 11:06:48 UTC
Merge branch '10.6' into 10.11

Author: Oleksandr "Sanja" Byelkin
Author Date: 2024-04-20 11:06:48 UTC

Merge branch '10.6' into 10.11

bb-10.11-MDEV-33420-fix 2024-04-20 01:51:31 UTC
HASHICORP_KEY_MANAGEMENT: MDEV-33420 post-fix

Author: Julius Goryavsky
Author Date: 2024-04-20 01:51:31 UTC

HASHICORP_KEY_MANAGEMENT: MDEV-33420 post-fix

Compilation correction after MDEV-33420.

bb-10.11-MDEV-33420-fix2 2024-04-20 01:51:31 UTC
HASHICORP_KEY_MANAGEMENT: MDEV-33420 post-fix

Author: Julius Goryavsky
Author Date: 2024-04-20 01:51:31 UTC

HASHICORP_KEY_MANAGEMENT: MDEV-33420 post-fix

Compilation correction after MDEV-33420.

bb-11.5-mdev-30929-wait-and-retry 2024-04-18 23:42:07 UTC
[demo] spider.spider_fixes_part: wait and retry

Author: Yuchen Pei
Author Date: 2024-04-18 23:42:07 UTC

[demo] spider.spider_fixes_part: wait and retry

bb-11.5-mdev-30929-wait-and-die 2024-04-18 23:41:25 UTC
[demo] spider.spider_fixes_part: wait and die

Author: Yuchen Pei
Author Date: 2024-04-18 23:41:25 UTC

[demo] spider.spider_fixes_part: wait and die

bb-11.5-MDEV-33625 2024-04-18 19:07:55 UTC
MDEV-33625 Add option --dir to mariadb-dump

Author: VladislavVaintroub
Author Date: 2024-03-04 22:12:34 UTC

MDEV-33625 Add option --dir to mariadb-dump

New option works just like --tab, wrt output (sql file for table definition
and tab-separated for data, same options, e.g --parallel)

Compared to --tab it allows --databases and --all-databases.
When --dir is used , it creates directory structure in the output directory,
pointed to by --dir. For every database to be dumped, there will be a
directory with database name.

All options that --tab supports, are also supported by --dir, in particular
--parallel

bb-11.5-bar-MDEV-31340 2024-04-18 11:22:10 UTC
reset cached client plugin when it's no longer needed

Author: Sergei Golubchik
Author Date: 2024-03-17 14:00:09 UTC

reset cached client plugin when it's no longer needed

it's a pointer into the net buffer, so it might be overwritten by the
next read or write. And the next plugin switch (in multi-auth) will
try to compare it (in send_plugin_request_packet) which is normally
harmless but fails the assert with Lex_ident::is_valid_ident()

bb-11.4-vec-vicentiu-hugo 2024-04-18 10:15:04 UTC
Bug fixes - on top of Hugo's patch

Author: Vicențiu Ciorbaru
Author Date: 2024-04-18 10:15:04 UTC

Bug fixes - on top of Hugo's patch

bb-11.5-mdev12404-extras 2024-04-18 08:35:59 UTC
MDEV-12404: Add assertions about Index Condition Pushdown use

Author: Sergey Petrunia
Author Date: 2024-03-13 08:53:31 UTC

MDEV-12404: Add assertions about Index Condition Pushdown use

Add assertions about limitations one has when using Index Condition
Pushdown:
- add handler::assert_icp_limitations()
- call this function from functions that may attempt violations.

Verified that assert_icp_limitations() as well as calls to it are
compiled away in release build.

bb-10.11-release-spider-fixup 2024-04-18 07:16:44 UTC
[merge fixup] spider: restore extern declarations of some vars

Author: Yuchen Pei
Author Date: 2024-04-18 07:16:44 UTC

[merge fixup] spider: restore extern declarations of some vars

How did they get removed during the merge?? The removal did not appear
in the resolution diff at all.

bb-11.5-mdev-30929-sleep 2024-04-18 01:25:41 UTC
[demo] spider.spider_fixes_part: sleep until not running?

Author: Yuchen Pei
Author Date: 2024-04-18 01:25:41 UTC

[demo] spider.spider_fixes_part: sleep until not running?

bb-10.11-MDEV-33420 2024-04-17 23:45:24 UTC
MDEV-33420: HASHICORP_KEY_MANAGEMENT fails on Windows with libcurl installed

Author: Anel Husakovic
Author Date: 2024-04-12 06:55:27 UTC

MDEV-33420: HASHICORP_KEY_MANAGEMENT fails on Windows with libcurl installed

- When `libcurl` is installed in path out of default path, like on
Windows, `include_directories` failed to find `curl/curl.h`.
- Fix `cmake` by using modern syntax with imported target and
`find_package`
- Fix warnings treated as the errors
  - Remove `HASHICORP_HAVE_EXCEPTIONS` macro and related code
- Add package to `Server` component in Windows
- Tested with `$ ./mysql-test/mtr --suite=vault`
- Closes PR #3068
- Reviewer: <wlad@mariadb.com>
            <julius.goryavsky@mariadb.com>

merge-10.11-MDEV-33668 2024-04-17 20:42:01 UTC
Restore thread existence check

Author: Brandon Nesterenko
Author Date: 2024-04-17 20:38:40 UTC

Restore thread existence check

bb-10.4-mdev-30727 2024-04-17 07:26:41 UTC
MDEV-30727 Check spider_hton_ptr in spider udfs

Author: Yuchen Pei
Author Date: 2024-04-17 07:26:41 UTC

MDEV-30727 Check spider_hton_ptr in spider udfs

We have to #undef my_error and find it from udfs when spider is not
installed.

bb-10.6-wlad 2024-04-16 22:23:00 UTC
MDEV-33840 - fixup.

Author: VladislavVaintroub
Author Date: 2024-04-16 20:04:59 UTC

MDEV-33840 - fixup.

Be more careful, when switching on/off maintenance timer.

As long as there are active tasks and not enough threads, this will now
trigger the periodic deadlock check.

Previously, pool could block, without timer even starting.

bb-10.6-mdev33752 2024-04-16 09:40:47 UTC
MDEV-33752: EXPLAIN UPDATE acquires locks on table rows

Author: Sergey Petrunia
Author Date: 2024-04-16 09:40:47 UTC

MDEV-33752: EXPLAIN UPDATE acquires locks on table rows

Make EXPLAIN commands behave like SELECTs when it comes to locking:
- In the SQL parser, make EXPLAIN DELETE and EXPLAIN UPDATE not to
  request write MDL or table locks.
- Same as above in multi_delete_set_locks_and_link_aux_tables().
- InnoDB analyzes the return value of thd_sql_command() and sets its
  locking behavior accordingly.
  EXPLAIN UPDATE|DELETE have thd_sql_command()=SQLCOM_UPDATE|DELETE.
  Introduce also thd_sql_is_explain() and if that returns true, InnoDB
  now will work as if thd_sql_command()==SQLCOM_SELECT.

bb-10.5-release 2024-04-16 09:04:14 UTC
Merge branch '10.4' into 10.5

Author: Oleksandr "Sanja" Byelkin
Author Date: 2024-04-16 09:04:14 UTC

Merge branch '10.4' into 10.5

bb-10.5-wlad 2024-04-16 07:16:52 UTC
MDEV-16944 followup

Author: VladislavVaintroub
Author Date: 2024-04-16 07:16:52 UTC

MDEV-16944 followup

- Better comments for do_write_line
- Add EOL to the line to be printed like "echo" does

bb-11.4-MDEV-18478-v4-MDEV-12404 2024-04-16 01:09:28 UTC
remove unused function should_collect_handler_stats

Author: Dave Gosselin
Author Date: 2024-04-16 01:09:28 UTC

remove unused function should_collect_handler_stats

bb-10.4-MDEV-28621-reference-counter 2024-04-15 22:54:05 UTC
MDEV-28621 group by optimization incorrectly removing subquery where subject ...

Author: Rex Johnston
Author Date: 2024-04-03 00:55:24 UTC

MDEV-28621 group by optimization incorrectly removing subquery where subject buried in a function

A group by query optimization technique, where the a group by clause in
a subquery can be removed is incorrectly removing references to subquery
items that may be defined and used elsewhere.

This is the initial implementation of a reference counter in the unit
attached to an Item_subquery.

11.4-mdev-33616 2024-04-15 19:17:30 UTC
MDEV-33616 Tests failing on macOS

Author: Dave Gosselin
Author Date: 2024-04-15 19:17:30 UTC

MDEV-33616 Tests failing on macOS

These tests rely on THR_KEY_mysys but it is not initialized. On
Linux, the corresponding thread variable is null, but on macOS it has a
nonzero value. In all cases, initialize the variable explicitly. We could
call MY_INIT, however some memory is leaked on test program exit in that
case. Instead, factor just enough to be able to initialize THR_KEY_mysys
from the test code (as well as from the library code).

bb-11.5-MDEV-33151-userstat 2024-04-15 18:12:26 UTC
MDEV-33913 TABLE_STATISTICS increments ROWS_CHANGED twice upon UPDATE and doe...

Author: Elena Stepanova
Author Date: 2024-04-15 18:12:26 UTC

MDEV-33913 TABLE_STATISTICS increments ROWS_CHANGED twice upon UPDATE and does not count DELETE

bb-10.5-knielsen 2024-04-15 16:54:30 UTC
Fix windows build failure

Author: Kristian Nielsen
Author Date: 2024-04-15 16:54:30 UTC

Fix windows build failure

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>

11.4-mdev-33616-sp-inout-case 2024-04-15 16:19:07 UTC
MDEV-33616 Tests failing on macOS

Author: Dave Gosselin
Author Date: 2024-04-15 16:15:04 UTC

MDEV-33616 Tests failing on macOS

compat/oracle.sp-inout now uses lowercase object names for test
compatibility with both case-insensitive and case-sensitive
filesystems.

11.4-macos-test-exclusion-mechanism 2024-04-15 15:57:07 UTC
MTR flag to mark tests as incompatible with macOS

Author: Dave Gosselin
Author Date: 2024-03-07 20:31:26 UTC

MTR flag to mark tests as incompatible with macOS

Introduces a new MTR include, not_mac.inc, which when included
at the top of a test, prevents that test from running on macOS.

11.4 2024-04-15 10:46:56 UTC
MDEV-33592: Use X509v3 for compatibility with libraries

Author: Daniel Black
Author Date: 2024-03-05 03:46:28 UTC

MDEV-33592: Use X509v3 for compatibility with libraries

According to rfc5280, x509v3 was standardised in June 1996.

RusTLS only accepts v3 certificates rejected the v1 default.
(ref:
https://github.com/rustls/webpki/issues/29#issuecomment-1453783741)

It seems reasonable that all client libraries can accept v3.

X509_VERSION_3 has a fixed value of 2, but isn't defined in
OpenSSL-1.1.1.

Thanks Austin Bonander for the suggested patch.

bb-11.4-release 2024-04-15 08:12:29 UTC
and even more fixes

Author: Oleksandr "Sanja" Byelkin
Author Date: 2024-04-12 12:43:21 UTC

and even more fixes

11.4-mdev-32777 2024-04-12 19:13:31 UTC
MDEV-32777 DDL operations very slow under macOS

Author: Dave Gosselin
Author Date: 2024-03-18 17:03:33 UTC

MDEV-32777 DDL operations very slow under macOS

macOS is a development platform for our product but calls to
fcntl(F_FULLFSYNC) are too slow for developer needs. macOS offers
at least three different disk flush calls, making tradeoffs between
reliability and performance (see analysis notes on this MDEV).
On macOS only and as a compromise, we will back out the change to
call fcntl(F_FULLFSYNC), sacrificing a full flush in favor of more
performant writes.

bb-11.6-monty 2024-04-12 16:23:05 UTC
Added Lock_time_ms and Table_catalog columns to metadata_lock_info

Author: Monty
Author Date: 2024-04-12 15:59:59 UTC

Added Lock_time_ms and Table_catalog columns to metadata_lock_info

If compiled for debugging, LOCK_DURATION is also filled in.

10.11-monty 2024-04-12 15:59:59 UTC
Added Lock_time_ms and Table_catalog columns to metadata_lock_info

Author: Monty
Author Date: 2024-04-12 15:59:59 UTC

Added Lock_time_ms and Table_catalog columns to metadata_lock_info

If compiled for debugging, LOCK_DURATION is also filled in.

11.2 2024-04-11 16:17:57 UTC
MDEV-33659 Server crashed at Create_func_aes_decrypt::create_native

Author: Andre Alves
Author Date: 2024-03-25 16:37:22 UTC

MDEV-33659 Server crashed at Create_func_aes_decrypt::create_native

bb-10.5-MDEV-33677-galera 2024-04-11 12:56:40 UTC
MDEV-33677 : Port Performance Schema for Galera from ES

Author: Julius Goryavsky
Author Date: 2021-06-20 22:54:11 UTC

MDEV-33677 : Port Performance Schema for Galera from ES

Added performance schema tables for Galera.
This is a port of the code from ES 10.6

Refs:
MENT-346 commit 86c06851
MENT-346 commit 10d0fcaf
MENT-1333 commit 2005adc3
MENT-347 commit aaca43b4
MENT-1370 commit 1f460e6b

bb-10.4-MDEV-30732-galera 2024-04-11 12:26:39 UTC
MDEV-30732: additional changes after fix

Author: Julius Goryavsky
Author Date: 2024-04-10 04:32:06 UTC

MDEV-30732: additional changes after fix

bb-10.5-release-spider-fix 2024-04-11 00:09:40 UTC
[merge fix] MDEV-33728 redundant macros MYSQL_VERSION_ID etc.

Author: Yuchen Pei
Author Date: 2024-04-11 00:09:40 UTC

[merge fix] MDEV-33728 redundant macros MYSQL_VERSION_ID etc.

generated by

unifdef -DMYSQL_VERSION_ID=100500 -DMARIADB_BASE_VERSION -m storage/spider/spd_* storage/spider/ha_spider.* storage/spider/hs_client/*

bb-10.5-bar 2024-04-10 18:21:51 UTC
MDEV-32458 ASAN unknown-crash in Inet6::ascii_to_fbt when casting character s...

Author: Alexander Barkov
Author Date: 2024-04-10 13:58:36 UTC

MDEV-32458 ASAN unknown-crash in Inet6::ascii_to_fbt when casting character string to inet6

The condition checked the value of the leftmost byte before checking if
at least one byte is still available in the buffer.
Changing the order in the condition: check for a byte availability before
checking the byte value.

bb-10.5-andrei 2024-04-10 16:31:39 UTC
MDEV-31779 Server crash in Rows_log_event::update_sequence upon replaying bi...

Author: Andrei
Author Date: 2024-04-10 15:19:43 UTC

 MDEV-31779 Server crash in Rows_log_event::update_sequence upon replaying binary log

The crash at running mysqlbinlog on a SEQUENCE containing binlog file
was caused MDEV-29621 fixes that did not check which of the slave
or binlog applier executes a block introduced there.

The block is meaningful only for the parallel slave applier, so
it's safe to fix this bug with identified the actual applier and
skipping the block when it's the mysqlbinlog one.

knielsen_mdev32020 2024-04-10 14:12:20 UTC
MDEV-32020: Partial commit, start of slave-side XA replication

Author: Kristian Nielsen
Author Date: 2024-04-10 14:12:20 UTC

MDEV-32020: Partial commit, start of slave-side XA replication

The slave can replicate prepared xa data by simply binlogging the data.
The slave can apply the committed xa as normal trx, but preserving XID on the GTID.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>

bb-11.4-MDEV-30260-mergefix 2024-04-10 11:51:28 UTC
reb

Author: Brandon Nesterenko
Author Date: 2024-04-10 11:51:28 UTC

reb

bb-11.5-mdev-31609 2024-04-10 01:13:46 UTC
MDEV-31609 Send initial values of system variables in first OK packet

Author: Yuchen Pei
Author Date: 2024-03-01 01:59:21 UTC

MDEV-31609 Send initial values of system variables in first OK packet

Values of all session tracking system variables will be sent in the
first ok packet upon connection after successful authentication.

Also updated mtr to print session track info on connection (h/t Sergei
Golubchik) so that we can write mtr tests for this change.

bb-10.11-MDEV-30260-mergefix 2024-04-09 20:51:08 UTC
MDEV-30260: Slave crashed:reload_acl_and_cache during shutdown

Author: Brandon Nesterenko
Author Date: 2024-04-08 19:04:59 UTC

MDEV-30260: Slave crashed:reload_acl_and_cache during shutdown

The signal handler thread can use various different runtime
resources when processing a SIGHUP (e.g. master-info information)
due to calling into reload_acl_and_cache(). Currently, the shutdown
process waits for the termination of the signal thread after
performing cleanup. However, this could cause resources actively
used by the signal handler to be freed while reload_acl_and_cache()
is processing.

The specific resource that caused MDEV-30260 is a race condition for
the hostname_cache, such that mysqld would delete it in
clean_up()::hostname_cache_free(), before the signal handler would
use it in reload_acl_and_cache()::hostname_cache_refresh().

Another similar resource is the active_mi/master_info_index. There
was a race between its deletion by the main thread in end_slave(),
and their usage by the Signal Handler as a part of
Master_info_index::flush_all_relay_logs.read(active_mi) in
reload_acl_and_cache().

This patch fixes these race conditions by relocating where server
shutdown waits for the signal handler to die until after
server-level threads have been killed (i.e., as a last step of
close_connections()). With respect to the hostname_cache, active_mi
and master_info_cache, this ensures that they cannot be destroyed
while the signal handler is still active, and potentially using
them.

Additionally:

 1) This requires that Events memory is still in place for SIGHUP
handling's mysql_print_status(). So event deinitialization is moved
into clean_up(), but the event scheduler still needs to be stopped
in close_connections() at the same spot.

 2) The function kill_server_thread is no longer used, so it is
deleted

 3) The timeout to wait for the death of the signal thread was not
consistent with the comment. The comment mentioned up to 10 seconds,
whereas it was actually 0.01s. The code has been fixed to wait up to
10 seconds.

 4) A warning has been added if the signal handler thread fails to
exit in time.

 5) Added pthread_join() to end of wait_for_signal_thread_to_end()
if it hadn't ended in 10s with a warning. Note this also removes
the pthread_detached attribute from the signal_thread to allow
for the pthread_join().

Reviewed By:
===========
Vladislav Vaintroub <wlad@mariadb.com>
Andrei Elkin <andrei.elkin@mariadb.com>

bb-10.6-MDEV-30260-mergefix 2024-04-09 20:28:39 UTC
MDEV-30260: Slave crashed:reload_acl_and_cache during shutdown

Author: Brandon Nesterenko
Author Date: 2024-04-08 19:04:59 UTC

MDEV-30260: Slave crashed:reload_acl_and_cache during shutdown

The signal handler thread can use various different runtime
resources when processing a SIGHUP (e.g. master-info information)
due to calling into reload_acl_and_cache(). Currently, the shutdown
process waits for the termination of the signal thread after
performing cleanup. However, this could cause resources actively
used by the signal handler to be freed while reload_acl_and_cache()
is processing.

The specific resource that caused MDEV-30260 is a race condition for
the hostname_cache, such that mysqld would delete it in
clean_up()::hostname_cache_free(), before the signal handler would
use it in reload_acl_and_cache()::hostname_cache_refresh().

Another similar resource is the active_mi/master_info_index. There
was a race between its deletion by the main thread in end_slave(),
and their usage by the Signal Handler as a part of
Master_info_index::flush_all_relay_logs.read(active_mi) in
reload_acl_and_cache().

This patch fixes these race conditions by relocating where server
shutdown waits for the signal handler to die until after
server-level threads have been killed (i.e., as a last step of
close_connections()). With respect to the hostname_cache, active_mi
and master_info_cache, this ensures that they cannot be destroyed
while the signal handler is still active, and potentially using
them.

Additionally:

 1) This requires that Events memory is still in place for SIGHUP
handling's mysql_print_status(). So event deinitialization is moved
into clean_up(), but the event scheduler still needs to be stopped
in close_connections() at the same spot.

 2) The function kill_server_thread is no longer used, so it is
deleted

 3) The timeout to wait for the death of the signal thread was not
consistent with the comment. The comment mentioned up to 10 seconds,
whereas it was actually 0.01s. The code has been fixed to wait up to
10 seconds.

 4) A warning has been added if the signal handler thread fails to
exit in time.

 5) Added pthread_join() to end of wait_for_signal_thread_to_end()
if it hadn't ended in 10s with a warning. Note this also removes
the pthread_detached attribute from the signal_thread to allow
for the pthread_join().

Reviewed By:
===========
Vladislav Vaintroub <wlad@mariadb.com>
Andrei Elkin <andrei.elkin@mariadb.com>

bb-10.11-MDEV-33672-mergefix 2024-04-09 17:35:22 UTC
MDEV-33672: 10.11 Fix for Two Phase Alter Flags

Author: Brandon Nesterenko
Author Date: 2024-04-09 17:35:22 UTC

MDEV-33672: 10.11 Fix for Two Phase Alter Flags

Extends 89c907bd4f713b77e248f7c8e6247b5f3be18fb4 to account for
binlog_two_phase_alter flags in a Gtid log event. I.e., if the
FL_COMMIT_ALTER_E1 or FL_ROLLBACK_ALTER_E2 flags are set in the
event flags, yet the length of the event is too short to hold
the value, then set the event as invalid

bb-10.4-mdev-32401 2024-04-09 13:45:53 UTC
MDEV-32401: expression cache heap-use-after-free

Author: Dave Gosselin
Author Date: 2024-01-26 16:13:48 UTC

MDEV-32401: expression cache heap-use-after-free

Queries selecting a TEXT column by alias, then joining that with a subquery
referencing the same alias may invoke a subquery expression cache. Typically,
these caches expect to rely on heap memory for their backing temporary table,
but TEXT (and BLOB) types require an ARIA backing; in this case, a crash may
result. Such a query may look like:

SELECT t1.d FROM (SELECT c AS d FROM t0) AS t1 JOIN t0 ON (
  SELECT ORD((SELECT BIT_OR(d))) FROM t0 GROUP BY d
);

This patch checks if there are blob types present before attempting to create
the SQL expression cache and if so, it does not, leaving the associated item
cache transparent.

The Expression_cache_tmptable implements the Expression_cache using a temporary
table. During Expression_cache_tmptable::init, we expect the created temporary
table to have the heap handlerton. However, for the crash in this ticket, it
is created using the ARIA handlerton instead. This happens because the
Create_tmp_table::choose_engine selects the ARIA engine because the temporary
table's associated TABLE_SHARE indicates that there are BLOB fields present.
This is true because TEXT fields are handled in the same way as BLOB fields in
our system; in our grammar, both TEXT and BLOB types rely on the
type_handler_blob handler. After the temporary table is created and the engine
associated with it, we then invoke move_field on each field associated with
the TABLE_SHARE. However, once this is complete and we return to
Expression_cache_tmptable::init, we check to see that the heap hton is used as
expected and it is not: so we delete the temporary table. Unfortunately, this
leaves the pointers inside the Field objects dangling, and we crash later as
indicated in the stack traces on this ticket. Non-BLOB types avoid this
problem because they end up with a temporary table backed by the heap
handlerton.

10.5-mdev-32403 2024-04-09 13:43:29 UTC
MDEV-32397, MDEV-32403 Crashes during join processing.

Author: Dave Gosselin
Author Date: 2024-04-03 17:16:25 UTC

MDEV-32397, MDEV-32403 Crashes during join processing.

Queries having the following form may cause a crash
  SELECT t1.a FROM ( SELECT a AS a1 FROM t1 ) dt
  JOIN t1 ON a1 LIKE EXISTS ( SELECT a + RAND () FROM t1 UNION SELECT a FROM t1);
because the table t1 has some JOIN cleanup operations performed prematurely
during the subselect.

In this particular case, the presence of RAND() makes the subquery
uncacheable, necessitating the need to execute the subquery multiple
times during join record evaluation. Each time the subquery runs, it
creates its own JOIN structure which has references to the table t1.
When the subquery completes, JOIN::cleanup and functions called by it
result in ha_end_keyread() being called on table t1. However, we are
not done with table t1 because the upper level `select t1.a from...`
query requires table t1 to be open. To solve this, we make the executor
aware of when we're in subqueries like this and delay JOIN cleanup
until the end of the query.

bb-11.2-release 2024-04-09 10:12:33 UTC
Merge branch '11.1' into 11.2

Author: Oleksandr "Sanja" Byelkin
Author Date: 2024-04-09 10:12:33 UTC

Merge branch '11.1' into 11.2

bb-10.4-mdev-29363-no-prop-subquery 2024-04-09 06:43:18 UTC
MDEV-29363 [demo] avoid equality propagation of items with subqueries

Author: Yuchen Pei
Author Date: 2024-04-09 06:43:18 UTC

MDEV-29363 [demo] avoid equality propagation of items with subqueries

We update one place to avoid equality propagation of items with
subqueries. It may not be thorough, but is sufficient for the
counterexample in this demo: simply run tests on
main.multiple_equality and notice how it fails in the MDEV-32539 case.

bb-10.5-MDEV-30646 2024-04-08 13:42:28 UTC
MDEV-30646: View created via JSON_ARRAYAGG returns incorrect json object

Author: Rucha Deodhar
Author Date: 2024-04-08 13:42:28 UTC

MDEV-30646: View created via JSON_ARRAYAGG returns incorrect json object

Analysis:
For the JSON typehandler ::type_handler_for_tmp_table() returns
plain VARCHAR. Hence so the VARCHAR field is created in the temporary table.
So 'is_json_type()' check in the append_json_value() fails and we end up
quoting the string additionally.
Fix:
Force treat it as json, because append_json_value() will of course always
append json.

bb-11.5-MDEV-9101-max-tmp-space-used 2024-04-08 12:53:43 UTC
squash! 9831521fc852f72317024778c723e28d121635e6

Author: Monty
Author Date: 2024-04-06 09:07:49 UTC

squash! 9831521fc852f72317024778c723e28d121635e6

MDEV-33680 Server hangs or assertion fails upon SELECT with limited max_tmp_space_usage

The bug was that Aggregator_distinct::add() did not properly handle
write errors. (Old bug exposed by the new code).

bb-11.5-bar-MDEV-11339 2024-04-08 09:21:59 UTC
Fixup 2: MDEV-11339 Implement native UUID4 function

Author: Alexander Barkov
Author Date: 2024-04-05 06:18:28 UTC

Fixup 2: MDEV-11339 Implement native UUID4 function

Adding a template Item_func_uuid_vx to share the code
between the implementations of UUID() and UUIDv4().

bb-11.5-mdev-33734 2024-04-08 06:30:22 UTC
MDEV-33734 Improve the sequence increment inequality testing

Author: Yuchen Pei
Author Date: 2024-03-26 03:37:17 UTC

MDEV-33734 Improve the sequence increment inequality testing

We add an extra condition that makes the inequality testing in
SEQUENCE::increment_value() mathematically watertight, and we cast to
and from unsigned in potential underflow and overflow addition and
subtractions to avoid undefined behaviour.

Let's start by distinguishing between c++ expressions and mathematical
expressions. by c++ expression I mean an expression with the outcome
determined by the compiler/runtime. by mathematical expression I mean
an expression whose value is mathematically determined. So a c++
expression -9223372036854775806 - 1000 at worst can evaluate to any
value due to underflow. A mathematical expression -9223372036854775806
- 1000 evaluates to -9223372036854776806.

The problem boils down to how to write a c++ expression equivalent to
an mathematical expression x + y < z where x and z can take any values
of long long int, and y < 0 is also a long long int. Ideally we want
to avoid underflow, but I'm not sure how this can be done.

The correct c++ form should be (x + y < z || x < z - y || x < z).
Let M=9223372036854775808 i.e. LONGLONG_MAX + 1. We have

-M < x < M - 1
-M < y < 0
-M < z < M - 1

Let's consider the case where x + y < z is true as a mathematical
expression.

If the first disjunct underflows, i.e. the mathematical expression x
+ y < -M. If the arbitrary value resulting from the underflow causes
the c++ expression to hold too, then we are done. Otherwise we move
onto the next expression x < z - y. If there's no overflow in z
- y then we are done. If there's overflow i.e. z - y > M - 1,
and the c++ expression evals to false, then we are onto x < z.
There's no over or underflow here, and it will eval to true. To see
this, note that

x + y < -M means x < -M - y < -M - (-M) = 0
z - y > M - 1 means z > y + M - 1 > - M + M - 1 = -1
so x < z.

Now let's consider the case where x + y < z is false as a mathematical
expression.

The first disjunct will not underflow in this case, so we move to (x <
z - y). This will not overflow. To see this, note that

x + y >= z means z - y <= x < M - 1

So it evals to false too. And the third disjunct x < z also evals to
false because x >= z - y > z.

I suspect that in either case the expression x < z does not determine
the final value of the disjunction in the vast majority cases, which
is why we leave it as the final one in case of the rare cases of both
an underflow and an overflow happening.

Here's an example of both underflow and overflow happening and the
added inequality x < z saves the day:

x = - M / 2
y = - M / 2 - 1
z = M / 2

x + y evals to M - 1 which is > z
z - y evals to - M + 1 which is < x

We can do the same to test x + y > z where the increment y is positive:

(x > z - y || x + y > z || x > z)

And the same analysis applies to unsigned cases.

bb-10.4-mdev-33679 2024-04-08 04:25:17 UTC
MDEV-33679 Spider group by handler: skip on multiple equalities

Author: Yuchen Pei
Author Date: 2024-03-18 02:11:49 UTC

MDEV-33679 Spider group by handler: skip on multiple equalities

The spider group by handler is created in
JOIN::make_aggr_tables_info(), by which time calls to
substitute_for_best_equal_field() should have already removed all the
multiple equalities (i.e. Item_equal, with MULT_EQUAL_FUNC func_type).
Therefore, if there is still such items, it is deemed as an optimizer
bug and should be skipped.

bb-10.4-mdev-33728 2024-04-08 04:21:59 UTC
MDEV-33728 spider: remove use of MYSQL_VERSION_ID and MARIADB_BASE_VERSION

Author: Yuchen Pei
Author Date: 2024-03-20 03:03:52 UTC

MDEV-33728 spider: remove use of MYSQL_VERSION_ID and MARIADB_BASE_VERSION

change created by:

unifdef -DMYSQL_VERSION_ID=100400 -DMARIADB_BASE_VERSION -m storage/spider/spd_* storage/spider/ha_spider.* storage/spider/hs_client/*

basically MDEV-27637, MDEV-27641, MDEV-27655

bb-10.4-mdev-28992 2024-04-08 04:15:34 UTC
MDEV-28992 Spider group by handler: Push down TIMESTAMPDIFF function

Author: Yuchen Pei
Author Date: 2024-03-19 23:36:25 UTC

MDEV-28992 Spider group by handler: Push down TIMESTAMPDIFF function

Also removed ITEM_FUNC_TIMESTAMPDIFF_ARE_PUBLIC.

Similar to pr#2225, with the testcase adapted from that patch:

--8<---------------cut here---------------start------------->8---
From 884f7c6df16236748ca975339e0b1c267e195309 Mon Sep 17 00:00:00 2001
From: "Norio Akagi (norakagi)" <norakagi@amazon.com>
Date: Wed, 3 Aug 2022 23:30:34 -0700
Subject: [PATCH] [MDEV-28992] Push down TIMESTAMP_DIFF in spider

This changes so that TIMESTAMP_DIFF function in a query is pushed down and works natively in Spider.
Instead of directly accessing item's member, now we can rely on a public accessor method to make it work.
Unit tests are added under spider.pushdown_timestamp_diff.

All new code of the whole pull request, including one or several files
that are either new files or modified ones, are contributed under the
BSD-new license. I am contributing on behalf of my employer
Amazon Web Services, Inc.
--8<---------------cut here---------------end--------------->8---

bb-11.0-MDEV-31793-fix-loosescan-derived 2024-04-08 02:46:57 UTC
MDEV-31793 LooseScan join on derived table crashes

Author: Rex Johnston
Author Date: 2024-04-08 02:46:57 UTC

MDEV-31793 LooseScan join on derived table crashes

Test to see if not adding the offending key on the end has any consequences.

knielsen_xa_sched_minimal_fix 2024-04-06 18:03:07 UTC
MDEV-33668: More efficient XA dependency tracking in SQL driver thread

Author: Kristian Nielsen
Author Date: 2024-04-05 16:06:40 UTC

MDEV-33668: More efficient XA dependency tracking in SQL driver thread

Avoid linear scan of all recently queued XIDs in the SQL driver thread,
which might be expensive in XA-heavy workloads and large number of parallel
replication worker threads.

Instead keep a hash in the rpl_parallel_entry of where recently queued XIDs
were scheduled. This allows direct lookup of any potential scheduling
dependency.

Keep a list in each scheduling bucket of recently queued XIDs, and purge the
list (based on generations) when queueing next XA.

Also implement a more fine-grained dependency check based on sub_id
comparison. This can sometimes avoid a scheduling dependency that would
otherwise look necessary based solely on the generation check.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>

bb-10.4-MDEV-28621 2024-04-05 22:50:50 UTC
MDEV-28621 group by optimization incorrectly removing subquery where subject ...

Author: Rex Johnston
Author Date: 2024-04-03 00:55:24 UTC

MDEV-28621 group by optimization incorrectly removing subquery where subject buried in a function

A group by query optimization technique, where the a group by clause in
a subquery can be removed is incorrectly removing references to subquery
items that may be defined and used elsewhere.

This is the initial implementation of a reference counter in the unit
attached to an Item_subquery.

1100 of 2359 results

Other repositories

Name Last Modified
lp:maria 5 hours ago
lp:~maria-captains/maria/+git/connector-c 2018-01-08
12 of 2 results
You can't create new repositories for MariaDB.