Skip to content
  • Praveenkumar Hulakund's avatar
    1f13d1e5
    Bug#31000043 - MINOR PERFORMANCE DEGRADATION AT SYSBENCH-POINT_SELECT TEST · 1f13d1e5
    Praveenkumar Hulakund authored
    Map of THD instance to Session instance is maintained by the
    Srv_session module. Map is protected with a read write lock.
    Every Session service does a sanity check that verifies Session
    instance is present in the Map. This works well with the less number
    of threads. With more thread accessing the read write lock minor
    performance degradation is observed.
    
    Session instance contains state of the session (i.e. CREATED,
    ATTACHED, DETACHED and CLOSED). Session instance is added to the
    Map when session is opened. And it is removed when session is
    closed. Session instance in Map can be in ATTACHED or DETACHED
    state. The state of the valid session is ATTACHED and DETACHED.
    Session is valid even when opened and added to the list but not
    attached yet. We do not have any state to represent Session in
    opened but not in attached situation for now.
    
    To fix the issue, added one more state "OPENED" for the Session.
    This state is set when session is opened and after adding
    Session instance to Map. Now instead of checking session existence
    in Map, state of the Session instance is checked. If state of the
    Session instance is OPENED, ATTACHED or DETACHED the it is a valid
    session otherwise invalid.
    For debug build, Map is still checked to make sure valid session
    exists and invalid session doesn't exists in the opened sessions
    list.
    
    Patch changes semantics of the API. Using MYSQL_SESSION handle
    after session close now may easily result in memory related
    issues. MYSQL_SESSION handle becomes dangling pointer after
    session close. Even current implementation has a similar issue
    but not hit easily. Such usage is observed in the test code
    and fixed by setting MYSQL_SESSION to nullptr.
    
    Change-Id: I33f697ac42d3875e01d8f000bec00c082ff0fb44
    1f13d1e5
    Bug#31000043 - MINOR PERFORMANCE DEGRADATION AT SYSBENCH-POINT_SELECT TEST
    Praveenkumar Hulakund authored
    Map of THD instance to Session instance is maintained by the
    Srv_session module. Map is protected with a read write lock.
    Every Session service does a sanity check that verifies Session
    instance is present in the Map. This works well with the less number
    of threads. With more thread accessing the read write lock minor
    performance degradation is observed.
    
    Session instance contains state of the session (i.e. CREATED,
    ATTACHED, DETACHED and CLOSED). Session instance is added to the
    Map when session is opened. And it is removed when session is
    closed. Session instance in Map can be in ATTACHED or DETACHED
    state. The state of the valid session is ATTACHED and DETACHED.
    Session is valid even when opened and added to the list but not
    attached yet. We do not have any state to represent Session in
    opened but not in attached situation for now.
    
    To fix the issue, added one more state "OPENED" for the Session.
    This state is set when session is opened and after adding
    Session instance to Map. Now instead of checking session existence
    in Map, state of the Session instance is checked. If state of the
    Session instance is OPENED, ATTACHED or DETACHED the it is a valid
    session otherwise invalid.
    For debug build, Map is still checked to make sure valid session
    exists and invalid session doesn't exists in the opened sessions
    list.
    
    Patch changes semantics of the API. Using MYSQL_SESSION handle
    after session close now may easily result in memory related
    issues. MYSQL_SESSION handle becomes dangling pointer after
    session close. Even current implementation has a similar issue
    but not hit easily. Such usage is observed in the test code
    and fixed by setting MYSQL_SESSION to nullptr.
    
    Change-Id: I33f697ac42d3875e01d8f000bec00c082ff0fb44
Loading