mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge 10.4 into 10.5
This commit is contained in:
@ -1158,11 +1158,21 @@ public:
|
||||
Prepared statement: STMT_INITIALIZED -> STMT_PREPARED -> STMT_EXECUTED.
|
||||
Stored procedure: STMT_INITIALIZED_FOR_SP -> STMT_EXECUTED.
|
||||
Other statements: STMT_CONVENTIONAL_EXECUTION never changes.
|
||||
|
||||
Special case for stored procedure arguments: STMT_SP_QUERY_ARGUMENTS
|
||||
This state never changes and used for objects
|
||||
whose lifetime is whole duration of function call
|
||||
(sp_rcontext, it's tables and items. etc). Such objects
|
||||
should be deallocated after every execution of a stored
|
||||
routine. Caller's arena/memroot can't be used for
|
||||
placing such objects since memory allocated on caller's
|
||||
arena not freed until termination of user's session.
|
||||
*/
|
||||
enum enum_state
|
||||
{
|
||||
STMT_INITIALIZED= 0, STMT_INITIALIZED_FOR_SP= 1, STMT_PREPARED= 2,
|
||||
STMT_CONVENTIONAL_EXECUTION= 3, STMT_EXECUTED= 4, STMT_ERROR= -1
|
||||
STMT_CONVENTIONAL_EXECUTION= 3, STMT_EXECUTED= 4,
|
||||
STMT_SP_QUERY_ARGUMENTS= 5, STMT_ERROR= -1
|
||||
};
|
||||
|
||||
enum_state state;
|
||||
@ -4218,6 +4228,17 @@ public:
|
||||
|
||||
inline Query_arena *activate_stmt_arena_if_needed(Query_arena *backup)
|
||||
{
|
||||
if (state == Query_arena::STMT_SP_QUERY_ARGUMENTS)
|
||||
/*
|
||||
Caller uses the arena with state STMT_SP_QUERY_ARGUMENTS for stored
|
||||
routine's parameters. Lifetime of these objects spans a lifetime of
|
||||
stored routine call and freed every time the stored routine execution
|
||||
has been completed. That is the reason why switching to statement's
|
||||
arena is not performed for arguments, else we would observe increasing
|
||||
of memory usage while a stored routine be called over and over again.
|
||||
*/
|
||||
return NULL;
|
||||
|
||||
/*
|
||||
Use the persistent arena if we are in a prepared statement or a stored
|
||||
procedure statement and we have not already changed to use this arena.
|
||||
|
Reference in New Issue
Block a user