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-5 and finished taking 9 minutes — see the log
Import started on juju-98ee42-prod-launchpad-codeimport-4 and finished taking 9 minutes — see the log
Import started on juju-98ee42-prod-launchpad-codeimport-4 and finished taking 8 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-2 and finished taking 8 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 10 minutes — see the log
Import started on juju-98ee42-prod-launchpad-codeimport-0 and finished taking 9 minutes — see the log
Import started on juju-98ee42-prod-launchpad-codeimport-0 and finished taking 6 minutes — see the log
Import started on juju-98ee42-prod-launchpad-codeimport-4 and finished taking 10 minutes — see the log

Branches

Name Last Modified Last Commit
bb-11.5-bar-MDEV-25829 2024-03-29 05:14:21 UTC
Cherry-picking from 10.5: MDEV-33788 HEX(COLUMN_CREATE(.. AS CHAR ...)) fails...

Author: Alexander Barkov
Author Date: 2024-03-28 10:01:43 UTC

Cherry-picking from 10.5: MDEV-33788 HEX(COLUMN_CREATE(.. AS CHAR ...)) fails with --view-protocol

Item_func_dyncol_create::print_arguments() printed only CHARSET clause
without COLLATE.

Therefore,

HEX(column_create(1,'1212' AS CHAR CHARACTER SET utf8mb3 COLLATE utf8mb3_bin))

inside a VIEW changed to just:

HEX(column_create(1,'1212' AS CHAR CHARACTER SET utf8mb3))

which changed the collation ID seen in the HEX output.

