mariadb/mysql-test/suite
unknown bd4153a8c2 MDEV-5262, MDEV-5914, MDEV-5941, MDEV-6020: Deadlocks during parallel
replication causing replication to fail.

Remove the temporary fix for MDEV-5914, which used READ COMMITTED for parallel
replication worker threads. Replace it with a better, more selective solution.

The issue is with certain edge cases of InnoDB gap locks, for example between
INSERT and ranged DELETE. It is possible for the gap lock set by the DELETE to
block the INSERT, if the DELETE runs first, while the record lock set by
INSERT does not block the DELETE, if the INSERT runs first. This can cause a
conflict between the two in parallel replication on the slave even though they
ran without conflicts on the master.

With this patch, InnoDB will ask the server layer about the two involved
transactions before blocking on a gap lock. If the server layer tells InnoDB
that the transactions are already fixed wrt. commit order, as they are in
parallel replication, InnoDB will ignore the gap lock and allow the two
transactions to proceed in parallel, avoiding the conflict.

Improve the fix for MDEV-6020. When InnoDB itself detects a deadlock, it now
asks the server layer for any preferences about which transaction to roll
back. In case of parallel replication with two transactions T1 and T2 fixed to
commit T1 before T2, the server layer will ask InnoDB to roll back T2 as the
deadlock victim, not T1. This helps in some cases to avoid excessive deadlock
rollback, as T2 will in any case need to wait for T1 to complete before it can
itself commit.

Also some misc. fixes found during development and testing:

 - Remove thd_rpl_is_parallel(), it is not used or needed.

 - Use KILL_CONNECTION instead of KILL_QUERY when a parallel replication
   worker thread is killed to resolve a deadlock with fixed commit
   ordering. There are some cases, eg. in sql/sql_parse.cc, where a KILL_QUERY
   can be ignored if the query otherwise completed successfully, and this
   could cause the deadlock kill to be lost, so that the deadlock was not
   correctly resolved.

 - Fix random test failure due to missing wait_for_binlog_checkpoint.inc.

 - Make sure that deadlock or other temporary errors during parallel
   replication are not printed to the the error log; there were some places
   around the replication code with extra error logging. These conditions can
   occur occasionally and are handled automatically without breaking
   replication, so they should not pollute the error log.

 - Fix handling of rgi->gtid_sub_id. We need to be able to access this also at
   the end of a transaction, to be able to detect and resolve deadlocks due to
   commit ordering. But this value was also used as a flag to mark whether
   record_gtid() had been called, by being set to zero, losing the value. Now,
   introduce a separate flag rgi->gtid_pending, so rgi->gtid_sub_id remains
   valid for the entire duration of the transaction.

 - Fix one place where the code to handle ignored errors called reset_killed()
   unconditionally, even if no error was caught that should be ignored. This
   could cause loss of a deadlock kill signal, breaking deadlock detection and
   resolution.

 - Fix a couple of missing mysql_reset_thd_for_next_command(). This could
   cause a prior error condition to remain for the next event executed,
   causing assertions about errors already being set and possibly giving
   incorrect error handling for following event executions.

 - Fix code that cleared thd->rgi_slave in the parallel replication worker
   threads after each event execution; this caused the deadlock detection and
   handling code to not be able to correctly process the associated
   transactions as belonging to replication worker threads.

 - Remove useless error code in slave_background_kill_request().

 - Fix bug where wfc->wakeup_error was not cleared at
   wait_for_commit::unregister_wait_for_prior_commit(). This could cause the
   error condition to wrongly propagate to a later wait_for_prior_commit(),
   causing spurious ER_PRIOR_COMMIT_FAILED errors.

 - Do not put the binlog background thread into the processlist. It causes
   too many result differences in mtr, but also it probably is not useful
   for users to pollute the process list with a system thread that does not
   really perform any user-visible tasks...
2014-06-10 10:13:15 +02:00
..
archive MDEV-5818: MySQL WL#6145: Separate the dependence of DATA DIRECTORY from symbolic links 2014-03-23 17:00:29 +02:00
binlog 5.5.38 merge 2014-06-06 00:07:27 +02:00
csv MDEV-5612 - my_rename() deletes files when it shouldn't 2014-02-26 12:55:28 +04:00
engines MDEV-4929 Myanmar collation 2013-12-20 12:42:33 +04:00
federated 10.0-base merge 2014-02-26 15:28:07 +01:00
funcs_1 5.5.38 merge 2014-06-06 00:07:27 +02:00
funcs_2 overlay support for mysql-test-run and mysqltest 2012-02-23 07:50:11 +01:00
handler 10.0-base merge 2014-02-03 15:22:39 +01:00
heap 5.5 merge 2014-05-09 12:35:11 +02:00
innodb MDEV-6288: Innodb causes server crash after disk full, 2014-07-04 06:31:48 +03:00
innodb_fts MDEV-6047: Make exists_to_in optimization ON by default 2014-06-09 13:42:21 +03:00
innodb_zip 10.0-base merge 2014-02-26 15:28:07 +01:00
jp find_files(): don't sort files in my_dir(), sort table names 2013-04-07 17:17:25 +02:00
large_tests
manual
maria MDEV-6287 Bad warning level when inserting a DATETIME value into a TIME column 2014-06-02 12:33:17 +04:00
mtr/t overlay support for mysql-test-run and mysqltest 2012-02-23 07:50:11 +01:00
mtr2 Fix for overlayed include files on Windows and a test case 2013-11-10 14:37:32 +04:00
multi_source MDEV-5804: If same GTID is received on multiple master connections in multi-source replication, the event is double-executed causing corruption or replication failure 2014-03-12 00:14:49 +01:00
optimizer_unfixed_bugs MDEV-4447 MariaDB sources should have unix-style line endings everywhere 2014-02-27 12:00:16 +01:00
parts 5.5 merge 2014-05-09 12:35:11 +02:00
percona Percona-Server-5.6.14-rel62.0 merge 2013-12-22 17:06:50 +01:00
perfschema MDEV-5262, MDEV-5914, MDEV-5941, MDEV-6020: Deadlocks during parallel 2014-06-03 10:31:11 +02:00
perfschema_stress perfschema 5.6.10 initial commit. 2014-05-06 23:20:50 +02:00
plugins 5.5 merge 2014-05-09 12:35:11 +02:00
roles MDEV-6401 SET ROLE returning ERROR 1959 Invalid role specification for valid role 2014-06-27 09:32:55 +02:00
rpl MDEV-5262, MDEV-5914, MDEV-5941, MDEV-6020: Deadlocks during parallel 2014-06-10 10:13:15 +02:00
storage_engine Intentional change in logging 2014-02-05 16:39:21 +04:00
stress Bug #11751927 42960: MTR2: NO MORE --STRESS PARAMETERS 2011-09-15 12:34:32 +02:00
sys_vars MDEV-6047: Make exists_to_in optimization ON by default 2014-06-09 13:42:21 +03:00
unit MDEV-4425 REGEXP enhancements 2013-09-26 18:02:17 +04:00
vcol MDEV-6103 - Adding/removing non-materialized virtual column triggers 2014-06-03 16:57:29 +04:00