mariadb/storage/tokudb/mysql-test/tokudb_mariadb/t
Andrei Elkin c8ae357341 MDEV-742 XA PREPAREd transaction survive disconnect/server restart
Lifted long standing limitation to the XA of rolling it back at the
transaction's
connection close even if the XA is prepared.

Prepared XA-transaction is made to sustain connection close or server
restart.
The patch consists of

    - binary logging extension to write prepared XA part of
      transaction signified with
      its XID in a new XA_prepare_log_event. The concusion part -
      with Commit or Rollback decision - is logged separately as
      Query_log_event.
      That is in the binlog the XA consists of two separate group of
      events.

      That makes the whole XA possibly interweaving in binlog with
      other XA:s or regular transaction but with no harm to
      replication and data consistency.

      Gtid_log_event receives two more flags to identify which of the
      two XA phases of the transaction it represents. With either flag
      set also XID info is added to the event.

      When binlog is ON on the server XID::formatID is
      constrained to 4 bytes.

    - engines are made aware of the server policy to keep up user
      prepared XA:s so they (Innodb, rocksdb) don't roll them back
      anymore at their disconnect methods.

    - slave applier is refined to cope with two phase logged XA:s
      including parallel modes of execution.

This patch does not address crash-safe logging of the new events which
is being addressed by MDEV-21469.

CORNER CASES: read-only, pure myisam, binlog-*, @@skip_log_bin, etc

Are addressed along the following policies.
1. The read-only at reconnect marks XID to fail for future
   completion with ER_XA_RBROLLBACK.

2. binlog-* filtered XA when it changes engine data is regarded as
   loggable even when nothing got cached for binlog.  An empty
   XA-prepare group is recorded. Consequent Commit-or-Rollback
   succeeds in the Engine(s) as well as recorded into binlog.

3. The same applies to the non-transactional engine XA.

4. @@skip_log_bin=OFF does not record anything at XA-prepare
   (obviously), but the completion event is recorded into binlog to
   admit inconsistency with slave.

The following actions are taken by the patch.

At XA-prepare:
   when empty binlog cache - don't do anything to binlog if RO,
   otherwise write empty XA_prepare (assert(binlog-filter case)).

At Disconnect:
   when Prepared && RO (=> no binlogging was done)
     set Xid_cache_element::error := ER_XA_RBROLLBACK
     *keep* XID in the cache, and rollback the transaction.

At XA-"complete":
   Discover the error, if any don't binlog the "complete",
   return the error to the user.

Kudos
-----
Alexey Botchkov took to drive this work initially.
Sergei Golubchik, Sergei Petrunja, Marko Mäkelä provided a number of
good recommendations.
Sergei Voitovich made a magnificent review and improvements to the code.
They all deserve a bunch of thanks for making this work done!
2020-03-14 22:45:48 +02:00
..
229cols.test MDEV-7003 test-alter-table crashes debug build due to double free of plugin 2014-11-13 13:40:19 +01:00
alter.test tokudb test suites 2013-09-09 13:59:38 +02:00
autoinc.test MDEV-6605 Multiple Clients Inserting Causing Error: Failed to read auto-increment value from storage engine 2014-09-08 18:38:13 +02:00
clustering.test MDEV-16188 Post merge fixes: more for TokuDB 2019-02-08 12:32:31 -08:00
commit_5396.test MDEV-5396 Assertion `Handlerton: r==0 ' failed (errno=0) on EXPLAIN with TokuDB tables 2013-12-17 17:26:54 +01:00
compression.test Fixed compiler warnings 2014-01-29 15:41:10 +02:00
create_or_replace.test MDEV-5930 Server crashes in thd_get_ha_data on CREATE OR REPLACE TABLE 2014-03-23 18:39:10 +02:00
discover_names.test MDEV-5943 'show table status' does not immediately show tokudb tables 2014-03-26 22:32:15 +01:00
mdev5426.test MDEV-5426: Assertion `toku_ft_needed_unlocked(src_h)' failed (errno=11) ... 2014-01-21 14:02:56 +04:00
mdev6519.test MDEV-6519: Assertion `join->best_read < double(...)' failed after adding a key to a TokuDB table... 2014-10-10 23:52:47 +04:00
mdev6657.test MDEV-12737: tokudb_mariadb.mdev6657 fails in buildbot with different plan, and outside with valgrind warnings 2018-03-20 11:05:28 +05:30
mdev12972.test MDEV-12972 Random and Frequent Segfault 2017-08-03 19:28:05 +03:00
mrr.test MDEV-5976: TokuDB: Wrong query result using mrr=on 2014-06-06 21:28:42 +04:00
optimize.test mtr: check that tests clean up debug_sync. fix tests that didn't. 2014-01-27 12:10:53 +01:00
savepoint.test tokudb test suites 2013-09-09 13:59:38 +02:00
xa-recovery-9214.opt MDEV-9214 Server miscalculates the number of XA-capable engines 2015-12-19 13:59:29 +01:00
xa-recovery-9214.test enable tests that were skipped because of have_xtradb 2016-12-29 13:23:49 +01:00
xa.test MDEV-742 XA PREPAREd transaction survive disconnect/server restart 2020-03-14 22:45:48 +02:00