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
10800c1e
Commit
10800c1e
authored
Feb 18, 2005
by
jimw@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/home/jimw/my/mysql-4.1-8475
into mysql.com:/home/jimw/my/mysql-4.1-clean
parents
4823eade
1c22de90
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
11 deletions
+56
-11
mysql-test/r/multi_statement.result
mysql-test/r/multi_statement.result
+17
-0
mysql-test/t/multi_statement-master.opt
mysql-test/t/multi_statement-master.opt
+2
-0
mysql-test/t/multi_statement.test
mysql-test/t/multi_statement.test
+15
-0
sql/sql_parse.cc
sql/sql_parse.cc
+22
-11
No files found.
mysql-test/r/multi_statement.result
View file @
10800c1e
...
...
@@ -31,3 +31,20 @@ select 5'abcd'
select 'finish';
finish
finish
flush status;
create table t1 (i int);
insert into t1 values (1);
select * from t1 where i = 1;
insert into t1 values (2),(3),(4);
select * from t1 where i = 2;
select * from t1 where i = 3||||
i
1
i
2
i
3
show status like 'Slow_queries'||||
Variable_name Value
Slow_queries 2
drop table t1||||
mysql-test/t/multi_statement-master.opt
0 → 100644
View file @
10800c1e
--log-slow-queries=slow.log
--log-queries-not-using-indexes
mysql-test/t/multi_statement.test
View file @
10800c1e
...
...
@@ -14,3 +14,18 @@ select "abcd'";'abcd'select "'abcd";'abcd'
select
5
'abcd'
delimiter
;
'abcd'
select
'finish'
;
# Bug #8475: Make sure every statement that is a slow query in
# a multi-statement query gets logged as a slow query.
flush
status
;
delimiter
||||
;
create
table
t1
(
i
int
);
insert
into
t1
values
(
1
);
select
*
from
t1
where
i
=
1
;
insert
into
t1
values
(
2
),(
3
),(
4
);
select
*
from
t1
where
i
=
2
;
select
*
from
t1
where
i
=
3
||||
show
status
like
'Slow_queries'
||||
drop
table
t1
||||
delimiter
;
||||
sql/sql_parse.cc
View file @
10800c1e
...
...
@@ -59,6 +59,7 @@ static void remove_escape(char *name);
static
void
refresh_status
(
void
);
static
bool
append_file_to_dir
(
THD
*
thd
,
const
char
**
filename_ptr
,
const
char
*
table_name
);
static
void
log_slow_query
(
THD
*
thd
);
const
char
*
any_db
=
"*any*"
;
// Special symbol for check_access
...
...
@@ -1516,6 +1517,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
#endif
ulong
length
=
(
ulong
)(
packet_end
-
packet
);
log_slow_query
(
thd
);
/* Remove garbage at start of query */
while
(
my_isspace
(
thd
->
charset
(),
*
packet
)
&&
length
>
0
)
{
...
...
@@ -1526,6 +1529,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thd
->
query_length
=
length
;
thd
->
query
=
packet
;
thd
->
query_id
=
query_id
++
;
thd
->
set_time
();
/* Reset the query start time. */
/* TODO: set thd->lex->sql_command to SQLCOM_END here */
VOID
(
pthread_mutex_unlock
(
&
LOCK_thread_count
));
#ifndef EMBEDDED_LIBRARY
...
...
@@ -1822,6 +1826,24 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
if
(
thd
->
is_fatal_error
)
send_error
(
thd
,
0
);
// End of memory ?
log_slow_query
(
thd
);
thd
->
proc_info
=
"cleaning up"
;
VOID
(
pthread_mutex_lock
(
&
LOCK_thread_count
));
// For process list
thd
->
proc_info
=
0
;
thd
->
command
=
COM_SLEEP
;
thd
->
query
=
0
;
thd
->
query_length
=
0
;
thread_running
--
;
VOID
(
pthread_mutex_unlock
(
&
LOCK_thread_count
));
thd
->
packet
.
shrink
(
thd
->
variables
.
net_buffer_length
);
// Reclaim some memory
free_root
(
thd
->
mem_root
,
MYF
(
MY_KEEP_PREALLOC
));
DBUG_RETURN
(
error
);
}
static
void
log_slow_query
(
THD
*
thd
)
{
time_t
start_of_query
=
thd
->
start_time
;
thd
->
end_time
();
// Set start time
...
...
@@ -1840,17 +1862,6 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
mysql_slow_log
.
write
(
thd
,
thd
->
query
,
thd
->
query_length
,
start_of_query
);
}
}
thd
->
proc_info
=
"cleaning up"
;
VOID
(
pthread_mutex_lock
(
&
LOCK_thread_count
));
// For process list
thd
->
proc_info
=
0
;
thd
->
command
=
COM_SLEEP
;
thd
->
query
=
0
;
thd
->
query_length
=
0
;
thread_running
--
;
VOID
(
pthread_mutex_unlock
(
&
LOCK_thread_count
));
thd
->
packet
.
shrink
(
thd
->
variables
.
net_buffer_length
);
// Reclaim some memory
free_root
(
thd
->
mem_root
,
MYF
(
MY_KEEP_PREALLOC
));
DBUG_RETURN
(
error
);
}
...
...
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