Note, the collation ID inside column_create() is not really much important.
(It's only important what the character set is).
And for COLLATE, the more important thing is what's later written
in the AS clause of COLUMN_GET:

SELECT
   COLUMN_GET(
    column_create(1,'1212' AS CHAR CHARACTER SET utf8mb3 COLLATE utf8mb3_bin)
    column_nr AS type -- this type is more important
   );

Still, let's add the COLLATE clause into the COLUMN_CREATE() print output,
although it's not important for now for anything else than just the HEX output.
At least to make VIEW work in a more predictable way with HEX(COLUMN_CREATE()).

Also, in the future we can start using somehow the collation ID written inside
COLUMN_CREATE(), for example by making the `AS type` clause optional in
COLUMN_GET():
  COLUMN_GET(dyncol_blob, column_nr [AS type]);
instead of:
  COLUMN_GET(dyncol_blob, column_nr AS type);

SQL Server compatibility layer may need this for
the SQL_Variant data type support.

bb-10.5-bar-MDEV-33788 2024-03-29 01:45:06 UTC
MDEV-33788 HEX(COLUMN_CREATE(.. AS CHAR ...)) fails with --view-protocol

Author: Alexander Barkov
Author Date: 2024-03-28 10:01:43 UTC

MDEV-33788 HEX(COLUMN_CREATE(.. AS CHAR ...)) fails with --view-protocol

Item_func_dyncol_create::print_arguments() printed only CHARSET clause
without COLLATE.

Therefore,

HEX(column_create(1,'1212' AS CHAR CHARACTER SET utf8mb3 COLLATE utf8mb3_bin))

inside a VIEW changed to just:

HEX(column_create(1,'1212' AS CHAR CHARACTER SET utf8mb3))

which changed the collation ID seen in the HEX output.

Note, the collation ID inside column_create() is not really much important.
(It's only important what the character set is).
And for COLLATE, the more important thing is what's later written
in the AS clause of COLUMN_GET:

SELECT
   COLUMN_GET(
    column_create(1,'1212' AS CHAR CHARACTER SET utf8mb3 COLLATE utf8mb3_bin)
    column_nr AS type -- this type is more important
   );

Still, let's add the COLLATE clause into the COLUMN_CREATE() print output,
although it's not important for now for anything else than just the HEX output.
At least to make VIEW work in a more predictable way with HEX(COLUMN_CREATE()).

Also, in the future we can start using somehow the collation ID written inside
COLUMN_CREATE(), for example by making the `AS type` clause optional in
COLUMN_GET():
  COLUMN_GET(dyncol_blob, column_nr [AS type]);
instead of:
  COLUMN_GET(dyncol_blob, column_nr AS type);

SQL Server compatibility layer may need this for
the SQL_Variant data type support.

10.5 2024-03-29 01:45:06 UTC
MDEV-33788 HEX(COLUMN_CREATE(.. AS CHAR ...)) fails with --view-protocol

Author: Alexander Barkov
Author Date: 2024-03-28 10:01:43 UTC

MDEV-33788 HEX(COLUMN_CREATE(.. AS CHAR ...)) fails with --view-protocol

Item_func_dyncol_create::print_arguments() printed only CHARSET clause
without COLLATE.

Therefore,

HEX(column_create(1,'1212' AS CHAR CHARACTER SET utf8mb3 COLLATE utf8mb3_bin))

inside a VIEW changed to just:

HEX(column_create(1,'1212' AS CHAR CHARACTER SET utf8mb3))

which changed the collation ID seen in the HEX output.

Note, the collation ID inside column_create() is not really much important.
(It's only important what the character set is).
And for COLLATE, the more important thing is what's later written
in the AS clause of COLUMN_GET:

SELECT
   COLUMN_GET(
    column_create(1,'1212' AS CHAR CHARACTER SET utf8mb3 COLLATE utf8mb3_bin)
    column_nr AS type -- this type is more important
   );

Still, let's add the COLLATE clause into the COLUMN_CREATE() print output,
although it's not important for now for anything else than just the HEX output.
At least to make VIEW work in a more predictable way with HEX(COLUMN_CREATE()).

Also, in the future we can start using somehow the collation ID written inside
COLUMN_CREATE(), for example by making the `AS type` clause optional in
COLUMN_GET():
  COLUMN_GET(dyncol_blob, column_nr [AS type]);
instead of:
  COLUMN_GET(dyncol_blob, column_nr AS type);

SQL Server compatibility layer may need this for
the SQL_Variant data type support.

bb-10.5-elenst 2024-03-28 23:57:21 UTC
Test commit

Author: Elena Stepanova
Author Date: 2024-03-28 23:57:21 UTC

Test commit

bb-10.5-serg 2024-03-28 23:55:59 UTC
and more

Author: Sergei Golubchik
Author Date: 2024-03-28 23:55:59 UTC

and more

bb-10.5-nikita-MDEV-30046 2024-03-28 21:34:24 UTC
Refactor REPLACE

Author: Nikita Malyavin
Author Date: 2023-01-18 11:49:35 UTC

Refactor REPLACE

bb-10.5-MDEV-33677-galera 2024-03-28 18:35:25 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

10.6-MDEV-33672 2024-03-28 16:36:54 UTC
MDEV-33672: Gtid_log_event Construction from File Should Ensure Event Length ...

Author: Brandon Nesterenko
Author Date: 2024-03-13 20:42:28 UTC

MDEV-33672: Gtid_log_event Construction from File Should Ensure Event Length When Using Extra Flags

A GTID event can have variable length, with contributing factors
such as the variable length from the flags2 and optional extra flags
fields. These fields are bitmaps, where each set bit indicates an
additional value that should be appended to the event, e.g.
multi-engine transactions append a number to indicate the number of
additional engines a transaction uses. However, if a flags bit is
set, and no additional fields are appended to the event, MDEV-33672
reports that the server can still try to read from memory as if it
did exist. Note, however, in debug builds, this condition is
asserted for FL_EXTRA_MULTI_ENGINE.

This patch fixes this to check that the length of the event is
aligned with the expectation set by the flags for FL_PREPARED_XA,
FL_COMPLETED_XA, and FL_EXTRA_MULTI_ENGINE.

Reviewed By:
============
Kristian Nielsen <knielsen@knielsen-hq.org>

10.6-MDEV-33757-TrxUndoRsegs 2024-03-28 16:23:13 UTC
MDEV-33757 Get rid of TrxUndoRsegs code

Author: Vlad Lesin
Author Date: 2024-03-23 18:37:55 UTC

MDEV-33757 Get rid of TrxUndoRsegs code

TrxUndoRsegs is wrapper for vector of trx_rseg_t*. It has two
constructors, both initialize the vector with only one element. And they
are used to push transactions rseg(the singular) to purge queue. There is
no function to add elements to the vector. The default constructor is used
only for declaration of NullElement.

The TrxUndoRsegs was introduced in WL#6915 in MySQL 5.7 and. MySQL 5.7
would unnecessarily let the purge of history parse the
temporary undo records, and then look up the table (via a global hash
table), and only at the point of processing the parsed undo log record
determine that the table is a temporary table and the undo record must be
thrown away.

In MariaDB 10.2 we have two disjoint sets of rollback segments (128 for
persistent, 128 for temporary), and purge does not even see the temporary
tables. The only reason why temporary tables are visible to other threads
is a SQL layer bug (MDEV-17805).

purge_sys_t::choose_next_log(): merge the relevant part
of TrxUndoRsegsIterator::set_next() to the start of
purge_sys_t::choose_next_log().

purge_sys_t::rseg_get_next_history_log(): add a tail call of
purge_sys_t::choose_next_log() and adjust the callers, to simplify the
control flow further.

purge_sys.pq_mutex and purge_sys.purge_queue: make it private by adding
some simple accessor function.

trx_purge_cleanse_purge_queue(): make it a member of purge_sys_t to have
have access to private purge_sys.pq_mutex and purge_sys.purge_queue,
simplify the code with using simple array copy and clearing purge queue
instead of poping each purge queue element.

Thanks Marko Mäkelä for historical overview of TrxUndoRsegs development.

Reviewed by: Marko Mäkelä

10.5-mdev-32397 2024-03-28 16:16:25 UTC
MDEV-32397 join_read_first, keyread SEGV crash

Author: Dave Gosselin
Author Date: 2024-03-27 21:09:55 UTC

MDEV-32397 join_read_first, keyread SEGV crash

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 cleanup operations performed prematurely
during the subselect, before the outer query has finished with the table.

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 when we call
ha_end_keyread() until the end of the parent query.

11.0-MDEV-33545 2024-03-28 13:12:55 UTC
MDEV-33545: Improve innodb_doublewrite to cover NO_FSYNC

Author: Marko Mäkelä
Author Date: 2024-03-28 13:12:55 UTC

MDEV-33545: Improve innodb_doublewrite to cover NO_FSYNC

In commit 24648768b443f6adeb8a0f4302958bfb300d536f (MDEV-30136)
the parameter innodb_flush_method was deprecated, with no direct
replacement for innodb_flush_method=O_DIRECT_NO_FSYNC.

Let us change innodb_doublewrite from Boolean to ENUM that can
be changed while the server is running:

OFF: Assume that writes of innodb_page_size are atomic
ON: Prevent torn writes (the default)
fearless: Like OFF, but avoid fsync() on data files
fast: Like ON, but avoid fsync() on data files

The deprecated start-up parameter innodb_flush_method=NO_FSYNC will cause
the innodb_doublewrite to be changed to "fearless" or "fast",
which will prevent InnoDB from making any durable writes to data files.
This would normally be done right before the log checkpoint LSN is updated.
Depending on the file systems being used and their configuration,
this may or may not be safe.

The value innodb_doublewrite=fast differs from the previous combination of
innodb_doublewrite=ON and innodb_flush_method=O_DIRECT_NO_FSYNC by always
invoking os_file_flush() on the doublewrite buffer itself
in buf_dblwr_t::flush_buffered_writes_completed(). This should be safer
when there are multiple doublewrite batches between checkpoints.
Typically, once per second, buf_flush_page_cleaner() would write out
up to innodb_io_capacity pages and advance the log checkpoint.
Also typically, innodb_io_capacity>128, which is the size of the
doublewrite buffer in pages. Should os_file_flush_func() not be invoked
between doublewrite batches, writes could be reordered in an unsafe way.

The setting innodb_doublewrite=fast could be safe when the doublewrite
buffer (the first file of the system tablespace) and the data files
reside in the same file system.

This was tested by running "./mtr --rr innodb.alter_kill". On the first
server startup, with innodb_doublewrite=fearless, os_file_flush_func()
would only be invoked on the ib_logfile0 (and not even then when using
a memory-mapped log). On subsequent startups with innodb_doublewrite=OFF,
os_file_flush_func() will be invoked on data files during log_checkpoint().

Note: The setting debug_no_sync (in the code, my_disable_sync) would also
disable durable writes to the log file or the doublewrite buffer,
which would be much less safe.

IORequest::Type: Introduce special values WRITE_DBL and PUNCH_DBL
for asynchronous writes that are submitted via the doublewrite buffer.
In this way, fil_space_t::use_doublewrite() or buf_dblwr.in_use()
will only be consulted during buf_page_t::flush() and the doublewrite
buffer can be enabled or disabled without any fear of inconsistency.

buf_dblwr_t::block_size: Replaces block_size().

buf_dblwr_t::flush_buffered_writes(): If !in_use() and the doublewrite
buffer is empty, just invoke fil_flush_file_spaces() and return. The
doublewrite buffer could have been disabled while a batch was in
progress.

innodb_init_params(): If innodb_flush_method=O_DIRECT_NO_FSYNC,
set innodb_doublewrite=fast or innodb_doublewrite=fearless.

Thanks to Mark Callaghan for reporting this, and Vladislav Vaintroub
for feedback.

10.6-MDEV-20094 2024-03-28 11:35:19 UTC
MDEV-20094 MariaDB Server 10.2 grows .ibd files faster than 10.1

Author: THIRUNARAYANAN BALATHANDAYUTHAPANI
Author Date: 2024-03-28 11:35:19 UTC

MDEV-20094 MariaDB Server 10.2 grows .ibd files faster than 10.1

- InnoDB reserves the free extents unnecessarily during blob
page allocation even though btr_page_alloc() can handle
reserving the extent when the existing ran out of pages to be used.

11.1 2024-03-28 10:15:36 UTC
Merge 11.0 into 11.1

Author: Marko Mäkelä
Author Date: 2024-03-28 10:15:36 UTC

Merge 11.0 into 11.1

bb-10.6-MDEV-33216-galera 2024-03-28 10:00:06 UTC
MDEV-33216 stack-use-after-return in Wsrep_schema_impl::open_table()

Author: Daniele Sciascia
Author Date: 2024-01-10 13:34:12 UTC

MDEV-33216 stack-use-after-return in Wsrep_schema_impl::open_table()

Fix a case of stack-use-after-return reported by ASAN in
Wsrep_schema_impl::open_table(). This function has a stack allocated
TABLE_LIST object and return TABLE_LIST::table to the caller.
Changed the function to take a TABLE_LIST pointer as argument.

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

bb-10.5-MDEV-33216-galera 2024-03-28 09:56:57 UTC
MDEV-33216 stack-use-after-return in Wsrep_schema_impl::open_table()

Author: Daniele Sciascia
Author Date: 2024-01-10 13:34:12 UTC

MDEV-33216 stack-use-after-return in Wsrep_schema_impl::open_table()

Fix a case of stack-use-after-return reported by ASAN in
Wsrep_schema_impl::open_table(). This function has a stack allocated
TABLE_LIST object and return TABLE_LIST::table to the caller.
Changed the function to take a TABLE_LIST pointer as argument.

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

10.4 2024-03-28 09:55:37 UTC
MDEV-33216 stack-use-after-return in Wsrep_schema_impl::open_table()

Author: Daniele Sciascia
Author Date: 2024-01-10 13:34:12 UTC

MDEV-33216 stack-use-after-return in Wsrep_schema_impl::open_table()

Fix a case of stack-use-after-return reported by ASAN in
Wsrep_schema_impl::open_table(). This function has a stack allocated
TABLE_LIST object and return TABLE_LIST::table to the caller.
Changed the function to take a TABLE_LIST pointer as argument.

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

bb-10.4-MDEV-33216-galera 2024-03-28 09:55:37 UTC
MDEV-33216 stack-use-after-return in Wsrep_schema_impl::open_table()

Author: Daniele Sciascia
Author Date: 2024-01-10 13:34:12 UTC

MDEV-33216 stack-use-after-return in Wsrep_schema_impl::open_table()

Fix a case of stack-use-after-return reported by ASAN in
Wsrep_schema_impl::open_table(). This function has a stack allocated
TABLE_LIST object and return TABLE_LIST::table to the caller.
Changed the function to take a TABLE_LIST pointer as argument.

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

11.0 2024-03-28 08:51:36 UTC
Merge 10.11 into 11.0

Author: Marko Mäkelä
Author Date: 2024-03-28 08:51:36 UTC

Merge 10.11 into 11.0

bb-10.5-MDEV-33768 2024-03-28 07:53:58 UTC
MDEV-33768: Memory leak found in the test main.constraints run with --ps-prot...

Author: Dmitry Shulga
Author Date: 2024-03-27 13:44:05 UTC

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

The discovered memory leak was introduced by the commit
  762bf7a03b6214f091a66ca8683df341112d7d4a
    (MDEV-22602 Disable UPDATE CASCADE for SQL constraints)

The reason why a memory leaked on running the test main.constraints
is that a statement arena was used for allocation a memory
for storing a constraint name. A constraint name is an entity having
temporary nature by its design so runtime arena should be used for its
allocation.

10.11 2024-03-28 07:21:48 UTC
MDEV-33515 fixup for POWER

Author: Marko Mäkelä
Author Date: 2024-03-28 07:21:48 UTC

MDEV-33515 fixup for POWER

bb-10.4-mdev-30727 2024-03-28 06:00:12 UTC
MDEV-30727 Check spider_hton_ptr in spider direct sql udf

Author: Yuchen Pei
Author Date: 2024-03-28 06:00:12 UTC

MDEV-30727 Check spider_hton_ptr in spider direct sql udf

I cannot call my_error() at the beginning of spider_direct_sql_body()
without getting segv of my_error pointing to an invalid address.

bb-10.5-MDEV-33767 2024-03-28 04:54:23 UTC
MDEV-33767: Memory leaks found in some tests run with --ps-protocol against a...

Author: Dmitry Shulga
Author Date: 2024-03-27 15:55:15 UTC

MDEV-33767: Memory leaks found in some tests run with --ps-protocol against a server built with the option -DWITH_PROTECT_STATEMENT_MEMROOT

Found memory leaks were introduced by the commit
  a896bebfa6d00b0bb7685956196a7977d9273652
  MDEV-18844 Implement EXCEPT ALL and INTERSECT ALL operations
and caused by using a statement arena instead a runtime arena for
allocation of objects having temporary life span by their nature.
Aforementioned memory leaks were produced by running queries
that typically use select with intersect, union or table values
constructors.

To fix these memory leaks use the runtime arena for allocation
of Item_field objects used by set operations.

Additionally, OOM handling added on allocation of aforementioned
Item_field objects.

bb-10.4-MDEV-14959-1 2024-03-28 04:48:32 UTC
MDEV-14959: the follow-up patch to turn on the option -DWITH_PROTECT_STATEMEN...

Author: Dmitry Shulga
Author Date: 2024-03-28 04:48:32 UTC

MDEV-14959: the follow-up patch to turn on the option -DWITH_PROTECT_STATEMENT_MEMROOT by default

bb-10.5-mdev-33731 2024-03-28 00:04:45 UTC
MDEV-33731 Only iterate over m_locked_partitions in update_next_auto_inc_val()

Author: Yuchen Pei
Author Date: 2024-03-28 00:04:45 UTC

MDEV-33731 Only iterate over m_locked_partitions in update_next_auto_inc_val()

Only locked will participate in the query in this case.

bb-10.4-mdev-33661-partial 2024-03-27 22:32:59 UTC
MDEV-33661 MENT-1591 Fix spider/bugfix.mdev_28856 because of MDEV-29718.

Author: Yuchen Pei
Author Date: 2024-03-13 02:11:07 UTC

MDEV-33661 MENT-1591 Fix spider/bugfix.mdev_28856 because of MDEV-29718.

The failure should be table not found, rather than no spider same
server link

bb-10.4-mdev-33661 2024-03-27 22:32:59 UTC
MDEV-33661 MENT-1591 Keep spider in memory until exit in ASAN builds

Author: Yuchen Pei
Author Date: 2024-03-13 02:11:15 UTC

MDEV-33661 MENT-1591 Keep spider in memory until exit in ASAN builds

Same as MDEV-29579. For some reason, libodbc does not clean up
properly if unloaded too early with the dlclose() of spider. So we add
UNIQUE symbols to spider so the spider does not reload in dlclose().

This change, however, uncovers some hidden problems in the spider
codebase, for which we move the initialisation of some spider global
variables into the initialisation of spider itself.

Spider has some global variables. Their initialisation should be done
in the initialisation of spider itself, otherwise, if spider were
re-initialised without these symbol being unloaded, the values could
be inconsistent and causing issues.

One such issue is caused by the variables
spider_mon_table_cache_version and spider_mon_table_cache_version_req.
They are used for resetting the spider monitoring table cache and have
initial values of 0 and 1 respectively. We have that always
spider_mon_table_cache_version_req >= spider_mon_table_cache_version,
and when the relation is strict, the cache is reset,
spider_mon_table_cache_version is brought to be equal to
spider_mon_table_cache_version_req, and the cache is searched for
matching table_name, db_name and link_idx. If the relation is equal,
no reset would happen and the cache would be searched directly.

When spider is re-inited without resetting the values of
spider_mon_table_cache_version and spider_mon_table_cache_version_req
that were set to be equal in the previous cache reset action, the
cache was emptied in the previous spider deinit, which would result in
HA_ERR_KEY_NOT_FOUND unexpectedly.

An alternative way to fix this issue would be to call the spider udf
spider_flush_mon_cache_table(), which increments
spider_mon_table_cache_version_req thus making sure the inequality is
strict. However, there's no reason for spider to initialise these
global variables on dlopen(), rather than on spider init, which is
cleaner and "purer".

To reproduce this issue, simply revert the changes involving the two
variables and then run:

mtr --no-reorder spider.ha{,_part}

bb-11.4-midenok-MDEV-20865 2024-03-27 19:56:10 UTC
MDEV-33780 Server crashes on renaming of table if table is locked

Author: midenok
Author Date: 2024-03-27 19:55:38 UTC

MDEV-33780 Server crashes on renaming of table if table is locked

Under LOCK TABLES there is no ticket for old_table.

10.6 2024-03-27 13:00:56 UTC
Merge 10.5 into 10.6

Author: Marko Mäkelä
Author Date: 2024-03-27 13:00:56 UTC

Merge 10.5 into 10.6

10.6-MDEV-33779 2024-03-27 11:42:10 UTC
MDEV-33779 ha_innobase::index_read() and ha_innobase::rnd_pos() could be faster

Author: Marko Mäkelä
Author Date: 2024-03-27 11:42:10 UTC

MDEV-33779 ha_innobase::index_read() and ha_innobase::rnd_pos() could be faster

We have quite a few assertions
ut_a(m_prebuilt->trx == thd_to_trx(ha_thd()));
in low-level functions.
These had better be debug assertions for performance reasons.
It should suffice to check that condition in the less frequently invoked
ha_innobase::change_active_index().

ha_innobase::index_read(): Only branch on find_flag once, and
simplify the error handling after invoking row_search_mvcc().

ha_innobase::rnd_pos(): Remove an assertion that is duplicating one
in ha_innobase::index_read(), which we are calling unconditionally.

bb-11.5-timestamp 2024-03-27 11:28:18 UTC
squash! 9831521fc852f72317024778c723e28d121635e6

Author: Monty
Author Date: 2024-03-26 20:10:46 UTC

squash! 9831521fc852f72317024778c723e28d121635e6

- Added Max_tmp_disk_space_used to slow query log.
- Fixed some bugs in log_slow_innodb.test
- Fixed that Filesort_on_disk in slow query log works again
  (A commit in 10.10 caused it to be always 'No')

bb-10.4-MDEV-26499-galera 2024-03-27 03:31:45 UTC
galera: wsrep-lib submodule update

Author: Julius Goryavsky
Author Date: 2024-03-27 00:23:42 UTC

galera: wsrep-lib submodule update

bb-10.5-ycp 2024-03-27 02:41:44 UTC
MDEV-33731 Only iterate over m_locked_partitions in update_next_auto_inc_val()

Author: Yuchen Pei
Author Date: 2024-03-27 02:41:44 UTC

MDEV-33731 Only iterate over m_locked_partitions in update_next_auto_inc_val()

bb-10.4-mdev-33584 2024-03-27 00:40:41 UTC
MDEV-33584 Use the default SQL_MODE for spider init queries

Author: Yuchen Pei
Author Date: 2024-03-27 00:40:41 UTC

MDEV-33584 Use the default SQL_MODE for spider init queries

This should fix all future problems caused by a non-default global
sql_mode from the server where spider is to be installed.

bb-10.4-ycp 2024-03-27 00:25:15 UTC
MDEV-33777 Spider: Correct checks for show index column numbers

Author: Yuchen Pei
Author Date: 2024-03-27 00:15:25 UTC

MDEV-33777 Spider: Correct checks for show index column numbers

It was updated for 10.6+ in MDEV-7317. Because a lower version spider
node may connect to a higher version data node, we need to change this
for 10.4 and 10.5 as well.

bb-10.4-mdev-33777 2024-03-27 00:25:15 UTC
MDEV-33777 Spider: Correct checks for show index column numbers

Author: Yuchen Pei
Author Date: 2024-03-27 00:15:25 UTC

MDEV-33777 Spider: Correct checks for show index column numbers

It was updated for 10.6+ in MDEV-7317. Because a lower version spider
node may connect to a higher version data node, we need to change this
for 10.4 and 10.5 as well.

bb-10.5-mdev-33777 2024-03-27 00:15:25 UTC
MDEV-33777 Spider: Correct checks for show index column numbers

Author: Yuchen Pei
Author Date: 2024-03-27 00:15:25 UTC

MDEV-33777 Spider: Correct checks for show index column numbers

It was updated for 10.6+ in MDEV-7317. Because a lower version spider
node may connect to a higher version data node, we need to change this
for 10.4 and 10.5 as well.

bb-10.11-midenok 2024-03-26 11:45:28 UTC
MDEV-29872 MSAN/Valgrind uninitialised value errors in TABLE::vers_switch_par...

Author: midenok
Author Date: 2023-11-15 10:20:06 UTC

MDEV-29872 MSAN/Valgrind uninitialised value errors in TABLE::vers_switch_partition

Delayed_insert has its own THD (initialized at mysql_insert()) and
hence its own LEX. Delayed_insert initalizes a very few parameters for
LEX and 'duplicates' is not in this list. Now we copy this missing
parameter from parser LEX (as well as sql_command).

bb-11.4-midenok 2024-03-26 11:26:43 UTC
MDEV-33125 CHECK TABLE does not recognize corruption

Author: midenok
Author Date: 2024-03-26 11:26:43 UTC

MDEV-33125 CHECK TABLE does not recognize corruption
after EXCHANGE WITHOUT VALIDATION on system-time partitioning

MDEV-21011 disabled this check if there is no INTERVAL on history
partitions as the rows may be in any history partition. Now we
reenable the check and allow this condition.

bb-11.5-midenok 2024-03-26 11:20:05 UTC
MDEV-27293 Allow converting a versioned table from implicit

Author: midenok
Author Date: 2024-03-13 22:39:14 UTC

MDEV-27293 Allow converting a versioned table from implicit
           to explicit row_start/row_end columns

In case of adding both system fields of same type (length, unsigned
flag) as old implicit system fields do the rename of implicit system
fields to the ones specified in ALTER, remove SYSTEM_INVISIBLE flag in
that case. Correct PERIOD clause must be specified in ALTER as well.

bb-11.5-bar-MDEV-31340 2024-03-26 11:13:24 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-10.5-hf 2024-03-26 10:00:19 UTC
MDEV-33393 audit plugin do not report user did the action.

Author: Alexey Botchkov
Author Date: 2024-03-07 12:02:35 UTC

MDEV-33393 audit plugin do not report user did the action.

Specific test for the auditing plugin v1 instead of the rpl_auditing
test.

bb-10.4-MDEV-33747 2024-03-26 09:45:36 UTC
MDEV-33747: Optimization of (SELECT) IN (SELECT ...) executes subquery at pre...

Author: Sergey Petrunia
Author Date: 2024-03-22 11:04:46 UTC

MDEV-33747: Optimization of (SELECT) IN (SELECT ...) executes subquery at prepare stage

Make IN->EXISTS rewrite not to compute constant left expression if it
has a subquery in it.

bb-10.6-MDEV-28621-v3-eliminate-carefully 2024-03-26 07:52:25 UTC
MDEV-28621: group by optimization incorrectly removing subquery

Author: Sergey Petrunia
Author Date: 2024-03-25 10:53:55 UTC

MDEV-28621: group by optimization incorrectly removing subquery

Try a different approach at removal: remove only "local" subqueries
for which we can't find any other references in the select list.

10.6-MDEV-33588 2024-03-26 07:32:54 UTC
fixup! a8cfde313dd403533003272b410a8229ce4928f6

Author: Marko Mäkelä
Author Date: 2024-03-26 07:32:54 UTC

fixup! a8cfde313dd403533003272b410a8229ce4928f6

Avoid a double-release of reference count and page latch

10.11-MDEV-33087 2024-03-26 05:59:06 UTC
MDEV-33087 ALTER TABLE...ALGORITHM=COPY should build indexes more efficiently

Author: THIRUNARAYANAN BALATHANDAYUTHAPANI
Author Date: 2024-03-25 13:08:31 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.

bb-10.6-MDEV-33136-galera 2024-03-26 05:46:20 UTC
MDEV-33136: Properly BF-abort user transactions with explicit locks

Author: Denis Protivensky
Author Date: 2024-02-06 08:55:04 UTC

MDEV-33136: Properly BF-abort user transactions with explicit locks

User transactions may acquire explicit MDL locks from InnoDB level
when persistent statistics is re-read for a table.
If such a transaction would be subject to BF-abort, it was improperly
detected as a system transaction and wouldn't get aborted.

The fix: Check if a transaction holding explicit MDL locks is a user
transaction in the MDL conflict handling code.

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

bb-10.6-MDEV-33509-galera 2024-03-26 05:45:46 UTC
MDEV-33509 Failed to apply write set with flags=(rollback|pa_unsafe)

Author: Daniele Sciascia
Author Date: 2024-03-21 13:03:19 UTC

MDEV-33509 Failed to apply write set with flags=(rollback|pa_unsafe)

Fix function `remove_fragment()` in wsrep_schema so that no error is
raised if the fragment to be removed is not found in the
wsrep_streaming_log table. This is necessary to handle the case where
streaming transaction in idle state is BF aborted. This may result in
the case where the rollbacker thread successfully removes the
transaction's fragments, followed by the applier's attempt to remove
the same fragments. Causing the node to leave the cluster after
reporting a "Failed to apply write set" error.

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

bb-10.5-MDEV-33509-galera 2024-03-26 05:44:20 UTC
MDEV-33509 Failed to apply write set with flags=(rollback|pa_unsafe)

Author: Daniele Sciascia
Author Date: 2024-03-21 13:03:19 UTC

MDEV-33509 Failed to apply write set with flags=(rollback|pa_unsafe)

Fix function `remove_fragment()` in wsrep_schema so that no error is
raised if the fragment to be removed is not found in the
wsrep_streaming_log table. This is necessary to handle the case where
streaming transaction in idle state is BF aborted. This may result in
the case where the rollbacker thread successfully removes the
transaction's fragments, followed by the applier's attempt to remove
the same fragments. Causing the node to leave the cluster after
reporting a "Failed to apply write set" error.

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

11.5 2024-03-26 03:57:56 UTC
MDEV-33739 Check field type of the first field in check_sequence_fields()

Author: Yuchen Pei
Author Date: 2024-03-22 04:29:41 UTC

MDEV-33739 Check field type of the first field in check_sequence_fields()

This avoids non-integral types breaking the call of
sequence_structure().

bb-11.5-mdev-33739 2024-03-26 03:57:56 UTC
MDEV-33739 Check field type of the first field in check_sequence_fields()

Author: Yuchen Pei
Author Date: 2024-03-22 04:29:41 UTC

MDEV-33739 Check field type of the first field in check_sequence_fields()

This avoids non-integral types breaking the call of
sequence_structure().

bb-11.5-ycp-mtr-ubsan-overflow 2024-03-26 03:52:16 UTC
remove "for ubsan" see what happens

Author: Yuchen Pei
Author Date: 2024-03-26 03:52:16 UTC

remove "for ubsan" see what happens

bb-11.5-mdev-33734 2024-03-26 03:37:17 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.6-MDEV-28621-delayed-elimination 2024-03-26 03:04:08 UTC
MDEV-28621 what if we delay actual subquery removal to the end of the optimi...

Author: Rex Johnston
Author Date: 2024-03-21 23:57:16 UTC

MDEV-28621 what if we delay actual subquery removal to the end of the optimization phase?

not sure this is the best way to do it, but at least is has the virtue
of being mildly cunning by leaving the actual subquery removal to end of
the optimization phase and untaging something for removal if we walk
into it earlier in the optimization.

bb-10.6-MDEV-30456-galera 2024-03-26 01:14:59 UTC
Re-enable MTR test galera_sr.GCF-1060

Author: Daniele Sciascia
Author Date: 2023-05-11 08:19:26 UTC

Re-enable MTR test galera_sr.GCF-1060

Test seems to pass reliably now.

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

bb-10.5-MDEV-30456-galera 2024-03-26 01:13:38 UTC
Re-enable MTR test galera_sr.GCF-1060

Author: Daniele Sciascia
Author Date: 2023-05-11 08:19:26 UTC

Re-enable MTR test galera_sr.GCF-1060

Test seems to pass reliably now.

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

scope_exit 2024-03-26 01:03:14 UTC
REfactor REPLACE!!!!

Author: Nikita Malyavin
Author Date: 2023-01-18 11:49:35 UTC

REfactor REPLACE!!!!

bb-10.5-MDEV-32633-galera 2024-03-25 13:40:55 UTC
MDEV-32633: Fix Galera cluster <-> native replication interaction

Author: Denis Protivensky
Author Date: 2024-03-25 13:40:55 UTC

MDEV-32633: Fix Galera cluster <-> native replication interaction

It's possible to establish Galera multi-cluster setups connected
through the native replication when every Galera cluster is configured
to have a separate domain ID.
For this setup to work, we need to replace domain ID values in generated
GTID events when they are written at transaction commit to the values
configured by Wsrep replication.

At the same time, it's possible that the GTID event already contains
a correct domain ID if it comes through the native replication from
another Galera cluster.
In this case, when such an event is applied either through a native
replication slave thread or through Wsrep applier, we write GTID event
on transaction start and avoid writing it during transaction commit.

The code contained multiple problems that were fixed:
- applying GTID events didn't work because it's applied without a
running server transaction and Wsrep transaction was not started
- GTID event generation on transaction start didn't contain proper
"standalone" and "is_transactional" flags that the original applied
GTID event contained
- condition determining that GTID event is written on transaction start
to avoid writing it on commit relied on the fact that the GTID event
is the first found in transaction/statement caches, which wasn't the
case and resulted in duplicate GTID events written
- instead of relying on the caches to find a GTID event, a simple check
is introduced that follows the exact rules for checking if event is
written at transaction start as described above
- the test case is improved to check that exact GTID events are
applied after two Galera clusters have synced.

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

bb-10.4-MDEV-32633-galera 2024-03-25 12:02:21 UTC
MDEV-32633: Fix Galera cluster <-> native replication interaction

Author: Denis Protivensky
Author Date: 2024-03-05 08:51:04 UTC

MDEV-32633: Fix Galera cluster <-> native replication interaction

It's possible to establish Galera multi-cluster setups connected
through the native replication when every Galera cluster is configured
to have a separate domain ID.
For this setup to work, we need to replace domain ID values in generated
GTID events when they are written at transaction commit to the values
configured by Wsrep replication.

At the same time, it's possible that the GTID event already contains
a correct domain ID if it comes through the native replication from
another Galera cluster.
In this case, when such an event is applied either through a native
replication slave thread or through Wsrep applier, we write GTID event
on transaction start and avoid writing it during transaction commit.

The code contained multiple problems that were fixed:
- applying GTID events didn't work because it's applied without a
running server transaction and Wsrep transaction was not started
- GTID event generation on transaction start didn't contain proper
"standalone" and "is_transactional" flags that the original applied
GTID event contained
- condition determining that GTID event is written on transaction start
to avoid writing it on commit relied on the fact that the GTID event
is the first found in transaction/statement caches, which wasn't the
case and resulted in duplicate GTID events written
- instead of relying on the caches to find a GTID event, a simple check
is introduced that follows the exact rules for checking if event is
written at transaction start as described above
- the test case is improved to check that exact GTID events are
applied after two Galera clusters have synced.

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

bb-11.1-MDEV-33533 2024-03-25 03:32:04 UTC
MDEV-33533 Crash at execution of DELETE when trying to use rowid filter

Author: Igor Babaev
Author Date: 2024-03-25 03:32:04 UTC

MDEV-33533 Crash at execution of DELETE when trying to use rowid filter

This bug could cause a crash of the server when executing multi-delete if
the optimization using rowid filters was allowed. The same problem could
be observed for a delete if it was converted into multi-delete, in
particular for a delete containing IN subqueries. The problem could appear
only if the query used InnoDB tables.

Multi-delete as well as multu-update usually is executed in two phases:
first a corresponding select is performed to find the records to be
affected by the command, then delete/update of these records is carried
out. If select uses a rowid filter to access the table whose records are
to be deleted/updated then the filter should be disabled for the second
phase. Otherwise it can confuse the used storage engine what could be seen
at execution of the query reported for the bug.

Disabling of the rowid filter at the second phase of multi-update execution
was added earlier, but execution of multi-delete missed it.

Approved by Oleksandr Byelkin <sanja@mariadb.com>

bb-10.4-mdev-33742 2024-03-25 03:06:59 UTC
MDEV-33742 Do not create group by handler when all tables are constant

Author: Yuchen Pei
Author Date: 2024-03-25 03:00:11 UTC

MDEV-33742 Do not create group by handler when all tables are constant

Also removed a macro PARTITION_HAS_GET_CHILD_HANDLERS which is defined
in spd_environ.h, similar to MDEV-27658.

bb-10.11-ycp 2024-03-25 02:17:24 UTC
MDEV-33220 Fix -wmaybe-uninitialized warnings for g++-13

Author: Yuchen Pei
Author Date: 2024-03-21 06:17:53 UTC

MDEV-33220 Fix -wmaybe-uninitialized warnings for g++-13

bb-11.5-mdev-31789 2024-03-25 01:51:13 UTC
MDEV-31789 Deprecate spider_casual_read

Author: Yuchen Pei
Author Date: 2024-02-21 01:19:26 UTC

MDEV-31789 Deprecate spider_casual_read

The corresponding table param was deprecated as part of MDEV-28861

bb-10.6-MDEV-33668 2024-03-24 14:06:56 UTC
MDEV-33668: More precise dependency tracking of XA XID in parallel replication

Author: Kristian Nielsen
Author Date: 2024-02-27 18:08:20 UTC

MDEV-33668: More precise dependency tracking of XA XID in parallel replication

Keep track of each recently active XID, recording which worker it was queued
on. If an XID might still be active, choose the same worker to queue event
groups that refer to the same XID to avoid conflicts.

Otherwise, schedule the XID freely in the next round-robin slot.

This way, XA PREPARE can normally be scheduled without restrictions (unless
duplicate XID transactions come close together). This improves scheduling
and parallelism over the old method, where the worker thread to schedule XA
PREPARE on was fixed based on a hash value of the XID.

XA COMMIT will normally be scheduled on the same worker as XA PREPARE, but
can be a different one if the XA PREPARE is far back in the event history.

Testcase and code for trimming dynamic array due to Andrei.

Reviewed-by: Andrei Elkin <andrei.elkin@mariadb.com>
Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>

bb-11.5-serg 2024-03-23 11:59:25 UTC
re-enable WITH_SSL as a backward-compatibility shortcut

Author: Sergei Golubchik
Author Date: 2024-03-21 13:45:59 UTC

re-enable WITH_SSL as a backward-compatibility shortcut

also, don't require -DWITH_SSL=system if OPENSSL_ROOT_DIR is specified

bb-11.5-MDEV-33748 2024-03-22 20:32:31 UTC
MDEV-33748 get rid of pthread_key_t and pthread_get/setspecific APIs.

Author: VladislavVaintroub
Author Date: 2024-03-22 17:09:21 UTC

MDEV-33748 get rid of pthread_key_t and pthread_get/setspecific APIs.

Replaced with C-style _Thread_local(standard since C11), C++11 thread_local
or compiler-dependent equivalents.

thread_local is easier to use, does not require specfic order
of initialization/termination, unlike pthread thread specific variables.

It is also slightly faster to access these variables. This comes handy in
threadpool code, where a bunch of TLS variables are reset on every query.

bb-10.11-MDEV-33551-mergefix 2024-03-21 18:09:11 UTC
MDEV-33551: Semi-sync Wait Point AFTER_COMMIT Slow on Workloads with Heavy Co...

Author: Brandon Nesterenko
Author Date: 2024-02-27 19:11:06 UTC

MDEV-33551: Semi-sync Wait Point AFTER_COMMIT Slow on Workloads with Heavy Concurrency

When using semi-sync replication with
rpl_semi_sync_master_wait_point=AFTER_COMMIT, the performance of the
primary can significantly reduce compared to AFTER_SYNC's
performance for workloads with many concurrent users executing
transactions. This is because all connections on the primary share
the same cond_wait variable/mutex pair, so any time an ACK is
received from a replica, all waiting connections are awoken to check
if the ACK was for itself, which is done in mutual exclusion.

This patch changes this such that the waiting THD will use its own
local condition variable, and the ACK receiver thread only signals
connections which have been ACKed for wakeup. That is, the
THD::LOCK_wakeup_ready condition variable is re-used for this
purpose, and the Active_tranx queue nodes are extended to hold the
waiting thread, so it can be signalled once ACKed.

Additionally:

 1) Removed part of MDEV-11853 additions, which allowed suspended
connection threads awaiting their semi-sync ACKs to live until their
ACKs had been received. This part, however, wasn't needed. That is,
all that was needed was for the Ack_thread to survive. So now the
connection threads are killed during phase 1. Thereby
THD::is_awaiting_semisync_ack, and all its related code was removed.

 2) COND_binlog_send is repurposed to signal on the condition when
Active_tranx is emptied during clear_active_tranx_nodes.

 3) At master shutdown (when waiting for slaves), instead of the
