Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
69d78cd3
Commit
69d78cd3
authored
Nov 23, 2023
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move MEM_ROOT::read_only into flags
parent
d1ca8fbb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
18 deletions
+11
-18
include/my_alloc.h
include/my_alloc.h
+2
-4
mysys/my_alloc.c
mysys/my_alloc.c
+2
-7
sql/sp_head.cc
sql/sp_head.cc
+3
-3
sql/sql_prepare.cc
sql/sql_prepare.cc
+4
-4
No files found.
include/my_alloc.h
View file @
69d78cd3
...
...
@@ -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
;
...
...
mysys/my_alloc.c
View file @
69d78cd3
...
...
@@ -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"
,
{
...
...
sql/sp_head.cc
View file @
69d78cd3
...
...
@@ -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
));
...
...
sql/sql_prepare.cc
View file @
69d78cd3
...
...
@@ -176,7 +176,7 @@ class Prepared_statement: public Statement
/*
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 @@ Prepared_statement::execute_loop(String *expanded_query,
#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 @@ Prepared_statement::execute_loop(String *expanded_query,
#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 @@ Prepared_statement::execute_loop(String *expanded_query,
{
// 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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment