• Sujatha's avatar
    MDEV-22706: Assertion `!current' failed in PROFILING::start_new_query · f1838434
    Sujatha authored
    Analysis:
    ========
    When "Profiling" is enabled, server collects the resource usage of each
    statement that gets executed in current session. Profiling doesn't support
    nested statements. In order to ensure this behavior when profiling is enabled
    for a statement, there should not be any other active query which is being
    profiled. This active query information is stored in 'current' variable. When
    a nested query arrives it finds 'current' being not NULL and server aborts.
    
    When 'init_connect' and 'init_slave' system variables are set they contain a
    set of statements to be executed. "execute_init_command" is the function call
    which invokes "dispatch_command" for each statement provided in
    'init_connect', 'init_slave' system variables. "execute_init_command" invokes
    "start_new_query" and it passes the statement list to "dispatch_command". This
    "dispatch_command" intern invokes "start_new_query" which leads to nesting of
    queries. Hence '!current' assert is triggered.
    
    Fix:
    ===
    Remove profiling from "execute_init_command" as it will be done within
    "dispatch_command" execution.
    f1838434
nested_profiling.result 425 Bytes