Home - Waterfall Grid T-Grid Console Builders Recent Builds Buildslaves Changesources - JSON API - About

Console View


Categories: connectors experimental galera main
Legend:   Passed Failed Warnings Failed Again Running Exception Offline No data

connectors experimental galera main
Arcadiy Ivanov
MDEV-40946 Two heap blob tests fail with the embedded server

Both tests exercise server facilities that an embedded build does not
have, so neither can run there.

`INSERT DELAYED` has no delayed insert thread in an embedded build.
The whole facility sits inside `#ifndef EMBEDDED_LIBRARY`, including
the check that routes a delayed statement away from the ordinary
insert path, so the statement is an ordinary insert and
`DELAYED_WRITES` stays at 0.

`ALTER TABLE ... LOCK=NONE` is never online in an embedded build.
`online` is hard-wired to `false` when `HAVE_REPLICATION` is
undefined, and `my_global.h` leaves it undefined for
`EMBEDDED_LIBRARY`.  The source lock is therefore not downgraded, the
`alter_table_online_downgraded` sync point is never reached, and the
test's `WAIT_FOR downgraded` runs out its `debug_sync` timeout.

Skip both with `include/not_embedded.inc`, as `main.delayed` and
`main.alter_table_online_debug` already do.
Marko Mäkelä
fixup! 5823f92a3546316ded1df238e60c6e986801d5ec

Use the native FindFirstFileA() and FindNextFile() on Microsoft Windows
Marko Mäkelä
fixup! c909702dfcd2261a73cd0ca6a6ce5703ddda411a
KhaledR57
MDEV-32383 Server crashes in Item_func_match::init_search on 2nd execution of PS

Item_func_match::master links a MATCH item to an equal MATCH item that
owns the shared ft_handler. setup_ftfuncs() establishes that link on
every execution, but only for items whose master is still unset, and
Item_func_match::cleanup() never reset it.

When the MATCH items come from a mergeable view the view is merged only
once. On the second execution mysql_derived_prepare() returns early
because TABLE_LIST::merged is already set, so the inner select is not
prepared again and its MATCH item is never re-fixed. cleanup() had
cleared its table, and nothing restores it.

init_ftfuncs() drops unfixed items from ftfunc_list, but nothing checks
the item reached through master, so init_search() followed the stale
link into the orphaned item and dereferenced its NULL table.