main loop individually waiting for each ACK, await_slave_reply()
(renamed await_all_slave_replies()) just waits once for the
repurposed COND_binlog_send to signal it is empty.

 4) Test rpl_semi_sync_shutdown_await_ack is updates as following:
   4.1) Added test case (adapted from Kristian Nielsen) to ensure
that if a thread awaiting its ACK is killed while SHUTDOWN WAIT FOR
ALL SLAVES is issued, the primary will still wait for the ACK from
the killed thread.
   4.2) As connections which by-passed phase 1 of thread killing no
longer are delayed for kill until phase 2, we can no longer query
yes/no tx after receiving an ACK/timeout. The check for these
variables is removed.
   4.3) Comment descriptions are updated which mention that the
connection is alive; and adjusted to be the Ack_thread.

Reviewed By:
============
Kristian Nielsen <knielsen@knielsen-hq.org>

10.11-MDEV-33515-spinflag 2024-03-21 15:20:54 UTC
PMEM: Invoke mtr_t::finish_write via a function pointer

Author: Marko Mäkelä
Author Date: 2024-03-21 15:20:54 UTC

PMEM: Invoke mtr_t::finish_write via a function pointer

bb-11.2-growt 2024-03-20 17:59:55 UTC
perf measures

Author: Nikita Malyavin
Author Date: 2024-03-20 16:47:39 UTC

