• Annamalai Gurusami's avatar
    Bug #16004999 ASSERT STATE == TRX_STATE_NOT_STARTED, UNLOCK_ROW() · 9a0f3d3d
    Annamalai Gurusami authored
    Problem:
    
    During the index intersect access method, the SQL layer will access one row,
    that satisfies a set of conditions, using an index i1.  And then it will try to
    access the same row, with other set of conditions using the next index i2.  If
    the fetch from i2 fails (we are talking about an error situation here and not
    simply an unmatched row situation), then it will unlock the row accessed via
    i1.  This will work in all situations except deadlock error.
    
    When a deadlock happens, InnoDB will rollback the transaction.  InnoDB intimates
    the SQL layer about this through the THD::transaction_rollback_request member.
    But this is not currently used by the SQL layer.
    
    Solution:
    
    When an error happens, the SQL layer must check the 
    THD::transaction_rollback_request member, before calling handler::unlock_row().
    We have also added a debug assert in ha_innobase::unlock_row() checking that
    it must be called only when the transaction is in active state.
    
    rb#1773 approved by Marko and Sunny.
    9a0f3d3d
opt_range.cc 371 KB