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
9ea65e5f
Commit
9ea65e5f
authored
Nov 24, 2009
by
Mikael Ronstrom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WL#5138, Fixed according to code review comments from Davi
parent
39703a1b
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
32 additions
and
12 deletions
+32
-12
sql/log_event.cc
sql/log_event.cc
+2
-3
sql/sp_head.cc
sql/sp_head.cc
+2
-2
sql/sql_class.cc
sql/sql_class.cc
+20
-0
sql/sql_class.h
sql/sql_class.h
+4
-1
sql/sql_cursor.cc
sql/sql_cursor.cc
+1
-1
sql/sql_parse.cc
sql/sql_parse.cc
+3
-5
No files found.
sql/log_event.cc
View file @
9ea65e5f
...
...
@@ -3055,8 +3055,7 @@ int Query_log_event::do_apply_event(Relay_log_info const *rli,
rpl_filter
->
db_ok
(
thd
->
db
))
{
thd
->
set_time
((
time_t
)
when
);
thd
->
set_query
((
char
*
)
query_arg
,
q_len_arg
);
thd
->
query_id
=
next_query_id
();
thd
->
set_query_and_id
((
char
*
)
query_arg
,
q_len_arg
,
next_query_id
());
thd
->
variables
.
pseudo_thread_id
=
thread_id
;
// for temp tables
DBUG_PRINT
(
"query"
,(
"%s"
,
thd
->
query
()));
...
...
@@ -8068,7 +8067,7 @@ int Table_map_log_event::do_apply_event(Relay_log_info const *rli)
DBUG_ASSERT
(
rli
->
sql_thd
==
thd
);
/* Step the query id to mark what columns that are actually used. */
thd
->
query_id
=
next_query_id
(
);
thd
->
set_query_id
(
next_query_id
()
);
if
(
!
(
memory
=
my_multi_malloc
(
MYF
(
MY_WME
),
&
table_list
,
(
uint
)
sizeof
(
RPL_TABLE_LIST
),
...
...
sql/sp_head.cc
View file @
9ea65e5f
...
...
@@ -1338,7 +1338,7 @@ sp_head::execute(THD *thd)
/* To avoid wiping out thd->change_list on old_change_list destruction */
old_change_list
.
empty
();
thd
->
lex
=
old_lex
;
thd
->
query_id
=
old_query_id
;
thd
->
set_query_id
(
old_query_id
)
;
DBUG_ASSERT
(
!
thd
->
derived_tables
);
thd
->
derived_tables
=
old_derived_tables
;
thd
->
variables
.
sql_mode
=
save_sql_mode
;
...
...
@@ -2736,7 +2736,7 @@ sp_lex_keeper::reset_lex_and_exec_core(THD *thd, uint *nextp,
*/
thd
->
lex
=
m_lex
;
thd
->
query_id
=
next_query_id
(
);
thd
->
set_query_id
(
next_query_id
()
);
if
(
thd
->
prelocked_mode
==
NON_PRELOCKED
)
{
...
...
sql/sql_class.cc
View file @
9ea65e5f
...
...
@@ -3273,6 +3273,26 @@ void THD::set_query(char *query_arg, uint32 query_length_arg)
pthread_mutex_unlock
(
&
LOCK_thd_data
);
}
/** Assign a new value to thd->query and thd->query_id. */
void
THD
::
set_query_and_id
(
char
*
query_arg
,
uint32
query_length_arg
,
query_id_t
new_query_id
)
{
pthread_mutex_lock
(
&
LOCK_thd_data
);
set_query_inner
(
query_arg
,
query_length_arg
);
query_id
=
new_query_id
;
pthread_mutex_unlock
(
&
LOCK_thd_data
);
}
/** Assign a new value to thd->query_id. */
void
THD
::
set_query_id
(
query_id_t
new_query_id
)
{
pthread_mutex_lock
(
&
LOCK_thd_data
);
query_id
=
new_query_id
;
pthread_mutex_unlock
(
&
LOCK_thd_data
);
}
/**
Mark transaction to rollback and mark error as fatal to a sub-statement.
...
...
sql/sql_class.h
View file @
9ea65e5f
...
...
@@ -2324,10 +2324,13 @@ class THD :public Statement,
virtual
void
set_statement
(
Statement
*
stmt
);
/**
Assign a new value to thd->query.
Assign a new value to thd->query
and thd->query_id
.
Protected with LOCK_thd_data mutex.
*/
void
set_query
(
char
*
query_arg
,
uint32
query_length_arg
);
void
set_query_and_id
(
char
*
query_arg
,
uint32
query_length_arg
,
query_id_t
new_query_id
);
void
set_query_id
(
query_id_t
new_query_id
);
private
:
/** The current internal error handler for this thread, or NULL. */
Internal_error_handler
*
m_internal_handler
;
...
...
sql/sql_cursor.cc
View file @
9ea65e5f
...
...
@@ -438,7 +438,7 @@ Sensitive_cursor::fetch(ulong num_rows)
thd
->
derived_tables
=
derived_tables
;
thd
->
open_tables
=
open_tables
;
thd
->
lock
=
lock
;
thd
->
query_id
=
query_id
;
thd
->
set_query_id
(
query_id
)
;
thd
->
change_list
=
change_list
;
/* save references to memory allocated during fetch */
thd
->
set_n_backup_active_arena
(
this
,
&
backup_arena
);
...
...
sql/sql_parse.cc
View file @
9ea65e5f
...
...
@@ -484,7 +484,7 @@ static void handle_bootstrap_impl(THD *thd)
query
=
(
char
*
)
thd
->
memdup_w_gap
(
buff
,
length
+
1
,
thd
->
db_length
+
1
+
QUERY_CACHE_FLAGS_SIZE
);
thd
->
set_query
(
query
,
length
);
thd
->
set_query
_and_id
(
query
,
length
,
next_query_id
()
);
DBUG_PRINT
(
"query"
,(
"%-.4096s"
,
thd
->
query
()));
#if defined(ENABLED_PROFILING)
thd
->
profiling
.
start_new_query
();
...
...
@@ -495,7 +495,6 @@ static void handle_bootstrap_impl(THD *thd)
We don't need to obtain LOCK_thread_count here because in bootstrap
mode we have only one thread.
*/
thd
->
query_id
=
next_query_id
();
thd
->
set_time
();
mysql_parse
(
thd
,
thd
->
query
(),
length
,
&
found_semicolon
);
close_thread_tables
(
thd
);
// Free tables
...
...
@@ -1008,7 +1007,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
statistic_increment
(
thd
->
status_var
.
questions
,
&
LOCK_status
);
query_id
=
next_query_id
()
-
1
;
}
thd
->
query_id
=
query_id
;
thd
->
set_query_id
(
query_id
)
;
}
inc_thread_running
();
...
...
@@ -1275,12 +1274,11 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thd
->
security_ctx
->
priv_user
,
(
char
*
)
thd
->
security_ctx
->
host_or_ip
);
thd
->
set_query
(
beginning_of_next_stmt
,
length
);
thd
->
set_query
_and_id
(
beginning_of_next_stmt
,
length
,
next_query_id
()
);
/*
Count each statement from the client.
*/
statistic_increment
(
thd
->
status_var
.
questions
,
&
LOCK_status
);
thd
->
query_id
=
next_query_id
();
thd
->
set_time
();
/* Reset the query start time. */
/* TODO: set thd->lex->sql_command to SQLCOM_END here */
mysql_parse
(
thd
,
beginning_of_next_stmt
,
length
,
&
end_of_stmt
);
...
...
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