• Sergey Vojtovich's avatar
    Safe session_track_system_variables snapshot · 1b5cf2f7
    Sergey Vojtovich authored
    When enabling system variables tracker, make a copy of
    global_system_variables.session_track_system_variables
    under LOCK_global_system_variables. This protects from concurrent variable
    updates and potential freed memory access, as well as from variable
    reconstruction (which was previously protected by LOCK_plugin).
    
    We can also use this copy as a session variable pointer, so that we don't
    have to allocate memory and reconstruct it every time it is referenced.
    
    For this very reason we don't need buffer_length stuff anymore.
    
    As well as don't we need to take LOCK_plugin early in ::enable().
    Unified ::parse_var_list() to acquire LOCK_plugin unconditionally.
    For no apparent reason it wasn't previously acquired for global
    variable update.
    
    Part of MDEV-14984 - regression in connect performance
    1b5cf2f7
session_tracker.h 12.7 KB