perf measures

10.11-MDEV-33515-spinlock 2024-03-20 13:36:44 UTC
MDEV-33515 attempt 1 (halving throughput on Haswell)

Author: Marko Mäkelä
Author Date: 2024-03-20 13:36:44 UTC

MDEV-33515 attempt 1 (halving throughput on Haswell)

Let us make log_sys.lsn_lock a pure spin lock, using the x86 instruction
xchg for acquisition. On a Haswell microarchitecture dual
Intel Xeon E5-2630 v4 at 256 virtual users, this is nearly halving the
throughput. But, the Linux kernel function native_queued_spin_lock_slowpath
surely gets replaced with lsn_delay().

bb-10.4-MDEV-21102 2024-03-20 10:09:12 UTC
MDEV-21102: Server crashes in JOIN_CACHE::write_record_data upon EXPLAIN with...

Author: Sergey Petrunia
Author Date: 2024-03-20 10:09:12 UTC

MDEV-21102: Server crashes in JOIN_CACHE::write_record_data upon EXPLAIN with subqueries

JOIN_CACHE has a light-weight initialization mode that's targeted at
EXPLAINs. In that mode, JOIN_CACHE objects are not able to execute.

Light-weight mode was used whenever the statement was an EXPLAIN. However
the EXPLAIN can execute subqueries, provided they enumerate less than
@@expensive_subquery_limit rows.

