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
Kristian Nielsen
MDEV-36287: Server crash in SHOW SLAVE STATUS concurrent with STOP SLAVE

In SHOW SLAVE STATUS, do not access members of the SQL thread's THD without
holding mi->run_lock. Otherwise the THD can go away in case of concurrent
STOP SLAVE, leading to invalid memory references and server crash.

Reviewed-by: Monty <[email protected]>
Signed-off-by: Kristian Nielsen <[email protected]>
Vladislav Vaintroub
MDEV-14091 - Address review comments

- Return error when reading file-based password from locations readable
  by LOAD DATA or LOAD_FILE().

- If ssl_passphrase was set, SHOW VARIABLE will show "file:", "env:" or
  "pass:" (but won't reveal sensitive data)
Dmitry Shulga
MDEV-34501: SIGSEGV in pfs_start_mutex_wait_v1, __strlen_avx2, or __strlen_evex from safe_mutex_lock on CREATE DEFINER when using skip-grant-tables

Attempt to create a procedure with the DEFINER clause resulted in
abnormal server termination in case the server run with the option
--skip-grant-tables=1.

The reason of abnormal termination is that on handling of the DEFINER
clause, not initialized data members of acl_cache is accessed, that led
to server crash.

To fix the issue, running of the CREATE PROCEDURE/FUNCITON with
the DEFINER clause must be disabled against a server that is started
with the option --skip-grant-tables=1
Rucha Deodhar
MDEV-25099: Inconsistent error upon updating read-only table with
ROW_FORMAT=COMPRESSED

Analysis:

Warning level is incorrect
Fix:
Changed to correct warning level
Monty
Add memory allocated by my_once_alloc() to memory status

Global Memory_used and global Memory_used_initial now
includes memory allocated by mysys libraries during
server startup.
Marko Mäkelä
Deprecate&ignore innodb_log_spin_wait_delay
Marko Mäkelä
squash! 55d2ec12ef3b75fd57d8831675e3eb5888b9aef7

trx_purge_attach_undo_recs(), trx_purge(): Clear purge_sys.m_active
only after all table handles have been released.
Monty
Fixed that HA_EXTRA_FLUSH in Aria and MyISAM flushes all data to disk

This is needed to support Atomic CREATE TABLE t1 SELECT * FROM ...
on non transactional tables.
Monty
Removed possible deadlock betwen LOCK_log and LOCK_global_system_variables

The lock order of the mutex must be LOCK_log followed by
LOCK_global_system_variables as InnoDB can lock
LOCK_global_system_variables during a transaction commit when LOCK_log
is hold.

Fix is to temporarly unlock LOCK_global_system_variables when setting
global binlog variables that needs to use LOCK_log.
Monty
Do not log ALTER table to ddl log for REPAIR

REPAIR of InnoDB tables was logging ALTER TABLE and REPAIR to ddl log.
ALTER TABLE contained the new tableid and REPAIR, wrongly, contained the
old rowid.

Now only REPAIR is logged

ddl.log changes:
REPAIR TABLE and OPTIMIZE TABLE that are done through ALTER TABLE will
now contain the old and new table id. If not done through ALTER TABLE,
only the current rowid will be shown (as before).
Marko Mäkelä
squash! 55d2ec12ef3b75fd57d8831675e3eb5888b9aef7

trx_purge_attach_undo_recs(), purge_sys_t::batch_cleanup():
Clear purge_sys.m_active only after all table handles have been released.
Rucha Deodhar
MDEV-31477: Inconsistent handling while fetching values in json

Analysis:
When we get value in json_value(), if any error occurs while scanning the
json, it is not reported. Only true is returned.
Fix:
Report error along with returning true (error)
Monty
MDEV-36099 Ensure that creation and usage of temporary tables in replication is predictable

The purpose of this commit is to ensure that creation and changes of
temporary tables are properly and predicable logged to the binary
log.  It also fixes some bugs where ROW logging was used in MIXED mode,
when STATEMENT would be a better (and expected) choice.

In this comment STATEMENT stands for logging to binary log in
STATEMENT format, MIXED stands for MIXED binlog format and ROW for ROW
binlog format.

New rules for logging of temporary tables
- CREATE of temporary tables are now by default binlogged only if
  STATEMENT binlog format is used. If it is binlogged, 1 is stored in
  TABLE_SHARE->table_creation_was_logged. The user can change this
  behavior by setting create_temporary_table_binlog_formats to
  MIXED,STATEMENT in which case the create is logged in statement
  format also in MIXED mode (as before).
- Changes to temporary tables are only binlogged if and only if
  the CREATE was logged. The logging happens under STATEMENT or MIXED.
  If binlog_format=ROW, temporary table changes are not binlogged. A
  temporary table that are changed under ROW are marked as 'not up to
  date in binlog' and no future row changes are logged.  Any usage of
  this temporary table will force row logging of other tables in any
  future statements using the temporary table to be row logged.
- DROP TEMPORARY is binlogged only of the CREATE was binlogged.

Changes done:
- Row logging is forced for any statement using temporary tables that
  are not up to date in the binary log.
  (Before the row logging was forced if the user has a temporary table)
- If there is any changes to the temporary table that is not binlogged,
  the table is marked as not up to date.
- TABLE_SHARE->table_creation_was_logged has a new definition for
  temporary tables:
  0  Table creating was not logged to binary log
  1  Table creating was logged to binary log and table is up to date.
  2  Table creating was logged to binary log but some changes where
    not logged to binary log.
  Table is not up to date in binary log is defined as value 0 or 2.
- If a multi-table-update or multi-table-delete fails then
  all updated temporary tables are marked as not up to date.
- Enforce row logging if the query is using temporary tables
  that are not up to date.
  Before row logging was enforced if the user had any
  temporary tables.
- When dropping temporary tables use IF EXISTS. This ensures
  that slave will not stop if it had crashed and lost the
  temporary tables.
- Remove comment and version from DROP /*!4000 TEMPORARY.. generated when
  a connection closes that has open temporary tables. Added 'generated by
  server' at the end of the DROP.

Bugs fixed:
- When using temporary tables with commands that forced row based,
  like INSERT INTO temporary_table VALUES (UUID()), this was never
  logged which causes the temporary table to be inconsistent on
  master and slave.
- Used binlog format is now clearly defined. It is now only depending
  on the current binlog_format and the tables used.
  Before it was depending on the user had ANY temporary tables and
  the state of 'current_stmt_binlog_format' set by previous queries.
  This also caused temporary tables to be logged to binary log in
  some cases.
- CREATE TABLE t1 LIKE not_logged_temporary_table caused replication
  to stop.
- Rename of not binlogged temporary tables where binlogged to binary log
  which caused replication to stop.

Changes in behavior:

- By default create_temporary_table_binlog_formats=STATEMENT, which
  means that CREATE TEMPORARY is not logged to binary log under MIXED
  binary logging. This can be changed by setting
  create_temporary_table_binlog_formats to MIXED,STATEMENT.
- Using temporary tables that was not logged to the binary log will
  cause any query using them for updating other tables to be logged in
  ROW format. Before all queries was logged in ROW format if the user had
  any temporary tables, even if they were not used by the query.
- Generated DROP TEMPORARY TABLE is now always using IF EXISTS and
  has a "generated by server" comment in the binary log.

The consequences of the above is that manipulations of a lot of rows
through temporary tables will by default be be slower in mixed mode.

For example:
  BEGIN;
  CREATE TEMPORARY TABLE tmp AS SELECT a, b, c FROM
  large_table1 JOIN large_table2 ON ...;
  INSERT INTO other_table SELECT b, c FROM tmp WHERE a <100;
  DROP TEMPORARY TABLE tmp;
  COMMIT;

By default this will create a huge entry in the binary log, compared
to just a few hundred bytes in statement mode. However the change in
this commit will make usage of temporary tables more reliable and
predicable and is thus worth it. Using statement mode or
create_temporary_table_binlog_formats can be used to avoid this issue.
Monty
MDEV-25292 Atomic CREATE OR REPLACE TABLE

Atomic CREATE OR REPLACE allows to keep an old table intact if the
command fails or during the crash. That is done by renaming the
original table to temporary name, as a backup and restoring it if the
CREATE fails. When the command is complete and logged the backup
table is deleted.

Atomic replace algorithm

  Two DDL chains are used for CREATE OR REPLACE:
  ddl_log_state_create (C) and ddl_log_state_rm (D).

  1. (C) Log rename of ORIG to TMP table (Rename TMP to original).
  2. Rename orignal to TMP.
  3. (C) Log CREATE_TABLE_ACTION of ORIG (drops ORIG);
  4. Do everything with ORIG (like insert data)
  5. (D) Log drop of TMP
  6. Write query to binlog (this marks (C) to be closed in
    case of failure)
  7. Execute drop of TMP through (D)
  8. Close (C) and (D)

  If there is a failure before 6) we revert the changes in (C)
  Chain (D) is only executed if 6) succeded (C is closed on
  crash recovery).

Foreign key errors will be found at the 1) stage.

Additional notes

  - CREATE TABLE without REPLACE and temporary tables is not affected
    by this commit.
    set @@drop_before_create_or_replace=1 can be used to
    get old behaviour where existing tables are dropped
    in CREATE OR REPLACE.

  - CREATE TABLE is reverted if binlogging the query fails.

  - Engines having HTON_EXPENSIVE_RENAME flag set are not affected by
    this commit. Conflicting tables marked with this flag will be
    deleted with CREATE OR REPLACE.

  - Replication execution is not affected by this commit.
    - Replication will first drop the conflicting table and then
      creating the new one.

  - CREATE TABLE .. SELECT XID usage is fixed and now there is no need
    to log DROP TABLE via DDL_CREATE_TABLE_PHASE_LOG (see comments in
    do_postlock()). XID is now correctly updated so it disables
    DDL_LOG_DROP_TABLE_ACTION. Note that binary log is flushed at the
    final stage when the table is ready. So if we have XID in the
    binary log we don't need to drop the table.

  - Three variations of CREATE OR REPLACE handled:

    1. CREATE OR REPLACE TABLE t1 (..);
    2. CREATE OR REPLACE TABLE t1 LIKE t2;
    3. CREATE OR REPLACE TABLE t1 SELECT ..;

  - Test case uses 6 combinations for engines (aria, aria_notrans,
    myisam, ib, lock_tables, expensive_rename) and 2 combinations for
    binlog types (row, stmt). Combinations help to check differences
    between the results. Error failures are tested for the above three
    variations.

  - expensive_rename tests CREATE OR REPLACE without atomic
    replace. The effect should be the same as with the old behaviour
    before this commit.

  - Triggers mechanism is unaffected by this change. This is tested in
    create_replace.test.

  - LOCK TABLES is affected. Lock restoration must be done after new
    table is created or TMP is renamed back to ORIG

  - Moved ddl_log_complete() from send_eof() to finalize_ddl(). This
    checkpoint was not executed before for normal CREATE TABLE but is
    executed now.

  - CREATE TABLE will now rollback also if writing to the binary
    logging failed. See rpl_gtid_strict.test

backup ddl log changes

- In case of a successfull CREATE OR REPLACE we only log
  the CREATE event, not the DROP TABLE event of the old table.

ddl_log.cc changes

  ddl_log_execute_action() now properly return error conditions.
  ddl_log_disable_entry() added to allow one to disable one entry.
  The entry on disk is still reserved until ddl_log_complete() is
  executed.

On XID usage

  Like with all other atomic DDL operations XID is used to avoid
  inconsistency between master and slave in the case of a crash after
  binary log is written and before ddl_log_state_create is closed. On
  recovery XIDs are taken from binary log and corresponding DDL log
  events get disabled.  That is done by
  ddl_log_close_binlogged_events().

On linking two chains together

  Chains are executed in the ascending order of entry_pos of execute
  entries. But entry_pos assignment order is undefined: it may assign
  bigger number for the first chain and then smaller number for the
  second chain. So the execution order in that case will be reverse:
  second chain will be executed first.

  To avoid that we link one chain to another. While the base chain
  (ddl_log_state_create) is active the secondary chain
  (ddl_log_state_rm) is not executed. That is: only one chain can be
  executed in two linked chains.

  The interface ddl_log_link_chains() was defined in "MDEV-22166
  ddl_log_write_execute_entry() extension".

Atomic info parameters in HA_CREATE_INFO

  Many functions in CREATE TABLE pass the same parameters. These
  parameters are part of table creation info and should be in
  HA_CREATE_INFO (or whatever). Passing parameters via single
  structure is much easier for adding new data and
  refactoring.

InnoDB changes
  Added ha_innobase::can_be_renamed_to_backup() to check if
  a table with foreign keys can be renamed.

Aria changes:
- Fixed issue in Aria engine with CREATE + locked tables
  that data was not properly commited in some cases in
  case of crashes.

Known issues:
- InnoDB tables with foreign key definitions are not fully supported
  with atomic create and replace:
  - ha_innobase::can_be_renamed_to_backup() can detect some cases
    where InnoDB does not support renaming table with foreign key
    constraints.  In this case MariaDB will drop the old table before
    creating the new one.
    The detected cases are:
    - The new and old table is using the same foreign key constraint
      name.
    - The old table has self referencing constraints.
  - If the old and new table uses the same name for a constraint the
    create of the new table will fail. The orignal table will be
    restored in this case.
  - The above issues will be fixed in a future commit.
- CREATE OR REPLACE TEMPORARY table is not full atomic. Any conflicting
  table will always be dropped before creating a new one. (Old behaviour).
Rucha Deodhar
MDEV-25099: Inconsistent error upon updating read-only table with
ROW_FORMAT=COMPRESSED

Analysis:

Warning level is incorrect
Fix:
Changed to correct warning level
Monty
Always call mysql_cond_broadcast(&rli->data_cond) under data_lock

This is a safetly fix to try to fix random failures in
parallel_backup_xa_debug reported as:
sync_slave_with_master failed:
'select master_pos_wait('master-bin.000001', 1034, 300, '')' returned -1

One possible reason could be lost signals, which this patch fixes.
Alexander Barkov
MDEV-20034 Add support for the pre-defined weak SYS_REFCURSOR

This patch adds support for SYS_REFCURSOR (a weakly typed cursor)
for both sql_mode=ORACLE and sql_mode=DEFAULT.

Works as a regular stored routine variable, parameter and return value:

- can be passed as an IN parameter to stored functions and procedures
- can be passed as an OUT parameter to stored procedures
- can be returned from a stored function

Note, strongly typed REF CURSOR will be added separately.

The implementation consists of the following parts:
- A new class sp_cursor_array deriving from Dynamic_array
- A new member THD::m_session_cursors of the sp_cursor_array data type.
- A new data type handler Type_handler_sys_refcursor.
  It is designed to store an uint16 index -
  the position of the cursor in THD::m_session_cursors.
- Type_handler_sys_refcursor suppresses some derived numeric features.
  When a SYS_REFCURSOR variable is used as an integer an error is raised.
- A new abstract class sp_instr_fetch_cursor. It's needed to share
  the common code between "OPEN cur" (for static cursors) and
  "OPER cur FOR stmt" (for SYS_REFCURSORs).
- New sp_instr classes:
  * sp_instr_copen_by_ref    - OPEN sys_ref_curor FOR stmt;
  * sp_instr_cfetch_by_ref    - FETCH sys_ref_cursor INTO targets;
  * sp_instr_cclose_by_ref    - CLOSE sys_ref_cursor;
- New methods in LEX:
  * sp_open_cursor_for_stmt - handles "OPER sys_ref_cursor FOR stmt".
  * sp_add_instr_fetch_cursor - "FETCH cur INTO targets" for both
                                static cursors and SYS_REFCURSORs.
  * sp_close - handles "CLOSE cur" both for static cursors and SYS_REFCURSORs.
- Changes in cursor functions to handle both static cursors and SYS_REFCURSORs:
  * Item_func_cursor_isopen
  * Item_func_cursor_found
  * Item_func_cursor_notfound
  * Item_func_cursor_rowcount
- A new system variable @@max_open_cursors - to limit the number
  of cursors (static and SYS_REFCURSORs) opened at the same time.
  Its allowed range
  is [0-65536], with 50 by default.
- A new virtual method Type_handler::can_return_bool() telling
  if Item::val_bool() can be used.
- New methods in Sp_rcontext_handlers:
  * get_cursor()
  * get_cursor_by_ref()
- A new class Sp_rcontext_handler_session to handle session-wide cursors
Kristian Nielsen
MDEV-36287: Server crash in SHOW SLAVE STATUS concurrent with STOP SLAVE

In SHOW SLAVE STATUS, do not access members of the SQL thread's THD without
holding mi->run_lock. Otherwise the THD can go away in case of concurrent
STOP SLAVE, leading to invalid memory references and server crash.

Signed-off-by: Kristian Nielsen <[email protected]>
Monty
Comment improvements
Alexander Barkov
MDEV-20034 Add support for the pre-defined weak SYS_REFCURSOR

This patch adds support for SYS_REFCURSOR (a weakly typed cursor)
for both sql_mode=ORACLE and sql_mode=DEFAULT.

Works as a regular stored routine variable, parameter and return value:

- can be passed as an IN parameter to stored functions and procedures
- can be passed as an INOUT and OUT parameter to stored procedures
- can be returned from a stored function

Note, strongly typed REF CURSOR will be added separately.

Note, to maintain dependencies easier, some parts of sql_class.h
and item.h were moved to new header files:

- select_results.h:
  class select_result_sink
  class select_result
  class select_result_interceptor

- sp_cursor.h:
  class sp_cursor_statistics
  class sp_cursor

- sp_rcontext_handler.h
  class Sp_rcontext_handler and its descendants

The implementation consists of the following parts:
- A new class sp_cursor_array deriving from Dynamic_array

- A new class Statement_rcontext which contains data shared
  between sub-statements of a compound statement.
  It has a member m_statement_cursors of the sp_cursor_array data type,
  as well as open cursor counters. THD inherits from Statement_rcontext.

- A new data type handler Type_handler_sys_refcursor in plugins/type_cursor/
  It is designed to store uint16 references -
  positions of the cursor in THD::m_statement_cursors.

- Type_handler_sys_refcursor suppresses some derived numeric features.
  When a SYS_REFCURSOR variable is used as an integer an error is raised.

- A new abstract class sp_instr_fetch_cursor. It's needed to share
  the common code between "OPEN cur" (for static cursors) and
  "OPER cur FOR stmt" (for SYS_REFCURSORs).

- New sp_instr classes:
  * sp_instr_copen_by_ref      - OPEN sys_ref_curor FOR stmt;
  * sp_instr_cfetch_by_ref    - FETCH sys_ref_cursor INTO targets;
  * sp_instr_cclose_by_ref    - CLOSE sys_ref_cursor;
  * sp_instr_destruct_variable - to destruct SYS_REFCURSOR variables when
                                the execution goes out of the BEGIN..END block
                                where SYS_REFCURSOR variables are declared.
- New methods in LEX:
  * sp_open_cursor_for_stmt  - handles "OPEN sys_ref_cursor FOR stmt".
  * sp_add_instr_fetch_cursor - "FETCH cur INTO targets" for both
                                static cursors and SYS_REFCURSORs.
  * sp_close - handles "CLOSE cur" both for static cursors and SYS_REFCURSORs.

- Changes in cursor functions to handle both static cursors and SYS_REFCURSORs:
  * Item_func_cursor_isopen
  * Item_func_cursor_found
  * Item_func_cursor_notfound
  * Item_func_cursor_rowcount

- A new system variable @@max_open_cursors - to limit the number
  of cursors (static and SYS_REFCURSORs) opened at the same time.
  Its allowed range is [0-65536], with 50 by default.

- A new virtual method Type_handler::can_return_bool() telling
  if calling item->val_bool() is allowed for Items of this data type,
  or if otherwise the "Illegal parameter for operation" error should be raised
  at fix_fields() time.

- New methods in Sp_rcontext_handlers:
  * get_cursor()
  * get_cursor_by_ref()

- A new class Sp_rcontext_handler_session to handle top level statement
  wide cursors which are shared by all substatements.

- A new virtual method expr_event_handler() in classes Item, Field
  and Type_handler. It's needed to close (and make available for a new OPEN)
  unused THD::m_statement_cursors elements which do not have any references
  any more. It can happen in various moments in time, e.g.
  * after evaluation parameters of an SQL routine
  * after assigning a cursor expression into a SYS_REFCURSOR variable
  * when leaving a BEGIN..END block with SYS_REFCURSOR variables
  * after setting OUT/INOUT routine actual parameters from formal
    parameters.
Kristian Nielsen
Add --source include/long_test.inc to a few long-running tests

Signed-off-by: Kristian Nielsen <[email protected]>
Oleg Smirnov
MDEV-34870 Correctly process nested joins having multiple levels of embedding
Monty
Added make_tmp_table_name() to simplify creating temporary table names
Monty
Add MDL locks around rename and drop table in ddl_log.cc

This includes both normal tables and backup tables (as part of
atomic create and replace).

This is needed to ensure that InnoDB purge_coordinator_task and drop table
does not cause conflicts.
Marko Mäkelä
WIP MDEV-21923 (does not bootstrap)

FIXME: Initialize log_sys.buf_start_lsn correctly

FIXME: Refine the back-off logic
Marko Mäkelä
squash! d757498dc2d5bb456539851d596cb75a639777f4

trx_purge_attach_undo_recs(), trx_purge(): Clear purge_sys.m_active
only after all table handles have been released.
Alexander Barkov
MDEV-20034 Add support for the pre-defined weak SYS_REFCURSOR

This patch adds support for SYS_REFCURSOR (a weakly typed cursor)
for both sql_mode=ORACLE and sql_mode=DEFAULT.

Works as a regular stored routine variable, parameter and return value:

- can be passed as an IN parameter to stored functions and procedures
- can be passed as an OUT parameter to stored procedures
- can be returned from a stored function

Note, strongly typed REF CURSOR will be added separately.

The implementation consists of the following parts:
- A new class sp_cursor_array deriving from Dynamic_array
- A new member THD::m_session_cursors of the sp_cursor_array data type.
- A new data type handler Type_handler_sys_refcursor.
  It is designed to store an uint16 index -
  the position of the cursor in THD::m_session_cursors.
- Type_handler_sys_refcursor suppresses some derived numeric features.
  When a SYS_REFCURSOR variable is used as an integer an error is raised.
- A new abstract class sp_instr_fetch_cursor. It's needed to share
  the common code between "OPEN cur" (for static cursors) and
  "OPER cur FOR stmt" (for SYS_REFCURSORs).
- New sp_instr classes:
  * sp_instr_copen_by_ref    - OPEN sys_ref_curor FOR stmt;
  * sp_instr_cfetch_by_ref    - FETCH sys_ref_cursor INTO targets;
  * sp_instr_cclose_by_ref    - CLOSE sys_ref_cursor;
- New methods in LEX:
  * sp_open_cursor_for_stmt - handles "OPER sys_ref_cursor FOR stmt".
  * sp_add_instr_fetch_cursor - "FETCH cur INTO targets" for both
                                static cursors and SYS_REFCURSORs.
  * sp_close - handles "CLOSE cur" both for static cursors and SYS_REFCURSORs.
- Changes in cursor functions to handle both static cursors and SYS_REFCURSORs:
  * Item_func_cursor_isopen
  * Item_func_cursor_found
  * Item_func_cursor_notfound
  * Item_func_cursor_rowcount
- A new system variable @@max_open_cursors - to limit the number
  of cursors (static and SYS_REFCURSORs) opened at the same time.
  Its allowed range
  is [0-65536], with 50 by default.
- A new virtual method Type_handler::can_return_bool() telling
  if Item::val_bool() can be used.
- New methods in Sp_rcontext_handlers:
  * get_cursor()
  * get_cursor_by_ref()
- A new class Sp_rcontext_handler_session to handle session-wide cursors
Monty
Added VALGRIND_YIELD to be able to abort from busy loops

Valgrind is single threaded and only changes threads as part of
system calls or waits.

I found some busy loops where the server assumes that some other
thread will change the state, which will not happen with valgrind.

Added VALGRIND_YIELD to the loops, which calls pthread_yield() if
HAVE_VALGRIND is defined.

Added pthread_yield() to the loops in table_cache.

We should consider changing some of the VALGRIND_YIELD calls to call
pthread_yield() as busy loop without any sleep() is usually a bad
thing.

Reviewer: [email protected]
Kristian Nielsen
MDEV-34705: Binlog-in-engine: First working recovery

Still needs more testing.

Signed-off-by: Kristian Nielsen <[email protected]>
Monty
Always use all arguments for ddl_log_write_execute_entry()

Remove not anymore used
bool ddl_log_write_execute_entry(uint first_entry,
                                DDL_LOG_MEMORY_ENTRY **active_entry)

Simple transformations, no logic changes.
Kristian Nielsen
Fix redundant ER_PRIOR_COMMIT_FAILED in parallel replication

wait_for_prior_commit() can be called multiple times per event group,
only do my_error() the first time the call fails.

Remove redundant set_overwrite_status() calls.

Signed-off-by: Kristian Nielsen <[email protected]>
Reviewed-by: Monty <[email protected]>
Oleg Smirnov
MDEV-34870 Correctly update JOIN_TAB::key_dependent after applying hints
Oleksandr Byelkin
mixing joins handled
Kristian Nielsen
Add --source include/long_test.inc to some tests

This speed up mtr --parallel=96 with 25 seconds for me.

Signed-off-by: Kristian Nielsen <[email protected]>
Monty
ha_table_exists() cleanup and improvement

This is part of MDEV-25292 Atomic CREATE OR REPLACE TABLE.

Removed default values for arguments, added flags argument to specify
filename flags (FN_TO_IS_TMP, FN_FROM_IS_TMP) and forward the flag to
build_table_name().

Original patch from: Aleksey Midenkov <[email protected]>
Kristian Nielsen
MDEV-34705: Binlog-in-engine: First working recovery

Still needs more testing.

Signed-off-by: Kristian Nielsen <[email protected]>
Monty
rename binlog_show_create_table_() to binlog_show_create_table()

Other things:
- Removed not existing binlog_show_create_table() declaration in
  class select_create()
Aleksey Midenkov
MDEV-25292 Refactoring: moved select_field_count into Alter_info.

There is a need in MDEV-25292 to have both C_ALTER_TABLE and
select_field_count in one call. Semantically creation mode and field
count are two different things. Making creation mode negative
constants and field count positive variable into one parameter seems
to be a lazy hack for not making the second parameter.

select_count does not make sense without alter_info->create_list, so
the natural way is to hold it in Alter_info too. select_count is now
stored in member select_field_count.

Merged and updated by: Monty
Marko Mäkelä
squash! d757498dc2d5bb456539851d596cb75a639777f4

trx_purge_attach_undo_recs(), purge_sys_t::batch_cleanup():
Clear purge_sys.m_active only after all table handles have been released.
Alexander Barkov
MDEV-20034 Add support for the pre-defined weak SYS_REFCURSOR

This patch adds support for SYS_REFCURSOR (a weakly typed cursor)
for both sql_mode=ORACLE and sql_mode=DEFAULT.

Works as a regular stored routine variable, parameter and return value:

- can be passed as an IN parameter to stored functions and procedures
- can be passed as an OUT parameter to stored procedures
- can be returned from a stored function

Note, strongly typed REF CURSOR will be added separately.

The implementation consists of the following parts:
- A new class sp_cursor_array deriving from Dynamic_array
- A new member THD::m_session_cursors of the sp_cursor_array data type.
- A new data type handler Type_handler_sys_refcursor.
  It is designed to store an uint16 index -
  the position of the cursor in THD::m_session_cursors.
- Type_handler_sys_refcursor suppresses some derived numeric features.
  When a SYS_REFCURSOR variable is used as an integer an error is raised.
- A new abstract class sp_instr_fetch_cursor. It's needed to share
  the common code between "OPEN cur" (for static cursors) and
  "OPER cur FOR stmt" (for SYS_REFCURSORs).
- New sp_instr classes:
  * sp_instr_copen_by_ref    - OPEN sys_ref_curor FOR stmt;
  * sp_instr_cfetch_by_ref    - FETCH sys_ref_cursor INTO targets;
  * sp_instr_cclose_by_ref    - CLOSE sys_ref_cursor;
- New methods in LEX:
  * sp_open_cursor_for_stmt - handles "OPER sys_ref_cursor FOR stmt".
  * sp_add_instr_fetch_cursor - "FETCH cur INTO targets" for both
                                static cursors and SYS_REFCURSORs.
  * sp_close - handles "CLOSE cur" both for static cursors and SYS_REFCURSORs.
- Changes in cursor functions to handle both static cursors and SYS_REFCURSORs:
  * Item_func_cursor_isopen
  * Item_func_cursor_found
  * Item_func_cursor_notfound
  * Item_func_cursor_rowcount
- A new system variable @@max_open_cursors - to limit the number
  of cursors (static and SYS_REFCURSORs) opened at the same time.
  Its allowed range
  is [0-65536], with 50 by default.
- A new virtual method Type_handler::can_return_bool() telling
  if Item::val_bool() can be used.
- New methods in Sp_rcontext_handlers:
  * get_cursor()
  * get_cursor_by_ref()
- A new class Sp_rcontext_handler_session to handle session-wide cursors