maria:bb-10.2-vicentiu-mdev-17964

Last commit made on 2021-10-15
Get this branch:
git clone -b bb-10.2-vicentiu-mdev-17964 https://git.launchpad.net/maria

Branch merges

Branch information

Name:
bb-10.2-vicentiu-mdev-17964
Repository:
lp:maria

Recent commits

643264a... by Vicențiu Ciorbaru

MDEV-17964: Assertion `status == 0' failed in add_role_user_mapping_action

This happens upon CREATE USER and DROP ROLE.

The underlying problem is that our HASH implementation shuffles elements
around when performing an update or delete. This means that when doing a
scan through the HASH table by index, in search of elements to delete or
update one must restart the scan to make sure nothing is missed if at least
one delete / update happened.

More specifically, what happened in this case:
The hash has 131 element, DROP ROLE removes the element
[119]. Its [119]->next was element [129], so [129] is moved to [119].
Now we need to compact the hash, removing the last element [130]. It
gets one bit off its hash value and becomes element [2]. The existing
element [2] is moved to [129], and old [130] is moved to [2].

We cannot simply move [130] to [129] and make [2]->next=130, it won't
work if [2] is itself in the collision list and doesn't belong in [2].

The handle_grant_struct code assumed that it is safe to continue by only
reexamining the currently modified / deleted element index, but that is
not true.

Missing to delete an element in the hash triggered the assertion in
the test case. DROP ROLE would not clear all necessary role->role or
role->user mappings.

To fix the problem we ensure that the scan is restarted, only if an
element was deleted / updated, similar to how bubble-sort keeps sorting
until it finds no more elements to swap.

a2a42f4... by Alexander Barkov

MDEV-23408 Wrong result upon query from I_S and further Assertion `!alias_arg || strlen(alias_arg->str) == alias_arg->length' failed with certain connection charset

There were two independent problems which lead to the crash
and to the non-relevant records returned in I_S queries:

- The code in the I_S implementation was not secure
  about values with 0x00 bytes.
  It's fixed by using check_db_name() and check_table_name()
  inside make_table_name_list(), and by adding the test for
  0x00 inside check_table_name().

- The code in Item_string::print() did not convert
  strings without introducers when restoring
  the CREATE VIEW statement from an Item tree.
  This made wrong literals inside the "query" line in the view FRM file
  in cases when the VIEW parse time
  character_set_client!=character_set_connection.
  That's fixed by adding a proper conversion.

  This change also fixed a similar problem in SHOW PROCEDURE CODE -
  the literals were displayed in wrong character set in SP instructions
  in cases when the SP parse time
  character_set_client!=character_set_connection.

bbae2d3... by Andrei Elkin <email address hidden>

MDEV-26712 row events never reset thd->mem_root

but must do that at the end of the statement.
A provide template patch is elaborated also to match
to the upstream fixes of the very same bug.

ef0dc50... by Jan Lindström

MDEV-26815 : galera.galera_ftwrl_drain fails with wrong errno 1146

Add wait_conditions to stabilize

2bb8d7c... by Marko Mäkelä

MDEV-26811: Assertion "log_sys->n_pending_flushes == 1" fails

In commit 1cb218c37cc3fe01a1ff2fe9b1cbfb591e90d5ce (MDEV-26450)
we introduced the function log_write_and_flush(), which may
compete with log_checkpoint() invoking log_write_flush_to_disk_low()
from another thread.

The assertion n_pending_flushes==1 is too strict.
There is no possibility of a race condition here, because
fil_flush() is protected by fil_system->mutex and the
rest will be protected by log_sys->mutex.

log_write_flush_to_disk_low(), log_write_and_flush():
Relax the assertions to test for a nonzero count.

6f32b28... by Sergei Krivonos

Xcode compatibility update

8f04ec2... by Alexander Barkov

MDEV-25925 Warning: Memory not freed: 32 on INSERT DELAYED

Also fixes MDEV-24467 Memory not freed after failed INSERT DELAYED

Description:

In case of an error (e.g. data truncation) during mysql_insert()
handling an INSERT DELAYED, the data type specific data in
fields (e.g. Field_blob::value) is not taken over by the delayed
writer thread.

All fields in table_list->table are freed by free_root()
immediately after mysql_insert(). To avoid a memory leak,
we need to free the specific data before exiting mysql_insert()
on error.

eadd878... by Alexander Barkov

MDEV-23269 SIGSEGV in ft_boolean_check_syntax_string on setting ft_boolean_syntax

The crash happened because my_isalnum() does not support character
sets with mbminlen>1.

The value of "ft_boolean_syntax" is converted to utf8 in do_string_check().
So calling my_isalnum() is combination with "default_charset_info" was wrong.

Adding new parameters (size_t length, CHARSET_INFO *cs) to
ft_boolean_check_syntax_string() and passing self->charset(thd)
as the character set.

9300b66... by Alexander Barkov

MDEV-24742 Server crashes in Charset::numchars / String::numchars

The crash happened because Item_aes_crypt::val_str() did not
set the character set of the result.

5e3e5cc... by SergMariaDB <email address hidden>

Apple Silicon is a 64-bit platform (#1922)

Co-authored-by: FX Coudert <email address hidden>