Skip to content
  • Dyre Tjeldvoll's avatar
    6883ff2a
    BUG#21638823: ASSERTION FAILED: THD->GET_TRANSACTION()->IS_EMPTY(TRANSACTION_CTX::STMT) || THD · 6883ff2a
    Dyre Tjeldvoll authored
    Problem: Issuing DROP TEMPORARY TABLE when in XA_IDLE state, would
    trigger an assert when running with --log-bin. Root cause was that a
    binlog handler for the DROP TEMPORARY TABLE statement was added to the
    transaction in XA_IDLE state, but its removal was "optimized" away since
    the statement was not actually doing anything.
    
    Solution: Since the XA-spec actually prohibits DROP [TEMPORARY] TABLE
    in XA_IDLE the problem can be avoided by returning ER_XAER_RMFAIL in
    this case.
    
    Temporary tables are also dropped when a connection ends. This implicit
    DROP is binlogged as an explicit DROP statement. The assert (on the master)
    does not manifest itself in this case because the implicit DROP has a
    completely different code path which does not add a binlog handler to the
    transaction even if we are in XA_IDLE.
    
    The explicit DROP added to the binlog is NOT rejected on the slave because:
    - in row mode the XA statements are not replicated, so the slave is not
      in XA_IDLE
    - in stmt and mixed mode a COMMIT is inserted before the explicit DROP
      so the slave is no longer in XA_IDLE
    
    Note! This patch changes behavior. Statements which would previously succeed
    in XA_IDLE now fail with ER_XAER_RMFAIL. However, when running with
    --gtid-mode=ON, an explicit DROP continues to fail with
    ER_GTID_UNSAFE_CREATE_DROP_TEMPORARY_TABLE_IN_TRANSACTION
    6883ff2a
    BUG#21638823: ASSERTION FAILED: THD->GET_TRANSACTION()->IS_EMPTY(TRANSACTION_CTX::STMT) || THD
    Dyre Tjeldvoll authored
    Problem: Issuing DROP TEMPORARY TABLE when in XA_IDLE state, would
    trigger an assert when running with --log-bin. Root cause was that a
    binlog handler for the DROP TEMPORARY TABLE statement was added to the
    transaction in XA_IDLE state, but its removal was "optimized" away since
    the statement was not actually doing anything.
    
    Solution: Since the XA-spec actually prohibits DROP [TEMPORARY] TABLE
    in XA_IDLE the problem can be avoided by returning ER_XAER_RMFAIL in
    this case.
    
    Temporary tables are also dropped when a connection ends. This implicit
    DROP is binlogged as an explicit DROP statement. The assert (on the master)
    does not manifest itself in this case because the implicit DROP has a
    completely different code path which does not add a binlog handler to the
    transaction even if we are in XA_IDLE.
    
    The explicit DROP added to the binlog is NOT rejected on the slave because:
    - in row mode the XA statements are not replicated, so the slave is not
      in XA_IDLE
    - in stmt and mixed mode a COMMIT is inserted before the explicit DROP
      so the slave is no longer in XA_IDLE
    
    Note! This patch changes behavior. Statements which would previously succeed
    in XA_IDLE now fail with ER_XAER_RMFAIL. However, when running with
    --gtid-mode=ON, an explicit DROP continues to fail with
    ER_GTID_UNSAFE_CREATE_DROP_TEMPORARY_TABLE_IN_TRANSACTION
Loading