maria:bb-10.4-mdev-29363-cheap

Last commit made on 2024-04-24
Get this branch:
git clone -b bb-10.4-mdev-29363-cheap https://git.launchpad.net/maria

Branch merges

Branch information

Name:
bb-10.4-mdev-29363-cheap
Repository:
lp:maria

Recent commits

f5868e9... by Yuchen Pei <email address hidden>

MDEV-29363 replace subqueries with their values before adding to item_equal

The optimizer constructs multiple equalities, and swap them in during
equality propagation. In doing so, it may create multiple pointers to
the same item. When the item contain subqueries, bad things can
happen. For example, in pushdown of HAVING to WHERE, if the HAVING
conditions contain multiple equalities with a const subquery, the
subquery will not be excluded from pushdown into WHERE. And if there
are multiple pointers to the same subquery, it may unfix the subquery
and destroy and rebuild its join, which could cause further
use-after-free if there are external pointers to items in the
join (e.g. tmp table fields as in the main case in MDEV-29363).

This patch also fixes cases in MDEV-32424, MDEV-32608, MDEV-32539.

234229f... by Sergey Petrunia

MDEV-33648: range optimizer works incorrectly for date_col=expression yielding invalid_date

range optimizer constructs index lookup value by calling
value_item->save_in_field(). When that function returns an error, it
calls Field::stored_field_make_mm_leaf_truncated().

That function has logic that "truncated value means there won't
be any matches for equality lookup". This is not true for DATE columns:
invalid date is equal to '0000-00-00', which can be present in the table.

Fix stored_field_make_mm_leaf_truncated() to not return SEL_ARG_IMPOSSIBLE
if the field is a date field.

a2fee2d... by =?utf-8?q?Jan_Lindstr=C3=B6m?= <email address hidden>

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 <email address hidden>

4aeba25... by =?utf-8?q?Jan_Lindstr=C3=B6m?= <email address hidden>

MDEV-33895 : Galera test failure on galera_sr.MDEV-25718

Test was waiting INSERT-clause to make rollback but
wait_condition was too tight. State could be
Freeing items or Rollback. Fixed wait_condition
to expect one of them.

50998a6... by Oleksandr "Sanja" Byelkin

MDEV-33861 main.query_cache fails with embedded after enabling WITH_PROTECT_STATEMENT_MEMROOT

Synopsis: If SELECT returned answer from Query Cache it is not really executed.

The reason for firing of assertion
  DBUG_ASSERT((mem_root->flags & ROOT_FLAG_READ_ONLY) == 0);
is that in case the query_cache is on and the same query run by different
stored routines the following use case can take place:
First, lets say that bodies of routines used by the test case are the same
and contains the only query 'SELECT * FROM t1';
  call p1() -- a result set is stored in query cache for further use.
  call p2() -- the same query is run against the table t1, that result in
               not running the actual query but using its cached result.
               On finishing execution of this routine, its memory root is
               marked for read only since every SP instruction that this
               routine contains has been executed.
  INSERT INT t1 VALUE (1); -- force following invalidation of query cache
  call p2() -- query the table t1 will result in assertion failure since its
               execution would require allocation on the memory root that
               has been already marked as read only memory root

The root cause of firing the assertion is that memory root of the stored
routine 'p2' was marked as read only although actual execution of the query
contained inside hadn't been performed.

To fix the issue, mark a SP instruction as not yet run in case its execution
doesn't result in real query processing and a result set got from query cache
instead.

Note that, this issue relates server built in debug mode AND with the protect
statement memory root feature turned on. It doesn't affect server built
in release mode.

051a1fa... by Yuchen Pei <email address hidden>

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.

18b93d6... by Yuchen Pei <email address hidden>

MDEV-28993 Spider: Push down CASE statement

99dc0f0... by Yuchen Pei <email address hidden>

MDEV-28993 spider: revert removal of ITEM_FUNC_CASE_PARAMS_ARE_PUBLIC

It was done in MDEV-29447.

d7fc975... by Vlad Lesin

MDEV-33802 Weird read view after ROLLBACK of other transactions.

In the case if some unique key fields are nullable, there can be
several records with the same key fields in unique index with at least
one key field equal to NULL, as NULL != NULL.

When transaction is resumed after waiting on the record with at least one
key field equal to NULL, and stored in persistent cursor record is
deleted, persistent cursor can be restored to the record with all key
fields equal to the stored ones, but with at least one field equal to
NULL. And such record is wrongly treated as a record with the same unique
key as stored in persistent cursor record one, what is wrong as
NULL != NULL.

The fix is to check if at least one unique field is NULL in restored
persistent cursor position, and, if so, then don't treat the record as
one with the same unique key as in the stored record key.

dict_index_t::nulls_equal was removed, as it was initially developed for
never existed in MariaDB "intrinsic tables", and there is no code, which
would set it to "true".

Reviewed by Marko Mäkelä.

d824977... by Marko Mäkelä

MDEV-33512 Corrupted table after IMPORT TABLESPACE and restart

In commit d74d95961a31b47986d943216489513896108782 (MDEV-18543)
there was an error that would cause the hidden metadata record
to be deleted, and therefore cause the table to appear corrupted
when it is reloaded into the data dictionary cache.

PageConverter::update_records(): Do not delete the metadata record,
but do validate it.

RecIterator::open(): Make the API more similar to 10.6, to simplify
merges.