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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
9de694e5
Commit
9de694e5
authored
Dec 21, 2003
by
konstantin@oak.local
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
THD::init_for_queries() pushed back:
see comments to the method why
parent
947057e7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
7 deletions
+30
-7
sql/slave.cc
sql/slave.cc
+1
-0
sql/sql_class.cc
sql/sql_class.cc
+17
-6
sql/sql_class.h
sql/sql_class.h
+10
-1
sql/sql_parse.cc
sql/sql_parse.cc
+2
-0
No files found.
sql/slave.cc
View file @
9de694e5
...
...
@@ -3111,6 +3111,7 @@ slave_begin:
sql_print_error
(
"Failed during slave thread initialization"
);
goto
err
;
}
thd
->
init_for_queries
();
rli
->
sql_thd
=
thd
;
thd
->
temporary_tables
=
rli
->
save_temporary_tables
;
// restore temp tables
pthread_mutex_lock
(
&
LOCK_thread_count
);
...
...
sql/sql_class.cc
View file @
9de694e5
...
...
@@ -144,9 +144,6 @@ THD::THD():user_time(0), is_fatal_error(0),
*
scramble
=
'\0'
;
init
();
init_sql_alloc
(
&
mem_root
,
// must be after init()
variables
.
query_alloc_block_size
,
variables
.
query_prealloc_size
);
/* Initialize sub structures */
bzero
((
char
*
)
&
transaction
.
mem_root
,
sizeof
(
transaction
.
mem_root
));
bzero
((
char
*
)
&
warn_root
,
sizeof
(
warn_root
));
...
...
@@ -182,9 +179,6 @@ THD::THD():user_time(0), is_fatal_error(0),
transaction
.
trans_log
.
end_of_file
=
max_binlog_cache_size
;
}
#endif
init_sql_alloc
(
&
transaction
.
mem_root
,
variables
.
trans_alloc_block_size
,
variables
.
trans_prealloc_size
);
/*
We need good random number initialization for new thread
Just coping global one will not work
...
...
@@ -227,6 +221,23 @@ void THD::init(void)
}
/*
Init THD for query processing.
This has to be called once before we call mysql_parse.
See also comments in sql_class.h.
*/
void
THD
::
init_for_queries
()
{
init_sql_alloc
(
&
mem_root
,
variables
.
query_alloc_block_size
,
variables
.
query_prealloc_size
);
init_sql_alloc
(
&
transaction
.
mem_root
,
variables
.
trans_alloc_block_size
,
variables
.
trans_prealloc_size
);
}
/*
Do what's needed when one invokes change user
...
...
sql/sql_class.h
View file @
9de694e5
...
...
@@ -405,7 +405,6 @@ struct system_variables
void
free_tmp_table
(
THD
*
thd
,
TABLE
*
entry
);
class
Prepared_statement
;
/*
State of a single command executed against this connection.
...
...
@@ -760,6 +759,16 @@ public:
~
THD
();
void
init
(
void
);
/*
Initialize memory roots necessary for query processing and (!)
pre-allocate memory for it. We can't do that in THD constructor because
there are use cases (acl_init, delayed inserts, watcher threads,
killing mysqld) where it's vital to not allocate excessive and not used
memory. Note, that we still don't return error from init_for_queries():
if preallocation fails, we should notice that at the first call to
alloc_root.
*/
void
init_for_queries
();
void
change_user
(
void
);
void
cleanup
(
void
);
bool
store_globals
();
...
...
sql/sql_parse.cc
View file @
9de694e5
...
...
@@ -974,6 +974,7 @@ pthread_handler_decl(handle_one_connection,arg)
thd
->
proc_info
=
0
;
thd
->
set_time
();
thd
->
init_for_queries
();
while
(
!
net
->
error
&&
net
->
vio
!=
0
&&
!
thd
->
killed
)
{
if
(
do_command
(
thd
))
...
...
@@ -1054,6 +1055,7 @@ extern "C" pthread_handler_decl(handle_bootstrap,arg)
thd
->
priv_user
=
thd
->
user
=
(
char
*
)
my_strdup
(
"boot"
,
MYF
(
MY_WME
));
buff
=
(
char
*
)
thd
->
net
.
buff
;
thd
->
init_for_queries
();
while
(
fgets
(
buff
,
thd
->
net
.
max_packet
,
file
))
{
uint
length
=
(
uint
)
strlen
(
buff
);
...
...
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