mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
move MEM_ROOT::read_only into flags
This commit is contained in:
@@ -23,6 +23,8 @@
|
||||
#define ALLOC_MAX_BLOCK_TO_DROP 4096
|
||||
#define ALLOC_MAX_BLOCK_USAGE_BEFORE_DROP 10
|
||||
|
||||
#define ROOT_FLAG_READ_ONLY 4
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -52,10 +54,6 @@ typedef struct st_mem_root
|
||||
unsigned short first_block_usage;
|
||||
unsigned short flags;
|
||||
|
||||
#ifdef PROTECT_STATEMENT_MEMROOT
|
||||
int read_only;
|
||||
#endif
|
||||
|
||||
void (*error_handler)(void);
|
||||
const char *name;
|
||||
} MEM_ROOT;
|
||||
|
@@ -24,6 +24,7 @@
|
||||
#define EXTRA_DEBUG
|
||||
|
||||
#define ROOT_FLAG_THREAD_SPECIFIC 1
|
||||
#define ROOT_FLAG_READ_ONLY 4
|
||||
|
||||
/* data packed in MEM_ROOT -> min_malloc */
|
||||
|
||||
@@ -74,9 +75,6 @@ void init_alloc_root(MEM_ROOT *mem_root, const char *name, size_t block_size,
|
||||
mem_root->first_block_usage= 0;
|
||||
mem_root->total_alloc= 0;
|
||||
mem_root->name= name;
|
||||
#ifdef PROTECT_STATEMENT_MEMROOT
|
||||
mem_root->read_only= 0;
|
||||
#endif
|
||||
|
||||
#if !(defined(HAVE_valgrind) && defined(EXTRA_DEBUG))
|
||||
if (pre_alloc_size)
|
||||
@@ -218,10 +216,7 @@ void *alloc_root(MEM_ROOT *mem_root, size_t length)
|
||||
DBUG_ENTER("alloc_root");
|
||||
DBUG_PRINT("enter",("root: %p name: %s", mem_root, mem_root->name));
|
||||
DBUG_ASSERT(alloc_root_inited(mem_root));
|
||||
|
||||
#ifdef PROTECT_STATEMENT_MEMROOT
|
||||
DBUG_ASSERT(mem_root->read_only == 0);
|
||||
#endif
|
||||
DBUG_ASSERT((mem_root->flags & ROOT_FLAG_READ_ONLY) == 0);
|
||||
|
||||
DBUG_EXECUTE_IF("simulate_out_of_memory",
|
||||
{
|
||||
|
@@ -1477,7 +1477,7 @@ sp_head::execute(THD *thd, bool merge_da_on_success)
|
||||
{
|
||||
// Don't count a call ended with an error as normal run
|
||||
executed_counter= 0;
|
||||
main_mem_root.read_only= 0;
|
||||
main_mem_root.flags &= ~ROOT_FLAG_READ_ONLY;
|
||||
reset_instrs_executed_counter();
|
||||
}
|
||||
#endif
|
||||
@@ -1597,10 +1597,10 @@ sp_head::execute(THD *thd, bool merge_da_on_success)
|
||||
#ifdef PROTECT_STATEMENT_MEMROOT
|
||||
if (!err_status)
|
||||
{
|
||||
if (!main_mem_root.read_only &&
|
||||
if (!(main_mem_root.flags & ROOT_FLAG_READ_ONLY) &&
|
||||
has_all_instrs_executed())
|
||||
{
|
||||
main_mem_root.read_only= 1;
|
||||
main_mem_root.flags |= ROOT_FLAG_READ_ONLY;
|
||||
}
|
||||
++executed_counter;
|
||||
DBUG_PRINT("info", ("execute counter: %lu", executed_counter));
|
||||
|
@@ -176,7 +176,7 @@ public:
|
||||
/*
|
||||
The following data member is wholly for debugging purpose.
|
||||
It can be used for possible crash analysis to determine how many times
|
||||
the stored routine was executed before the mem_root marked read_only
|
||||
the stored routine was executed before the mem_root marked ROOT_FLAG_READ_ONLY
|
||||
was requested for a memory chunk. Additionally, a value of this data
|
||||
member is output to the log with DBUG_PRINT.
|
||||
*/
|
||||
@@ -4489,7 +4489,7 @@ reexecute:
|
||||
#ifdef PROTECT_STATEMENT_MEMROOT
|
||||
// There was reprepare so the counter of runs should be reset
|
||||
executed_counter= 0;
|
||||
mem_root->read_only= 0;
|
||||
mem_root->flags &= ~ROOT_FLAG_READ_ONLY;
|
||||
#endif
|
||||
goto reexecute;
|
||||
}
|
||||
@@ -4498,7 +4498,7 @@ reexecute:
|
||||
#ifdef PROTECT_STATEMENT_MEMROOT
|
||||
if (!error)
|
||||
{
|
||||
mem_root->read_only= 1;
|
||||
mem_root->flags |= ROOT_FLAG_READ_ONLY;
|
||||
++executed_counter;
|
||||
|
||||
DBUG_PRINT("info", ("execute counter: %lu", executed_counter));
|
||||
@@ -4507,7 +4507,7 @@ reexecute:
|
||||
{
|
||||
// Error on call shouldn't be counted as a normal run
|
||||
executed_counter= 0;
|
||||
mem_root->read_only= 0;
|
||||
mem_root->flags &= ~ROOT_FLAG_READ_ONLY;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user