Make sure we use light-weight initialization mode only when the select is
more expensive @@expensive_subquery_limit.

Also add an assert into JOIN_CACHE::put_record() which prevents its use
if it was initialized for EXPLAIN only.

bb-10.4-mdev-28993 2024-03-20 06:24:08 UTC
MDEV-28993 Spider: Push down CASE statement

Author: Yuchen Pei
Author Date: 2024-03-20 06:20:39 UTC

MDEV-28993 Spider: Push down CASE statement

bb-10.4-mdev-33728 2024-03-20 06:23:02 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-03-20 03:00:55 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---

review__knielsen_xa_sched_minimal_fix 2024-03-19 20:31:26 UTC
Review suggestion.

Author: Andrei
Author Date: 2024-03-19 20:31:26 UTC

Review suggestion.

As maybe_active_xid can expand in runtime and its extra allocated elements
may not be needed in a while, lets check for that and shrink
the size to a double of the initial one.

bb-10.5-MDEV-8578 2024-03-19 19:12:28 UTC
MDEV-8578: Wrong error code/message with enforce_storage_engine and

Author: Rucha Deodhar
Author Date: 2024-03-19 19:12:28 UTC

MDEV-8578: Wrong error code/message with enforce_storage_engine and
NO_ENGINE_SUBSTITUTION

