• seppo's avatar
    MDEV-20225 BF aborting SP execution (#1394) · c42c4233
    seppo authored
    * MDEV-20225 BF aborting SP execution
    
    When stored procedure execution was chosen as victim for a BF abort, the old implemnetationn called for rollback immediately
    when execution was inside SP isntruction. Technically this happened in wsrep_after_statement() call, which identified the
    need for a rollback.
    The problem was that MariaDB does not accept rollback (nor commit) inside sub statement, there are several asserts about it,
    checking for THD::in_sub_stmt.
    
    This patch contains a fix, which skips calling wsrep_after_statement() for SP execution, which is marked as BF must abort. Instead,
    we return error code to upper level, where rollback will eventually happen, ouside of SP execution.
    Also, appending the affected trigger table (dropped or created) in the populated key set for the write set,
    which prevents parallel applying of other transactions working on the same table.
    
    * MDEV-20225 BF aborting SP execution, second patch
    
    First PR missed 4 commits, which are now squashed in this patch:
    - Added galera_sp_bf_abort test.
      A MTR test case which will reproduce BF-BF conflict if all keys
      corresponding to affected tables are not assigned for DROP TRIGGER.
    - Fixed incorrect use of sync pointsin MDEV-20225
    - Added condition for SQLCOM_DROP_TRIGGER in wsrep_can_run_in_toi()
      to make it replicate.
    
    * MDEV-20225 BF aborting SP execution, third patch
    
    The galera_trigger.test caused a situation, where SP invocation caused a trigger
    to fire, and the trigger executed as sub statement SP, and was BF aborted by applier.
    because of wsrep_after_statement() was called for the sub-statement level, it ended up
    in exeuting rollback and asserted there.
    Thus fix will catch sub-statement level SP execution, and avoids calling wsrep_after_statement()
    c42c4233
wsrep_mysqld.cc 81.1 KB