• Andrei Elkin's avatar
    MDEV-742: read-only, pure myisam, binlog-*, @@skip_log_bin corner cases · dc905718
    Andrei Elkin authored
    (Pushed to 10.5)
    Are addressed along the following policies.
    Prepared read-only, or on non-transactional engines, or
    binlog-* filter in binlog, or skipped to binlog XA:s remains in the xid cache after disconnect.
    But their consequent completion with Commit or Rollback differs.
    
    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.
    
    RO patch review notes.
    dc905718
rpl_xa-master.opt 28 Bytes