• Dmitry Shulga's avatar
    MDEV-14959: Control over memory allocated for SP/PS · 0d4be10a
    Dmitry Shulga authored
    This patch adds support for controlling of memory allocation
    done by SP/PS that could happen on second and following executions.
    As soon as SP or PS has been executed the first time its memory root
    is marked as read only since no further memory allocation should
    be performed on it. In case such allocation takes place it leads to
    the assert hit for invariant that force no new memory allocations
    takes place as soon as the SP/PS has been marked as read only.
    
    The feature for control of memory allocation made on behalf SP/PS
    is turned on when both debug build is on and the cmake option
    -DWITH_PROTECT_STATEMENT_MEMROOT is set.
    
    The reason for introduction of the new cmake option
      -DWITH_PROTECT_STATEMENT_MEMROOT
    to control memory allocation of second and following executions of
    SP/PS is that for the current server implementation there are too many
    places where such memory allocation takes place. As soon as all such
    incorrect allocations be fixed the cmake option
     -DWITH_PROTECT_STATEMENT_MEMROOT
    can be removed and control of memory allocation made on second and
    following executions can be turned on only for debug build. Before
    every incorrect memory allocation be fixed it makes sense to guard
    the checking of memory allocation on read only memory by extra cmake
    option else we would get a lot of failing test on buildbot.
    
    Moreover, fixing of all incorrect memory allocations could take pretty
    long period of time, so for introducing the feature without necessary
    to wait until all places throughout the source code be fixed it makes
    sense to add the new cmake option.
    0d4be10a
sp_head.h 59.8 KB