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
2e6e572f
Commit
2e6e572f
authored
May 22, 2007
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge malff@bk-internal.mysql.com:/home/bk/mysql-5.1-runtime
into weblab.(none):/home/marcsql/TREE/mysql-5.1-21554-merge
parents
79a6e53e
bb64e39e
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
88 additions
and
85 deletions
+88
-85
include/my_global.h
include/my_global.h
+4
-11
include/my_pthread.h
include/my_pthread.h
+42
-15
sql/filesort.cc
sql/filesort.cc
+3
-4
sql/handler.cc
sql/handler.cc
+9
-10
sql/sql_insert.cc
sql/sql_insert.cc
+1
-1
sql/sql_parse.cc
sql/sql_parse.cc
+16
-25
sql/sql_prepare.cc
sql/sql_prepare.cc
+6
-6
sql/sql_select.cc
sql/sql_select.cc
+7
-13
No files found.
include/my_global.h
View file @
2e6e572f
...
@@ -441,17 +441,7 @@ C_MODE_END
...
@@ -441,17 +441,7 @@ C_MODE_END
#ifdef HAVE_ALLOCA_H
#ifdef HAVE_ALLOCA_H
#include <alloca.h>
#include <alloca.h>
#endif
#endif
#ifdef HAVE_ATOMIC_ADD
#define new my_arg_new
#define need_to_restore_new 1
C_MODE_START
#include <asm/atomic.h>
C_MODE_END
#ifdef need_to_restore_new
/* probably safer than #ifdef new */
#undef new
#undef need_to_restore_new
#endif
#endif
#include <errno.h>
/* Recommended by debian */
#include <errno.h>
/* Recommended by debian */
/* We need the following to go around a problem with openssl on solaris */
/* We need the following to go around a problem with openssl on solaris */
#if defined(HAVE_CRYPT_H)
#if defined(HAVE_CRYPT_H)
...
@@ -1449,10 +1439,13 @@ do { doubleget_union _tmp; \
...
@@ -1449,10 +1439,13 @@ do { doubleget_union _tmp; \
#ifndef THREAD
#ifndef THREAD
#define thread_safe_increment(V,L) (V)++
#define thread_safe_increment(V,L) (V)++
#define thread_safe_decrement(V,L) (V)--
#define thread_safe_add(V,C,L) (V)+=(C)
#define thread_safe_add(V,C,L) (V)+=(C)
#define thread_safe_sub(V,C,L) (V)-=(C)
#define thread_safe_sub(V,C,L) (V)-=(C)
#define statistic_increment(V,L) (V)++
#define statistic_increment(V,L) (V)++
#define statistic_decrement(V,L) (V)--
#define statistic_add(V,C,L) (V)+=(C)
#define statistic_add(V,C,L) (V)+=(C)
#define statistic_sub(V,C,L) (V)-=(C)
#endif
#endif
#ifdef HAVE_CHARSET_utf8
#ifdef HAVE_CHARSET_utf8
...
...
include/my_pthread.h
View file @
2e6e572f
...
@@ -710,33 +710,60 @@ extern uint my_thread_end_wait_time;
...
@@ -710,33 +710,60 @@ extern uint my_thread_end_wait_time;
extern
uint
thd_lib_detected
;
extern
uint
thd_lib_detected
;
/* statistics_xxx functions are for not essential statistic */
/*
thread_safe_xxx functions are for critical statistic or counters.
#ifndef thread_safe_increment
The implementation is guaranteed to be thread safe, on all platforms.
#ifdef HAVE_ATOMIC_ADD
Note that the calling code should *not* assume the counter is protected
#define thread_safe_increment(V,L) atomic_inc((atomic_t*) &V)
by the mutex given, as the implementation of these helpers may change
#define thread_safe_decrement(V,L) atomic_dec((atomic_t*) &V)
to use my_atomic operations instead.
#define thread_safe_add(V,C,L) atomic_add((C),(atomic_t*) &V)
*/
#define thread_safe_sub(V,C,L) atomic_sub((C),(atomic_t*) &V)
#else
/*
Warning:
When compiling without threads, this file is not included.
See the *other* declarations of thread_safe_xxx in include/my_global.h
*/
#ifdef THREAD
#define thread_safe_increment(V,L) \
#define thread_safe_increment(V,L) \
(pthread_mutex_lock((L)), (V)++, pthread_mutex_unlock((L)))
(pthread_mutex_lock((L)), (V)++, pthread_mutex_unlock((L)))
#define thread_safe_decrement(V,L) \
#define thread_safe_decrement(V,L) \
(pthread_mutex_lock((L)), (V)--, pthread_mutex_unlock((L)))
(pthread_mutex_lock((L)), (V)--, pthread_mutex_unlock((L)))
#define thread_safe_add(V,C,L) (pthread_mutex_lock((L)), (V)+=(C), pthread_mutex_unlock((L)))
#define thread_safe_add(V,C,L) \
(pthread_mutex_lock((L)), (V)+=(C), pthread_mutex_unlock((L)))
#define thread_safe_sub(V,C,L) \
#define thread_safe_sub(V,C,L) \
(pthread_mutex_lock((L)), (V)-=(C), pthread_mutex_unlock((L)))
(pthread_mutex_lock((L)), (V)-=(C), pthread_mutex_unlock((L)))
#endif
/* HAVE_ATOMIC_ADD */
#endif
/*
statistics_xxx functions are for non critical statistic,
maintained in global variables.
When compiling with SAFE_STATISTICS:
- race conditions can not occur.
- some locking occurs, which may cause performance degradation.
When compiling without SAFE_STATISTICS:
- race conditions can occur, making the result slightly inaccurate.
- the lock given is not honored.
*/
#ifdef SAFE_STATISTICS
#ifdef SAFE_STATISTICS
#define statistic_increment(V,L) thread_safe_increment((V),(L))
#define statistic_increment(V,L) thread_safe_increment((V),(L))
#define statistic_decrement(V,L) thread_safe_decrement((V),(L))
#define statistic_decrement(V,L) thread_safe_decrement((V),(L))
#define statistic_add(V,C,L) thread_safe_add((V),(C),(L))
#define statistic_add(V,C,L) thread_safe_add((V),(C),(L))
#define statistic_sub(V,C,L) thread_safe_sub((V),(C),(L))
#else
#else
#define statistic_decrement(V,L) (V)--
#define statistic_decrement(V,L) (V)--
#define statistic_increment(V,L) (V)++
#define statistic_increment(V,L) (V)++
#define statistic_add(V,C,L) (V)+=(C)
#define statistic_add(V,C,L) (V)+=(C)
#define statistic_sub(V,C,L) (V)-=(C)
#endif
/* SAFE_STATISTICS */
#endif
/* SAFE_STATISTICS */
#endif
/* thread_safe_increment */
/*
No locking needed, the counter is owned by the thread
*/
#define status_var_increment(V) (V)++
#define status_var_decrement(V) (V)--
#define status_var_add(V,C) (V)+=(C)
#define status_var_sub(V,C) (V)-=(C)
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
sql/filesort.cc
View file @
2e6e572f
...
@@ -171,11 +171,11 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
...
@@ -171,11 +171,11 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
if
(
select
&&
select
->
quick
)
if
(
select
&&
select
->
quick
)
{
{
stat
istic_increment
(
thd
->
status_var
.
filesort_range_count
,
&
LOCK_status
);
stat
us_var_increment
(
thd
->
status_var
.
filesort_range_count
);
}
}
else
else
{
{
stat
istic_increment
(
thd
->
status_var
.
filesort_scan_count
,
&
LOCK_status
);
stat
us_var_increment
(
thd
->
status_var
.
filesort_scan_count
);
}
}
#ifdef CAN_TRUST_RANGE
#ifdef CAN_TRUST_RANGE
if
(
select
&&
select
->
quick
&&
select
->
quick
->
records
>
0L
)
if
(
select
&&
select
->
quick
&&
select
->
quick
->
records
>
0L
)
...
@@ -1120,8 +1120,7 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file,
...
@@ -1120,8 +1120,7 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file,
THD
::
killed_state
not_killable
;
THD
::
killed_state
not_killable
;
DBUG_ENTER
(
"merge_buffers"
);
DBUG_ENTER
(
"merge_buffers"
);
statistic_increment
(
current_thd
->
status_var
.
filesort_merge_passes
,
status_var_increment
(
current_thd
->
status_var
.
filesort_merge_passes
);
&
LOCK_status
);
if
(
param
->
not_killable
)
if
(
param
->
not_killable
)
{
{
killed
=
&
not_killable
;
killed
=
&
not_killable
;
...
...
sql/handler.cc
View file @
2e6e572f
...
@@ -639,7 +639,7 @@ int ha_prepare(THD *thd)
...
@@ -639,7 +639,7 @@ int ha_prepare(THD *thd)
for
(;
*
ht
;
ht
++
)
for
(;
*
ht
;
ht
++
)
{
{
int
err
;
int
err
;
stat
istic_increment
(
thd
->
status_var
.
ha_prepare_count
,
&
LOCK_status
);
stat
us_var_increment
(
thd
->
status_var
.
ha_prepare_count
);
if
((
*
ht
)
->
prepare
)
if
((
*
ht
)
->
prepare
)
{
{
if
((
err
=
(
*
(
*
ht
)
->
prepare
)(
*
ht
,
thd
,
all
)))
if
((
err
=
(
*
(
*
ht
)
->
prepare
)(
*
ht
,
thd
,
all
)))
...
@@ -734,7 +734,7 @@ int ha_commit_trans(THD *thd, bool all)
...
@@ -734,7 +734,7 @@ int ha_commit_trans(THD *thd, bool all)
my_error
(
ER_ERROR_DURING_COMMIT
,
MYF
(
0
),
err
);
my_error
(
ER_ERROR_DURING_COMMIT
,
MYF
(
0
),
err
);
error
=
1
;
error
=
1
;
}
}
stat
istic_increment
(
thd
->
status_var
.
ha_prepare_count
,
&
LOCK_status
);
stat
us_var_increment
(
thd
->
status_var
.
ha_prepare_count
);
}
}
DBUG_EXECUTE_IF
(
"crash_commit_after_prepare"
,
abort
(););
DBUG_EXECUTE_IF
(
"crash_commit_after_prepare"
,
abort
(););
if
(
error
||
(
is_real_trans
&&
xid
&&
if
(
error
||
(
is_real_trans
&&
xid
&&
...
@@ -781,7 +781,7 @@ int ha_commit_one_phase(THD *thd, bool all)
...
@@ -781,7 +781,7 @@ int ha_commit_one_phase(THD *thd, bool all)
my_error
(
ER_ERROR_DURING_COMMIT
,
MYF
(
0
),
err
);
my_error
(
ER_ERROR_DURING_COMMIT
,
MYF
(
0
),
err
);
error
=
1
;
error
=
1
;
}
}
stat
istic_increment
(
thd
->
status_var
.
ha_commit_count
,
&
LOCK_status
);
stat
us_var_increment
(
thd
->
status_var
.
ha_commit_count
);
*
ht
=
0
;
*
ht
=
0
;
}
}
trans
->
nht
=
0
;
trans
->
nht
=
0
;
...
@@ -837,7 +837,7 @@ int ha_rollback_trans(THD *thd, bool all)
...
@@ -837,7 +837,7 @@ int ha_rollback_trans(THD *thd, bool all)
my_error
(
ER_ERROR_DURING_ROLLBACK
,
MYF
(
0
),
err
);
my_error
(
ER_ERROR_DURING_ROLLBACK
,
MYF
(
0
),
err
);
error
=
1
;
error
=
1
;
}
}
stat
istic_increment
(
thd
->
status_var
.
ha_rollback_count
,
&
LOCK_status
);
stat
us_var_increment
(
thd
->
status_var
.
ha_rollback_count
);
*
ht
=
0
;
*
ht
=
0
;
}
}
trans
->
nht
=
0
;
trans
->
nht
=
0
;
...
@@ -1252,8 +1252,7 @@ int ha_rollback_to_savepoint(THD *thd, SAVEPOINT *sv)
...
@@ -1252,8 +1252,7 @@ int ha_rollback_to_savepoint(THD *thd, SAVEPOINT *sv)
my_error
(
ER_ERROR_DURING_ROLLBACK
,
MYF
(
0
),
err
);
my_error
(
ER_ERROR_DURING_ROLLBACK
,
MYF
(
0
),
err
);
error
=
1
;
error
=
1
;
}
}
statistic_increment
(
thd
->
status_var
.
ha_savepoint_rollback_count
,
status_var_increment
(
thd
->
status_var
.
ha_savepoint_rollback_count
);
&
LOCK_status
);
trans
->
no_2pc
|=
(
*
ht
)
->
prepare
==
0
;
trans
->
no_2pc
|=
(
*
ht
)
->
prepare
==
0
;
}
}
/*
/*
...
@@ -1268,7 +1267,7 @@ int ha_rollback_to_savepoint(THD *thd, SAVEPOINT *sv)
...
@@ -1268,7 +1267,7 @@ int ha_rollback_to_savepoint(THD *thd, SAVEPOINT *sv)
my_error
(
ER_ERROR_DURING_ROLLBACK
,
MYF
(
0
),
err
);
my_error
(
ER_ERROR_DURING_ROLLBACK
,
MYF
(
0
),
err
);
error
=
1
;
error
=
1
;
}
}
stat
istic_increment
(
thd
->
status_var
.
ha_rollback_count
,
&
LOCK_status
);
stat
us_var_increment
(
thd
->
status_var
.
ha_rollback_count
);
*
ht
=
0
;
// keep it conveniently zero-filled
*
ht
=
0
;
// keep it conveniently zero-filled
}
}
DBUG_RETURN
(
error
);
DBUG_RETURN
(
error
);
...
@@ -1301,7 +1300,7 @@ int ha_savepoint(THD *thd, SAVEPOINT *sv)
...
@@ -1301,7 +1300,7 @@ int ha_savepoint(THD *thd, SAVEPOINT *sv)
my_error
(
ER_GET_ERRNO
,
MYF
(
0
),
err
);
my_error
(
ER_GET_ERRNO
,
MYF
(
0
),
err
);
error
=
1
;
error
=
1
;
}
}
stat
istic_increment
(
thd
->
status_var
.
ha_savepoint_count
,
&
LOCK_status
);
stat
us_var_increment
(
thd
->
status_var
.
ha_savepoint_count
);
}
}
sv
->
nht
=
trans
->
nht
;
sv
->
nht
=
trans
->
nht
;
#endif
/* USING_TRANSACTIONS */
#endif
/* USING_TRANSACTIONS */
...
@@ -1489,7 +1488,7 @@ handler *handler::clone(MEM_ROOT *mem_root)
...
@@ -1489,7 +1488,7 @@ handler *handler::clone(MEM_ROOT *mem_root)
void
handler
::
ha_statistic_increment
(
ulong
SSV
::*
offset
)
const
void
handler
::
ha_statistic_increment
(
ulong
SSV
::*
offset
)
const
{
{
stat
istic_increment
(
table
->
in_use
->
status_var
.
*
offset
,
&
LOCK_status
);
stat
us_var_increment
(
table
->
in_use
->
status_var
.
*
offset
);
}
}
void
**
handler
::
ha_data
(
THD
*
thd
)
const
void
**
handler
::
ha_data
(
THD
*
thd
)
const
...
@@ -2836,7 +2835,7 @@ int ha_discover(THD *thd, const char *db, const char *name,
...
@@ -2836,7 +2835,7 @@ int ha_discover(THD *thd, const char *db, const char *name,
error
=
0
;
error
=
0
;
if
(
!
error
)
if
(
!
error
)
stat
istic_increment
(
thd
->
status_var
.
ha_discover_count
,
&
LOCK_status
);
stat
us_var_increment
(
thd
->
status_var
.
ha_discover_count
);
DBUG_RETURN
(
error
);
DBUG_RETURN
(
error
);
}
}
...
...
sql/sql_insert.cc
View file @
2e6e572f
...
@@ -2538,7 +2538,7 @@ bool Delayed_insert::handle_inserts(void)
...
@@ -2538,7 +2538,7 @@ bool Delayed_insert::handle_inserts(void)
if
(
table
->
s
->
blob_fields
)
if
(
table
->
s
->
blob_fields
)
free_delayed_insert_blobs
(
table
);
free_delayed_insert_blobs
(
table
);
thread_safe_
sub
(
delayed_rows_in_use
,
1
,
&
LOCK_delayed_status
);
thread_safe_
decrement
(
delayed_rows_in_use
,
&
LOCK_delayed_status
);
thread_safe_increment
(
delayed_insert_writes
,
&
LOCK_delayed_status
);
thread_safe_increment
(
delayed_insert_writes
,
&
LOCK_delayed_status
);
pthread_mutex_lock
(
&
mutex
);
pthread_mutex_lock
(
&
mutex
);
...
...
sql/sql_parse.cc
View file @
2e6e572f
...
@@ -721,8 +721,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
...
@@ -721,8 +721,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
case
COM_INIT_DB
:
case
COM_INIT_DB
:
{
{
LEX_STRING
tmp
;
LEX_STRING
tmp
;
statistic_increment
(
thd
->
status_var
.
com_stat
[
SQLCOM_CHANGE_DB
],
status_var_increment
(
thd
->
status_var
.
com_stat
[
SQLCOM_CHANGE_DB
]);
&
LOCK_status
);
thd
->
convert_string
(
&
tmp
,
system_charset_info
,
thd
->
convert_string
(
&
tmp
,
system_charset_info
,
packet
,
packet_length
-
1
,
thd
->
charset
());
packet
,
packet_length
-
1
,
thd
->
charset
());
if
(
!
mysql_change_db
(
thd
,
&
tmp
,
FALSE
))
if
(
!
mysql_change_db
(
thd
,
&
tmp
,
FALSE
))
...
@@ -757,7 +756,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
...
@@ -757,7 +756,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
break
;
break
;
}
}
stat
istic_increment
(
thd
->
status_var
.
com_other
,
&
LOCK_status
);
stat
us_var_increment
(
thd
->
status_var
.
com_other
);
thd
->
enable_slow_log
=
opt_log_slow_admin_statements
;
thd
->
enable_slow_log
=
opt_log_slow_admin_statements
;
db
.
str
=
thd
->
alloc
(
db_len
+
tbl_len
+
2
);
db
.
str
=
thd
->
alloc
(
db_len
+
tbl_len
+
2
);
db
.
length
=
db_len
;
db
.
length
=
db_len
;
...
@@ -773,7 +772,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
...
@@ -773,7 +772,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
}
}
case
COM_CHANGE_USER
:
case
COM_CHANGE_USER
:
{
{
stat
istic_increment
(
thd
->
status_var
.
com_other
,
&
LOCK_status
);
stat
us_var_increment
(
thd
->
status_var
.
com_other
);
char
*
user
=
(
char
*
)
packet
,
*
packet_end
=
packet
+
packet_length
;
char
*
user
=
(
char
*
)
packet
,
*
packet_end
=
packet
+
packet_length
;
char
*
passwd
=
strend
(
user
)
+
1
;
char
*
passwd
=
strend
(
user
)
+
1
;
...
@@ -956,8 +955,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
...
@@ -956,8 +955,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
/* used as fields initializator */
/* used as fields initializator */
lex_start
(
thd
);
lex_start
(
thd
);
statistic_increment
(
thd
->
status_var
.
com_stat
[
SQLCOM_SHOW_FIELDS
],
status_var_increment
(
thd
->
status_var
.
com_stat
[
SQLCOM_SHOW_FIELDS
]);
&
LOCK_status
);
bzero
((
char
*
)
&
table_list
,
sizeof
(
table_list
));
bzero
((
char
*
)
&
table_list
,
sizeof
(
table_list
));
if
(
thd
->
copy_db_to
(
&
table_list
.
db
,
&
dummy
))
if
(
thd
->
copy_db_to
(
&
table_list
.
db
,
&
dummy
))
break
;
break
;
...
@@ -1023,8 +1021,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
...
@@ -1023,8 +1021,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
LEX_STRING
db
,
alias
;
LEX_STRING
db
,
alias
;
HA_CREATE_INFO
create_info
;
HA_CREATE_INFO
create_info
;
statistic_increment
(
thd
->
status_var
.
com_stat
[
SQLCOM_CREATE_DB
],
status_var_increment
(
thd
->
status_var
.
com_stat
[
SQLCOM_CREATE_DB
]);
&
LOCK_status
);
if
(
thd
->
LEX_STRING_make
(
&
db
,
packet
,
packet_length
-
1
)
||
if
(
thd
->
LEX_STRING_make
(
&
db
,
packet
,
packet_length
-
1
)
||
thd
->
LEX_STRING_make
(
&
alias
,
db
.
str
,
db
.
length
)
||
thd
->
LEX_STRING_make
(
&
alias
,
db
.
str
,
db
.
length
)
||
check_db_name
(
&
db
))
check_db_name
(
&
db
))
...
@@ -1043,8 +1040,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
...
@@ -1043,8 +1040,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
}
}
case
COM_DROP_DB
:
// QQ: To be removed
case
COM_DROP_DB
:
// QQ: To be removed
{
{
statistic_increment
(
thd
->
status_var
.
com_stat
[
SQLCOM_DROP_DB
],
status_var_increment
(
thd
->
status_var
.
com_stat
[
SQLCOM_DROP_DB
]);
&
LOCK_status
);
LEX_STRING
db
;
LEX_STRING
db
;
if
(
thd
->
LEX_STRING_make
(
&
db
,
packet
,
packet_length
-
1
)
||
if
(
thd
->
LEX_STRING_make
(
&
db
,
packet
,
packet_length
-
1
)
||
...
@@ -1073,7 +1069,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
...
@@ -1073,7 +1069,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
ushort
flags
;
ushort
flags
;
uint32
slave_server_id
;
uint32
slave_server_id
;
stat
istic_increment
(
thd
->
status_var
.
com_other
,
&
LOCK_status
);
stat
us_var_increment
(
thd
->
status_var
.
com_other
);
thd
->
enable_slow_log
=
opt_log_slow_admin_statements
;
thd
->
enable_slow_log
=
opt_log_slow_admin_statements
;
if
(
check_global_access
(
thd
,
REPL_SLAVE_ACL
))
if
(
check_global_access
(
thd
,
REPL_SLAVE_ACL
))
break
;
break
;
...
@@ -1099,8 +1095,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
...
@@ -1099,8 +1095,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
case
COM_REFRESH
:
case
COM_REFRESH
:
{
{
bool
not_used
;
bool
not_used
;
statistic_increment
(
thd
->
status_var
.
com_stat
[
SQLCOM_FLUSH
],
status_var_increment
(
thd
->
status_var
.
com_stat
[
SQLCOM_FLUSH
]);
&
LOCK_status
);
ulong
options
=
(
ulong
)
(
uchar
)
packet
[
0
];
ulong
options
=
(
ulong
)
(
uchar
)
packet
[
0
];
if
(
check_global_access
(
thd
,
RELOAD_ACL
))
if
(
check_global_access
(
thd
,
RELOAD_ACL
))
break
;
break
;
...
@@ -1112,7 +1107,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
...
@@ -1112,7 +1107,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
#ifndef EMBEDDED_LIBRARY
#ifndef EMBEDDED_LIBRARY
case
COM_SHUTDOWN
:
case
COM_SHUTDOWN
:
{
{
stat
istic_increment
(
thd
->
status_var
.
com_other
,
&
LOCK_status
);
stat
us_var_increment
(
thd
->
status_var
.
com_other
);
if
(
check_global_access
(
thd
,
SHUTDOWN_ACL
))
if
(
check_global_access
(
thd
,
SHUTDOWN_ACL
))
break
;
/* purecov: inspected */
break
;
/* purecov: inspected */
/*
/*
...
@@ -1164,8 +1159,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
...
@@ -1164,8 +1159,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
#endif
#endif
general_log_print
(
thd
,
command
,
NullS
);
general_log_print
(
thd
,
command
,
NullS
);
statistic_increment
(
thd
->
status_var
.
com_stat
[
SQLCOM_SHOW_STATUS
],
status_var_increment
(
thd
->
status_var
.
com_stat
[
SQLCOM_SHOW_STATUS
]);
&
LOCK_status
);
calc_sum_of_all_status
(
&
current_global_status_var
);
calc_sum_of_all_status
(
&
current_global_status_var
);
if
(
!
(
uptime
=
(
ulong
)
(
thd
->
start_time
-
server_start_time
)))
if
(
!
(
uptime
=
(
ulong
)
(
thd
->
start_time
-
server_start_time
)))
queries_per_second1000
=
0
;
queries_per_second1000
=
0
;
...
@@ -1201,12 +1195,11 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
...
@@ -1201,12 +1195,11 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
break
;
break
;
}
}
case
COM_PING
:
case
COM_PING
:
stat
istic_increment
(
thd
->
status_var
.
com_other
,
&
LOCK_status
);
stat
us_var_increment
(
thd
->
status_var
.
com_other
);
send_ok
(
thd
);
// Tell client we are alive
send_ok
(
thd
);
// Tell client we are alive
break
;
break
;
case
COM_PROCESS_INFO
:
case
COM_PROCESS_INFO
:
statistic_increment
(
thd
->
status_var
.
com_stat
[
SQLCOM_SHOW_PROCESSLIST
],
status_var_increment
(
thd
->
status_var
.
com_stat
[
SQLCOM_SHOW_PROCESSLIST
]);
&
LOCK_status
);
if
(
!
thd
->
security_ctx
->
priv_user
[
0
]
&&
if
(
!
thd
->
security_ctx
->
priv_user
[
0
]
&&
check_global_access
(
thd
,
PROCESS_ACL
))
check_global_access
(
thd
,
PROCESS_ACL
))
break
;
break
;
...
@@ -1217,15 +1210,14 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
...
@@ -1217,15 +1210,14 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
break
;
break
;
case
COM_PROCESS_KILL
:
case
COM_PROCESS_KILL
:
{
{
stat
istic_increment
(
thd
->
status_var
.
com_stat
[
SQLCOM_KILL
],
&
LOCK_status
);
stat
us_var_increment
(
thd
->
status_var
.
com_stat
[
SQLCOM_KILL
]
);
ulong
id
=
(
ulong
)
uint4korr
(
packet
);
ulong
id
=
(
ulong
)
uint4korr
(
packet
);
sql_kill
(
thd
,
id
,
false
);
sql_kill
(
thd
,
id
,
false
);
break
;
break
;
}
}
case
COM_SET_OPTION
:
case
COM_SET_OPTION
:
{
{
statistic_increment
(
thd
->
status_var
.
com_stat
[
SQLCOM_SET_OPTION
],
status_var_increment
(
thd
->
status_var
.
com_stat
[
SQLCOM_SET_OPTION
]);
&
LOCK_status
);
uint
opt_command
=
uint2korr
(
packet
);
uint
opt_command
=
uint2korr
(
packet
);
switch
(
opt_command
)
{
switch
(
opt_command
)
{
...
@@ -1244,7 +1236,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
...
@@ -1244,7 +1236,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
break
;
break
;
}
}
case
COM_DEBUG
:
case
COM_DEBUG
:
stat
istic_increment
(
thd
->
status_var
.
com_other
,
&
LOCK_status
);
stat
us_var_increment
(
thd
->
status_var
.
com_other
);
if
(
check_global_access
(
thd
,
SUPER_ACL
))
if
(
check_global_access
(
thd
,
SUPER_ACL
))
break
;
/* purecov: inspected */
break
;
/* purecov: inspected */
mysql_print_status
();
mysql_print_status
();
...
@@ -1783,8 +1775,7 @@ mysql_execute_command(THD *thd)
...
@@ -1783,8 +1775,7 @@ mysql_execute_command(THD *thd)
#ifdef HAVE_REPLICATION
#ifdef HAVE_REPLICATION
}
/* endif unlikely slave */
}
/* endif unlikely slave */
#endif
#endif
statistic_increment
(
thd
->
status_var
.
com_stat
[
lex
->
sql_command
],
status_var_increment
(
thd
->
status_var
.
com_stat
[
lex
->
sql_command
]);
&
LOCK_status
);
switch
(
lex
->
sql_command
)
{
switch
(
lex
->
sql_command
)
{
case
SQLCOM_SHOW_EVENTS
:
case
SQLCOM_SHOW_EVENTS
:
...
...
sql/sql_prepare.cc
View file @
2e6e572f
...
@@ -2430,7 +2430,7 @@ void mysql_stmt_fetch(THD *thd, char *packet, uint packet_length)
...
@@ -2430,7 +2430,7 @@ void mysql_stmt_fetch(THD *thd, char *packet, uint packet_length)
/* First of all clear possible warnings from the previous command */
/* First of all clear possible warnings from the previous command */
mysql_reset_thd_for_next_command
(
thd
);
mysql_reset_thd_for_next_command
(
thd
);
stat
istic_increment
(
thd
->
status_var
.
com_stmt_fetch
,
&
LOCK_status
);
stat
us_var_increment
(
thd
->
status_var
.
com_stmt_fetch
);
if
(
!
(
stmt
=
find_prepared_statement
(
thd
,
stmt_id
,
"mysql_stmt_fetch"
)))
if
(
!
(
stmt
=
find_prepared_statement
(
thd
,
stmt_id
,
"mysql_stmt_fetch"
)))
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
...
@@ -2494,7 +2494,7 @@ void mysql_stmt_reset(THD *thd, char *packet)
...
@@ -2494,7 +2494,7 @@ void mysql_stmt_reset(THD *thd, char *packet)
/* First of all clear possible warnings from the previous command */
/* First of all clear possible warnings from the previous command */
mysql_reset_thd_for_next_command
(
thd
);
mysql_reset_thd_for_next_command
(
thd
);
stat
istic_increment
(
thd
->
status_var
.
com_stmt_reset
,
&
LOCK_status
);
stat
us_var_increment
(
thd
->
status_var
.
com_stmt_reset
);
if
(
!
(
stmt
=
find_prepared_statement
(
thd
,
stmt_id
,
"mysql_stmt_reset"
)))
if
(
!
(
stmt
=
find_prepared_statement
(
thd
,
stmt_id
,
"mysql_stmt_reset"
)))
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
...
@@ -2598,7 +2598,7 @@ void mysql_stmt_get_longdata(THD *thd, char *packet, ulong packet_length)
...
@@ -2598,7 +2598,7 @@ void mysql_stmt_get_longdata(THD *thd, char *packet, ulong packet_length)
#endif
#endif
DBUG_ENTER
(
"mysql_stmt_get_longdata"
);
DBUG_ENTER
(
"mysql_stmt_get_longdata"
);
stat
istic_increment
(
thd
->
status_var
.
com_stmt_send_long_data
,
&
LOCK_status
);
stat
us_var_increment
(
thd
->
status_var
.
com_stmt_send_long_data
);
#ifndef EMBEDDED_LIBRARY
#ifndef EMBEDDED_LIBRARY
/* Minimal size of long data packet is 6 bytes */
/* Minimal size of long data packet is 6 bytes */
if
(
packet_length
<=
MYSQL_LONG_DATA_HEADER
)
if
(
packet_length
<=
MYSQL_LONG_DATA_HEADER
)
...
@@ -2849,7 +2849,7 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len)
...
@@ -2849,7 +2849,7 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len)
However, it seems handy if com_stmt_prepare is increased always,
However, it seems handy if com_stmt_prepare is increased always,
no matter what kind of prepare is processed.
no matter what kind of prepare is processed.
*/
*/
stat
istic_increment
(
thd
->
status_var
.
com_stmt_prepare
,
&
LOCK_status
);
stat
us_var_increment
(
thd
->
status_var
.
com_stmt_prepare
);
/*
/*
alloc_query() uses thd->memroot && thd->query, so we should call
alloc_query() uses thd->memroot && thd->query, so we should call
...
@@ -2972,7 +2972,7 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor)
...
@@ -2972,7 +2972,7 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor)
Query_arena
*
old_stmt_arena
;
Query_arena
*
old_stmt_arena
;
bool
error
=
TRUE
;
bool
error
=
TRUE
;
stat
istic_increment
(
thd
->
status_var
.
com_stmt_execute
,
&
LOCK_status
);
stat
us_var_increment
(
thd
->
status_var
.
com_stmt_execute
);
/* Check if we got an error when sending long data */
/* Check if we got an error when sending long data */
if
(
state
==
Query_arena
::
ERROR
)
if
(
state
==
Query_arena
::
ERROR
)
...
@@ -3094,7 +3094,7 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor)
...
@@ -3094,7 +3094,7 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor)
bool
Prepared_statement
::
deallocate
()
bool
Prepared_statement
::
deallocate
()
{
{
/* We account deallocate in the same manner as mysql_stmt_close */
/* We account deallocate in the same manner as mysql_stmt_close */
stat
istic_increment
(
thd
->
status_var
.
com_stmt_close
,
&
LOCK_status
);
stat
us_var_increment
(
thd
->
status_var
.
com_stmt_close
);
if
(
flags
&
(
uint
)
IS_IN_USE
)
if
(
flags
&
(
uint
)
IS_IN_USE
)
{
{
my_error
(
ER_PS_NO_RECURSION
,
MYF
(
0
));
my_error
(
ER_PS_NO_RECURSION
,
MYF
(
0
));
...
...
sql/sql_select.cc
View file @
2e6e572f
...
@@ -6282,8 +6282,7 @@ make_join_readinfo(JOIN *join, ulonglong options)
...
@@ -6282,8 +6282,7 @@ make_join_readinfo(JOIN *join, ulonglong options)
join
->
thd
->
server_status
|=
SERVER_QUERY_NO_GOOD_INDEX_USED
;
join
->
thd
->
server_status
|=
SERVER_QUERY_NO_GOOD_INDEX_USED
;
tab
->
read_first_record
=
join_init_quick_read_record
;
tab
->
read_first_record
=
join_init_quick_read_record
;
if
(
statistics
)
if
(
statistics
)
statistic_increment
(
join
->
thd
->
status_var
.
select_range_check_count
,
status_var_increment
(
join
->
thd
->
status_var
.
select_range_check_count
);
&
LOCK_status
);
}
}
else
else
{
{
...
@@ -6293,15 +6292,13 @@ make_join_readinfo(JOIN *join, ulonglong options)
...
@@ -6293,15 +6292,13 @@ make_join_readinfo(JOIN *join, ulonglong options)
if
(
tab
->
select
&&
tab
->
select
->
quick
)
if
(
tab
->
select
&&
tab
->
select
->
quick
)
{
{
if
(
statistics
)
if
(
statistics
)
statistic_increment
(
join
->
thd
->
status_var
.
select_range_count
,
status_var_increment
(
join
->
thd
->
status_var
.
select_range_count
);
&
LOCK_status
);
}
}
else
else
{
{
join
->
thd
->
server_status
|=
SERVER_QUERY_NO_INDEX_USED
;
join
->
thd
->
server_status
|=
SERVER_QUERY_NO_INDEX_USED
;
if
(
statistics
)
if
(
statistics
)
statistic_increment
(
join
->
thd
->
status_var
.
select_scan_count
,
status_var_increment
(
join
->
thd
->
status_var
.
select_scan_count
);
&
LOCK_status
);
}
}
}
}
else
else
...
@@ -6309,15 +6306,13 @@ make_join_readinfo(JOIN *join, ulonglong options)
...
@@ -6309,15 +6306,13 @@ make_join_readinfo(JOIN *join, ulonglong options)
if
(
tab
->
select
&&
tab
->
select
->
quick
)
if
(
tab
->
select
&&
tab
->
select
->
quick
)
{
{
if
(
statistics
)
if
(
statistics
)
statistic_increment
(
join
->
thd
->
status_var
.
select_full_range_join_count
,
status_var_increment
(
join
->
thd
->
status_var
.
select_full_range_join_count
);
&
LOCK_status
);
}
}
else
else
{
{
join
->
thd
->
server_status
|=
SERVER_QUERY_NO_INDEX_USED
;
join
->
thd
->
server_status
|=
SERVER_QUERY_NO_INDEX_USED
;
if
(
statistics
)
if
(
statistics
)
statistic_increment
(
join
->
thd
->
status_var
.
select_full_join_count
,
status_var_increment
(
join
->
thd
->
status_var
.
select_full_join_count
);
&
LOCK_status
);
}
}
}
}
if
(
!
table
->
no_keyread
)
if
(
!
table
->
no_keyread
)
...
@@ -9377,7 +9372,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
...
@@ -9377,7 +9372,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
(
int
)
distinct
,
(
int
)
save_sum_fields
,
(
int
)
distinct
,
(
int
)
save_sum_fields
,
(
ulong
)
rows_limit
,
test
(
group
)));
(
ulong
)
rows_limit
,
test
(
group
)));
stat
istic_increment
(
thd
->
status_var
.
created_tmp_tables
,
&
LOCK_statu
s
);
stat
us_var_increment
(
thd
->
status_var
.
created_tmp_table
s
);
if
(
use_temp_pool
&&
!
(
test_flags
&
TEST_KEEP_TMP_TABLES
))
if
(
use_temp_pool
&&
!
(
test_flags
&
TEST_KEEP_TMP_TABLES
))
temp_pool_slot
=
bitmap_lock_set_next
(
&
temp_pool
);
temp_pool_slot
=
bitmap_lock_set_next
(
&
temp_pool
);
...
@@ -10249,8 +10244,7 @@ static bool create_myisam_tmp_table(TABLE *table,TMP_TABLE_PARAM *param,
...
@@ -10249,8 +10244,7 @@ static bool create_myisam_tmp_table(TABLE *table,TMP_TABLE_PARAM *param,
table
->
db_stat
=
0
;
table
->
db_stat
=
0
;
goto
err
;
goto
err
;
}
}
statistic_increment
(
table
->
in_use
->
status_var
.
created_tmp_disk_tables
,
status_var_increment
(
table
->
in_use
->
status_var
.
created_tmp_disk_tables
);
&
LOCK_status
);
share
->
db_record_offset
=
1
;
share
->
db_record_offset
=
1
;
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
err:
err:
...
...
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