Analysis:
When the error is hit, wrong error code is passed in my_error
Fix:
Pass a better error code.

bb-11.5-opentables 2024-03-19 14:22:23 UTC
Fix integer types

Author: Nikita Malyavin
Author Date: 2024-03-19 12:40:54 UTC

Fix integer types

bb-11.4-MDEV-18478-v4-MDEV-12404 2024-03-19 14:01:58 UTC
Fixup 2 for MDEV-18478 ANALYZE for statement part#2

Author: Sergey Petrunia
Author Date: 2024-03-19 14:01:58 UTC

Fixup 2 for MDEV-18478 ANALYZE for statement part#2

We may get r_index_rows=0. Do not divide by 0 in this case,
as the result is undefined. Produce "r_total_filtered": 100 instead.

bb-10.6-MDEV-32297 2024-03-19 01:34:13 UTC
MDEV-32297 pushed condition into context with empty table list crashes.

Author: Rex Johnston
Author Date: 2024-03-19 01:31:58 UTC

MDEV-32297 pushed condition into context with empty table list crashes.

When a condition is pushed into a subquery that has no table references,
under some circumstances, the context for the purposes of name resolution
may be left in an unexpected state.

bb-10.6-wlad 2024-03-18 22:43:56 UTC
Post-fix 567c0973591eb66797bb0f982f312b516f8fe82c