Reset master in Item_func_match::cleanup(), after the ft_handler
ownership check that reads it, so the link is rebuilt from scratch on
every execution.
Monty
MDEV-40765 Assertion `"unexpected references" == 0' failed upon failing CREATE OR REPLACE

There was a few reasons for this failure:
- There was no timeout for the mdl_lock in the ddl log in
  execute_rename_table. This was needed to protect against a concurrent
  purge in InnoDB. If the purge would be running, the ddl would call
  rename_table without a ddl protection the assert could happen.
- InnoDB locked the original table name in purge, not the temporary
  name used to cache the table in case of rollback. The effect is
  that if a purge happens during rename the assert could happen.
- The table was a partitioned and the detection of partitioned tables
  did not take into account temporary #sql-create- prefixed tables.

Fix:
- Take a MDL lock for the temporary table before the table is created.

Other things:
- Removed mysql_mutex_unlock(&LOCK_gdl) / mysql_mutex_lock(&LOCK_gdl)
  around calls to binlog as these are unsafe. The binlog code uses
  global variables that needs protection from other caller.
- Fixed a few compiler warnings related to tmp_file_prefix.
Alexander Barkov
MDEV-39563 Implement UPDATE ... RETURNING ... INTO

Adding support for UPDATE .. RETURNING .. INTO queries.

For example:

  UPDATE t1 SET a=10,b=20 RETURNING a,b INTO va,vb;
  UPDATE t1 SET a=10,b=20 RETURNING a,b INTO @a,@b;

Limitations:
1. These types of queries:
  - REPLACE .. RETURNING .. INTO
  - DELETE .. RETURNING .. INTO
  - INSERT .. RETURNING .. INTO
  do not work - they return an error.
  They will be implemented separately, when needed.

2. UPDATE..RETURNING..INTO with --binlog_format=statement is not allowed
  and an error is raised.

3. Using OLD_VALUE(col) inside UPDATE..RETURNING..INTO is not allowed
  and an error is raised.

4. Multi-table updates, as well as single table updates with a subquery
  to the same table in WHERE (which get converted to multi-table) do
  not work and an error is raised.

Notes:

1. ANALYZE and EXPLAIN
  Both
    ANALYZE UPDATE .. RETURNING .. INTO ..
    EXPLAIN UPDATE .. RETURNING .. INTO ..
  return this error:
    'RETURNING..INTO' is not allowed in this context

2. Behavior on no data

  a. In case of degenerated plans (WHERE 1=0, LIMIT 0),
    no errors are raised.

  b. If the updated table contains no rows, the behavior depends on the engine,
    for example:
    - MyISAM returns no errors
    - InnoDB raises
        No data - zero rows fetched, selected, or processed
    This behavior is engine dependent because some engines (e.g. MyISAM)
    quickly know that the table has no records and execute the statement
    using a degenerated plan.

  c. If there are some rows, but non of them match the WHERE condition,
    then this error is raised:
      No data - zero rows fetched, selected, or processed

  d. If some rows where found but none of them actually
    got changed by the SET, still this error is raised:
      No data - zero rows fetched, selected, or processed
    The error message might be misleading. However, if we read
    it as "zero rows [that required updates] fetched", it looks OK.
    Let's not introduce a new error message for now.

Helper changes:

1. The grammar in analyze_stmt_command was changed to have
  LEX::analyze_stmt set to true earlier, so
  LEX::set_returning_into_result() already knows if this
  is an ANALYZE statement.

2. The Sql_cmd_update constructor is now called earlier in the grammar,
  to be able to call Sql_cmd_update::set_with_old_value_items()
  in the SET and RETURNING clauses.

3. Sql_cmd_dml::lex is now set during the constructor time.
  It makes things easier:
  - Sql_cmd_update::returns_result_set() needs the lex.
  - Sql_cmd_delete::orig_multitable and Sql_cmd_update::orig_multitable
    are not needed any more.
    They were used only in Sql_cmd_delete::sql_command_code() and
    Sql_cmd_update::sql_command_code().
    Sql_cmd_dml::sql_command_code() now returns lex->sql_command.
    The overrides Sql_cmd_delete::sql_command_code() and
    Sql_cmd_update::sql_command_code() were removed.
Marko Mäkelä
fixup! 9b196734f997f1a7336c22b5d5e370c9d1bbe9a6

Use fdopendir(3) and openat(2) on POSIX,
to fix libmysqld.

FIXME: Microsoft Windows is broken
Marko Mäkelä
fixup! 9268c3da4b6b0f62fc9034753d8dfaaabc00cc0d
Kristian Nielsen
MDEV-39779: binlog.binlog_gtid_index sporadic failure

The GTID index is written asynchronously from the binlog background thread,
the test would fail when trying to read the index file before the background
thread had time to write it.

Fix by making the test case wait for the file to reach the expected size
before accessing.

Signed-off-by: Kristian Nielsen <[email protected]>
Yuchen Pei
MDEV-40168 wip

works:

SET SESSION debug = '+d,test_invisible_index,test_completely_invisible';
create table t1 (c int, j json, key idx ((CAST(j->'$.tags' AS CHAR(6) ARRAY))))engine=innodb;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
  `c` int(11) DEFAULT NULL,
  `j` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`j`))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored
t1 1 invisible1 1 invisible1 A 0 NULL NULL YES BTREE NO
t1 1 idx 1 DB_MVI_1 NULL NULL NULL NULL YES FULLTEXT NO
set @old_innodb_ft_aux_table=@@global.innodb_ft_aux_table;
set global innodb_ft_aux_table='test/t1';
insert into t1 values (1, '{"tags": ["1", "abcde", "34567"]}');
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
31xx 1 1 1 1 0
3334353637 1 1 1 1 16
6162636465 1 1 1 1 5
DROP TABLE t1;
set global innodb_ft_aux_table=@old_innodb_ft_aux_table;
select mvi_encode('[1, 42, "3"]', int);
mvi_encode('[1, 42, "3"]', int)
8000000000000001 800000000000002a 8000000000000003
select mvi_encode('[1, 42, "3"]', unsigned);
mvi_encode('[1, 42, "3"]', unsigned)
0000000000000001 000000000000002a 0000000000000003
select mvi_encode('[1, 42, "3  "]', char(6));
mvi_encode('[1, 42, "3  "]', char(6))
31xx 3432 33xx
select mvi_encode('[1, 42, "3  "]', binary(6));
mvi_encode('[1, 42, "3  "]', binary(6))
31xx 3432 33xx
Kristian Nielsen
MDEV-40930: binlog-in-engine: seek() on invalid handle during change_user()

When using binlog-in-engine, the binlog trx cache is memory-only and does
not have an underlying temporary file backing the cache. The binlog code
must handle this and avoid calling into IO_CACHE code that manipulates the
underlying file. However, one case was forgotten where the binlog caches are
truncated during COM_CHANGE_USER / THD::change_user() (connection pool
reset), and the code would try to seek() on an invalid file handle. This
crashes on Windows and is just plain wrong on any platform.

Thanks to Vlad for analysis and test case.

Signed-off-by: Kristian Nielsen <[email protected]>
Yuchen Pei
MDEV-40168 wip

works:

SET SESSION debug = '+d,test_invisible_index,test_completely_invisible';
create table t1 (c int, j json, key idx ((CAST(j->'$.tags' AS CHAR(6) ARRAY))))engine=innodb;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
  `c` int(11) DEFAULT NULL,
  `j` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`j`))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored
t1 1 invisible1 1 invisible1 A 0 NULL NULL YES BTREE NO
t1 1 idx 1 DB_MVI_1 NULL NULL NULL NULL YES FULLTEXT NO
set @old_innodb_ft_aux_table=@@global.innodb_ft_aux_table;
set global innodb_ft_aux_table='test/t1';
insert into t1 values (1, '{"tags": ["1", "abcde", "34567"]}');
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
31XX 1 1 1 1 0
3334353637 1 1 1 1 16
6162636465 1 1 1 1 5
DROP TABLE t1;
set global innodb_ft_aux_table=@old_innodb_ft_aux_table;
select mvi_encode('[1, 42, "3"]', int);
mvi_encode('[1, 42, "3"]', int)
8000000000000001 800000000000002a 8000000000000003
select mvi_encode('[1, 42, "3"]', unsigned);
mvi_encode('[1, 42, "3"]', unsigned)
0000000000000001 000000000000002a 0000000000000003
select mvi_encode('[1, 42, "3  "]', char(6));
mvi_encode('[1, 42, "3  "]', char(6))
31XX 3432 33XX
select mvi_encode('[1, 42, "3  "]', binary(6));
mvi_encode('[1, 42, "3  "]', binary(6))
31XX 3432 33XX
Sergei Petrunia
Move pwt_worker_execution::stats into pwt_worker_base_with_stats
Oleg Smirnov
MDEV-39491 Add test harness

This commit implements pseudo-parallel execution of SELECTs
which allows to test the correctness of parallel algorithms.

Eligible InnoDB tables that were planned to be either full-scanned
or scanned on a set of ranges of the clustered index, are switched
to the pseudo-parallel execution.
That means the primary index is split into chunks, and those
chunks are processed one after another by a single thread.
This thread mimics the parallel execution by calling the
parallel handler API and acting as both the coordinator and
the worker.

This mode is activated automatically, there is no need to set
any variables before that. If an InnoDB table is set to be
either full-scanned or scanned on a set of ranges of
the primary index, the pseudo-parallel mode is employed.

This harness allows to run MTR tests to catch possible bugs
in the parallel logic implementation. Some new test files
(pq*.test) are added too.

NOTE:
`innodb_ext_key` test failure is expected: the difference is only
in the handler statistics, and it is caused by slightly different
algorithms in the serial and parallel paths
Vladislav Vaintroub
MDEV-38918 follow-up: fix crash when large pages are unavailable

Make my_large_virtual_alloc() always return read-write memory if
MY_TRY_LARGE_PAGES is requested.

Prior to this patch, it returned PROT_NONE in a fallback. Since
my_virtual_mem_commit() is a no-op for MY_TRY_LARGE_PAGES, the memory
remained inaccessible even after commit.

In the past, this worked because the global variable my_use_large_pages
was flipped from 1 to 0 on large allocation error. We don't do that
anymore.
Sergei Petrunia
Make pwt_worker ctor accept pwt_manager *manager_arg argument
Kristian Nielsen
Fix earlier incorrect search/replace

The errorneous replacements were from this commit:

commit e680c21ce5c563493c60a0df1a8f867854920252
Author: Monty <[email protected]>
Date:  Sat Jan 24 17:13:52 2026 +0200

    Fixed compilation failures in InnoDB with gcc 7.5.0

Signed-off-by: Kristian Nielsen <[email protected]>
Vladislav Vaintroub
MDEV-38918 follow-up: fix crash when large pages are unavailable

Make my_large_virtual_alloc() always return read-write memory if
MY_TRY_LARGE_PAGES is requested.

Prior to this patch, it returned PROT_NONE in a fallback. Since
my_virtual_mem_commit() is a no-op for MY_TRY_LARGE_PAGES, the memory
remained inaccessible even after commit.

In the past, this worked because the global variable my_use_large_pages
was flipped from 1 to 0 on large allocation error. We don't do that
anymore.
Sergei Petrunia
pwt_worker: cleanup the cleanup code.
Marko Mäkelä
fixup! 466fb3c8eb87d4f6f04b4ed3af21c7bb66e8ad87
Sergei Petrunia
Add comments.
Alexey Yurchenko
MDEV-38920 MTR tests for Galera-side fixes

MDEV-38920-evs-config-warn checks that there is a warning about bad configuration
values and they are not accepted.
MDEV-38920-install-timer-expired reproduces 'install timer expired' situation.
Both tests require fixed Galera library to pass.
Yuchen Pei
MDEV-40168 wip
Kristian Nielsen
Enable the binlog_in_engine mtr suite in Windows Buildbot

Signed-off-by: Kristian Nielsen <[email protected]>
bsrikanth-mariadb
MDEV-39368: Code cleanup and make it more maintainable

1. Remove hard codings and instead use MACROS
2. Introduce pre and post query hooks
3. Remove duplicate code and instead use functions
Akshat Nehra
MDEV-40867 CONNECT writes unvalidated data from remote filter into fixed-len buffer

TestFil() in storage/connect/tabtbl.cpp uses unbounded sscanf
format specifiers to parse TABID filter values pushed from
ha_connect::CheckCond(). When a WHERE tabname='...' filter
exceeds NAME_LEN bytes (192), sscanf overflows the
stack-allocated tn[NAME_LEN] buffer, corrupting the stack
and crashing mysqld with SIGSEGV.

Fix: add width specifiers to bound all sscanf writes:
- %7s for op[8]
- %192[^'] for tn (NAME_LEN bytes + null terminator)

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.
KhaledR57
MDEV-32383 Server crashes in Item_func_match::init_search on 2nd execution of PS

Item_func_match::master points at an equal MATCH item that owns the
shared ft_handler. setup_ftfuncs() sets it only when it is still unset,
and cleanup() never reset it.

A mergeable view is merged once. On re-execution mysql_derived_prepare()
returns early because TABLE_LIST::merged is set, so the view's own MATCH
item is never re-fixed and keeps the NULL table left by cleanup().
init_ftfuncs() skips unfixed items in ftfunc_list, but init_search()
follows master without that check and dereferenced the NULL table.

Reset master in cleanup(), after the ft_handler ownership check that
reads it, so the link is rebuilt from scratch on every execution.
Yuchen Pei
MDEV-40168 wip

works:

SET SESSION debug = '+d,test_invisible_index,test_completely_invisible';
create table t1 (c int, j json, key idx ((CAST(j->'$.tags' AS CHAR(6) ARRAY))))engine=innodb;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
  `c` int(11) DEFAULT NULL,
  `j` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`j`))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored
t1 1 invisible1 1 invisible1 A 0 NULL NULL YES BTREE NO
t1 1 idx 1 DB_MVI_1 NULL NULL NULL NULL YES FULLTEXT NO
set @old_innodb_ft_aux_table=@@global.innodb_ft_aux_table;
set global innodb_ft_aux_table='test/t1';
insert into t1 values (1, '{"tags": ["1", "abcde", "34567"]}');
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
000031 1 1 1 1 0
000033000034000035000036000037 1 1 1 1 38
000061000062000063000064000065 1 1 1 1 7
DROP TABLE t1;
set global innodb_ft_aux_table=@old_innodb_ft_aux_table;
select mvi_encode('[1, 42, "3"]', int);
mvi_encode('[1, 42, "3"]', int)
8000000000000001 800000000000002a 8000000000000003
select mvi_encode('[1, 42, "3"]', unsigned);
mvi_encode('[1, 42, "3"]', unsigned)
0000000000000001 000000000000002a 0000000000000003
select mvi_encode('[1, 42, "3  "]', char(6));
mvi_encode('[1, 42, "3  "]', char(6))
31 3432 33
select mvi_encode('[1, 42, "3  "]', binary(6));
mvi_encode('[1, 42, "3  "]', binary(6))
31 3432 33
Marko Mäkelä
fixup! da840d352e08e765d42abc801fa711b81dc09c8b
Vladislav Vaintroub
MDEV-38918 follow-up: fix crash when large pages are unavailable

Make my_large_virtual_alloc() always return read-write memory if
MY_TRY_LARGE_PAGES is requested.

Prior to this patch, it returned PROT_NONE in a fallback. Since
my_virtual_mem_commit() is a no-op for MY_TRY_LARGE_PAGES, the memory
remained inaccessible even after commit.

In the past, this worked because the global variable my_use_large_pages
was flipped from 1 to 0 on large allocation error. We don't do that
anymore.
Vladislav Vaintroub
MDEV-38918 Make large pages an explicit per-caller opt-in

my_large_malloc() attempted large pages whenever --large-pages was
enabled, silently rounding the size up and reporting it back via an
in/out parameter. ut_malloc_dontdump() never passed that adjusted
size on to its own callers (the InnoDB redo log buffer and
recv_sys_t::tmp_buf), so freeing later used the original, smaller
size, causing the reported "faux memory leak".

Only the buffer pool and the MyISAM/Aria key caches are documented
to benefit from large pages. Everything else that ended up calling
my_large_malloc() only wanted its "do not dump to core" property and
picked up large pages as an undocumented side effect; those buffers
are also small and sequentially accessed, so they would have gained
little from large pages anyway.

Add MY_TRY_LARGE_PAGES: my_large_malloc() and my_large_virtual_alloc()
now only attempt large pages when a caller passes this flag, instead
of always trying whenever the global option is set. Only the buffer
pool and the key caches pass it. The redo log buffer, tmp_buf, and
row0log.cc's crypt buffers no longer request large pages at all,
which removes the size-rounding bug for them without touching that
code.

Also fix a broken mtr suppression regex in main.large_pages that
would fail the test on Windows.
Marko Mäkelä
fixup! f46d1e4f9443b535572948c08f4288a32ee02f3b
bsrikanth-mariadb
MDEV-39368: Code cleanup and make it more maintainable

1. Remove hard codings and instead use MACROS
2. Introduce pre and post query hooks
3. Remove duplicate code and instead use functions
Alexey Yurchenko
MDEV-38920 MTR tests for Galera-side fixes

MDEV-38920-evs-config-warn checks that there is a warning about bad configuration
values and they are not accepted.
MDEV-38920-install-timer-expired reproduces 'install timer expired' situation.
Both tests require fixed Galera library to pass.
Georgi (Joro) Kodinov
fixes for mysql_socket.h
Sergei Petrunia
Make pwt_manager::workers a Dynamic_array<ptw_worker*>
Yuchen Pei
MDEV-40168 wip

works:

SET SESSION debug = '+d,test_invisible_index,test_completely_invisible';
create table t1 (c int, j json, key idx ((CAST(j->'$.tags' AS CHAR(6) ARRAY))))engine=innodb;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
  `c` int(11) DEFAULT NULL,
  `j` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`j`))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored
t1 1 invisible1 1 invisible1 A 0 NULL NULL YES BTREE NO
t1 1 idx 1 DB_MVI_1 NULL NULL NULL NULL YES FULLTEXT NO
set @old_innodb_ft_aux_table=@@global.innodb_ft_aux_table;
set global innodb_ft_aux_table='test/t1';
insert into t1 values (1, '{"tags": ["1", "abcde", "34567"]}');
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
31xx 1 1 1 1 0
3334353637 1 1 1 1 16
6162636465 1 1 1 1 5
DROP TABLE t1;
set global innodb_ft_aux_table=@old_innodb_ft_aux_table;
select mvi_encode('[1, 42, "3"]', int);
mvi_encode('[1, 42, "3"]', int)
8000000000000001 800000000000002a 8000000000000003
select mvi_encode('[1, 42, "3"]', unsigned);
mvi_encode('[1, 42, "3"]', unsigned)
0000000000000001 000000000000002a 0000000000000003
select mvi_encode('[1, 42, "3  "]', char(6));
mvi_encode('[1, 42, "3  "]', char(6))
31xx 3432 33xx
select mvi_encode('[1, 42, "3  "]', binary(6));
mvi_encode('[1, 42, "3  "]', binary(6))
31xx 3432 33xx
Kristian Nielsen
Fix mariadb-binlog for InnoDB binlog in Windows

Do not use the dup() call from the IO-cache fd to initialize the
binlog reader, it does not work on Windows. This was probably intended
to easily open the binlog file both from a filename and from stdin.

However, reading InnoDB binlog files requires a seekable fd for
pread() anyway and access to other binlog files from their original
filename in case of OOB references, reading from stdin via a pipe eg.
does not work anyway.

So just open the binlog by name and disallow reading from stdin explicitly.

Signed-off-by: Kristian Nielsen <[email protected]>
Georgi (Joro) Kodinov
days work: the services are danzo. Some more plugin types.
Alexander Barkov
MDEV-39518 Allow prepared statements in stored functions in assignment right hand

Allowing prepared statements in stored functions when
a stored function is used in an assignment right hand.

Both DEFAULT clause of a variable initialization and
the right side of the SET statement are supported:

  CREATE PROCEDURE p1()
  BEGIN
    -- case 1: DEFAULT clause
    DECLARE spvar1 INT DEFAULT f1_with_ps(); -- OK

    -- case 2: SP variable assignment statement
    DECLARE spvar2 INT;
    SET spvar2= f1_with_ps(); -- OK
  END;

- Only assignments to SP variables works for now:
  * SET spvar= func_with_ps(); -- OK
  * SET @uvar= func_with_ps(); -- Error

- Only bare function calls are supported for now. Using a function in
  an expression does not make it PS-safe yet:
    SET v= f1()+0;

- The parser now does not reject PS statements in stored functions.
  PS applicability in stored functions is now detected at run time.
  Note, PS statements in triggers are still prohibited by the parser.

- Functions with PS do not acquire MDL locks on tables, and no MDL is
  taken on the routines themselves either. They work like procedures in
  terms of table opening and routine locking: a concurrent DROP FUNCTION
  can complete while such a function is executing.

- Functions with PS are not replicated as a single `SELECT f1()` call.
  They are replicated per-statement, like procedures.