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
d4e7e9ac
Commit
d4e7e9ac
authored
Nov 14, 2003
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
do not log certain commans in the slow log
parent
d3efeb1b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
15 deletions
+24
-15
sql/sql_class.h
sql/sql_class.h
+7
-6
sql/sql_parse.cc
sql/sql_parse.cc
+17
-9
No files found.
sql/sql_class.h
View file @
d4e7e9ac
...
@@ -509,7 +509,7 @@ class THD :public ilink
...
@@ -509,7 +509,7 @@ class THD :public ilink
PREP_STMT
*
last_prepared_stmt
;
PREP_STMT
*
last_prepared_stmt
;
#ifndef DBUG_OFF
#ifndef DBUG_OFF
uint
dbug_sentry
;
// watch out for memory corruption
uint
dbug_sentry
;
// watch out for memory corruption
#endif
#endif
struct
st_my_thread_var
*
mysys_var
;
struct
st_my_thread_var
*
mysys_var
;
enum
enum_server_command
command
;
enum
enum_server_command
command
;
uint32
server_id
;
uint32
server_id
;
...
@@ -531,9 +531,9 @@ class THD :public ilink
...
@@ -531,9 +531,9 @@ class THD :public ilink
THD_TRANS
stmt
;
// Trans for current statement
THD_TRANS
stmt
;
// Trans for current statement
uint
bdb_lock_count
;
uint
bdb_lock_count
;
/*
/*
Tables changed in transaction (that must be invalidated in query cache).
Tables changed in transaction (that must be invalidated in query cache).
List contain only transactional tables, that not invalidated in query
List contain only transactional tables, that not invalidated in query
cache (instead of full list of changed in transaction tables).
cache (instead of full list of changed in transaction tables).
*/
*/
CHANGED_TABLE_LIST
*
changed_tables
;
CHANGED_TABLE_LIST
*
changed_tables
;
...
@@ -551,7 +551,7 @@ class THD :public ilink
...
@@ -551,7 +551,7 @@ class THD :public ilink
#endif
#endif
#ifdef SIGNAL_WITH_VIO_CLOSE
#ifdef SIGNAL_WITH_VIO_CLOSE
Vio
*
active_vio
;
Vio
*
active_vio
;
#endif
#endif
/*
/*
next_insert_id is set on SET INSERT_ID= #. This is used as the next
next_insert_id is set on SET INSERT_ID= #. This is used as the next
generated auto_increment value in handler.cc
generated auto_increment value in handler.cc
...
@@ -573,9 +573,9 @@ class THD :public ilink
...
@@ -573,9 +573,9 @@ class THD :public ilink
sent_row_count
,
examined_row_count
;
sent_row_count
,
examined_row_count
;
table_map
used_tables
;
table_map
used_tables
;
USER_CONN
*
user_connect
;
USER_CONN
*
user_connect
;
CHARSET_INFO
*
db_charset
;
CHARSET_INFO
*
db_charset
;
List
<
TABLE
>
temporary_tables_should_be_free
;
// list of temporary tables
List
<
TABLE
>
temporary_tables_should_be_free
;
// list of temporary tables
List
<
MYSQL_ERROR
>
warn_list
;
List
<
MYSQL_ERROR
>
warn_list
;
uint
warn_count
[(
uint
)
MYSQL_ERROR
::
WARN_LEVEL_END
];
uint
warn_count
[(
uint
)
MYSQL_ERROR
::
WARN_LEVEL_END
];
uint
total_warn_count
;
uint
total_warn_count
;
ulong
query_id
,
warn_id
,
version
,
options
,
thread_id
,
col_access
;
ulong
query_id
,
warn_id
,
version
,
options
,
thread_id
,
col_access
;
...
@@ -609,6 +609,7 @@ class THD :public ilink
...
@@ -609,6 +609,7 @@ class THD :public ilink
bool
prepare_command
;
bool
prepare_command
;
bool
tmp_table_used
;
bool
tmp_table_used
;
bool
charset_is_system_charset
,
charset_is_collation_connection
;
bool
charset_is_system_charset
,
charset_is_collation_connection
;
bool
slow_command
;
/*
/*
If we do a purge of binary logs, log index info of the threads
If we do a purge of binary logs, log index info of the threads
...
...
sql/sql_parse.cc
View file @
d4e7e9ac
...
@@ -1185,10 +1185,10 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
...
@@ -1185,10 +1185,10 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
Commands which will always take a long time should be marked with
Commands which will always take a long time should be marked with
this so that they will not get logged to the slow query log
this so that they will not get logged to the slow query log
*/
*/
bool
slow_command
=
FALSE
;
DBUG_ENTER
(
"dispatch_command"
);
DBUG_ENTER
(
"dispatch_command"
);
thd
->
command
=
command
;
thd
->
command
=
command
;
thd
->
slow_command
=
FALSE
;
thd
->
set_time
();
thd
->
set_time
();
VOID
(
pthread_mutex_lock
(
&
LOCK_thread_count
));
VOID
(
pthread_mutex_lock
(
&
LOCK_thread_count
));
thd
->
query_id
=
query_id
;
thd
->
query_id
=
query_id
;
...
@@ -1224,7 +1224,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
...
@@ -1224,7 +1224,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
uint
tbl_len
=
*
(
uchar
*
)
(
packet
+
db_len
+
1
);
uint
tbl_len
=
*
(
uchar
*
)
(
packet
+
db_len
+
1
);
statistic_increment
(
com_other
,
&
LOCK_status
);
statistic_increment
(
com_other
,
&
LOCK_status
);
slow_command
=
TRUE
;
thd
->
slow_command
=
TRUE
;
db
=
thd
->
alloc
(
db_len
+
tbl_len
+
2
);
db
=
thd
->
alloc
(
db_len
+
tbl_len
+
2
);
tbl_name
=
strmake
(
db
,
packet
+
1
,
db_len
)
+
1
;
tbl_name
=
strmake
(
db
,
packet
+
1
,
db_len
)
+
1
;
strmake
(
tbl_name
,
packet
+
db_len
+
2
,
tbl_len
);
strmake
(
tbl_name
,
packet
+
db_len
+
2
,
tbl_len
);
...
@@ -1345,14 +1345,14 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
...
@@ -1345,14 +1345,14 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
while
(
!
thd
->
killed
&&
!
thd
->
is_fatal_error
&&
thd
->
lex
.
found_colon
)
while
(
!
thd
->
killed
&&
!
thd
->
is_fatal_error
&&
thd
->
lex
.
found_colon
)
{
{
char
*
packet
=
thd
->
lex
.
found_colon
;
char
*
packet
=
thd
->
lex
.
found_colon
;
/*
/*
Multiple queries exits, execute them individually
Multiple queries exits, execute them individually
*/
*/
if
(
thd
->
lock
||
thd
->
open_tables
||
thd
->
derived_tables
)
if
(
thd
->
lock
||
thd
->
open_tables
||
thd
->
derived_tables
)
close_thread_tables
(
thd
);
close_thread_tables
(
thd
);
ulong
length
=
thd
->
query_length
-
(
ulong
)(
thd
->
lex
.
found_colon
-
thd
->
query
);
ulong
length
=
thd
->
query_length
-
(
ulong
)(
thd
->
lex
.
found_colon
-
thd
->
query
);
/* Remove garbage at start of query */
/* Remove garbage at start of query */
while
(
my_isspace
(
thd
->
charset
(),
*
packet
)
&&
length
>
0
)
while
(
my_isspace
(
thd
->
charset
(),
*
packet
)
&&
length
>
0
)
{
{
...
@@ -1463,7 +1463,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
...
@@ -1463,7 +1463,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
case
COM_BINLOG_DUMP
:
case
COM_BINLOG_DUMP
:
{
{
statistic_increment
(
com_other
,
&
LOCK_status
);
statistic_increment
(
com_other
,
&
LOCK_status
);
slow_command
=
TRUE
;
thd
->
slow_command
=
TRUE
;
if
(
check_global_access
(
thd
,
REPL_SLAVE_ACL
))
if
(
check_global_access
(
thd
,
REPL_SLAVE_ACL
))
break
;
break
;
mysql_log
.
write
(
thd
,
command
,
0
);
mysql_log
.
write
(
thd
,
command
,
0
);
...
@@ -1606,7 +1606,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
...
@@ -1606,7 +1606,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thd
->
end_time
();
// Set start time
thd
->
end_time
();
// Set start time
/* If not reading from backup and if the query took too long */
/* If not reading from backup and if the query took too long */
if
(
!
slow_command
&&
!
thd
->
user_time
)
// do not log 'slow_command' queries
if
(
!
thd
->
slow_command
&&
!
thd
->
user_time
)
// do not log 'slow_command' queries
{
{
thd
->
proc_info
=
"logging slow query"
;
thd
->
proc_info
=
"logging slow query"
;
...
@@ -1947,6 +1947,7 @@ mysql_execute_command(THD *thd)
...
@@ -1947,6 +1947,7 @@ mysql_execute_command(THD *thd)
check_table_access
(
thd
,
SELECT_ACL
,
tables
,
0
)
||
check_table_access
(
thd
,
SELECT_ACL
,
tables
,
0
)
||
check_global_access
(
thd
,
FILE_ACL
))
check_global_access
(
thd
,
FILE_ACL
))
goto
error
;
/* purecov: inspected */
goto
error
;
/* purecov: inspected */
thd
->
slow_command
=
TRUE
;
res
=
mysql_backup_table
(
thd
,
tables
);
res
=
mysql_backup_table
(
thd
,
tables
);
break
;
break
;
...
@@ -1957,6 +1958,7 @@ mysql_execute_command(THD *thd)
...
@@ -1957,6 +1958,7 @@ mysql_execute_command(THD *thd)
check_table_access
(
thd
,
INSERT_ACL
,
tables
,
0
)
||
check_table_access
(
thd
,
INSERT_ACL
,
tables
,
0
)
||
check_global_access
(
thd
,
FILE_ACL
))
check_global_access
(
thd
,
FILE_ACL
))
goto
error
;
/* purecov: inspected */
goto
error
;
/* purecov: inspected */
thd
->
slow_command
=
TRUE
;
res
=
mysql_restore_table
(
thd
,
tables
);
res
=
mysql_restore_table
(
thd
,
tables
);
break
;
break
;
}
}
...
@@ -1974,7 +1976,7 @@ mysql_execute_command(THD *thd)
...
@@ -1974,7 +1976,7 @@ mysql_execute_command(THD *thd)
if
(
check_db_used
(
thd
,
tables
)
||
if
(
check_db_used
(
thd
,
tables
)
||
check_access
(
thd
,
INDEX_ACL
,
tables
->
db
,
check_access
(
thd
,
INDEX_ACL
,
tables
->
db
,
&
tables
->
grant
.
privilege
,
0
,
0
))
&
tables
->
grant
.
privilege
,
0
,
0
))
goto
error
;
goto
error
;
res
=
mysql_preload_keys
(
thd
,
tables
);
res
=
mysql_preload_keys
(
thd
,
tables
);
break
;
break
;
}
}
...
@@ -2173,6 +2175,7 @@ mysql_execute_command(THD *thd)
...
@@ -2173,6 +2175,7 @@ mysql_execute_command(THD *thd)
if
(
grant_option
&&
check_grant
(
thd
,
INDEX_ACL
,
tables
))
if
(
grant_option
&&
check_grant
(
thd
,
INDEX_ACL
,
tables
))
goto
error
;
goto
error
;
#endif
#endif
thd
->
slow_command
=
TRUE
;
if
(
end_active_trans
(
thd
))
if
(
end_active_trans
(
thd
))
res
=
-
1
;
res
=
-
1
;
else
else
...
@@ -2263,6 +2266,7 @@ mysql_execute_command(THD *thd)
...
@@ -2263,6 +2266,7 @@ mysql_execute_command(THD *thd)
res
=
-
1
;
res
=
-
1
;
else
else
{
{
thd
->
slow_command
=
TRUE
;
res
=
mysql_alter_table
(
thd
,
select_lex
->
db
,
lex
->
name
,
res
=
mysql_alter_table
(
thd
,
select_lex
->
db
,
lex
->
name
,
&
lex
->
create_info
,
&
lex
->
create_info
,
tables
,
lex
->
create_list
,
tables
,
lex
->
create_list
,
...
@@ -2352,6 +2356,7 @@ mysql_execute_command(THD *thd)
...
@@ -2352,6 +2356,7 @@ mysql_execute_command(THD *thd)
if
(
check_db_used
(
thd
,
tables
)
||
if
(
check_db_used
(
thd
,
tables
)
||
check_table_access
(
thd
,
SELECT_ACL
|
INSERT_ACL
,
tables
,
0
))
check_table_access
(
thd
,
SELECT_ACL
|
INSERT_ACL
,
tables
,
0
))
goto
error
;
/* purecov: inspected */
goto
error
;
/* purecov: inspected */
thd
->
slow_command
=
TRUE
;
res
=
mysql_repair_table
(
thd
,
tables
,
&
lex
->
check_opt
);
res
=
mysql_repair_table
(
thd
,
tables
,
&
lex
->
check_opt
);
/* ! we write after unlocking the table */
/* ! we write after unlocking the table */
if
(
!
res
&&
!
lex
->
no_write_to_binlog
)
if
(
!
res
&&
!
lex
->
no_write_to_binlog
)
...
@@ -2368,8 +2373,9 @@ mysql_execute_command(THD *thd)
...
@@ -2368,8 +2373,9 @@ mysql_execute_command(THD *thd)
case
SQLCOM_CHECK
:
case
SQLCOM_CHECK
:
{
{
if
(
check_db_used
(
thd
,
tables
)
||
if
(
check_db_used
(
thd
,
tables
)
||
check_table_access
(
thd
,
SELECT_ACL
|
EXTRA_ACL
,
tables
,
0
))
check_table_access
(
thd
,
SELECT_ACL
|
EXTRA_ACL
,
tables
,
0
))
goto
error
;
/* purecov: inspected */
goto
error
;
/* purecov: inspected */
thd
->
slow_command
=
TRUE
;
res
=
mysql_check_table
(
thd
,
tables
,
&
lex
->
check_opt
);
res
=
mysql_check_table
(
thd
,
tables
,
&
lex
->
check_opt
);
break
;
break
;
}
}
...
@@ -2378,6 +2384,7 @@ mysql_execute_command(THD *thd)
...
@@ -2378,6 +2384,7 @@ mysql_execute_command(THD *thd)
if
(
check_db_used
(
thd
,
tables
)
||
if
(
check_db_used
(
thd
,
tables
)
||
check_table_access
(
thd
,
SELECT_ACL
|
INSERT_ACL
,
tables
,
0
))
check_table_access
(
thd
,
SELECT_ACL
|
INSERT_ACL
,
tables
,
0
))
goto
error
;
/* purecov: inspected */
goto
error
;
/* purecov: inspected */
thd
->
slow_command
=
TRUE
;
res
=
mysql_analyze_table
(
thd
,
tables
,
&
lex
->
check_opt
);
res
=
mysql_analyze_table
(
thd
,
tables
,
&
lex
->
check_opt
);
/* ! we write after unlocking the table */
/* ! we write after unlocking the table */
if
(
!
res
&&
!
lex
->
no_write_to_binlog
)
if
(
!
res
&&
!
lex
->
no_write_to_binlog
)
...
@@ -2398,6 +2405,7 @@ mysql_execute_command(THD *thd)
...
@@ -2398,6 +2405,7 @@ mysql_execute_command(THD *thd)
if
(
check_db_used
(
thd
,
tables
)
||
if
(
check_db_used
(
thd
,
tables
)
||
check_table_access
(
thd
,
SELECT_ACL
|
INSERT_ACL
,
tables
,
0
))
check_table_access
(
thd
,
SELECT_ACL
|
INSERT_ACL
,
tables
,
0
))
goto
error
;
/* purecov: inspected */
goto
error
;
/* purecov: inspected */
thd
->
slow_command
=
TRUE
;
if
(
specialflag
&
(
SPECIAL_SAFE_MODE
|
SPECIAL_NO_NEW_FUNC
))
if
(
specialflag
&
(
SPECIAL_SAFE_MODE
|
SPECIAL_NO_NEW_FUNC
))
{
{
/* Use ALTER TABLE */
/* Use ALTER TABLE */
...
...
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