Author: VladislavVaintroub
Author Date: 2024-03-18 22:43:56 UTC

Post-fix 567c0973591eb66797bb0f982f312b516f8fe82c

Do *not* check if socket is closed by another thread. This is
race-condition prone, unnecessary, and harmful. VIO state was introduced
to debug the errors, not to change the behavior.

Rather than checking if socket is closed, add a DBUG_ASSERT that it is
*not* closed, because this is an actual logic error, and can potentially
lead to all sorts of funny behavior like writing error packets to Innodb
files.

Unlike closesocket(), shutdown(2) is not actually race-condition prone,
and it breaks poll() and read(), and it worked for longer than a decade,
and it does not need any state check in the code.

bb-11.0-MDEV-31793 2024-03-18 22:18:45 UTC
MDEV-31793 LooseScan join on derived table crashes

Author: Rex Johnston
Author Date: 2023-11-13 21:12:25 UTC

MDEV-31793 LooseScan join on derived table crashes

Statements that may be affected by this bug have
1) a semi join to a derived table
2) a text or blob field in the select list of the derived table
3) loose scan optimization enabled

When a temporary table is materialized that contains a BLOB or TEXT
field and a unique key is added to this table (for any reason)
a new key field is added as the first key part. This field is to
differentiate NULL from blank strings. This key part had it's store_length
set to zero, causing a potential loose scan to try and allocate then
free zero bytes. It is also an error to add it to the beginning of the
key and this breaks grouping assumptions in the LooseScan code.

Under normal circumstances, a loose scan is never performed on a derived
table, but it is possible to force it by either getting incorrect
statistics from the engine (see OP in MDEV) or altering the plan costs
and disabling some join types (see test case).

bb-10.5-MDEV-32583 2024-03-18 20:50:19 UTC
MDEV-32583 UUID() should be treated as stochastic for the purposes of forcing...

Author: Rex Johnston
Author Date: 2024-03-18 20:50:19 UTC

MDEV-32583 UUID() should be treated as stochastic for the purposes of forcing query materialization

RAND() and UUID() are treated differently with respect to subquery materialization
both should be marked as uncacheable, forcing materialization.
Altered Create_func_uuid::create_builder() to mark it as uncacheable.

bb-10.5-MDEV-19487 2024-03-18 20:00:13 UTC
MDEV-19487: JSON_TYPE doesnt detect the type of String Values

Author: Rucha Deodhar
Author Date: 2024-03-18 20:00:13 UTC

MDEV-19487: JSON_TYPE doesnt detect the type of String Values
(returns NULL) and for Date/DateTime returns "INTEGER"

Analysis:
When the first character of json is scanned it is number. Based on that
integer is returned.
Fix:
Scan rest of the json before returning the final result to ensure json is
valid in the first place in order to have a valid type.

bb-10.5-MDEV-32287 2024-03-18 18:42:58 UTC
MDEV-32287: JSON_EXTRACT not returning multiple values for same path

Author: Rucha Deodhar
Author Date: 2024-03-18 18:34:47 UTC

MDEV-32287: JSON_EXTRACT not returning multiple values for same path

Analysis:
When scanning json and getting the exact path at each step, if a path
is reached, we end up adding the item in the result and immediately get the
next item which results in current path changing.
Fix:
Instead of immediately returning the item, count the occurences of the path
in argument and append in the result as needed.

11.4-mdev-32777 2024-03-18 18:42:58 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-10.4-mdev-32401 2024-03-18 16:32:17 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.

