Skip to content
  • Olav Sandstaa's avatar
    43c937f1
    Fix for Bug#54286 Server crash at lock timeout with MRR · 43c937f1
    Olav Sandstaa authored
    This error happens when we try to read the first record from the
    database and a lock timeout occurs. This lock timeout error message
    does not get correctly propagated. The assert happens when the reply
    is going to be sent to the client and there is no error code set in
    the diagnostic area. The reason this happens when MRR is used is that
    when using MRR more work is done during initialization of MRR. One of
    the things the MRR code does is to try to fill the row id buffer by
    reading from the database index. This result in a call to
    ha_innobase::multi_range_read() which returns the lock timeout error
    code (error 146). This error code is not propagated up to the server code.
    
    When MRR is not in use there will be no calls to the database during
    initialization. The lock timeout error will only occur when the first call
    to read a record is done. With this code path the error code is
    correctly propagated to the server code and written to the diagnostic
    area before the reply message get sent to the client.
    
    This patch fixes this problem by the following two changes:
    
    1. Fix DsMrr_impl::dsmrr_init() so that it returns the same error code
       as reported by the storage engine instead of just returning one when
       an error occurs.
    
    2. Extend join_init_read_record() (in sql_select.cc) so that it
       handles errors that occurs during initialization (in this case from
       QUICK_RANGE_SELECT::reset()) and ensures the error code gets written
       to the diagnostic area.
    43c937f1
    Fix for Bug#54286 Server crash at lock timeout with MRR
    Olav Sandstaa authored
    This error happens when we try to read the first record from the
    database and a lock timeout occurs. This lock timeout error message
    does not get correctly propagated. The assert happens when the reply
    is going to be sent to the client and there is no error code set in
    the diagnostic area. The reason this happens when MRR is used is that
    when using MRR more work is done during initialization of MRR. One of
    the things the MRR code does is to try to fill the row id buffer by
    reading from the database index. This result in a call to
    ha_innobase::multi_range_read() which returns the lock timeout error
    code (error 146). This error code is not propagated up to the server code.
    
    When MRR is not in use there will be no calls to the database during
    initialization. The lock timeout error will only occur when the first call
    to read a record is done. With this code path the error code is
    correctly propagated to the server code and written to the diagnostic
    area before the reply message get sent to the client.
    
    This patch fixes this problem by the following two changes:
    
    1. Fix DsMrr_impl::dsmrr_init() so that it returns the same error code
       as reported by the storage engine instead of just returning one when
       an error occurs.
    
    2. Extend join_init_read_record() (in sql_select.cc) so that it
       handles errors that occurs during initialization (in this case from
       QUICK_RANGE_SELECT::reset()) and ensures the error code gets written
       to the diagnostic area.
Loading