11.4-macos-test-exclusion-mechanism 2024-03-18 16:31:03 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-mdev-33652 2024-03-18 16:03:55 UTC
MDEV-33652 compat/oracle.sp-inout fails on macOS

Author: Dave Gosselin
Author Date: 2024-03-13 13:25:50 UTC

MDEV-33652 compat/oracle.sp-inout fails on macOS

On systems where the database is running from a case-insensitive
filesystem (like APFS which is case-insensitive by default), we
discard the SP name case information. Later, if we print or
otherwise display this name to the user, it’s shown as all
lowercase, in contradiction to our documentation.

When specifying the name of a SP, we remember that name both in its
original case and in a lowercase form. We show the original case
to the user whenever it may appear in an error message or show output.
We retain the all-lowercase value for internal processing as we do today,
so internal SP lookup procedures are unaffected.

bb-11.5-MDEV-30366-bulk-return 2024-03-18 13:12:54 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-wlad 2024-03-18 12:30:03 UTC
MDEV-33519 Remove WITH_SSL=<custom_location_of_openssl> option

Author: VladislavVaintroub
Author Date: 2024-03-18 12:30:03 UTC

MDEV-33519 Remove WITH_SSL=<custom_location_of_openssl> option

This commit removes the WITH_SSL=<custom_location_of_openssl> option,
leaving only -DWITH_SSL=bundled/system.

The rationale behind this removal is as follows:

1. The WITH_SSL=<custom_location_of_openssl> option is obscure
and not widely used.

2. There is no added value in this option compared to using
OPENSSL_ROOT_DIR. In fact, the availability of "helpful" MySQL options
might discourage users from exploring proper CMake options independently.

3. Users may incorrectly assume full MySQL compatibility even with this
option, including undocumented behaviors such as MySQL's preference for static libraries
with WITH_SSL=<custom_location_of_openssl>.

This change simplifies the configuration options and encourages users to
adopt more standardized and documented practices.

11.2 2024-03-18 10:43:16 UTC
MDEV-33525: Recreate/reuse temporary table

Author: Dmitry Shulga
Author Date: 2024-03-18 10:43:16 UTC

MDEV-33525: Recreate/reuse temporary table

Calling a stored function that uses a cursor inside its body
could produce the error ER_NO_SUCH_TABLE on the second execution
in case the cursor uses multi-table query and one of the tables
is a temporary table just created before querying the cursor and
dropped just after the query has been executed.

The reason for issue is that re-parsing of failed a SP instruction
caused be create/drop of the temporary table used LEX object
left from previous parsing of a SP instruction's query instead
re-initialize the lex object before parsing.

To fix the issue, add initialization of lex for cursor's
statement before re-parsing the query of a failed SP instruction.

bb-11.2-MDEV-33525 2024-03-18 10:43:16 UTC
MDEV-33525: Recreate/reuse temporary table

Author: Dmitry Shulga
Author Date: 2024-03-18 10:43:16 UTC

MDEV-33525: Recreate/reuse temporary table

Calling a stored function that uses a cursor inside its body
could produce the error ER_NO_SUCH_TABLE on the second execution
in case the cursor uses multi-table query and one of the tables
is a temporary table just created before querying the cursor and
dropped just after the query has been executed.

The reason for issue is that re-parsing of failed a SP instruction
caused be create/drop of the temporary table used LEX object
left from previous parsing of a SP instruction's query instead
re-initialize the lex object before parsing.

To fix the issue, add initialization of lex for cursor's
statement before re-parsing the query of a failed SP instruction.

bb-10.6-bar-MDEV-33648 2024-03-18 10:13:22 UTC
Leak-proof error cleanup in Item_in_subselect::setup_mat_engine()

Author: Sergey Petrunia
Author Date: 2024-03-18 10:12:23 UTC

Leak-proof error cleanup in Item_in_subselect::setup_mat_engine()

The only pointer to allocated "engine" is in mat_engine local variable.
Free the mat_engine if we've failed to initialize it.

bb-11.5-password-errors 2024-03-18 09:02:30 UTC
MDEV-32218 PASSWORD_EXPIRATION_TIME column

Author: Sergei Golubchik
Author Date: 2024-03-15 21:12:30 UTC

MDEV-32218 PASSWORD_EXPIRATION_TIME column

* show it as a datetime, not number of seconds
* show all users
* show manually expired users as 0000-00-00 00:00:00
* show default expiration interval correctly
* numerous test fixes, add more tests
* fix compilation of embedded

bb-11.5-MDEV-32188-timestamps 2024-03-18 06:32:06 UTC
fixup MDEV-33449 improving repair of tables

Author: Sergei Golubchik
Author Date: 2024-03-16 22:12:19 UTC

fixup MDEV-33449 improving repair of tables

bb-11.5-MDEV-31466 2024-03-18 03:47:30 UTC
MDEV-31466 Add optional correlation column list for derived tables

Author: Rex Johnston
Author Date: 2023-08-18 03:51:54 UTC

MDEV-31466 Add optional correlation column list for derived tables

extend Mariadb to support column name assignment in derived sytax
(some expression) [as|=] ident [(comma separated column name list)]

bb-10.4-mdev-33706 2024-03-18 02:38:07 UTC
MDEV-33494 fix spider init with no_zero_date global sql mode

Author: Yuchen Pei
Author Date: 2024-02-20 00:20:21 UTC

MDEV-33494 fix spider init with no_zero_date global sql mode

Like the fix for MDEV-32753 and MDEV-33242, spider init queries
creates new connections that use the global sql_mode of the existing
connection.

bb-10.5-mdev-33679 2024-03-18 02:20:39 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-33679 2024-03-18 02:11:49 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.

knielsen_xa_sched_minimal_fix 2024-03-17 22:54:23 UTC
MDEV-33668: Remove redundant wait_for_prior_commit when applying XA PREPARE

Author: Kristian Nielsen
Author Date: 2024-03-17 22:54:23 UTC

MDEV-33668: Remove redundant wait_for_prior_commit when applying XA PREPARE

This was blocking XA PREPARE from group-committing with any prior transaction
in parallel replication, which would limit performance.

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

bb-11.5-MDEV-33501-query-response-time 2024-03-17 22:39:21 UTC
MDEV-33501 Extend query_response_time plugin to be compatible with Percona se...

Author: Monty
Author Date: 2024-02-20 15:25:40 UTC

MDEV-33501 Extend query_response_time plugin to be compatible with Percona server

This is to update the plugin to be compatible with Percona's
query_response_time plugin, with some additions.
Some of the tests are taken from Percona server.

- Added plugins QUERY_RESPONSE_TIME_READ, QUERY_RESPONSE_TIME_WRITE and
  QUERY_RESPONSE_TIME_READ_WRITE.
- Added option query_response_time_session_stats, with possible values
  GLOBAL, ON or OFF, to the query_response_time plugin.

Notes:
- All modules are dependent on QUERY_RESPONSE_READ_TIME. This must always
  be enabled if any of the other modules are used.
  This will be auto-enabled in the near future.
- Accounting are done per statement. Stored functions are regarded
  as part of the original statement.
- For stored procedures the accounting are done per statement executed
  in the stored procedure. CALL will not be accounted because of this.
- FLUSH commands will not be accounted for. This is to ensure that
  FLUSH QUERY_RESPONSE_TIME is not part of the statistics.
  (This helps when testing with mtr and otherwise).

1100 of 2323 results

Other repositories

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