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
e44fefc7
Commit
e44fefc7
authored
Jul 10, 2011
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding DBUG_ENTER/DBUG_RETURN tags that were useful when fixing memory leaks
parent
49501b4c
Changes
20
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
326 additions
and
164 deletions
+326
-164
client/mysqlcheck.c
client/mysqlcheck.c
+73
-40
mysys/array.c
mysys/array.c
+1
-1
mysys/default.c
mysys/default.c
+3
-2
mysys/hash.c
mysys/hash.c
+4
-2
mysys/my_getopt.c
mysys/my_getopt.c
+62
-38
mysys/my_malloc.c
mysys/my_malloc.c
+9
-3
mysys/my_open.c
mysys/my_open.c
+3
-2
mysys/string.c
mysys/string.c
+3
-2
sql-common/client.c
sql-common/client.c
+1
-1
sql-common/client_plugin.c
sql-common/client_plugin.c
+29
-16
sql/handler.h
sql/handler.h
+5
-1
sql/log.cc
sql/log.cc
+2
-4
sql/log.h
sql/log.h
+13
-7
sql/rpl_tblmap.cc
sql/rpl_tblmap.cc
+2
-0
sql/sql_class.cc
sql/sql_class.cc
+4
-0
sql/sql_lex.cc
sql/sql_lex.cc
+2
-0
sql/sql_parse.cc
sql/sql_parse.cc
+2
-1
sql/sql_plugin.cc
sql/sql_plugin.cc
+4
-3
storage/myisam/ha_myisam.cc
storage/myisam/ha_myisam.cc
+6
-4
storage/perfschema/pfs_instr.cc
storage/perfschema/pfs_instr.cc
+98
-37
No files found.
client/mysqlcheck.c
View file @
e44fefc7
...
@@ -224,6 +224,7 @@ static void print_version(void)
...
@@ -224,6 +224,7 @@ static void print_version(void)
static
void
usage
(
void
)
static
void
usage
(
void
)
{
{
DBUG_ENTER
(
"usage"
);
print_version
();
print_version
();
puts
(
ORACLE_WELCOME_COPYRIGHT_NOTICE
(
"2000, 2010"
));
puts
(
ORACLE_WELCOME_COPYRIGHT_NOTICE
(
"2000, 2010"
));
printf
(
"Usage: %s [OPTIONS] database [tables]
\n
"
,
my_progname
);
printf
(
"Usage: %s [OPTIONS] database [tables]
\n
"
,
my_progname
);
...
@@ -247,6 +248,7 @@ static void usage(void)
...
@@ -247,6 +248,7 @@ static void usage(void)
print_defaults
(
"my"
,
load_default_groups
);
print_defaults
(
"my"
,
load_default_groups
);
my_print_help
(
my_long_options
);
my_print_help
(
my_long_options
);
my_print_variables
(
my_long_options
);
my_print_variables
(
my_long_options
);
DBUG_VOID_RETURN
;
}
/* usage */
}
/* usage */
...
@@ -255,6 +257,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
...
@@ -255,6 +257,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char
*
argument
)
char
*
argument
)
{
{
int
orig_what_to_do
=
what_to_do
;
int
orig_what_to_do
=
what_to_do
;
DBUG_ENTER
(
"get_one_option"
);
switch
(
optid
)
{
switch
(
optid
)
{
case
'a'
:
case
'a'
:
...
@@ -335,15 +338,16 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
...
@@ -335,15 +338,16 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
{
{
fprintf
(
stderr
,
"Error: %s doesn't support multiple contradicting commands.
\n
"
,
fprintf
(
stderr
,
"Error: %s doesn't support multiple contradicting commands.
\n
"
,
my_progname
);
my_progname
);
return
1
;
DBUG_RETURN
(
1
)
;
}
}
return
0
;
DBUG_RETURN
(
0
)
;
}
}
static
int
get_options
(
int
*
argc
,
char
***
argv
)
static
int
get_options
(
int
*
argc
,
char
***
argv
)
{
{
int
ho_error
;
int
ho_error
;
DBUG_ENTER
(
"get_options"
);
if
(
*
argc
==
1
)
if
(
*
argc
==
1
)
{
{
...
@@ -385,21 +389,21 @@ static int get_options(int *argc, char ***argv)
...
@@ -385,21 +389,21 @@ static int get_options(int *argc, char ***argv)
!
get_charset_by_csname
(
default_charset
,
MY_CS_PRIMARY
,
MYF
(
MY_WME
)))
!
get_charset_by_csname
(
default_charset
,
MY_CS_PRIMARY
,
MYF
(
MY_WME
)))
{
{
printf
(
"Unsupported character set: %s
\n
"
,
default_charset
);
printf
(
"Unsupported character set: %s
\n
"
,
default_charset
);
return
1
;
DBUG_RETURN
(
1
)
;
}
}
if
(
*
argc
>
0
&&
opt_alldbs
)
if
(
*
argc
>
0
&&
opt_alldbs
)
{
{
printf
(
"You should give only options, no arguments at all, with option
\n
"
);
printf
(
"You should give only options, no arguments at all, with option
\n
"
);
printf
(
"--all-databases. Please see %s --help for more information.
\n
"
,
printf
(
"--all-databases. Please see %s --help for more information.
\n
"
,
my_progname
);
my_progname
);
return
1
;
DBUG_RETURN
(
1
)
;
}
}
if
(
*
argc
<
1
&&
!
opt_alldbs
)
if
(
*
argc
<
1
&&
!
opt_alldbs
)
{
{
printf
(
"You forgot to give the arguments! Please see %s --help
\n
"
,
printf
(
"You forgot to give the arguments! Please see %s --help
\n
"
,
my_progname
);
my_progname
);
printf
(
"for more information.
\n
"
);
printf
(
"for more information.
\n
"
);
return
1
;
DBUG_RETURN
(
1
)
;
}
}
if
(
tty_password
)
if
(
tty_password
)
opt_password
=
get_tty_password
(
NullS
);
opt_password
=
get_tty_password
(
NullS
);
...
@@ -407,7 +411,7 @@ static int get_options(int *argc, char ***argv)
...
@@ -407,7 +411,7 @@ static int get_options(int *argc, char ***argv)
my_end_arg
=
MY_CHECK_ERROR
|
MY_GIVE_INFO
;
my_end_arg
=
MY_CHECK_ERROR
|
MY_GIVE_INFO
;
if
(
debug_check_flag
)
if
(
debug_check_flag
)
my_end_arg
=
MY_CHECK_ERROR
;
my_end_arg
=
MY_CHECK_ERROR
;
return
(
0
);
DBUG_RETURN
((
0
)
);
}
/* get_options */
}
/* get_options */
...
@@ -416,13 +420,14 @@ static int process_all_databases()
...
@@ -416,13 +420,14 @@ static int process_all_databases()
MYSQL_ROW
row
;
MYSQL_ROW
row
;
MYSQL_RES
*
tableres
;
MYSQL_RES
*
tableres
;
int
result
=
0
;
int
result
=
0
;
DBUG_ENTER
(
"process_all_databases"
);
if
(
mysql_query
(
sock
,
"SHOW DATABASES"
)
||
if
(
mysql_query
(
sock
,
"SHOW DATABASES"
)
||
!
(
tableres
=
mysql_store_result
(
sock
)))
!
(
tableres
=
mysql_store_result
(
sock
)))
{
{
my_printf_error
(
0
,
"Error: Couldn't execute 'SHOW DATABASES': %s"
,
my_printf_error
(
0
,
"Error: Couldn't execute 'SHOW DATABASES': %s"
,
MYF
(
0
),
mysql_error
(
sock
));
MYF
(
0
),
mysql_error
(
sock
));
return
1
;
DBUG_RETURN
(
1
)
;
}
}
if
(
verbose
)
if
(
verbose
)
printf
(
"Processing databases
\n
"
);
printf
(
"Processing databases
\n
"
);
...
@@ -432,7 +437,7 @@ static int process_all_databases()
...
@@ -432,7 +437,7 @@ static int process_all_databases()
result
=
1
;
result
=
1
;
}
}
mysql_free_result
(
tableres
);
mysql_free_result
(
tableres
);
return
result
;
DBUG_RETURN
(
result
)
;
}
}
/* process_all_databases */
/* process_all_databases */
...
@@ -440,6 +445,8 @@ static int process_all_databases()
...
@@ -440,6 +445,8 @@ static int process_all_databases()
static
int
process_databases
(
char
**
db_names
)
static
int
process_databases
(
char
**
db_names
)
{
{
int
result
=
0
;
int
result
=
0
;
DBUG_ENTER
(
"process_databases"
);
if
(
verbose
)
if
(
verbose
)
printf
(
"Processing databases
\n
"
);
printf
(
"Processing databases
\n
"
);
for
(
;
*
db_names
;
db_names
++
)
for
(
;
*
db_names
;
db_names
++
)
...
@@ -447,14 +454,16 @@ static int process_databases(char **db_names)
...
@@ -447,14 +454,16 @@ static int process_databases(char **db_names)
if
(
process_one_db
(
*
db_names
))
if
(
process_one_db
(
*
db_names
))
result
=
1
;
result
=
1
;
}
}
return
result
;
DBUG_RETURN
(
result
)
;
}
/* process_databases */
}
/* process_databases */
static
int
process_selected_tables
(
char
*
db
,
char
**
table_names
,
int
tables
)
static
int
process_selected_tables
(
char
*
db
,
char
**
table_names
,
int
tables
)
{
{
DBUG_ENTER
(
"process_selected_tables"
);
if
(
use_db
(
db
))
if
(
use_db
(
db
))
return
1
;
DBUG_RETURN
(
1
)
;
if
(
opt_all_in_1
&&
what_to_do
!=
DO_UPGRADE
)
if
(
opt_all_in_1
&&
what_to_do
!=
DO_UPGRADE
)
{
{
/*
/*
...
@@ -471,7 +480,7 @@ static int process_selected_tables(char *db, char **table_names, int tables)
...
@@ -471,7 +480,7 @@ static int process_selected_tables(char *db, char **table_names, int tables)
if
(
!
(
table_names_comma_sep
=
(
char
*
)
if
(
!
(
table_names_comma_sep
=
(
char
*
)
my_malloc
((
sizeof
(
char
)
*
tot_length
)
+
4
,
MYF
(
MY_WME
))))
my_malloc
((
sizeof
(
char
)
*
tot_length
)
+
4
,
MYF
(
MY_WME
))))
return
1
;
DBUG_RETURN
(
1
)
;
for
(
end
=
table_names_comma_sep
+
1
;
tables
>
0
;
for
(
end
=
table_names_comma_sep
+
1
;
tables
>
0
;
tables
--
,
table_names
++
)
tables
--
,
table_names
++
)
...
@@ -486,7 +495,7 @@ static int process_selected_tables(char *db, char **table_names, int tables)
...
@@ -486,7 +495,7 @@ static int process_selected_tables(char *db, char **table_names, int tables)
else
else
for
(;
tables
>
0
;
tables
--
,
table_names
++
)
for
(;
tables
>
0
;
tables
--
,
table_names
++
)
handle_request_for_tables
(
*
table_names
,
fixed_name_length
(
*
table_names
));
handle_request_for_tables
(
*
table_names
,
fixed_name_length
(
*
table_names
));
return
0
;
DBUG_RETURN
(
0
)
;
}
/* process_selected_tables */
}
/* process_selected_tables */
...
@@ -494,6 +503,7 @@ static uint fixed_name_length(const char *name)
...
@@ -494,6 +503,7 @@ static uint fixed_name_length(const char *name)
{
{
const
char
*
p
;
const
char
*
p
;
uint
extra_length
=
2
;
/* count the first/last backticks */
uint
extra_length
=
2
;
/* count the first/last backticks */
DBUG_ENTER
(
"fixed_name_length"
);
for
(
p
=
name
;
*
p
;
p
++
)
for
(
p
=
name
;
*
p
;
p
++
)
{
{
...
@@ -501,13 +511,16 @@ static uint fixed_name_length(const char *name)
...
@@ -501,13 +511,16 @@ static uint fixed_name_length(const char *name)
extra_length
++
;
extra_length
++
;
else
if
(
*
p
==
'.'
)
else
if
(
*
p
==
'.'
)
extra_length
+=
2
;
extra_length
+=
2
;
}
}
return
(
uint
)
((
p
-
name
)
+
extra_length
);
DBUG_RETURN
((
uint
)
((
p
-
name
)
+
extra_length
)
);
}
}
static
char
*
fix_table_name
(
char
*
dest
,
char
*
src
)
static
char
*
fix_table_name
(
char
*
dest
,
char
*
src
)
{
{
DBUG_ENTER
(
"fix_table_name"
);
*
dest
++=
'`'
;
*
dest
++=
'`'
;
for
(;
*
src
;
src
++
)
for
(;
*
src
;
src
++
)
{
{
...
@@ -525,27 +538,28 @@ static char *fix_table_name(char *dest, char *src)
...
@@ -525,27 +538,28 @@ static char *fix_table_name(char *dest, char *src)
}
}
}
}
*
dest
++=
'`'
;
*
dest
++=
'`'
;
return
dest
;
DBUG_RETURN
(
dest
);
}
}
static
int
process_all_tables_in_db
(
char
*
database
)
static
int
process_all_tables_in_db
(
char
*
database
)
{
{
MYSQL_RES
*
res
;
MYSQL_RES
*
UNINIT_VAR
(
res
)
;
MYSQL_ROW
row
;
MYSQL_ROW
row
;
uint
num_columns
;
uint
num_columns
;
my_bool
system_database
=
0
;
my_bool
system_database
=
0
;
DBUG_ENTER
(
"process_all_tables_in_db"
);
LINT_INIT
(
res
);
if
(
use_db
(
database
))
if
(
use_db
(
database
))
return
1
;
DBUG_RETURN
(
1
)
;
if
((
mysql_query
(
sock
,
"SHOW /*!50002 FULL*/ TABLES"
)
&&
if
((
mysql_query
(
sock
,
"SHOW /*!50002 FULL*/ TABLES"
)
&&
mysql_query
(
sock
,
"SHOW TABLES"
))
||
mysql_query
(
sock
,
"SHOW TABLES"
))
||
!
(
res
=
mysql_store_result
(
sock
)))
!
(
res
=
mysql_store_result
(
sock
)))
{
{
my_printf_error
(
0
,
"Error: Couldn't get table list for database %s: %s"
,
my_printf_error
(
0
,
"Error: Couldn't get table list for database %s: %s"
,
MYF
(
0
),
database
,
mysql_error
(
sock
));
MYF
(
0
),
database
,
mysql_error
(
sock
));
return
1
;
DBUG_RETURN
(
1
)
;
}
}
if
(
!
strcmp
(
database
,
"mysql"
)
||
!
strcmp
(
database
,
"MYSQL"
))
if
(
!
strcmp
(
database
,
"mysql"
)
||
!
strcmp
(
database
,
"MYSQL"
))
...
@@ -571,7 +585,7 @@ static int process_all_tables_in_db(char *database)
...
@@ -571,7 +585,7 @@ static int process_all_tables_in_db(char *database)
if
(
!
(
tables
=
(
char
*
)
my_malloc
(
sizeof
(
char
)
*
tot_length
+
4
,
MYF
(
MY_WME
))))
if
(
!
(
tables
=
(
char
*
)
my_malloc
(
sizeof
(
char
)
*
tot_length
+
4
,
MYF
(
MY_WME
))))
{
{
mysql_free_result
(
res
);
mysql_free_result
(
res
);
return
1
;
DBUG_RETURN
(
1
)
;
}
}
for
(
end
=
tables
+
1
;
(
row
=
mysql_fetch_row
(
res
))
;)
for
(
end
=
tables
+
1
;
(
row
=
mysql_fetch_row
(
res
))
;)
{
{
...
@@ -602,7 +616,7 @@ static int process_all_tables_in_db(char *database)
...
@@ -602,7 +616,7 @@ static int process_all_tables_in_db(char *database)
}
}
}
}
mysql_free_result
(
res
);
mysql_free_result
(
res
);
return
0
;
DBUG_RETURN
(
0
)
;
}
/* process_all_tables_in_db */
}
/* process_all_tables_in_db */
...
@@ -611,8 +625,10 @@ static int fix_table_storage_name(const char *name)
...
@@ -611,8 +625,10 @@ static int fix_table_storage_name(const char *name)
{
{
char
qbuf
[
100
+
NAME_LEN
*
4
];
char
qbuf
[
100
+
NAME_LEN
*
4
];
int
rc
=
0
;
int
rc
=
0
;
DBUG_ENTER
(
"fix_table_storage_name"
);
if
(
strncmp
(
name
,
"#mysql50#"
,
9
))
if
(
strncmp
(
name
,
"#mysql50#"
,
9
))
return
1
;
DBUG_RETURN
(
1
)
;
sprintf
(
qbuf
,
"RENAME TABLE `%s` TO `%s`"
,
name
,
name
+
9
);
sprintf
(
qbuf
,
"RENAME TABLE `%s` TO `%s`"
,
name
,
name
+
9
);
if
(
mysql_query
(
sock
,
qbuf
))
if
(
mysql_query
(
sock
,
qbuf
))
{
{
...
@@ -622,15 +638,17 @@ static int fix_table_storage_name(const char *name)
...
@@ -622,15 +638,17 @@ static int fix_table_storage_name(const char *name)
}
}
if
(
verbose
)
if
(
verbose
)
printf
(
"%-50s %s
\n
"
,
name
,
rc
?
"FAILED"
:
"OK"
);
printf
(
"%-50s %s
\n
"
,
name
,
rc
?
"FAILED"
:
"OK"
);
return
rc
;
DBUG_RETURN
(
rc
)
;
}
}
static
int
fix_database_storage_name
(
const
char
*
name
)
static
int
fix_database_storage_name
(
const
char
*
name
)
{
{
char
qbuf
[
100
+
NAME_LEN
*
4
];
char
qbuf
[
100
+
NAME_LEN
*
4
];
int
rc
=
0
;
int
rc
=
0
;
DBUG_ENTER
(
"fix_database_storage_name"
);
if
(
strncmp
(
name
,
"#mysql50#"
,
9
))
if
(
strncmp
(
name
,
"#mysql50#"
,
9
))
return
1
;
DBUG_RETURN
(
1
)
;
sprintf
(
qbuf
,
"ALTER DATABASE `%s` UPGRADE DATA DIRECTORY NAME"
,
name
);
sprintf
(
qbuf
,
"ALTER DATABASE `%s` UPGRADE DATA DIRECTORY NAME"
,
name
);
if
(
mysql_query
(
sock
,
qbuf
))
if
(
mysql_query
(
sock
,
qbuf
))
{
{
...
@@ -640,17 +658,19 @@ static int fix_database_storage_name(const char *name)
...
@@ -640,17 +658,19 @@ static int fix_database_storage_name(const char *name)
}
}
if
(
verbose
)
if
(
verbose
)
printf
(
"%-50s %s
\n
"
,
name
,
rc
?
"FAILED"
:
"OK"
);
printf
(
"%-50s %s
\n
"
,
name
,
rc
?
"FAILED"
:
"OK"
);
return
rc
;
DBUG_RETURN
(
rc
)
;
}
}
static
int
rebuild_table
(
char
*
name
)
static
int
rebuild_table
(
char
*
name
)
{
{
char
*
query
,
*
ptr
;
char
*
query
,
*
ptr
;
int
rc
=
0
;
int
rc
=
0
;
DBUG_ENTER
(
"rebuild_table"
);
query
=
(
char
*
)
my_malloc
(
sizeof
(
char
)
*
(
12
+
fixed_name_length
(
name
)
+
6
+
1
),
query
=
(
char
*
)
my_malloc
(
sizeof
(
char
)
*
(
12
+
fixed_name_length
(
name
)
+
6
+
1
),
MYF
(
MY_WME
));
MYF
(
MY_WME
));
if
(
!
query
)
if
(
!
query
)
return
1
;
DBUG_RETURN
(
1
)
;
ptr
=
strmov
(
query
,
"ALTER TABLE "
);
ptr
=
strmov
(
query
,
"ALTER TABLE "
);
ptr
=
fix_table_name
(
ptr
,
name
);
ptr
=
fix_table_name
(
ptr
,
name
);
ptr
=
strxmov
(
ptr
,
" FORCE"
,
NullS
);
ptr
=
strxmov
(
ptr
,
" FORCE"
,
NullS
);
...
@@ -661,11 +681,13 @@ static int rebuild_table(char *name)
...
@@ -661,11 +681,13 @@ static int rebuild_table(char *name)
rc
=
1
;
rc
=
1
;
}
}
my_free
(
query
);
my_free
(
query
);
return
rc
;
DBUG_RETURN
(
rc
)
;
}
}
static
int
process_one_db
(
char
*
database
)
static
int
process_one_db
(
char
*
database
)
{
{
DBUG_ENTER
(
"process_one_db"
);
if
(
verbose
)
if
(
verbose
)
puts
(
database
);
puts
(
database
);
if
(
what_to_do
==
DO_UPGRADE
)
if
(
what_to_do
==
DO_UPGRADE
)
...
@@ -677,38 +699,42 @@ static int process_one_db(char *database)
...
@@ -677,38 +699,42 @@ static int process_one_db(char *database)
database
+=
9
;
database
+=
9
;
}
}
if
(
rc
||
!
opt_fix_table_names
)
if
(
rc
||
!
opt_fix_table_names
)
return
rc
;
DBUG_RETURN
(
rc
)
;
}
}
return
process_all_tables_in_db
(
database
);
DBUG_RETURN
(
process_all_tables_in_db
(
database
)
);
}
}
static
int
use_db
(
char
*
database
)
static
int
use_db
(
char
*
database
)
{
{
DBUG_ENTER
(
"use_db"
);
if
(
mysql_get_server_version
(
sock
)
>=
FIRST_INFORMATION_SCHEMA_VERSION
&&
if
(
mysql_get_server_version
(
sock
)
>=
FIRST_INFORMATION_SCHEMA_VERSION
&&
!
my_strcasecmp
(
&
my_charset_latin1
,
database
,
INFORMATION_SCHEMA_DB_NAME
))
!
my_strcasecmp
(
&
my_charset_latin1
,
database
,
INFORMATION_SCHEMA_DB_NAME
))
return
1
;
DBUG_RETURN
(
1
)
;
if
(
mysql_get_server_version
(
sock
)
>=
FIRST_PERFORMANCE_SCHEMA_VERSION
&&
if
(
mysql_get_server_version
(
sock
)
>=
FIRST_PERFORMANCE_SCHEMA_VERSION
&&
!
my_strcasecmp
(
&
my_charset_latin1
,
database
,
PERFORMANCE_SCHEMA_DB_NAME
))
!
my_strcasecmp
(
&
my_charset_latin1
,
database
,
PERFORMANCE_SCHEMA_DB_NAME
))
return
1
;
DBUG_RETURN
(
1
)
;
if
(
mysql_select_db
(
sock
,
database
))
if
(
mysql_select_db
(
sock
,
database
))
{
{
DBerror
(
sock
,
"when selecting the database"
);
DBerror
(
sock
,
"when selecting the database"
);
return
1
;
DBUG_RETURN
(
1
)
;
}
}
return
0
;
DBUG_RETURN
(
0
)
;
}
/* use_db */
}
/* use_db */
static
int
disable_binlog
()
static
int
disable_binlog
()
{
{
const
char
*
stmt
=
"SET SQL_LOG_BIN=0"
;
const
char
*
stmt
=
"SET SQL_LOG_BIN=0"
;
DBUG_ENTER
(
"disable_binlog"
);
if
(
mysql_query
(
sock
,
stmt
))
if
(
mysql_query
(
sock
,
stmt
))
{
{
fprintf
(
stderr
,
"Failed to %s
\n
"
,
stmt
);
fprintf
(
stderr
,
"Failed to %s
\n
"
,
stmt
);
fprintf
(
stderr
,
"Error: %s
\n
"
,
mysql_error
(
sock
));
fprintf
(
stderr
,
"Error: %s
\n
"
,
mysql_error
(
sock
));
return
1
;
DBUG_RETURN
(
1
)
;
}
}
return
0
;
DBUG_RETURN
(
0
)
;
}
}
static
int
handle_request_for_tables
(
char
*
tables
,
uint
length
)
static
int
handle_request_for_tables
(
char
*
tables
,
uint
length
)
...
@@ -716,6 +742,7 @@ static int handle_request_for_tables(char *tables, uint length)
...
@@ -716,6 +742,7 @@ static int handle_request_for_tables(char *tables, uint length)
char
*
query
,
*
end
,
options
[
100
],
message
[
100
];
char
*
query
,
*
end
,
options
[
100
],
message
[
100
];
uint
query_length
=
0
;
uint
query_length
=
0
;
const
char
*
op
=
0
;
const
char
*
op
=
0
;
DBUG_ENTER
(
"handle_request_for_tables"
);
options
[
0
]
=
0
;
options
[
0
]
=
0
;
end
=
options
;
end
=
options
;
...
@@ -742,11 +769,11 @@ static int handle_request_for_tables(char *tables, uint length)
...
@@ -742,11 +769,11 @@ static int handle_request_for_tables(char *tables, uint length)
op
=
(
opt_write_binlog
)
?
"OPTIMIZE"
:
"OPTIMIZE NO_WRITE_TO_BINLOG"
;
op
=
(
opt_write_binlog
)
?
"OPTIMIZE"
:
"OPTIMIZE NO_WRITE_TO_BINLOG"
;
break
;
break
;
case
DO_UPGRADE
:
case
DO_UPGRADE
:
return
fix_table_storage_name
(
tables
);
DBUG_RETURN
(
fix_table_storage_name
(
tables
)
);
}
}
if
(
!
(
query
=
(
char
*
)
my_malloc
((
sizeof
(
char
)
*
(
length
+
110
)),
MYF
(
MY_WME
))))
if
(
!
(
query
=
(
char
*
)
my_malloc
((
sizeof
(
char
)
*
(
length
+
110
)),
MYF
(
MY_WME
))))
return
1
;
DBUG_RETURN
(
1
)
;
if
(
opt_all_in_1
)
if
(
opt_all_in_1
)
{
{
/* No backticks here as we added them before */
/* No backticks here as we added them before */
...
@@ -765,11 +792,11 @@ static int handle_request_for_tables(char *tables, uint length)
...
@@ -765,11 +792,11 @@ static int handle_request_for_tables(char *tables, uint length)
{
{
sprintf
(
message
,
"when executing '%s TABLE ... %s'"
,
op
,
options
);
sprintf
(
message
,
"when executing '%s TABLE ... %s'"
,
op
,
options
);
DBerror
(
sock
,
message
);
DBerror
(
sock
,
message
);
return
1
;
DBUG_RETURN
(
1
)
;
}
}
print_result
();
print_result
();
my_free
(
query
);
my_free
(
query
);
return
0
;
DBUG_RETURN
(
0
)
;
}
}
...
@@ -780,6 +807,7 @@ static void print_result()
...
@@ -780,6 +807,7 @@ static void print_result()
char
prev
[(
NAME_LEN
+
9
)
*
2
+
2
];
char
prev
[(
NAME_LEN
+
9
)
*
2
+
2
];
uint
i
;
uint
i
;
my_bool
found_error
=
0
,
table_rebuild
=
0
;
my_bool
found_error
=
0
,
table_rebuild
=
0
;
DBUG_ENTER
(
"print_result"
);
res
=
mysql_use_result
(
sock
);
res
=
mysql_use_result
(
sock
);
...
@@ -843,6 +871,7 @@ static void print_result()
...
@@ -843,6 +871,7 @@ static void print_result()
insert_dynamic
(
&
tables4repair
,
(
uchar
*
)
prev
);
insert_dynamic
(
&
tables4repair
,
(
uchar
*
)
prev
);
}
}
mysql_free_result
(
res
);
mysql_free_result
(
res
);
DBUG_VOID_RETURN
;
}
}
...
@@ -888,9 +917,11 @@ static int dbConnect(char *host, char *user, char *passwd)
...
@@ -888,9 +917,11 @@ static int dbConnect(char *host, char *user, char *passwd)
static
void
dbDisconnect
(
char
*
host
)
static
void
dbDisconnect
(
char
*
host
)
{
{
DBUG_ENTER
(
"dbDisconnect"
);
if
(
verbose
>
1
)
if
(
verbose
>
1
)
fprintf
(
stderr
,
"# Disconnecting from %s...
\n
"
,
host
?
host
:
"localhost"
);
fprintf
(
stderr
,
"# Disconnecting from %s...
\n
"
,
host
?
host
:
"localhost"
);
mysql_close
(
sock
);
mysql_close
(
sock
);
DBUG_VOID_RETURN
;
}
/* dbDisconnect */
}
/* dbDisconnect */
...
@@ -906,13 +937,15 @@ static void DBerror(MYSQL *mysql, const char *when)
...
@@ -906,13 +937,15 @@ static void DBerror(MYSQL *mysql, const char *when)
static
void
safe_exit
(
int
error
)
static
void
safe_exit
(
int
error
)
{
{
DBUG_ENTER
(
"safe_exit"
);
if
(
!
first_error
)
if
(
!
first_error
)
first_error
=
error
;
first_error
=
error
;
if
(
ignore_errors
)
if
(
ignore_errors
)
return
;
DBUG_VOID_RETURN
;
if
(
sock
)
if
(
sock
)
mysql_close
(
sock
);
mysql_close
(
sock
);
exit
(
error
);
exit
(
error
);
DBUG_VOID_RETURN
;
}
}
...
...
mysys/array.c
View file @
e44fefc7
...
@@ -44,7 +44,7 @@ my_bool init_dynamic_array2(DYNAMIC_ARRAY *array, uint element_size,
...
@@ -44,7 +44,7 @@ my_bool init_dynamic_array2(DYNAMIC_ARRAY *array, uint element_size,
void
*
init_buffer
,
uint
init_alloc
,
void
*
init_buffer
,
uint
init_alloc
,
uint
alloc_increment
)
uint
alloc_increment
)
{
{
DBUG_ENTER
(
"init_dynamic_array"
);
DBUG_ENTER
(
"init_dynamic_array
2
"
);
if
(
!
alloc_increment
)
if
(
!
alloc_increment
)
{
{
alloc_increment
=
max
((
8192
-
MALLOC_OVERHEAD
)
/
element_size
,
16
);
alloc_increment
=
max
((
8192
-
MALLOC_OVERHEAD
)
/
element_size
,
16
);
...
...
mysys/default.c
View file @
e44fefc7
...
@@ -1198,10 +1198,11 @@ static const char **init_default_directories(MEM_ROOT *alloc)
...
@@ -1198,10 +1198,11 @@ static const char **init_default_directories(MEM_ROOT *alloc)
const
char
**
dirs
;
const
char
**
dirs
;
char
*
env
;
char
*
env
;
int
errors
=
0
;
int
errors
=
0
;
DBUG_ENTER
(
"init_default_directories"
);
dirs
=
(
const
char
**
)
alloc_root
(
alloc
,
DEFAULT_DIRS_SIZE
*
sizeof
(
char
*
));
dirs
=
(
const
char
**
)
alloc_root
(
alloc
,
DEFAULT_DIRS_SIZE
*
sizeof
(
char
*
));
if
(
dirs
==
NULL
)
if
(
dirs
==
NULL
)
return
NULL
;
DBUG_RETURN
(
NULL
)
;
bzero
((
char
*
)
dirs
,
DEFAULT_DIRS_SIZE
*
sizeof
(
char
*
));
bzero
((
char
*
)
dirs
,
DEFAULT_DIRS_SIZE
*
sizeof
(
char
*
));
#ifdef __WIN__
#ifdef __WIN__
...
@@ -1242,5 +1243,5 @@ static const char **init_default_directories(MEM_ROOT *alloc)
...
@@ -1242,5 +1243,5 @@ static const char **init_default_directories(MEM_ROOT *alloc)
errors
+=
add_directory
(
alloc
,
"~/"
,
dirs
);
errors
+=
add_directory
(
alloc
,
"~/"
,
dirs
);
#endif
#endif
return
(
errors
>
0
?
NULL
:
dirs
);
DBUG_RETURN
(
errors
>
0
?
NULL
:
dirs
);
}
}
mysys/hash.c
View file @
e44fefc7
...
@@ -77,6 +77,7 @@ _my_hash_init(HASH *hash, uint growth_size, CHARSET_INFO *charset,
...
@@ -77,6 +77,7 @@ _my_hash_init(HASH *hash, uint growth_size, CHARSET_INFO *charset,
my_hash_get_key
get_key
,
my_hash_get_key
get_key
,
void
(
*
free_element
)(
void
*
),
uint
flags
)
void
(
*
free_element
)(
void
*
),
uint
flags
)
{
{
my_bool
res
;
DBUG_ENTER
(
"my_hash_init"
);
DBUG_ENTER
(
"my_hash_init"
);
DBUG_PRINT
(
"enter"
,(
"hash: 0x%lx size: %u"
,
(
long
)
hash
,
(
uint
)
size
));
DBUG_PRINT
(
"enter"
,(
"hash: 0x%lx size: %u"
,
(
long
)
hash
,
(
uint
)
size
));
...
@@ -88,8 +89,9 @@ _my_hash_init(HASH *hash, uint growth_size, CHARSET_INFO *charset,
...
@@ -88,8 +89,9 @@ _my_hash_init(HASH *hash, uint growth_size, CHARSET_INFO *charset,
hash
->
free
=
free_element
;
hash
->
free
=
free_element
;
hash
->
flags
=
flags
;
hash
->
flags
=
flags
;
hash
->
charset
=
charset
;
hash
->
charset
=
charset
;
DBUG_RETURN
(
my_init_dynamic_array_ci
(
&
hash
->
array
,
res
=
my_init_dynamic_array_ci
(
&
hash
->
array
,
sizeof
(
HASH_LINK
),
size
,
growth_size
));
sizeof
(
HASH_LINK
),
size
,
growth_size
);
DBUG_RETURN
(
res
);
}
}
...
...
mysys/my_getopt.c
View file @
e44fefc7
...
@@ -72,6 +72,8 @@ static void default_reporter(enum loglevel level,
...
@@ -72,6 +72,8 @@ static void default_reporter(enum loglevel level,
const
char
*
format
,
...)
const
char
*
format
,
...)
{
{
va_list
args
;
va_list
args
;
DBUG_ENTER
(
"default_reporter"
);
va_start
(
args
,
format
);
va_start
(
args
,
format
);
if
(
level
==
WARNING_LEVEL
)
if
(
level
==
WARNING_LEVEL
)
fprintf
(
stderr
,
"%s"
,
"Warning: "
);
fprintf
(
stderr
,
"%s"
,
"Warning: "
);
...
@@ -81,6 +83,7 @@ static void default_reporter(enum loglevel level,
...
@@ -81,6 +83,7 @@ static void default_reporter(enum loglevel level,
va_end
(
args
);
va_end
(
args
);
fputc
(
'\n'
,
stderr
);
fputc
(
'\n'
,
stderr
);
fflush
(
stderr
);
fflush
(
stderr
);
DBUG_VOID_RETURN
;
}
}
static
my_getopt_value
getopt_get_addr
;
static
my_getopt_value
getopt_get_addr
;
...
@@ -162,6 +165,7 @@ int handle_options(int *argc, char ***argv,
...
@@ -162,6 +165,7 @@ int handle_options(int *argc, char ***argv,
void
*
value
;
void
*
value
;
int
error
,
i
;
int
error
,
i
;
my_bool
is_cmdline_arg
=
1
;
my_bool
is_cmdline_arg
=
1
;
DBUG_ENTER
(
"handle_options"
);
/* handle_options() assumes arg0 (program name) always exists */
/* handle_options() assumes arg0 (program name) always exists */
DBUG_ASSERT
(
argc
&&
*
argc
>=
1
);
DBUG_ASSERT
(
argc
&&
*
argc
>=
1
);
...
@@ -263,7 +267,7 @@ int handle_options(int *argc, char ***argv,
...
@@ -263,7 +267,7 @@ int handle_options(int *argc, char ***argv,
my_progname
,
special_opt_prefix
[
i
],
my_progname
,
special_opt_prefix
[
i
],
opt_str
,
special_opt_prefix
[
i
],
opt_str
,
special_opt_prefix
[
i
],
prev_found
);
prev_found
);
return
EXIT_AMBIGUOUS_OPTION
;
DBUG_RETURN
(
EXIT_AMBIGUOUS_OPTION
)
;
}
}
switch
(
i
)
{
switch
(
i
)
{
case
OPT_SKIP
:
case
OPT_SKIP
:
...
@@ -308,7 +312,7 @@ int handle_options(int *argc, char ***argv,
...
@@ -308,7 +312,7 @@ int handle_options(int *argc, char ***argv,
"%s: unknown variable '%s'"
,
"%s: unknown variable '%s'"
,
my_progname
,
cur_arg
);
my_progname
,
cur_arg
);
if
(
!
option_is_loose
)
if
(
!
option_is_loose
)
return
EXIT_UNKNOWN_VARIABLE
;
DBUG_RETURN
(
EXIT_UNKNOWN_VARIABLE
)
;
}
}
else
else
{
{
...
@@ -318,7 +322,7 @@ int handle_options(int *argc, char ***argv,
...
@@ -318,7 +322,7 @@ int handle_options(int *argc, char ***argv,
"%s: unknown option '--%s'"
,
"%s: unknown option '--%s'"
,
my_progname
,
cur_arg
);
my_progname
,
cur_arg
);
if
(
!
option_is_loose
)
if
(
!
option_is_loose
)
return
EXIT_UNKNOWN_OPTION
;
DBUG_RETURN
(
EXIT_UNKNOWN_OPTION
)
;
}
}
if
(
option_is_loose
)
if
(
option_is_loose
)
{
{
...
@@ -335,7 +339,7 @@ int handle_options(int *argc, char ***argv,
...
@@ -335,7 +339,7 @@ int handle_options(int *argc, char ***argv,
my_getopt_error_reporter
(
ERROR_LEVEL
,
my_getopt_error_reporter
(
ERROR_LEVEL
,
"%s: variable prefix '%s' is not unique"
,
"%s: variable prefix '%s' is not unique"
,
my_progname
,
opt_str
);
my_progname
,
opt_str
);
return
EXIT_VAR_PREFIX_NOT_UNIQUE
;
DBUG_RETURN
(
EXIT_VAR_PREFIX_NOT_UNIQUE
)
;
}
}
else
else
{
{
...
@@ -344,7 +348,7 @@ int handle_options(int *argc, char ***argv,
...
@@ -344,7 +348,7 @@ int handle_options(int *argc, char ***argv,
"%s: ambiguous option '--%s' (%s, %s)"
,
"%s: ambiguous option '--%s' (%s, %s)"
,
my_progname
,
opt_str
,
prev_found
,
my_progname
,
opt_str
,
prev_found
,
optp
->
name
);
optp
->
name
);
return
EXIT_AMBIGUOUS_OPTION
;
DBUG_RETURN
(
EXIT_AMBIGUOUS_OPTION
)
;
}
}
}
}
if
((
optp
->
var_type
&
GET_TYPE_MASK
)
==
GET_DISABLED
)
if
((
optp
->
var_type
&
GET_TYPE_MASK
)
==
GET_DISABLED
)
...
@@ -358,14 +362,14 @@ int handle_options(int *argc, char ***argv,
...
@@ -358,14 +362,14 @@ int handle_options(int *argc, char ***argv,
(
*
argc
)
--
;
(
*
argc
)
--
;
continue
;
continue
;
}
}
return
EXIT_OPTION_DISABLED
;
DBUG_RETURN
(
EXIT_OPTION_DISABLED
)
;
}
}
error
=
0
;
error
=
0
;
value
=
optp
->
var_type
&
GET_ASK_ADDR
?
value
=
optp
->
var_type
&
GET_ASK_ADDR
?
(
*
getopt_get_addr
)(
key_name
,
(
uint
)
strlen
(
key_name
),
optp
,
&
error
)
:
(
*
getopt_get_addr
)(
key_name
,
(
uint
)
strlen
(
key_name
),
optp
,
&
error
)
:
optp
->
value
;
optp
->
value
;
if
(
error
)
if
(
error
)
return
error
;
DBUG_RETURN
(
error
)
;
if
(
optp
->
arg_type
==
NO_ARG
)
if
(
optp
->
arg_type
==
NO_ARG
)
{
{
...
@@ -380,7 +384,7 @@ int handle_options(int *argc, char ***argv,
...
@@ -380,7 +384,7 @@ int handle_options(int *argc, char ***argv,
my_getopt_error_reporter
(
ERROR_LEVEL
,
my_getopt_error_reporter
(
ERROR_LEVEL
,
"%s: option '--%s' cannot take an argument"
,
"%s: option '--%s' cannot take an argument"
,
my_progname
,
optp
->
name
);
my_progname
,
optp
->
name
);
return
EXIT_NO_ARGUMENT_ALLOWED
;
DBUG_RETURN
(
EXIT_NO_ARGUMENT_ALLOWED
)
;
}
}
if
((
optp
->
var_type
&
GET_TYPE_MASK
)
==
GET_BOOL
)
if
((
optp
->
var_type
&
GET_TYPE_MASK
)
==
GET_BOOL
)
{
{
...
@@ -407,7 +411,7 @@ int handle_options(int *argc, char ***argv,
...
@@ -407,7 +411,7 @@ int handle_options(int *argc, char ***argv,
if
(
get_one_option
&&
get_one_option
(
optp
->
id
,
optp
,
if
(
get_one_option
&&
get_one_option
(
optp
->
id
,
optp
,
*
((
my_bool
*
)
value
)
?
*
((
my_bool
*
)
value
)
?
enabled_my_option
:
disabled_my_option
))
enabled_my_option
:
disabled_my_option
))
return
EXIT_ARGUMENT_INVALID
;
DBUG_RETURN
(
EXIT_ARGUMENT_INVALID
)
;
continue
;
continue
;
}
}
argument
=
optend
;
argument
=
optend
;
...
@@ -424,7 +428,7 @@ int handle_options(int *argc, char ***argv,
...
@@ -424,7 +428,7 @@ int handle_options(int *argc, char ***argv,
my_getopt_error_reporter
(
ERROR_LEVEL
,
my_getopt_error_reporter
(
ERROR_LEVEL
,
"%s: option '--%s' requires an argument"
,
"%s: option '--%s' requires an argument"
,
my_progname
,
optp
->
name
);
my_progname
,
optp
->
name
);
return
EXIT_ARGUMENT_REQUIRED
;
DBUG_RETURN
(
EXIT_ARGUMENT_REQUIRED
)
;
}
}
argument
=
*
pos
;
argument
=
*
pos
;
(
*
argc
)
--
;
(
*
argc
)
--
;
...
@@ -449,14 +453,14 @@ int handle_options(int *argc, char ***argv,
...
@@ -449,14 +453,14 @@ int handle_options(int *argc, char ***argv,
fprintf
(
stderr
,
fprintf
(
stderr
,
"%s: ERROR: Option '-%c' used, but is disabled
\n
"
,
"%s: ERROR: Option '-%c' used, but is disabled
\n
"
,
my_progname
,
optp
->
id
);
my_progname
,
optp
->
id
);
return
EXIT_OPTION_DISABLED
;
DBUG_RETURN
(
EXIT_OPTION_DISABLED
)
;
}
}
if
((
optp
->
var_type
&
GET_TYPE_MASK
)
==
GET_BOOL
&&
if
((
optp
->
var_type
&
GET_TYPE_MASK
)
==
GET_BOOL
&&
optp
->
arg_type
==
NO_ARG
)
optp
->
arg_type
==
NO_ARG
)
{
{
*
((
my_bool
*
)
optp
->
value
)
=
(
my_bool
)
1
;
*
((
my_bool
*
)
optp
->
value
)
=
(
my_bool
)
1
;
if
(
get_one_option
&&
get_one_option
(
optp
->
id
,
optp
,
argument
))
if
(
get_one_option
&&
get_one_option
(
optp
->
id
,
optp
,
argument
))
return
EXIT_UNSPECIFIED_ERROR
;
DBUG_RETURN
(
EXIT_UNSPECIFIED_ERROR
)
;
continue
;
continue
;
}
}
else
if
(
optp
->
arg_type
==
REQUIRED_ARG
||
else
if
(
optp
->
arg_type
==
REQUIRED_ARG
||
...
@@ -476,7 +480,7 @@ int handle_options(int *argc, char ***argv,
...
@@ -476,7 +480,7 @@ int handle_options(int *argc, char ***argv,
if
(
optp
->
var_type
==
GET_BOOL
)
if
(
optp
->
var_type
==
GET_BOOL
)
*
((
my_bool
*
)
optp
->
value
)
=
(
my_bool
)
1
;
*
((
my_bool
*
)
optp
->
value
)
=
(
my_bool
)
1
;
if
(
get_one_option
&&
get_one_option
(
optp
->
id
,
optp
,
argument
))
if
(
get_one_option
&&
get_one_option
(
optp
->
id
,
optp
,
argument
))
return
EXIT_UNSPECIFIED_ERROR
;
DBUG_RETURN
(
EXIT_UNSPECIFIED_ERROR
)
;
continue
;
continue
;
}
}
/* Check if there are more arguments after this one */
/* Check if there are more arguments after this one */
...
@@ -486,7 +490,7 @@ int handle_options(int *argc, char ***argv,
...
@@ -486,7 +490,7 @@ int handle_options(int *argc, char ***argv,
my_getopt_error_reporter
(
ERROR_LEVEL
,
my_getopt_error_reporter
(
ERROR_LEVEL
,
"%s: option '-%c' requires an argument"
,
"%s: option '-%c' requires an argument"
,
my_progname
,
optp
->
id
);
my_progname
,
optp
->
id
);
return
EXIT_ARGUMENT_REQUIRED
;
DBUG_RETURN
(
EXIT_ARGUMENT_REQUIRED
)
;
}
}
argument
=
*++
pos
;
argument
=
*++
pos
;
(
*
argc
)
--
;
(
*
argc
)
--
;
...
@@ -495,9 +499,9 @@ int handle_options(int *argc, char ***argv,
...
@@ -495,9 +499,9 @@ int handle_options(int *argc, char ***argv,
}
}
if
((
error
=
setval
(
optp
,
optp
->
value
,
argument
,
if
((
error
=
setval
(
optp
,
optp
->
value
,
argument
,
set_maximum_value
)))
set_maximum_value
)))
return
error
;
DBUG_RETURN
(
error
)
;
if
(
get_one_option
&&
get_one_option
(
optp
->
id
,
optp
,
argument
))
if
(
get_one_option
&&
get_one_option
(
optp
->
id
,
optp
,
argument
))
return
EXIT_UNSPECIFIED_ERROR
;
DBUG_RETURN
(
EXIT_UNSPECIFIED_ERROR
)
;
break
;
break
;
}
}
}
}
...
@@ -531,7 +535,7 @@ int handle_options(int *argc, char ***argv,
...
@@ -531,7 +535,7 @@ int handle_options(int *argc, char ***argv,
my_getopt_error_reporter
(
ERROR_LEVEL
,
my_getopt_error_reporter
(
ERROR_LEVEL
,
"%s: unknown option '-%c'"
,
"%s: unknown option '-%c'"
,
my_progname
,
*
optend
);
my_progname
,
*
optend
);
return
EXIT_UNKNOWN_OPTION
;
DBUG_RETURN
(
EXIT_UNKNOWN_OPTION
)
;
}
}
}
}
}
}
...
@@ -541,9 +545,9 @@ int handle_options(int *argc, char ***argv,
...
@@ -541,9 +545,9 @@ int handle_options(int *argc, char ***argv,
}
}
if
(((
error
=
setval
(
optp
,
value
,
argument
,
set_maximum_value
)))
&&
if
(((
error
=
setval
(
optp
,
value
,
argument
,
set_maximum_value
)))
&&
!
option_is_loose
)
!
option_is_loose
)
return
error
;
DBUG_RETURN
(
error
)
;
if
(
get_one_option
&&
get_one_option
(
optp
->
id
,
optp
,
argument
))
if
(
get_one_option
&&
get_one_option
(
optp
->
id
,
optp
,
argument
))
return
EXIT_UNSPECIFIED_ERROR
;
DBUG_RETURN
(
EXIT_UNSPECIFIED_ERROR
)
;
(
*
argc
)
--
;
/* option handled (long), decrease argument count */
(
*
argc
)
--
;
/* option handled (long), decrease argument count */
}
}
...
@@ -557,7 +561,7 @@ int handle_options(int *argc, char ***argv,
...
@@ -557,7 +561,7 @@ int handle_options(int *argc, char ***argv,
to the program, yet to be (possibly) handled.
to the program, yet to be (possibly) handled.
*/
*/
(
*
argv
)[
argvpos
]
=
0
;
(
*
argv
)[
argvpos
]
=
0
;
return
0
;
DBUG_RETURN
(
0
)
;
}
}
...
@@ -578,6 +582,7 @@ int handle_options(int *argc, char ***argv,
...
@@ -578,6 +582,7 @@ int handle_options(int *argc, char ***argv,
static
char
*
check_struct_option
(
char
*
cur_arg
,
char
*
key_name
)
static
char
*
check_struct_option
(
char
*
cur_arg
,
char
*
key_name
)
{
{
char
*
ptr
,
*
end
;
char
*
ptr
,
*
end
;
DBUG_ENTER
(
"check_struct_option"
);
ptr
=
strcend
(
cur_arg
+
1
,
'.'
);
/* Skip the first character */
ptr
=
strcend
(
cur_arg
+
1
,
'.'
);
/* Skip the first character */
end
=
strcend
(
cur_arg
,
'='
);
end
=
strcend
(
cur_arg
,
'='
);
...
@@ -594,12 +599,12 @@ static char *check_struct_option(char *cur_arg, char *key_name)
...
@@ -594,12 +599,12 @@ static char *check_struct_option(char *cur_arg, char *key_name)
uint
len
=
(
uint
)
(
ptr
-
cur_arg
);
uint
len
=
(
uint
)
(
ptr
-
cur_arg
);
set_if_smaller
(
len
,
FN_REFLEN
-
1
);
set_if_smaller
(
len
,
FN_REFLEN
-
1
);
strmake
(
key_name
,
cur_arg
,
len
);
strmake
(
key_name
,
cur_arg
,
len
);
return
++
ptr
;
DBUG_RETURN
(
++
ptr
)
;
}
}
else
else
{
{
key_name
[
0
]
=
0
;
key_name
[
0
]
=
0
;
return
cur_arg
;
DBUG_RETURN
(
cur_arg
)
;
}
}
}
}
...
@@ -615,18 +620,20 @@ static char *check_struct_option(char *cur_arg, char *key_name)
...
@@ -615,18 +620,20 @@ static char *check_struct_option(char *cur_arg, char *key_name)
static
my_bool
get_bool_argument
(
const
struct
my_option
*
opts
,
static
my_bool
get_bool_argument
(
const
struct
my_option
*
opts
,
const
char
*
argument
)
const
char
*
argument
)
{
{
DBUG_ENTER
(
"get_bool_argument"
);
if
(
!
my_strcasecmp
(
&
my_charset_latin1
,
argument
,
"true"
)
||
if
(
!
my_strcasecmp
(
&
my_charset_latin1
,
argument
,
"true"
)
||
!
my_strcasecmp
(
&
my_charset_latin1
,
argument
,
"on"
)
||
!
my_strcasecmp
(
&
my_charset_latin1
,
argument
,
"on"
)
||
!
my_strcasecmp
(
&
my_charset_latin1
,
argument
,
"1"
))
!
my_strcasecmp
(
&
my_charset_latin1
,
argument
,
"1"
))
return
1
;
DBUG_RETURN
(
1
)
;
else
if
(
!
my_strcasecmp
(
&
my_charset_latin1
,
argument
,
"false"
)
||
else
if
(
!
my_strcasecmp
(
&
my_charset_latin1
,
argument
,
"false"
)
||
!
my_strcasecmp
(
&
my_charset_latin1
,
argument
,
"off"
)
||
!
my_strcasecmp
(
&
my_charset_latin1
,
argument
,
"off"
)
||
!
my_strcasecmp
(
&
my_charset_latin1
,
argument
,
"0"
))
!
my_strcasecmp
(
&
my_charset_latin1
,
argument
,
"0"
))
return
0
;
DBUG_RETURN
(
0
)
;
my_getopt_error_reporter
(
WARNING_LEVEL
,
my_getopt_error_reporter
(
WARNING_LEVEL
,
"option '%s': boolean value '%s' wasn't recognized. Set to OFF."
,
"option '%s': boolean value '%s' wasn't recognized. Set to OFF."
,
opts
->
name
,
argument
);
opts
->
name
,
argument
);
return
0
;
DBUG_RETURN
(
0
)
;
}
}
/*
/*
...
@@ -640,6 +647,7 @@ static int setval(const struct my_option *opts, void *value, char *argument,
...
@@ -640,6 +647,7 @@ static int setval(const struct my_option *opts, void *value, char *argument,
my_bool
set_maximum_value
)
my_bool
set_maximum_value
)
{
{
int
err
=
0
,
res
=
0
;
int
err
=
0
,
res
=
0
;
DBUG_ENTER
(
"setval"
);
if
(
!
argument
)
if
(
!
argument
)
argument
=
enabled_my_option
;
argument
=
enabled_my_option
;
...
@@ -651,7 +659,7 @@ static int setval(const struct my_option *opts, void *value, char *argument,
...
@@ -651,7 +659,7 @@ static int setval(const struct my_option *opts, void *value, char *argument,
my_getopt_error_reporter
(
ERROR_LEVEL
,
my_getopt_error_reporter
(
ERROR_LEVEL
,
"%s: Maximum value of '%s' cannot be set"
,
"%s: Maximum value of '%s' cannot be set"
,
my_progname
,
opts
->
name
);
my_progname
,
opts
->
name
);
return
EXIT_NO_PTR_TO_VARIABLE
;
DBUG_RETURN
(
EXIT_NO_PTR_TO_VARIABLE
)
;
}
}
switch
((
opts
->
var_type
&
GET_TYPE_MASK
))
{
switch
((
opts
->
var_type
&
GET_TYPE_MASK
))
{
...
@@ -758,13 +766,13 @@ static int setval(const struct my_option *opts, void *value, char *argument,
...
@@ -758,13 +766,13 @@ static int setval(const struct my_option *opts, void *value, char *argument,
goto
ret
;
goto
ret
;
};
};
}
}
return
0
;
DBUG_RETURN
(
0
)
;
ret:
ret:
my_getopt_error_reporter
(
ERROR_LEVEL
,
my_getopt_error_reporter
(
ERROR_LEVEL
,
"%s: Error while setting value '%s' to '%s'"
,
"%s: Error while setting value '%s' to '%s'"
,
my_progname
,
argument
,
opts
->
name
);
my_progname
,
argument
,
opts
->
name
);
return
res
;
DBUG_RETURN
(
res
)
;
}
}
...
@@ -796,6 +804,7 @@ static int findopt(char *optpat, uint length,
...
@@ -796,6 +804,7 @@ static int findopt(char *optpat, uint length,
{
{
uint
count
;
uint
count
;
const
struct
my_option
*
opt
=
*
opt_res
;
const
struct
my_option
*
opt
=
*
opt_res
;
DBUG_ENTER
(
"findopt"
);
for
(
count
=
0
;
opt
->
name
;
opt
++
)
for
(
count
=
0
;
opt
->
name
;
opt
++
)
{
{
...
@@ -803,7 +812,7 @@ static int findopt(char *optpat, uint length,
...
@@ -803,7 +812,7 @@ static int findopt(char *optpat, uint length,
{
{
(
*
opt_res
)
=
opt
;
(
*
opt_res
)
=
opt
;
if
(
!
opt
->
name
[
length
])
/* Exact match */
if
(
!
opt
->
name
[
length
])
/* Exact match */
return
1
;
DBUG_RETURN
(
1
)
;
if
(
!
count
)
if
(
!
count
)
{
{
/* We only need to know one prev */
/* We only need to know one prev */
...
@@ -820,7 +829,7 @@ static int findopt(char *optpat, uint length,
...
@@ -820,7 +829,7 @@ static int findopt(char *optpat, uint length,
}
}
}
}
}
}
return
count
;
DBUG_RETURN
(
count
)
;
}
}
...
@@ -835,12 +844,14 @@ my_bool getopt_compare_strings(register const char *s, register const char *t,
...
@@ -835,12 +844,14 @@ my_bool getopt_compare_strings(register const char *s, register const char *t,
uint
length
)
uint
length
)
{
{
char
const
*
end
=
s
+
length
;
char
const
*
end
=
s
+
length
;
DBUG_ENTER
(
"getopt_compare_strings"
);
for
(;
s
!=
end
;
s
++
,
t
++
)
for
(;
s
!=
end
;
s
++
,
t
++
)
{
{
if
((
*
s
!=
'-'
?
*
s
:
'_'
)
!=
(
*
t
!=
'-'
?
*
t
:
'_'
))
if
((
*
s
!=
'-'
?
*
s
:
'_'
)
!=
(
*
t
!=
'-'
?
*
t
:
'_'
))
return
1
;
DBUG_RETURN
(
1
)
;
}
}
return
0
;
DBUG_RETURN
(
0
)
;
}
}
/*
/*
...
@@ -854,6 +865,8 @@ static longlong eval_num_suffix(char *argument, int *error, char *option_name)
...
@@ -854,6 +865,8 @@ static longlong eval_num_suffix(char *argument, int *error, char *option_name)
{
{
char
*
endchar
;
char
*
endchar
;
longlong
num
;
longlong
num
;
DBUG_ENTER
(
"eval_num_suffix"
);
*
error
=
0
;
*
error
=
0
;
errno
=
0
;
errno
=
0
;
...
@@ -863,7 +876,7 @@ static longlong eval_num_suffix(char *argument, int *error, char *option_name)
...
@@ -863,7 +876,7 @@ static longlong eval_num_suffix(char *argument, int *error, char *option_name)
my_getopt_error_reporter
(
ERROR_LEVEL
,
my_getopt_error_reporter
(
ERROR_LEVEL
,
"Incorrect integer value: '%s'"
,
argument
);
"Incorrect integer value: '%s'"
,
argument
);
*
error
=
1
;
*
error
=
1
;
return
0
;
DBUG_RETURN
(
0
)
;
}
}
if
(
*
endchar
==
'k'
||
*
endchar
==
'K'
)
if
(
*
endchar
==
'k'
||
*
endchar
==
'K'
)
num
*=
1024L
;
num
*=
1024L
;
...
@@ -877,9 +890,9 @@ static longlong eval_num_suffix(char *argument, int *error, char *option_name)
...
@@ -877,9 +890,9 @@ static longlong eval_num_suffix(char *argument, int *error, char *option_name)
"Unknown suffix '%c' used for variable '%s' (value '%s')
\n
"
,
"Unknown suffix '%c' used for variable '%s' (value '%s')
\n
"
,
*
endchar
,
option_name
,
argument
);
*
endchar
,
option_name
,
argument
);
*
error
=
1
;
*
error
=
1
;
return
0
;
DBUG_RETURN
(
0
)
;
}
}
return
num
;
DBUG_RETURN
(
num
)
;
}
}
/*
/*
...
@@ -913,6 +926,7 @@ longlong getopt_ll_limit_value(longlong num, const struct my_option *optp,
...
@@ -913,6 +926,7 @@ longlong getopt_ll_limit_value(longlong num, const struct my_option *optp,
my_bool
adjusted
=
FALSE
;
my_bool
adjusted
=
FALSE
;
char
buf1
[
255
],
buf2
[
255
];
char
buf1
[
255
],
buf2
[
255
];
ulonglong
block_size
=
(
optp
->
block_size
?
(
ulonglong
)
optp
->
block_size
:
1L
);
ulonglong
block_size
=
(
optp
->
block_size
?
(
ulonglong
)
optp
->
block_size
:
1L
);
DBUG_ENTER
(
"getopt_ll_limit_value"
);
if
(
num
>
0
&&
((
ulonglong
)
num
>
(
ulonglong
)
optp
->
max_value
)
&&
if
(
num
>
0
&&
((
ulonglong
)
num
>
(
ulonglong
)
optp
->
max_value
)
&&
optp
->
max_value
)
/* if max value is not set -> no upper limit */
optp
->
max_value
)
/* if max value is not set -> no upper limit */
...
@@ -959,7 +973,7 @@ longlong getopt_ll_limit_value(longlong num, const struct my_option *optp,
...
@@ -959,7 +973,7 @@ longlong getopt_ll_limit_value(longlong num, const struct my_option *optp,
my_getopt_error_reporter
(
WARNING_LEVEL
,
my_getopt_error_reporter
(
WARNING_LEVEL
,
"option '%s': signed value %s adjusted to %s"
,
"option '%s': signed value %s adjusted to %s"
,
optp
->
name
,
llstr
(
old
,
buf1
),
llstr
(
num
,
buf2
));
optp
->
name
,
llstr
(
old
,
buf1
),
llstr
(
num
,
buf2
));
return
num
;
DBUG_RETURN
(
num
)
;
}
}
/*
/*
...
@@ -982,6 +996,7 @@ ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp,
...
@@ -982,6 +996,7 @@ ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp,
my_bool
adjusted
=
FALSE
;
my_bool
adjusted
=
FALSE
;
ulonglong
old
=
num
;
ulonglong
old
=
num
;
char
buf1
[
255
],
buf2
[
255
];
char
buf1
[
255
],
buf2
[
255
];
DBUG_ENTER
(
"getopt_ull_limit_value"
);
if
((
ulonglong
)
num
>
(
ulonglong
)
optp
->
max_value
&&
if
((
ulonglong
)
num
>
(
ulonglong
)
optp
->
max_value
&&
optp
->
max_value
)
/* if max value is not set -> no upper limit */
optp
->
max_value
)
/* if max value is not set -> no upper limit */
...
@@ -1032,7 +1047,7 @@ ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp,
...
@@ -1032,7 +1047,7 @@ ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp,
"option '%s': unsigned value %s adjusted to %s"
,
"option '%s': unsigned value %s adjusted to %s"
,
optp
->
name
,
ullstr
(
old
,
buf1
),
ullstr
(
num
,
buf2
));
optp
->
name
,
ullstr
(
old
,
buf1
),
ullstr
(
num
,
buf2
));
return
num
;
DBUG_RETURN
(
num
)
;
}
}
double
getopt_double_limit_value
(
double
num
,
const
struct
my_option
*
optp
,
double
getopt_double_limit_value
(
double
num
,
const
struct
my_option
*
optp
,
...
@@ -1040,6 +1055,8 @@ double getopt_double_limit_value(double num, const struct my_option *optp,
...
@@ -1040,6 +1055,8 @@ double getopt_double_limit_value(double num, const struct my_option *optp,
{
{
my_bool
adjusted
=
FALSE
;
my_bool
adjusted
=
FALSE
;
double
old
=
num
;
double
old
=
num
;
DBUG_ENTER
(
"getopt_double_limit_value"
);
if
(
optp
->
max_value
&&
num
>
(
double
)
optp
->
max_value
)
if
(
optp
->
max_value
&&
num
>
(
double
)
optp
->
max_value
)
{
{
num
=
(
double
)
optp
->
max_value
;
num
=
(
double
)
optp
->
max_value
;
...
@@ -1056,7 +1073,7 @@ double getopt_double_limit_value(double num, const struct my_option *optp,
...
@@ -1056,7 +1073,7 @@ double getopt_double_limit_value(double num, const struct my_option *optp,
my_getopt_error_reporter
(
WARNING_LEVEL
,
my_getopt_error_reporter
(
WARNING_LEVEL
,
"option '%s': value %g adjusted to %g"
,
"option '%s': value %g adjusted to %g"
,
optp
->
name
,
old
,
num
);
optp
->
name
,
old
,
num
);
return
num
;
DBUG_RETURN
(
num
)
;
}
}
/*
/*
...
@@ -1190,7 +1207,9 @@ static void fini_one_value(const struct my_option *option, void *variable,
...
@@ -1190,7 +1207,9 @@ static void fini_one_value(const struct my_option *option, void *variable,
void
my_cleanup_options
(
const
struct
my_option
*
options
)
void
my_cleanup_options
(
const
struct
my_option
*
options
)
{
{
DBUG_ENTER
(
"my_cleanup_options"
);
init_variables
(
options
,
fini_one_value
);
init_variables
(
options
,
fini_one_value
);
DBUG_VOID_RETURN
;
}
}
...
@@ -1234,6 +1253,7 @@ static void init_variables(const struct my_option *options,
...
@@ -1234,6 +1253,7 @@ static void init_variables(const struct my_option *options,
static
uint
print_name
(
const
struct
my_option
*
optp
)
static
uint
print_name
(
const
struct
my_option
*
optp
)
{
{
const
char
*
s
=
optp
->
name
;
const
char
*
s
=
optp
->
name
;
for
(;
*
s
;
s
++
)
for
(;
*
s
;
s
++
)
putchar
(
*
s
==
'_'
?
'-'
:
*
s
);
putchar
(
*
s
==
'_'
?
'-'
:
*
s
);
return
s
-
optp
->
name
;
return
s
-
optp
->
name
;
...
@@ -1250,6 +1270,7 @@ void my_print_help(const struct my_option *options)
...
@@ -1250,6 +1270,7 @@ void my_print_help(const struct my_option *options)
uint
col
,
name_space
=
22
,
comment_space
=
57
;
uint
col
,
name_space
=
22
,
comment_space
=
57
;
const
char
*
line_end
;
const
char
*
line_end
;
const
struct
my_option
*
optp
;
const
struct
my_option
*
optp
;
DBUG_ENTER
(
"my_print_help"
);
for
(
optp
=
options
;
optp
->
name
;
optp
++
)
for
(
optp
=
options
;
optp
->
name
;
optp
++
)
{
{
...
@@ -1324,6 +1345,7 @@ void my_print_help(const struct my_option *options)
...
@@ -1324,6 +1345,7 @@ void my_print_help(const struct my_option *options)
}
}
}
}
}
}
DBUG_VOID_RETURN
;
}
}
...
@@ -1339,6 +1361,7 @@ void my_print_variables(const struct my_option *options)
...
@@ -1339,6 +1361,7 @@ void my_print_variables(const struct my_option *options)
ulonglong
llvalue
;
ulonglong
llvalue
;
char
buff
[
255
];
char
buff
[
255
];
const
struct
my_option
*
optp
;
const
struct
my_option
*
optp
;
DBUG_ENTER
(
"my_print_variables"
);
for
(
optp
=
options
;
optp
->
name
;
optp
++
)
for
(
optp
=
options
;
optp
->
name
;
optp
++
)
{
{
...
@@ -1425,4 +1448,5 @@ void my_print_variables(const struct my_option *options)
...
@@ -1425,4 +1448,5 @@ void my_print_variables(const struct my_option *options)
}
}
}
}
}
}
DBUG_VOID_RETURN
;
}
}
mysys/my_malloc.c
View file @
e44fefc7
...
@@ -115,9 +115,11 @@ void my_free(void *ptr)
...
@@ -115,9 +115,11 @@ void my_free(void *ptr)
void
*
my_memdup
(
const
void
*
from
,
size_t
length
,
myf
my_flags
)
void
*
my_memdup
(
const
void
*
from
,
size_t
length
,
myf
my_flags
)
{
{
void
*
ptr
;
void
*
ptr
;
DBUG_ENTER
(
"my_memdup"
);
if
((
ptr
=
my_malloc
(
length
,
my_flags
))
!=
0
)
if
((
ptr
=
my_malloc
(
length
,
my_flags
))
!=
0
)
memcpy
(
ptr
,
from
,
length
);
memcpy
(
ptr
,
from
,
length
);
return
ptr
;
DBUG_RETURN
(
ptr
)
;
}
}
...
@@ -125,20 +127,24 @@ char *my_strdup(const char *from, myf my_flags)
...
@@ -125,20 +127,24 @@ char *my_strdup(const char *from, myf my_flags)
{
{
char
*
ptr
;
char
*
ptr
;
size_t
length
=
strlen
(
from
)
+
1
;
size_t
length
=
strlen
(
from
)
+
1
;
DBUG_ENTER
(
"my_strdup"
);
if
((
ptr
=
(
char
*
)
my_malloc
(
length
,
my_flags
)))
if
((
ptr
=
(
char
*
)
my_malloc
(
length
,
my_flags
)))
memcpy
(
ptr
,
from
,
length
);
memcpy
(
ptr
,
from
,
length
);
return
ptr
;
DBUG_RETURN
(
ptr
)
;
}
}
char
*
my_strndup
(
const
char
*
from
,
size_t
length
,
myf
my_flags
)
char
*
my_strndup
(
const
char
*
from
,
size_t
length
,
myf
my_flags
)
{
{
char
*
ptr
;
char
*
ptr
;
DBUG_ENTER
(
"my_strndup"
);
if
((
ptr
=
(
char
*
)
my_malloc
(
length
+
1
,
my_flags
)))
if
((
ptr
=
(
char
*
)
my_malloc
(
length
+
1
,
my_flags
)))
{
{
memcpy
(
ptr
,
from
,
length
);
memcpy
(
ptr
,
from
,
length
);
ptr
[
length
]
=
0
;
ptr
[
length
]
=
0
;
}
}
return
ptr
;
DBUG_RETURN
(
ptr
)
;
}
}
mysys/my_open.c
View file @
e44fefc7
...
@@ -49,8 +49,9 @@ File my_open(const char *FileName, int Flags, myf MyFlags)
...
@@ -49,8 +49,9 @@ File my_open(const char *FileName, int Flags, myf MyFlags)
fd
=
open
((
char
*
)
FileName
,
Flags
);
fd
=
open
((
char
*
)
FileName
,
Flags
);
#endif
#endif
DBUG_RETURN
(
my_register_filename
(
fd
,
FileName
,
FILE_BY_OPEN
,
fd
=
my_register_filename
(
fd
,
FileName
,
FILE_BY_OPEN
,
EE_FILENOTFOUND
,
MyFlags
));
EE_FILENOTFOUND
,
MyFlags
);
DBUG_RETURN
(
fd
);
}
/* my_open */
}
/* my_open */
...
...
mysys/string.c
View file @
e44fefc7
...
@@ -98,20 +98,21 @@ my_bool dynstr_append_mem(DYNAMIC_STRING *str, const char *append,
...
@@ -98,20 +98,21 @@ my_bool dynstr_append_mem(DYNAMIC_STRING *str, const char *append,
size_t
length
)
size_t
length
)
{
{
char
*
new_ptr
;
char
*
new_ptr
;
DBUG_ENTER
(
"dynstr_append_mem"
);
if
(
str
->
length
+
length
>=
str
->
max_length
)
if
(
str
->
length
+
length
>=
str
->
max_length
)
{
{
size_t
new_length
=
(
str
->
length
+
length
+
str
->
alloc_increment
)
/
size_t
new_length
=
(
str
->
length
+
length
+
str
->
alloc_increment
)
/
str
->
alloc_increment
;
str
->
alloc_increment
;
new_length
*=
str
->
alloc_increment
;
new_length
*=
str
->
alloc_increment
;
if
(
!
(
new_ptr
=
(
char
*
)
my_realloc
(
str
->
str
,
new_length
,
MYF
(
MY_WME
))))
if
(
!
(
new_ptr
=
(
char
*
)
my_realloc
(
str
->
str
,
new_length
,
MYF
(
MY_WME
))))
return
TRUE
;
DBUG_RETURN
(
TRUE
)
;
str
->
str
=
new_ptr
;
str
->
str
=
new_ptr
;
str
->
max_length
=
new_length
;
str
->
max_length
=
new_length
;
}
}
memcpy
(
str
->
str
+
str
->
length
,
append
,
length
);
memcpy
(
str
->
str
+
str
->
length
,
append
,
length
);
str
->
length
+=
length
;
str
->
length
+=
length
;
str
->
str
[
str
->
length
]
=
0
;
/* Safety for C programs */
str
->
str
[
str
->
length
]
=
0
;
/* Safety for C programs */
return
FALSE
;
DBUG_RETURN
(
FALSE
)
;
}
}
...
...
sql-common/client.c
View file @
e44fefc7
...
@@ -4050,7 +4050,7 @@ mysql_fetch_lengths(MYSQL_RES *res)
...
@@ -4050,7 +4050,7 @@ mysql_fetch_lengths(MYSQL_RES *res)
int
STDCALL
int
STDCALL
mysql_options
(
MYSQL
*
mysql
,
enum
mysql_option
option
,
const
void
*
arg
)
mysql_options
(
MYSQL
*
mysql
,
enum
mysql_option
option
,
const
void
*
arg
)
{
{
DBUG_ENTER
(
"mysql_option"
);
DBUG_ENTER
(
"mysql_option
s
"
);
DBUG_PRINT
(
"enter"
,(
"option: %d"
,(
int
)
option
));
DBUG_PRINT
(
"enter"
,(
"option: %d"
,(
int
)
option
));
switch
(
option
)
{
switch
(
option
)
{
case
MYSQL_OPT_CONNECT_TIMEOUT
:
case
MYSQL_OPT_CONNECT_TIMEOUT
:
...
...
sql-common/client_plugin.c
View file @
e44fefc7
...
@@ -68,13 +68,15 @@ static pthread_mutex_t LOCK_load_client_plugin;
...
@@ -68,13 +68,15 @@ static pthread_mutex_t LOCK_load_client_plugin;
static
int
is_not_initialized
(
MYSQL
*
mysql
,
const
char
*
name
)
static
int
is_not_initialized
(
MYSQL
*
mysql
,
const
char
*
name
)
{
{
DBUG_ENTER
(
"is_not_initialized"
);
if
(
initialized
)
if
(
initialized
)
return
0
;
DBUG_RETURN
(
0
)
;
set_mysql_extended_error
(
mysql
,
CR_AUTH_PLUGIN_CANNOT_LOAD
,
set_mysql_extended_error
(
mysql
,
CR_AUTH_PLUGIN_CANNOT_LOAD
,
unknown_sqlstate
,
ER
(
CR_AUTH_PLUGIN_CANNOT_LOAD
),
unknown_sqlstate
,
ER
(
CR_AUTH_PLUGIN_CANNOT_LOAD
),
name
,
"not initialized"
);
name
,
"not initialized"
);
return
1
;
DBUG_RETURN
(
1
)
;
}
}
/**
/**
...
@@ -91,18 +93,19 @@ static struct st_mysql_client_plugin *
...
@@ -91,18 +93,19 @@ static struct st_mysql_client_plugin *
find_plugin
(
const
char
*
name
,
int
type
)
find_plugin
(
const
char
*
name
,
int
type
)
{
{
struct
st_client_plugin_int
*
p
;
struct
st_client_plugin_int
*
p
;
DBUG_ENTER
(
"find_plugin"
);
DBUG_ASSERT
(
initialized
);
DBUG_ASSERT
(
initialized
);
DBUG_ASSERT
(
type
>=
0
&&
type
<
MYSQL_CLIENT_MAX_PLUGINS
);
DBUG_ASSERT
(
type
>=
0
&&
type
<
MYSQL_CLIENT_MAX_PLUGINS
);
if
(
type
<
0
||
type
>=
MYSQL_CLIENT_MAX_PLUGINS
)
if
(
type
<
0
||
type
>=
MYSQL_CLIENT_MAX_PLUGINS
)
return
0
;
DBUG_RETURN
(
0
)
;
for
(
p
=
plugin_list
[
type
];
p
;
p
=
p
->
next
)
for
(
p
=
plugin_list
[
type
];
p
;
p
=
p
->
next
)
{
{
if
(
strcmp
(
p
->
plugin
->
name
,
name
)
==
0
)
if
(
strcmp
(
p
->
plugin
->
name
,
name
)
==
0
)
return
p
->
plugin
;
DBUG_RETURN
(
p
->
plugin
)
;
}
}
return
NULL
;
DBUG_RETURN
(
NULL
)
;
}
}
/**
/**
...
@@ -124,6 +127,7 @@ add_plugin(MYSQL *mysql, struct st_mysql_client_plugin *plugin, void *dlhandle,
...
@@ -124,6 +127,7 @@ add_plugin(MYSQL *mysql, struct st_mysql_client_plugin *plugin, void *dlhandle,
const
char
*
errmsg
;
const
char
*
errmsg
;
struct
st_client_plugin_int
plugin_int
,
*
p
;
struct
st_client_plugin_int
plugin_int
,
*
p
;
char
errbuf
[
1024
];
char
errbuf
[
1024
];
DBUG_ENTER
(
"add_plugin"
);
DBUG_ASSERT
(
initialized
);
DBUG_ASSERT
(
initialized
);
...
@@ -166,7 +170,7 @@ add_plugin(MYSQL *mysql, struct st_mysql_client_plugin *plugin, void *dlhandle,
...
@@ -166,7 +170,7 @@ add_plugin(MYSQL *mysql, struct st_mysql_client_plugin *plugin, void *dlhandle,
plugin_list
[
plugin
->
type
]
=
p
;
plugin_list
[
plugin
->
type
]
=
p
;
net_clear_error
(
&
mysql
->
net
);
net_clear_error
(
&
mysql
->
net
);
return
plugin
;
DBUG_RETURN
(
plugin
)
;
err2:
err2:
if
(
plugin
->
deinit
)
if
(
plugin
->
deinit
)
...
@@ -177,7 +181,7 @@ err1:
...
@@ -177,7 +181,7 @@ err1:
errmsg
);
errmsg
);
if
(
dlhandle
)
if
(
dlhandle
)
dlclose
(
dlhandle
);
dlclose
(
dlhandle
);
return
NULL
;
DBUG_RETURN
(
NULL
)
;
}
}
/**
/**
...
@@ -198,10 +202,11 @@ err1:
...
@@ -198,10 +202,11 @@ err1:
static
void
load_env_plugins
(
MYSQL
*
mysql
)
static
void
load_env_plugins
(
MYSQL
*
mysql
)
{
{
char
*
plugs
,
*
free_env
,
*
s
=
getenv
(
"LIBMYSQL_PLUGINS"
);
char
*
plugs
,
*
free_env
,
*
s
=
getenv
(
"LIBMYSQL_PLUGINS"
);
DBUG_ENTER
(
"load_env_plugins"
);
/* no plugins to load */
/* no plugins to load */
if
(
!
s
)
if
(
!
s
)
return
;
DBUG_VOID_RETURN
;
free_env
=
plugs
=
my_strdup
(
s
,
MYF
(
MY_WME
));
free_env
=
plugs
=
my_strdup
(
s
,
MYF
(
MY_WME
));
...
@@ -213,6 +218,7 @@ static void load_env_plugins(MYSQL *mysql)
...
@@ -213,6 +218,7 @@ static void load_env_plugins(MYSQL *mysql)
}
while
(
s
);
}
while
(
s
);
my_free
(
free_env
);
my_free
(
free_env
);
DBUG_VOID_RETURN
;
}
}
/********** extern functions to be used by libmysql *********************/
/********** extern functions to be used by libmysql *********************/
...
@@ -229,9 +235,10 @@ int mysql_client_plugin_init()
...
@@ -229,9 +235,10 @@ int mysql_client_plugin_init()
{
{
MYSQL
mysql
;
MYSQL
mysql
;
struct
st_mysql_client_plugin
**
builtin
;
struct
st_mysql_client_plugin
**
builtin
;
DBUG_ENTER
(
"mysql_client_plugin_init"
);
if
(
initialized
)
if
(
initialized
)
return
0
;
DBUG_RETURN
(
0
)
;
bzero
(
&
mysql
,
sizeof
(
mysql
));
/* dummy mysql for set_mysql_extended_error */
bzero
(
&
mysql
,
sizeof
(
mysql
));
/* dummy mysql for set_mysql_extended_error */
...
@@ -251,7 +258,7 @@ int mysql_client_plugin_init()
...
@@ -251,7 +258,7 @@ int mysql_client_plugin_init()
load_env_plugins
(
&
mysql
);
load_env_plugins
(
&
mysql
);
return
0
;
DBUG_RETURN
(
0
)
;
}
}
/**
/**
...
@@ -263,9 +270,10 @@ void mysql_client_plugin_deinit()
...
@@ -263,9 +270,10 @@ void mysql_client_plugin_deinit()
{
{
int
i
;
int
i
;
struct
st_client_plugin_int
*
p
;
struct
st_client_plugin_int
*
p
;
DBUG_ENTER
(
"mysql_client_plugin_deinit"
);
if
(
!
initialized
)
if
(
!
initialized
)
return
;
DBUG_VOID_RETURN
;
for
(
i
=
0
;
i
<
MYSQL_CLIENT_MAX_PLUGINS
;
i
++
)
for
(
i
=
0
;
i
<
MYSQL_CLIENT_MAX_PLUGINS
;
i
++
)
for
(
p
=
plugin_list
[
i
];
p
;
p
=
p
->
next
)
for
(
p
=
plugin_list
[
i
];
p
;
p
=
p
->
next
)
...
@@ -280,6 +288,7 @@ void mysql_client_plugin_deinit()
...
@@ -280,6 +288,7 @@ void mysql_client_plugin_deinit()
initialized
=
0
;
initialized
=
0
;
free_root
(
&
mem_root
,
MYF
(
0
));
free_root
(
&
mem_root
,
MYF
(
0
));
pthread_mutex_destroy
(
&
LOCK_load_client_plugin
);
pthread_mutex_destroy
(
&
LOCK_load_client_plugin
);
DBUG_VOID_RETURN
;
}
}
/************* public facing functions, for client consumption *********/
/************* public facing functions, for client consumption *********/
...
@@ -289,8 +298,10 @@ struct st_mysql_client_plugin *
...
@@ -289,8 +298,10 @@ struct st_mysql_client_plugin *
mysql_client_register_plugin
(
MYSQL
*
mysql
,
mysql_client_register_plugin
(
MYSQL
*
mysql
,
struct
st_mysql_client_plugin
*
plugin
)
struct
st_mysql_client_plugin
*
plugin
)
{
{
DBUG_ENTER
(
"mysql_client_register_plugin"
);
if
(
is_not_initialized
(
mysql
,
plugin
->
name
))
if
(
is_not_initialized
(
mysql
,
plugin
->
name
))
return
NULL
;
DBUG_RETURN
(
NULL
)
;
pthread_mutex_lock
(
&
LOCK_load_client_plugin
);
pthread_mutex_lock
(
&
LOCK_load_client_plugin
);
...
@@ -306,7 +317,7 @@ mysql_client_register_plugin(MYSQL *mysql,
...
@@ -306,7 +317,7 @@ mysql_client_register_plugin(MYSQL *mysql,
plugin
=
add_plugin
(
mysql
,
plugin
,
0
,
0
,
0
);
plugin
=
add_plugin
(
mysql
,
plugin
,
0
,
0
,
0
);
pthread_mutex_unlock
(
&
LOCK_load_client_plugin
);
pthread_mutex_unlock
(
&
LOCK_load_client_plugin
);
return
plugin
;
DBUG_RETURN
(
plugin
)
;
}
}
/* see <mysql/client_plugin.h> for a full description */
/* see <mysql/client_plugin.h> for a full description */
...
@@ -318,8 +329,8 @@ mysql_load_plugin_v(MYSQL *mysql, const char *name, int type,
...
@@ -318,8 +329,8 @@ mysql_load_plugin_v(MYSQL *mysql, const char *name, int type,
char
dlpath
[
FN_REFLEN
+
1
];
char
dlpath
[
FN_REFLEN
+
1
];
void
*
sym
,
*
dlhandle
;
void
*
sym
,
*
dlhandle
;
struct
st_mysql_client_plugin
*
plugin
;
struct
st_mysql_client_plugin
*
plugin
;
DBUG_ENTER
(
"mysql_load_plugin_v"
);
DBUG_ENTER
(
"mysql_load_plugin_v"
);
DBUG_PRINT
(
"entry"
,
(
"name=%s type=%d int argc=%d"
,
name
,
type
,
argc
));
DBUG_PRINT
(
"entry"
,
(
"name=%s type=%d int argc=%d"
,
name
,
type
,
argc
));
if
(
is_not_initialized
(
mysql
,
name
))
if
(
is_not_initialized
(
mysql
,
name
))
{
{
...
@@ -399,10 +410,12 @@ mysql_load_plugin(MYSQL *mysql, const char *name, int type, int argc, ...)
...
@@ -399,10 +410,12 @@ mysql_load_plugin(MYSQL *mysql, const char *name, int type, int argc, ...)
{
{
struct
st_mysql_client_plugin
*
p
;
struct
st_mysql_client_plugin
*
p
;
va_list
args
;
va_list
args
;
DBUG_ENTER
(
"mysql_load_plugin"
);
va_start
(
args
,
argc
);
va_start
(
args
,
argc
);
p
=
mysql_load_plugin_v
(
mysql
,
name
,
type
,
argc
,
args
);
p
=
mysql_load_plugin_v
(
mysql
,
name
,
type
,
argc
,
args
);
va_end
(
args
);
va_end
(
args
);
return
p
;
DBUG_RETURN
(
p
)
;
}
}
/* see <mysql/client_plugin.h> for a full description */
/* see <mysql/client_plugin.h> for a full description */
...
@@ -410,8 +423,8 @@ struct st_mysql_client_plugin *
...
@@ -410,8 +423,8 @@ struct st_mysql_client_plugin *
mysql_client_find_plugin
(
MYSQL
*
mysql
,
const
char
*
name
,
int
type
)
mysql_client_find_plugin
(
MYSQL
*
mysql
,
const
char
*
name
,
int
type
)
{
{
struct
st_mysql_client_plugin
*
p
;
struct
st_mysql_client_plugin
*
p
;
DBUG_ENTER
(
"mysql_client_find_plugin"
);
DBUG_ENTER
(
"mysql_client_find_plugin"
);
DBUG_PRINT
(
"entry"
,
(
"name=%s, type=%d"
,
name
,
type
));
DBUG_PRINT
(
"entry"
,
(
"name=%s, type=%d"
,
name
,
type
));
if
(
is_not_initialized
(
mysql
,
name
))
if
(
is_not_initialized
(
mysql
,
name
))
DBUG_RETURN
(
NULL
);
DBUG_RETURN
(
NULL
);
...
...
sql/handler.h
View file @
e44fefc7
...
@@ -1715,13 +1715,17 @@ public:
...
@@ -1715,13 +1715,17 @@ public:
int
ha_repair
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
);
int
ha_repair
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
);
void
ha_start_bulk_insert
(
ha_rows
rows
)
void
ha_start_bulk_insert
(
ha_rows
rows
)
{
{
DBUG_ENTER
(
"handler::ha_start_bulk_insert"
);
estimation_rows_to_insert
=
rows
;
estimation_rows_to_insert
=
rows
;
start_bulk_insert
(
rows
);
start_bulk_insert
(
rows
);
DBUG_VOID_RETURN
;
}
}
int
ha_end_bulk_insert
()
int
ha_end_bulk_insert
()
{
{
DBUG_ENTER
(
"handler::ha_end_bulk_insert"
);
estimation_rows_to_insert
=
0
;
estimation_rows_to_insert
=
0
;
return
end_bulk_insert
();
int
ret
=
end_bulk_insert
();
DBUG_RETURN
(
ret
);
}
}
int
ha_bulk_update_row
(
const
uchar
*
old_data
,
uchar
*
new_data
,
int
ha_bulk_update_row
(
const
uchar
*
old_data
,
uchar
*
new_data
,
uint
*
dup_key_found
);
uint
*
dup_key_found
);
...
...
sql/log.cc
View file @
e44fefc7
...
@@ -3827,8 +3827,7 @@ int MYSQL_BIN_LOG::close_purge_index_file()
...
@@ -3827,8 +3827,7 @@ int MYSQL_BIN_LOG::close_purge_index_file()
bool
MYSQL_BIN_LOG
::
is_inited_purge_index_file
()
bool
MYSQL_BIN_LOG
::
is_inited_purge_index_file
()
{
{
DBUG_ENTER
(
"MYSQL_BIN_LOG::is_inited_purge_index_file"
);
return
my_b_inited
(
&
purge_index_file
);
DBUG_RETURN
(
my_b_inited
(
&
purge_index_file
));
}
}
int
MYSQL_BIN_LOG
::
sync_purge_index_file
()
int
MYSQL_BIN_LOG
::
sync_purge_index_file
()
...
@@ -3864,13 +3863,12 @@ int MYSQL_BIN_LOG::register_create_index_entry(const char *entry)
...
@@ -3864,13 +3863,12 @@ int MYSQL_BIN_LOG::register_create_index_entry(const char *entry)
int
MYSQL_BIN_LOG
::
purge_index_entry
(
THD
*
thd
,
ulonglong
*
decrease_log_space
,
int
MYSQL_BIN_LOG
::
purge_index_entry
(
THD
*
thd
,
ulonglong
*
decrease_log_space
,
bool
need_mutex
)
bool
need_mutex
)
{
{
DBUG_ENTER
(
"MYSQL_BIN_LOG:purge_index_entry"
);
MY_STAT
s
;
MY_STAT
s
;
int
error
=
0
;
int
error
=
0
;
LOG_INFO
log_info
;
LOG_INFO
log_info
;
LOG_INFO
check_log_info
;
LOG_INFO
check_log_info
;
DBUG_ENTER
(
"MYSQL_BIN_LOG:purge_index_entry"
);
DBUG_ASSERT
(
my_b_inited
(
&
purge_index_file
));
DBUG_ASSERT
(
my_b_inited
(
&
purge_index_file
));
if
((
error
=
reinit_io_cache
(
&
purge_index_file
,
READ_CACHE
,
0
,
0
,
0
)))
if
((
error
=
reinit_io_cache
(
&
purge_index_file
,
READ_CACHE
,
0
,
0
,
0
)))
...
...
sql/log.h
View file @
e44fefc7
...
@@ -158,14 +158,20 @@ typedef struct st_log_info
...
@@ -158,14 +158,20 @@ typedef struct st_log_info
my_off_t
pos
;
my_off_t
pos
;
bool
fatal
;
// if the purge happens to give us a negative offset
bool
fatal
;
// if the purge happens to give us a negative offset
mysql_mutex_t
lock
;
mysql_mutex_t
lock
;
st_log_info
()
st_log_info
()
:
index_file_offset
(
0
),
index_file_start_offset
(
0
),
:
index_file_offset
(
0
),
index_file_start_offset
(
0
),
pos
(
0
),
fatal
(
0
)
pos
(
0
),
fatal
(
0
)
{
{
DBUG_ENTER
(
"LOG_INFO"
);
log_file_name
[
0
]
=
'\0'
;
log_file_name
[
0
]
=
'\0'
;
mysql_mutex_init
(
key_LOG_INFO_lock
,
&
lock
,
MY_MUTEX_INIT_FAST
);
mysql_mutex_init
(
key_LOG_INFO_lock
,
&
lock
,
MY_MUTEX_INIT_FAST
);
DBUG_VOID_RETURN
;
}
~
st_log_info
()
{
DBUG_ENTER
(
"~LOG_INFO"
);
mysql_mutex_destroy
(
&
lock
);
DBUG_VOID_RETURN
;
}
}
~
st_log_info
()
{
mysql_mutex_destroy
(
&
lock
);}
}
LOG_INFO
;
}
LOG_INFO
;
/*
/*
...
...
sql/rpl_tblmap.cc
View file @
e44fefc7
...
@@ -34,6 +34,7 @@
...
@@ -34,6 +34,7 @@
table_mapping
::
table_mapping
()
table_mapping
::
table_mapping
()
:
m_free
(
0
)
:
m_free
(
0
)
{
{
DBUG_ENTER
(
"table_mapping::table_mapping"
);
/*
/*
No "free_element" function for entries passed here, as the entries are
No "free_element" function for entries passed here, as the entries are
allocated in a MEM_ROOT (freed as a whole in the destructor), they cannot
allocated in a MEM_ROOT (freed as a whole in the destructor), they cannot
...
@@ -46,6 +47,7 @@ table_mapping::table_mapping()
...
@@ -46,6 +47,7 @@ table_mapping::table_mapping()
0
,
0
,
0
);
0
,
0
,
0
);
/* We don't preallocate any block, this is consistent with m_free=0 above */
/* We don't preallocate any block, this is consistent with m_free=0 above */
init_alloc_root
(
&
m_mem_root
,
TABLE_ID_HASH_SIZE
*
sizeof
(
entry
),
0
);
init_alloc_root
(
&
m_mem_root
,
TABLE_ID_HASH_SIZE
*
sizeof
(
entry
),
0
);
DBUG_VOID_RETURN
;
}
}
table_mapping
::~
table_mapping
()
table_mapping
::~
table_mapping
()
...
...
sql/sql_class.cc
View file @
e44fefc7
...
@@ -1723,6 +1723,7 @@ void THD::reset_globals()
...
@@ -1723,6 +1723,7 @@ void THD::reset_globals()
void
THD
::
cleanup_after_query
()
void
THD
::
cleanup_after_query
()
{
{
DBUG_ENTER
(
"THD::cleanup_after_query"
);
/*
/*
Reset rand_used so that detection of calls to rand() will save random
Reset rand_used so that detection of calls to rand() will save random
seeds if needed by the slave.
seeds if needed by the slave.
...
@@ -1756,6 +1757,7 @@ void THD::cleanup_after_query()
...
@@ -1756,6 +1757,7 @@ void THD::cleanup_after_query()
/* reset table map for multi-table update */
/* reset table map for multi-table update */
table_map_for_update
=
0
;
table_map_for_update
=
0
;
m_binlog_invoker
=
FALSE
;
m_binlog_invoker
=
FALSE
;
DBUG_VOID_RETURN
;
}
}
...
@@ -3035,6 +3037,7 @@ void Statement::restore_backup_statement(Statement *stmt, Statement *backup)
...
@@ -3035,6 +3037,7 @@ void Statement::restore_backup_statement(Statement *stmt, Statement *backup)
void
THD
::
end_statement
()
void
THD
::
end_statement
()
{
{
DBUG_ENTER
(
"THD::end_statement"
);
/* Cleanup SQL processing state to reuse this statement in next query. */
/* Cleanup SQL processing state to reuse this statement in next query. */
lex_end
(
lex
);
lex_end
(
lex
);
delete
lex
->
result
;
delete
lex
->
result
;
...
@@ -3045,6 +3048,7 @@ void THD::end_statement()
...
@@ -3045,6 +3048,7 @@ void THD::end_statement()
Don't free mem_root, as mem_root is freed in the end of dispatch_command
Don't free mem_root, as mem_root is freed in the end of dispatch_command
(once for any command).
(once for any command).
*/
*/
DBUG_VOID_RETURN
;
}
}
...
...
sql/sql_lex.cc
View file @
e44fefc7
...
@@ -2811,6 +2811,7 @@ void st_select_lex_unit::set_limit(st_select_lex *sl)
...
@@ -2811,6 +2811,7 @@ void st_select_lex_unit::set_limit(st_select_lex *sl)
void
LEX
::
set_trg_event_type_for_tables
()
void
LEX
::
set_trg_event_type_for_tables
()
{
{
uint8
new_trg_event_map
=
0
;
uint8
new_trg_event_map
=
0
;
DBUG_ENTER
(
"LEX::set_trg_event_type_for_tables"
);
/*
/*
Some auxiliary operations
Some auxiliary operations
...
@@ -2930,6 +2931,7 @@ void LEX::set_trg_event_type_for_tables()
...
@@ -2930,6 +2931,7 @@ void LEX::set_trg_event_type_for_tables()
tables
->
trg_event_map
=
new_trg_event_map
;
tables
->
trg_event_map
=
new_trg_event_map
;
tables
=
tables
->
next_local
;
tables
=
tables
->
next_local
;
}
}
DBUG_VOID_RETURN
;
}
}
...
...
sql/sql_parse.cc
View file @
e44fefc7
...
@@ -7342,6 +7342,7 @@ bool parse_sql(THD *thd,
...
@@ -7342,6 +7342,7 @@ bool parse_sql(THD *thd,
Object_creation_ctx
*
creation_ctx
)
Object_creation_ctx
*
creation_ctx
)
{
{
bool
ret_value
;
bool
ret_value
;
DBUG_ENTER
(
"parse_sql"
);
DBUG_ASSERT
(
thd
->
m_parser_state
==
NULL
);
DBUG_ASSERT
(
thd
->
m_parser_state
==
NULL
);
DBUG_ASSERT
(
thd
->
lex
->
m_stmt
==
NULL
);
DBUG_ASSERT
(
thd
->
lex
->
m_stmt
==
NULL
);
...
@@ -7389,7 +7390,7 @@ bool parse_sql(THD *thd,
...
@@ -7389,7 +7390,7 @@ bool parse_sql(THD *thd,
ret_value
=
mysql_parse_status
||
thd
->
is_fatal_error
;
ret_value
=
mysql_parse_status
||
thd
->
is_fatal_error
;
MYSQL_QUERY_PARSE_DONE
(
ret_value
);
MYSQL_QUERY_PARSE_DONE
(
ret_value
);
return
ret_value
;
DBUG_RETURN
(
ret_value
)
;
}
}
/**
/**
...
...
sql/sql_plugin.cc
View file @
e44fefc7
...
@@ -1125,7 +1125,7 @@ static void plugin_deinitialize(struct st_plugin_int *plugin, bool ref_check)
...
@@ -1125,7 +1125,7 @@ static void plugin_deinitialize(struct st_plugin_int *plugin, bool ref_check)
static
void
plugin_del
(
struct
st_plugin_int
*
plugin
)
static
void
plugin_del
(
struct
st_plugin_int
*
plugin
)
{
{
DBUG_ENTER
(
"plugin_del
(plugin)
"
);
DBUG_ENTER
(
"plugin_del"
);
mysql_mutex_assert_owner
(
&
LOCK_plugin
);
mysql_mutex_assert_owner
(
&
LOCK_plugin
);
/* Free allocated strings before deleting the plugin. */
/* Free allocated strings before deleting the plugin. */
mysql_rwlock_wrlock
(
&
LOCK_system_variables_hash
);
mysql_rwlock_wrlock
(
&
LOCK_system_variables_hash
);
...
@@ -2703,11 +2703,12 @@ static void restore_pluginvar_names(sys_var *first)
...
@@ -2703,11 +2703,12 @@ static void restore_pluginvar_names(sys_var *first)
*/
*/
static
uchar
*
intern_sys_var_ptr
(
THD
*
thd
,
int
offset
,
bool
global_lock
)
static
uchar
*
intern_sys_var_ptr
(
THD
*
thd
,
int
offset
,
bool
global_lock
)
{
{
DBUG_ENTER
(
"intern_sys_var_ptr"
);
DBUG_ASSERT
(
offset
>=
0
);
DBUG_ASSERT
(
offset
>=
0
);
DBUG_ASSERT
((
uint
)
offset
<=
global_system_variables
.
dynamic_variables_head
);
DBUG_ASSERT
((
uint
)
offset
<=
global_system_variables
.
dynamic_variables_head
);
if
(
!
thd
)
if
(
!
thd
)
return
(
uchar
*
)
global_system_variables
.
dynamic_variables_ptr
+
offset
;
DBUG_RETURN
((
uchar
*
)
global_system_variables
.
dynamic_variables_ptr
+
offset
)
;
/*
/*
dynamic_variables_head points to the largest valid offset
dynamic_variables_head points to the largest valid offset
...
@@ -2779,7 +2780,7 @@ static uchar *intern_sys_var_ptr(THD* thd, int offset, bool global_lock)
...
@@ -2779,7 +2780,7 @@ static uchar *intern_sys_var_ptr(THD* thd, int offset, bool global_lock)
mysql_rwlock_unlock
(
&
LOCK_system_variables_hash
);
mysql_rwlock_unlock
(
&
LOCK_system_variables_hash
);
}
}
return
(
uchar
*
)
thd
->
variables
.
dynamic_variables_ptr
+
offset
;
DBUG_RETURN
((
uchar
*
)
thd
->
variables
.
dynamic_variables_ptr
+
offset
)
;
}
}
...
...
storage/myisam/ha_myisam.cc
View file @
e44fefc7
...
@@ -1339,6 +1339,7 @@ int ha_myisam::disable_indexes(uint mode)
...
@@ -1339,6 +1339,7 @@ int ha_myisam::disable_indexes(uint mode)
int
ha_myisam
::
enable_indexes
(
uint
mode
)
int
ha_myisam
::
enable_indexes
(
uint
mode
)
{
{
int
error
;
int
error
;
DBUG_ENTER
(
"ha_myisam::enable_indexes"
);
DBUG_EXECUTE_IF
(
"wait_in_enable_indexes"
,
DBUG_EXECUTE_IF
(
"wait_in_enable_indexes"
,
debug_wait_for_kill
(
"wait_in_enable_indexes"
);
);
debug_wait_for_kill
(
"wait_in_enable_indexes"
);
);
...
@@ -1346,7 +1347,7 @@ int ha_myisam::enable_indexes(uint mode)
...
@@ -1346,7 +1347,7 @@ int ha_myisam::enable_indexes(uint mode)
if
(
mi_is_all_keys_active
(
file
->
s
->
state
.
key_map
,
file
->
s
->
base
.
keys
))
if
(
mi_is_all_keys_active
(
file
->
s
->
state
.
key_map
,
file
->
s
->
base
.
keys
))
{
{
/* All indexes are enabled already. */
/* All indexes are enabled already. */
return
0
;
DBUG_RETURN
(
0
)
;
}
}
if
(
mode
==
HA_KEY_SWITCH_ALL
)
if
(
mode
==
HA_KEY_SWITCH_ALL
)
...
@@ -1365,7 +1366,7 @@ int ha_myisam::enable_indexes(uint mode)
...
@@ -1365,7 +1366,7 @@ int ha_myisam::enable_indexes(uint mode)
const
char
*
save_proc_info
=
thd
->
proc_info
;
const
char
*
save_proc_info
=
thd
->
proc_info
;
if
(
!&
param
)
if
(
!&
param
)
return
HA_ADMIN_INTERNAL_ERROR
;
DBUG_RETURN
(
HA_ADMIN_INTERNAL_ERROR
)
;
thd_proc_info
(
thd
,
"Creating index"
);
thd_proc_info
(
thd
,
"Creating index"
);
myisamchk_init
(
&
param
);
myisamchk_init
(
&
param
);
...
@@ -1407,7 +1408,7 @@ int ha_myisam::enable_indexes(uint mode)
...
@@ -1407,7 +1408,7 @@ int ha_myisam::enable_indexes(uint mode)
/* mode not implemented */
/* mode not implemented */
error
=
HA_ERR_WRONG_COMMAND
;
error
=
HA_ERR_WRONG_COMMAND
;
}
}
return
error
;
DBUG_RETURN
(
error
)
;
}
}
...
@@ -1500,6 +1501,7 @@ void ha_myisam::start_bulk_insert(ha_rows rows)
...
@@ -1500,6 +1501,7 @@ void ha_myisam::start_bulk_insert(ha_rows rows)
int
ha_myisam
::
end_bulk_insert
()
int
ha_myisam
::
end_bulk_insert
()
{
{
DBUG_ENTER
(
"ha_myisam::end_bulk_insert"
);
mi_end_bulk_insert
(
file
);
mi_end_bulk_insert
(
file
);
int
err
=
mi_extra
(
file
,
HA_EXTRA_NO_CACHE
,
0
);
int
err
=
mi_extra
(
file
,
HA_EXTRA_NO_CACHE
,
0
);
if
(
!
err
&&
!
file
->
s
->
deleting
)
if
(
!
err
&&
!
file
->
s
->
deleting
)
...
@@ -1522,7 +1524,7 @@ int ha_myisam::end_bulk_insert()
...
@@ -1522,7 +1524,7 @@ int ha_myisam::end_bulk_insert()
}
}
}
}
}
}
return
err
;
DBUG_RETURN
(
err
)
;
}
}
...
...
storage/perfschema/pfs_instr.cc
View file @
e44fefc7
...
@@ -148,6 +148,7 @@ int init_instruments(const PFS_global_param *param)
...
@@ -148,6 +148,7 @@ int init_instruments(const PFS_global_param *param)
{
{
uint
thread_history_sizing
;
uint
thread_history_sizing
;
uint
index
;
uint
index
;
DBUG_ENTER
(
"init_instruments"
);
mutex_max
=
param
->
m_mutex_sizing
;
mutex_max
=
param
->
m_mutex_sizing
;
mutex_lost
=
0
;
mutex_lost
=
0
;
...
@@ -194,49 +195,49 @@ int init_instruments(const PFS_global_param *param)
...
@@ -194,49 +195,49 @@ int init_instruments(const PFS_global_param *param)
{
{
mutex_array
=
PFS_MALLOC_ARRAY
(
mutex_max
,
PFS_mutex
,
MYF
(
MY_ZEROFILL
));
mutex_array
=
PFS_MALLOC_ARRAY
(
mutex_max
,
PFS_mutex
,
MYF
(
MY_ZEROFILL
));
if
(
unlikely
(
mutex_array
==
NULL
))
if
(
unlikely
(
mutex_array
==
NULL
))
return
1
;
DBUG_RETURN
(
1
)
;
}
}
if
(
rwlock_max
>
0
)
if
(
rwlock_max
>
0
)
{
{
rwlock_array
=
PFS_MALLOC_ARRAY
(
rwlock_max
,
PFS_rwlock
,
MYF
(
MY_ZEROFILL
));
rwlock_array
=
PFS_MALLOC_ARRAY
(
rwlock_max
,
PFS_rwlock
,
MYF
(
MY_ZEROFILL
));
if
(
unlikely
(
rwlock_array
==
NULL
))
if
(
unlikely
(
rwlock_array
==
NULL
))
return
1
;
DBUG_RETURN
(
1
)
;
}
}
if
(
cond_max
>
0
)
if
(
cond_max
>
0
)
{
{
cond_array
=
PFS_MALLOC_ARRAY
(
cond_max
,
PFS_cond
,
MYF
(
MY_ZEROFILL
));
cond_array
=
PFS_MALLOC_ARRAY
(
cond_max
,
PFS_cond
,
MYF
(
MY_ZEROFILL
));
if
(
unlikely
(
cond_array
==
NULL
))
if
(
unlikely
(
cond_array
==
NULL
))
return
1
;
DBUG_RETURN
(
1
)
;
}
}
if
(
file_max
>
0
)
if
(
file_max
>
0
)
{
{
file_array
=
PFS_MALLOC_ARRAY
(
file_max
,
PFS_file
,
MYF
(
MY_ZEROFILL
));
file_array
=
PFS_MALLOC_ARRAY
(
file_max
,
PFS_file
,
MYF
(
MY_ZEROFILL
));
if
(
unlikely
(
file_array
==
NULL
))
if
(
unlikely
(
file_array
==
NULL
))
return
1
;
DBUG_RETURN
(
1
)
;
}
}
if
(
file_handle_max
>
0
)
if
(
file_handle_max
>
0
)
{
{
file_handle_array
=
PFS_MALLOC_ARRAY
(
file_handle_max
,
PFS_file
*
,
MYF
(
MY_ZEROFILL
));
file_handle_array
=
PFS_MALLOC_ARRAY
(
file_handle_max
,
PFS_file
*
,
MYF
(
MY_ZEROFILL
));
if
(
unlikely
(
file_handle_array
==
NULL
))
if
(
unlikely
(
file_handle_array
==
NULL
))
return
1
;
DBUG_RETURN
(
1
)
;
}
}
if
(
table_max
>
0
)
if
(
table_max
>
0
)
{
{
table_array
=
PFS_MALLOC_ARRAY
(
table_max
,
PFS_table
,
MYF
(
MY_ZEROFILL
));
table_array
=
PFS_MALLOC_ARRAY
(
table_max
,
PFS_table
,
MYF
(
MY_ZEROFILL
));
if
(
unlikely
(
table_array
==
NULL
))
if
(
unlikely
(
table_array
==
NULL
))
return
1
;
DBUG_RETURN
(
1
)
;
}
}
if
(
thread_max
>
0
)
if
(
thread_max
>
0
)
{
{
thread_array
=
PFS_MALLOC_ARRAY
(
thread_max
,
PFS_thread
,
MYF
(
MY_ZEROFILL
));
thread_array
=
PFS_MALLOC_ARRAY
(
thread_max
,
PFS_thread
,
MYF
(
MY_ZEROFILL
));
if
(
unlikely
(
thread_array
==
NULL
))
if
(
unlikely
(
thread_array
==
NULL
))
return
1
;
DBUG_RETURN
(
1
)
;
}
}
if
(
thread_history_sizing
>
0
)
if
(
thread_history_sizing
>
0
)
...
@@ -245,7 +246,7 @@ int init_instruments(const PFS_global_param *param)
...
@@ -245,7 +246,7 @@ int init_instruments(const PFS_global_param *param)
PFS_MALLOC_ARRAY
(
thread_history_sizing
,
PFS_events_waits
,
PFS_MALLOC_ARRAY
(
thread_history_sizing
,
PFS_events_waits
,
MYF
(
MY_ZEROFILL
));
MYF
(
MY_ZEROFILL
));
if
(
unlikely
(
thread_history_array
==
NULL
))
if
(
unlikely
(
thread_history_array
==
NULL
))
return
1
;
DBUG_RETURN
(
1
)
;
}
}
if
(
thread_instr_class_waits_sizing
>
0
)
if
(
thread_instr_class_waits_sizing
>
0
)
...
@@ -254,7 +255,7 @@ int init_instruments(const PFS_global_param *param)
...
@@ -254,7 +255,7 @@ int init_instruments(const PFS_global_param *param)
PFS_MALLOC_ARRAY
(
thread_instr_class_waits_sizing
,
PFS_MALLOC_ARRAY
(
thread_instr_class_waits_sizing
,
PFS_single_stat_chain
,
MYF
(
MY_ZEROFILL
));
PFS_single_stat_chain
,
MYF
(
MY_ZEROFILL
));
if
(
unlikely
(
thread_instr_class_waits_array
==
NULL
))
if
(
unlikely
(
thread_instr_class_waits_array
==
NULL
))
return
1
;
DBUG_RETURN
(
1
)
;
}
}
for
(
index
=
0
;
index
<
thread_instr_class_waits_sizing
;
index
++
)
for
(
index
=
0
;
index
<
thread_instr_class_waits_sizing
;
index
++
)
...
@@ -277,7 +278,7 @@ int init_instruments(const PFS_global_param *param)
...
@@ -277,7 +278,7 @@ int init_instruments(const PFS_global_param *param)
&
thread_instr_class_waits_array
[
index
*
instr_class_per_thread
];
&
thread_instr_class_waits_array
[
index
*
instr_class_per_thread
];
}
}
return
0
;
DBUG_RETURN
(
0
)
;
}
}
/**
/**
...
@@ -292,6 +293,7 @@ find_per_thread_mutex_class_wait_stat(PFS_thread *thread,
...
@@ -292,6 +293,7 @@ find_per_thread_mutex_class_wait_stat(PFS_thread *thread,
{
{
PFS_single_stat_chain
*
stat
;
PFS_single_stat_chain
*
stat
;
uint
index
;
uint
index
;
DBUG_ENTER
(
"find_per_thread_mutex_class_wait_stat"
);
DBUG_ASSERT
(
thread
!=
NULL
);
DBUG_ASSERT
(
thread
!=
NULL
);
DBUG_ASSERT
(
klass
!=
NULL
);
DBUG_ASSERT
(
klass
!=
NULL
);
...
@@ -299,7 +301,7 @@ find_per_thread_mutex_class_wait_stat(PFS_thread *thread,
...
@@ -299,7 +301,7 @@ find_per_thread_mutex_class_wait_stat(PFS_thread *thread,
DBUG_ASSERT
(
index
<
mutex_class_max
);
DBUG_ASSERT
(
index
<
mutex_class_max
);
stat
=
&
(
thread
->
m_instr_class_wait_stats
[
index
]);
stat
=
&
(
thread
->
m_instr_class_wait_stats
[
index
]);
return
stat
;
DBUG_RETURN
(
stat
)
;
}
}
/**
/**
...
@@ -314,6 +316,7 @@ find_per_thread_rwlock_class_wait_stat(PFS_thread *thread,
...
@@ -314,6 +316,7 @@ find_per_thread_rwlock_class_wait_stat(PFS_thread *thread,
{
{
PFS_single_stat_chain
*
stat
;
PFS_single_stat_chain
*
stat
;
uint
index
;
uint
index
;
DBUG_ENTER
(
"find_per_thread_rwlock_class_wait_stat"
);
DBUG_ASSERT
(
thread
!=
NULL
);
DBUG_ASSERT
(
thread
!=
NULL
);
DBUG_ASSERT
(
klass
!=
NULL
);
DBUG_ASSERT
(
klass
!=
NULL
);
...
@@ -322,7 +325,7 @@ find_per_thread_rwlock_class_wait_stat(PFS_thread *thread,
...
@@ -322,7 +325,7 @@ find_per_thread_rwlock_class_wait_stat(PFS_thread *thread,
stat
=
&
(
thread
->
m_instr_class_wait_stats
stat
=
&
(
thread
->
m_instr_class_wait_stats
[
per_thread_rwlock_class_start
+
index
]);
[
per_thread_rwlock_class_start
+
index
]);
return
stat
;
DBUG_RETURN
(
stat
)
;
}
}
/**
/**
...
@@ -337,6 +340,7 @@ find_per_thread_cond_class_wait_stat(PFS_thread *thread,
...
@@ -337,6 +340,7 @@ find_per_thread_cond_class_wait_stat(PFS_thread *thread,
{
{
PFS_single_stat_chain
*
stat
;
PFS_single_stat_chain
*
stat
;
uint
index
;
uint
index
;
DBUG_ENTER
(
"find_per_thread_cond_class_wait_stat"
);
DBUG_ASSERT
(
thread
!=
NULL
);
DBUG_ASSERT
(
thread
!=
NULL
);
DBUG_ASSERT
(
klass
!=
NULL
);
DBUG_ASSERT
(
klass
!=
NULL
);
...
@@ -345,7 +349,7 @@ find_per_thread_cond_class_wait_stat(PFS_thread *thread,
...
@@ -345,7 +349,7 @@ find_per_thread_cond_class_wait_stat(PFS_thread *thread,
stat
=
&
(
thread
->
m_instr_class_wait_stats
stat
=
&
(
thread
->
m_instr_class_wait_stats
[
per_thread_cond_class_start
+
index
]);
[
per_thread_cond_class_start
+
index
]);
return
stat
;
DBUG_RETURN
(
stat
)
;
}
}
/**
/**
...
@@ -360,6 +364,7 @@ find_per_thread_file_class_wait_stat(PFS_thread *thread,
...
@@ -360,6 +364,7 @@ find_per_thread_file_class_wait_stat(PFS_thread *thread,
{
{
PFS_single_stat_chain
*
stat
;
PFS_single_stat_chain
*
stat
;
uint
index
;
uint
index
;
DBUG_ENTER
(
"find_per_thread_file_class_wait_stat"
);
DBUG_ASSERT
(
thread
!=
NULL
);
DBUG_ASSERT
(
thread
!=
NULL
);
DBUG_ASSERT
(
klass
!=
NULL
);
DBUG_ASSERT
(
klass
!=
NULL
);
...
@@ -368,7 +373,7 @@ find_per_thread_file_class_wait_stat(PFS_thread *thread,
...
@@ -368,7 +373,7 @@ find_per_thread_file_class_wait_stat(PFS_thread *thread,
stat
=
&
(
thread
->
m_instr_class_wait_stats
stat
=
&
(
thread
->
m_instr_class_wait_stats
[
per_thread_file_class_start
+
index
]);
[
per_thread_file_class_start
+
index
]);
return
stat
;
DBUG_RETURN
(
stat
)
;
}
}
/** Reset the wait statistics per thread. */
/** Reset the wait statistics per thread. */
...
@@ -376,14 +381,18 @@ void reset_per_thread_wait_stat(void)
...
@@ -376,14 +381,18 @@ void reset_per_thread_wait_stat(void)
{
{
PFS_single_stat_chain
*
stat
=
thread_instr_class_waits_array
;
PFS_single_stat_chain
*
stat
=
thread_instr_class_waits_array
;
PFS_single_stat_chain
*
stat_last
=
stat
+
thread_instr_class_waits_sizing
;
PFS_single_stat_chain
*
stat_last
=
stat
+
thread_instr_class_waits_sizing
;
DBUG_ENTER
(
"reset_per_thread_wait_stat"
);
for
(
;
stat
<
stat_last
;
stat
++
)
for
(
;
stat
<
stat_last
;
stat
++
)
reset_single_stat_link
(
stat
);
reset_single_stat_link
(
stat
);
DBUG_VOID_RETURN
;
}
}
/** Cleanup all the instruments buffers. */
/** Cleanup all the instruments buffers. */
void
cleanup_instruments
(
void
)
void
cleanup_instruments
(
void
)
{
{
DBUG_ENTER
(
"cleanup_instruments"
);
pfs_free
(
mutex_array
);
pfs_free
(
mutex_array
);
mutex_array
=
NULL
;
mutex_array
=
NULL
;
mutex_max
=
0
;
mutex_max
=
0
;
...
@@ -409,6 +418,7 @@ void cleanup_instruments(void)
...
@@ -409,6 +418,7 @@ void cleanup_instruments(void)
thread_history_array
=
NULL
;
thread_history_array
=
NULL
;
pfs_free
(
thread_instr_class_waits_array
);
pfs_free
(
thread_instr_class_waits_array
);
thread_instr_class_waits_array
=
NULL
;
thread_instr_class_waits_array
=
NULL
;
DBUG_VOID_RETURN
;
}
}
extern
"C"
extern
"C"
...
@@ -419,13 +429,15 @@ static uchar *filename_hash_get_key(const uchar *entry, size_t *length,
...
@@ -419,13 +429,15 @@ static uchar *filename_hash_get_key(const uchar *entry, size_t *length,
const
PFS_file
*
const
*
typed_entry
;
const
PFS_file
*
const
*
typed_entry
;
const
PFS_file
*
file
;
const
PFS_file
*
file
;
const
void
*
result
;
const
void
*
result
;
DBUG_ENTER
(
"filename_hash_get_key"
);
typed_entry
=
reinterpret_cast
<
const
PFS_file
*
const
*>
(
entry
);
typed_entry
=
reinterpret_cast
<
const
PFS_file
*
const
*>
(
entry
);
DBUG_ASSERT
(
typed_entry
!=
NULL
);
DBUG_ASSERT
(
typed_entry
!=
NULL
);
file
=
*
typed_entry
;
file
=
*
typed_entry
;
DBUG_ASSERT
(
file
!=
NULL
);
DBUG_ASSERT
(
file
!=
NULL
);
*
length
=
file
->
m_filename_length
;
*
length
=
file
->
m_filename_length
;
result
=
file
->
m_filename
;
result
=
file
->
m_filename
;
return
const_cast
<
uchar
*>
(
reinterpret_cast
<
const
uchar
*>
(
result
));
DBUG_RETURN
(
const_cast
<
uchar
*>
(
reinterpret_cast
<
const
uchar
*>
(
result
)
));
}
}
}
}
...
@@ -435,34 +447,41 @@ static uchar *filename_hash_get_key(const uchar *entry, size_t *length,
...
@@ -435,34 +447,41 @@ static uchar *filename_hash_get_key(const uchar *entry, size_t *length,
*/
*/
int
init_file_hash
(
void
)
int
init_file_hash
(
void
)
{
{
DBUG_ENTER
(
"init_file_hash"
);
if
(
!
filename_hash_inited
)
if
(
!
filename_hash_inited
)
{
{
lf_hash_init
(
&
filename_hash
,
sizeof
(
PFS_file
*
),
LF_HASH_UNIQUE
,
lf_hash_init
(
&
filename_hash
,
sizeof
(
PFS_file
*
),
LF_HASH_UNIQUE
,
0
,
0
,
filename_hash_get_key
,
&
my_charset_bin
);
0
,
0
,
filename_hash_get_key
,
&
my_charset_bin
);
filename_hash_inited
=
true
;
filename_hash_inited
=
true
;
}
}
return
0
;
DBUG_RETURN
(
0
)
;
}
}
/** Cleanup the file name hash. */
/** Cleanup the file name hash. */
void
cleanup_file_hash
(
void
)
void
cleanup_file_hash
(
void
)
{
{
DBUG_ENTER
(
"cleanup_file_hash"
);
if
(
filename_hash_inited
)
if
(
filename_hash_inited
)
{
{
lf_hash_destroy
(
&
filename_hash
);
lf_hash_destroy
(
&
filename_hash
);
filename_hash_inited
=
false
;
filename_hash_inited
=
false
;
}
}
DBUG_VOID_RETURN
;
}
}
void
PFS_scan
::
init
(
uint
random
,
uint
max_size
)
void
PFS_scan
::
init
(
uint
random
,
uint
max_size
)
{
{
DBUG_ENTER
(
"PFS_scan::init"
);
m_pass
=
0
;
m_pass
=
0
;
if
(
max_size
==
0
)
if
(
max_size
==
0
)
{
{
/* Degenerated case, no buffer */
/* Degenerated case, no buffer */
m_pass_max
=
0
;
m_pass_max
=
0
;
return
;
DBUG_VOID_RETURN
;
}
}
DBUG_ASSERT
(
random
<
max_size
);
DBUG_ASSERT
(
random
<
max_size
);
...
@@ -521,6 +540,7 @@ void PFS_scan::init(uint random, uint max_size)
...
@@ -521,6 +540,7 @@ void PFS_scan::init(uint random, uint max_size)
/* The combined length of all passes should not exceed PFS_MAX_ALLOC_RETRY. */
/* The combined length of all passes should not exceed PFS_MAX_ALLOC_RETRY. */
DBUG_ASSERT
((
m_last
[
0
]
-
m_first
[
0
])
+
DBUG_ASSERT
((
m_last
[
0
]
-
m_first
[
0
])
+
(
m_last
[
1
]
-
m_first
[
1
])
<=
PFS_MAX_ALLOC_RETRY
);
(
m_last
[
1
]
-
m_first
[
1
])
<=
PFS_MAX_ALLOC_RETRY
);
DBUG_VOID_RETURN
;
}
}
/**
/**
...
@@ -533,6 +553,7 @@ PFS_mutex* create_mutex(PFS_mutex_class *klass, const void *identity)
...
@@ -533,6 +553,7 @@ PFS_mutex* create_mutex(PFS_mutex_class *klass, const void *identity)
{
{
PFS_scan
scan
;
PFS_scan
scan
;
uint
random
=
randomized_index
(
identity
,
mutex_max
);
uint
random
=
randomized_index
(
identity
,
mutex_max
);
DBUG_ENTER
(
"create_mutex"
);
for
(
scan
.
init
(
random
,
mutex_max
);
for
(
scan
.
init
(
random
,
mutex_max
);
scan
.
has_pass
();
scan
.
has_pass
();
...
@@ -559,14 +580,14 @@ PFS_mutex* create_mutex(PFS_mutex_class *klass, const void *identity)
...
@@ -559,14 +580,14 @@ PFS_mutex* create_mutex(PFS_mutex_class *klass, const void *identity)
pfs
->
m_owner
=
NULL
;
pfs
->
m_owner
=
NULL
;
pfs
->
m_last_locked
=
0
;
pfs
->
m_last_locked
=
0
;
pfs
->
m_lock
.
dirty_to_allocated
();
pfs
->
m_lock
.
dirty_to_allocated
();
return
pfs
;
DBUG_RETURN
(
pfs
)
;
}
}
}
}
}
}
}
}
mutex_lost
++
;
mutex_lost
++
;
return
NULL
;
DBUG_RETURN
(
NULL
)
;
}
}
/**
/**
...
@@ -575,8 +596,11 @@ PFS_mutex* create_mutex(PFS_mutex_class *klass, const void *identity)
...
@@ -575,8 +596,11 @@ PFS_mutex* create_mutex(PFS_mutex_class *klass, const void *identity)
*/
*/
void
destroy_mutex
(
PFS_mutex
*
pfs
)
void
destroy_mutex
(
PFS_mutex
*
pfs
)
{
{
DBUG_ENTER
(
"destroy_mutex"
);
DBUG_ASSERT
(
pfs
!=
NULL
);
DBUG_ASSERT
(
pfs
!=
NULL
);
pfs
->
m_lock
.
allocated_to_free
();
pfs
->
m_lock
.
allocated_to_free
();
DBUG_VOID_RETURN
;
}
}
/**
/**
...
@@ -589,6 +613,7 @@ PFS_rwlock* create_rwlock(PFS_rwlock_class *klass, const void *identity)
...
@@ -589,6 +613,7 @@ PFS_rwlock* create_rwlock(PFS_rwlock_class *klass, const void *identity)
{
{
PFS_scan
scan
;
PFS_scan
scan
;
uint
random
=
randomized_index
(
identity
,
rwlock_max
);
uint
random
=
randomized_index
(
identity
,
rwlock_max
);
DBUG_ENTER
(
"create_rwlock"
);
for
(
scan
.
init
(
random
,
rwlock_max
);
for
(
scan
.
init
(
random
,
rwlock_max
);
scan
.
has_pass
();
scan
.
has_pass
();
...
@@ -621,14 +646,14 @@ PFS_rwlock* create_rwlock(PFS_rwlock_class *klass, const void *identity)
...
@@ -621,14 +646,14 @@ PFS_rwlock* create_rwlock(PFS_rwlock_class *klass, const void *identity)
pfs
->
m_readers
=
0
;
pfs
->
m_readers
=
0
;
pfs
->
m_last_written
=
0
;
pfs
->
m_last_written
=
0
;
pfs
->
m_last_read
=
0
;
pfs
->
m_last_read
=
0
;
return
pfs
;
DBUG_RETURN
(
pfs
)
;
}
}
}
}
}
}
}
}
rwlock_lost
++
;
rwlock_lost
++
;
return
NULL
;
DBUG_RETURN
(
NULL
)
;
}
}
/**
/**
...
@@ -637,8 +662,11 @@ PFS_rwlock* create_rwlock(PFS_rwlock_class *klass, const void *identity)
...
@@ -637,8 +662,11 @@ PFS_rwlock* create_rwlock(PFS_rwlock_class *klass, const void *identity)
*/
*/
void
destroy_rwlock
(
PFS_rwlock
*
pfs
)
void
destroy_rwlock
(
PFS_rwlock
*
pfs
)
{
{
DBUG_ENTER
(
"destroy_rwlock"
);
DBUG_ASSERT
(
pfs
!=
NULL
);
DBUG_ASSERT
(
pfs
!=
NULL
);
pfs
->
m_lock
.
allocated_to_free
();
pfs
->
m_lock
.
allocated_to_free
();
DBUG_VOID_RETURN
;
}
}
/**
/**
...
@@ -651,6 +679,7 @@ PFS_cond* create_cond(PFS_cond_class *klass, const void *identity)
...
@@ -651,6 +679,7 @@ PFS_cond* create_cond(PFS_cond_class *klass, const void *identity)
{
{
PFS_scan
scan
;
PFS_scan
scan
;
uint
random
=
randomized_index
(
identity
,
cond_max
);
uint
random
=
randomized_index
(
identity
,
cond_max
);
DBUG_ENTER
(
"create_cond"
);
for
(
scan
.
init
(
random
,
cond_max
);
for
(
scan
.
init
(
random
,
cond_max
);
scan
.
has_pass
();
scan
.
has_pass
();
...
@@ -673,14 +702,14 @@ PFS_cond* create_cond(PFS_cond_class *klass, const void *identity)
...
@@ -673,14 +702,14 @@ PFS_cond* create_cond(PFS_cond_class *klass, const void *identity)
pfs
->
m_wait_stat
.
m_parent
=
&
klass
->
m_wait_stat
;
pfs
->
m_wait_stat
.
m_parent
=
&
klass
->
m_wait_stat
;
reset_single_stat_link
(
&
pfs
->
m_wait_stat
);
reset_single_stat_link
(
&
pfs
->
m_wait_stat
);
pfs
->
m_lock
.
dirty_to_allocated
();
pfs
->
m_lock
.
dirty_to_allocated
();
return
pfs
;
DBUG_RETURN
(
pfs
)
;
}
}
}
}
}
}
}
}
cond_lost
++
;
cond_lost
++
;
return
NULL
;
DBUG_RETURN
(
NULL
)
;
}
}
/**
/**
...
@@ -689,8 +718,11 @@ PFS_cond* create_cond(PFS_cond_class *klass, const void *identity)
...
@@ -689,8 +718,11 @@ PFS_cond* create_cond(PFS_cond_class *klass, const void *identity)
*/
*/
void
destroy_cond
(
PFS_cond
*
pfs
)
void
destroy_cond
(
PFS_cond
*
pfs
)
{
{
DBUG_ENTER
(
"destroy_cond"
);
DBUG_ASSERT
(
pfs
!=
NULL
);
DBUG_ASSERT
(
pfs
!=
NULL
);
pfs
->
m_lock
.
allocated_to_free
();
pfs
->
m_lock
.
allocated_to_free
();
DBUG_VOID_RETURN
;
}
}
/**
/**
...
@@ -707,6 +739,7 @@ PFS_thread* create_thread(PFS_thread_class *klass, const void *identity,
...
@@ -707,6 +739,7 @@ PFS_thread* create_thread(PFS_thread_class *klass, const void *identity,
{
{
PFS_scan
scan
;
PFS_scan
scan
;
uint
random
=
randomized_index
(
identity
,
thread_max
);
uint
random
=
randomized_index
(
identity
,
thread_max
);
DBUG_ENTER
(
"create_thread"
);
for
(
scan
.
init
(
random
,
thread_max
);
for
(
scan
.
init
(
random
,
thread_max
);
scan
.
has_pass
();
scan
.
has_pass
();
...
@@ -737,14 +770,14 @@ PFS_thread* create_thread(PFS_thread_class *klass, const void *identity,
...
@@ -737,14 +770,14 @@ PFS_thread* create_thread(PFS_thread_class *klass, const void *identity,
pfs
->
m_filename_hash_pins
=
NULL
;
pfs
->
m_filename_hash_pins
=
NULL
;
pfs
->
m_table_share_hash_pins
=
NULL
;
pfs
->
m_table_share_hash_pins
=
NULL
;
pfs
->
m_lock
.
dirty_to_allocated
();
pfs
->
m_lock
.
dirty_to_allocated
();
return
pfs
;
DBUG_RETURN
(
pfs
)
;
}
}
}
}
}
}
}
}
thread_lost
++
;
thread_lost
++
;
return
NULL
;
DBUG_RETURN
(
NULL
)
;
}
}
/**
/**
...
@@ -766,6 +799,7 @@ const char *sanitize_file_name(const char *unsafe)
...
@@ -766,6 +799,7 @@ const char *sanitize_file_name(const char *unsafe)
intptr
ptr
=
(
intptr
)
unsafe
;
intptr
ptr
=
(
intptr
)
unsafe
;
intptr
first
=
(
intptr
)
&
file_array
[
0
];
intptr
first
=
(
intptr
)
&
file_array
[
0
];
intptr
last
=
(
intptr
)
&
file_array
[
file_max
];
intptr
last
=
(
intptr
)
&
file_array
[
file_max
];
DBUG_ENTER
(
"sanitize_file_name"
);
/* Check if unsafe points inside file_array[] */
/* Check if unsafe points inside file_array[] */
if
(
likely
((
first
<=
ptr
)
&&
(
ptr
<
last
)))
if
(
likely
((
first
<=
ptr
)
&&
(
ptr
<
last
)))
...
@@ -775,10 +809,10 @@ const char *sanitize_file_name(const char *unsafe)
...
@@ -775,10 +809,10 @@ const char *sanitize_file_name(const char *unsafe)
intptr
valid_offset
=
my_offsetof
(
PFS_file
,
m_filename
[
0
]);
intptr
valid_offset
=
my_offsetof
(
PFS_file
,
m_filename
[
0
]);
if
(
likely
(
offset
==
valid_offset
))
if
(
likely
(
offset
==
valid_offset
))
{
{
return
unsafe
;
DBUG_RETURN
(
unsafe
)
;
}
}
}
}
return
NULL
;
DBUG_RETURN
(
NULL
)
;
}
}
/**
/**
...
@@ -787,6 +821,8 @@ const char *sanitize_file_name(const char *unsafe)
...
@@ -787,6 +821,8 @@ const char *sanitize_file_name(const char *unsafe)
*/
*/
void
destroy_thread
(
PFS_thread
*
pfs
)
void
destroy_thread
(
PFS_thread
*
pfs
)
{
{
DBUG_ENTER
(
"destroy_thread"
);
DBUG_ASSERT
(
pfs
!=
NULL
);
DBUG_ASSERT
(
pfs
!=
NULL
);
if
(
pfs
->
m_filename_hash_pins
)
if
(
pfs
->
m_filename_hash_pins
)
{
{
...
@@ -799,6 +835,7 @@ void destroy_thread(PFS_thread *pfs)
...
@@ -799,6 +835,7 @@ void destroy_thread(PFS_thread *pfs)
pfs
->
m_table_share_hash_pins
=
NULL
;
pfs
->
m_table_share_hash_pins
=
NULL
;
}
}
pfs
->
m_lock
.
allocated_to_free
();
pfs
->
m_lock
.
allocated_to_free
();
DBUG_VOID_RETURN
;
}
}
/**
/**
...
@@ -815,12 +852,13 @@ find_or_create_file(PFS_thread *thread, PFS_file_class *klass,
...
@@ -815,12 +852,13 @@ find_or_create_file(PFS_thread *thread, PFS_file_class *klass,
{
{
PFS_file
*
pfs
;
PFS_file
*
pfs
;
PFS_scan
scan
;
PFS_scan
scan
;
DBUG_ENTER
(
"find_or_create_file"
);
if
(
!
filename_hash_inited
)
if
(
!
filename_hash_inited
)
{
{
/* File instrumentation can be turned off. */
/* File instrumentation can be turned off. */
file_lost
++
;
file_lost
++
;
return
NULL
;
DBUG_RETURN
(
NULL
)
;
}
}
if
(
unlikely
(
thread
->
m_filename_hash_pins
==
NULL
))
if
(
unlikely
(
thread
->
m_filename_hash_pins
==
NULL
))
...
@@ -829,7 +867,7 @@ find_or_create_file(PFS_thread *thread, PFS_file_class *klass,
...
@@ -829,7 +867,7 @@ find_or_create_file(PFS_thread *thread, PFS_file_class *klass,
if
(
unlikely
(
thread
->
m_filename_hash_pins
==
NULL
))
if
(
unlikely
(
thread
->
m_filename_hash_pins
==
NULL
))
{
{
file_lost
++
;
file_lost
++
;
return
NULL
;
DBUG_RETURN
(
NULL
)
;
}
}
}
}
...
@@ -898,7 +936,7 @@ find_or_create_file(PFS_thread *thread, PFS_file_class *klass,
...
@@ -898,7 +936,7 @@ find_or_create_file(PFS_thread *thread, PFS_file_class *klass,
if
(
my_realpath
(
buffer
,
dirbuffer
,
MYF
(
0
))
!=
0
)
if
(
my_realpath
(
buffer
,
dirbuffer
,
MYF
(
0
))
!=
0
)
{
{
file_lost
++
;
file_lost
++
;
return
NULL
;
DBUG_RETURN
(
NULL
)
;
}
}
/* Append the unresolved file name to the resolved path */
/* Append the unresolved file name to the resolved path */
...
@@ -925,7 +963,7 @@ search:
...
@@ -925,7 +963,7 @@ search:
pfs
=
*
entry
;
pfs
=
*
entry
;
pfs
->
m_file_stat
.
m_open_count
++
;
pfs
->
m_file_stat
.
m_open_count
++
;
lf_hash_search_unpin
(
thread
->
m_filename_hash_pins
);
lf_hash_search_unpin
(
thread
->
m_filename_hash_pins
);
return
pfs
;
DBUG_RETURN
(
pfs
)
;
}
}
/* filename is not constant, just using it for noise on create */
/* filename is not constant, just using it for noise on create */
...
@@ -959,7 +997,7 @@ search:
...
@@ -959,7 +997,7 @@ search:
if
(
likely
(
res
==
0
))
if
(
likely
(
res
==
0
))
{
{
pfs
->
m_lock
.
dirty_to_allocated
();
pfs
->
m_lock
.
dirty_to_allocated
();
return
pfs
;
DBUG_RETURN
(
pfs
)
;
}
}
pfs
->
m_lock
.
dirty_to_free
();
pfs
->
m_lock
.
dirty_to_free
();
...
@@ -971,21 +1009,21 @@ search:
...
@@ -971,21 +1009,21 @@ search:
{
{
/* Avoid infinite loops */
/* Avoid infinite loops */
file_lost
++
;
file_lost
++
;
return
NULL
;
DBUG_RETURN
(
NULL
)
;
}
}
goto
search
;
goto
search
;
}
}
/* OOM in lf_hash_insert */
/* OOM in lf_hash_insert */
file_lost
++
;
file_lost
++
;
return
NULL
;
DBUG_RETURN
(
NULL
)
;
}
}
}
}
}
}
}
}
file_lost
++
;
file_lost
++
;
return
NULL
;
DBUG_RETURN
(
NULL
)
;
}
}
/**
/**
...
@@ -994,8 +1032,11 @@ search:
...
@@ -994,8 +1032,11 @@ search:
*/
*/
void
release_file
(
PFS_file
*
pfs
)
void
release_file
(
PFS_file
*
pfs
)
{
{
DBUG_ENTER
(
"release_file"
);
DBUG_ASSERT
(
pfs
!=
NULL
);
DBUG_ASSERT
(
pfs
!=
NULL
);
pfs
->
m_file_stat
.
m_open_count
--
;
pfs
->
m_file_stat
.
m_open_count
--
;
DBUG_VOID_RETURN
;
}
}
/**
/**
...
@@ -1005,12 +1046,15 @@ void release_file(PFS_file *pfs)
...
@@ -1005,12 +1046,15 @@ void release_file(PFS_file *pfs)
*/
*/
void
destroy_file
(
PFS_thread
*
thread
,
PFS_file
*
pfs
)
void
destroy_file
(
PFS_thread
*
thread
,
PFS_file
*
pfs
)
{
{
DBUG_ENTER
(
"destroy_file"
);
DBUG_ASSERT
(
thread
!=
NULL
);
DBUG_ASSERT
(
thread
!=
NULL
);
DBUG_ASSERT
(
thread
->
m_filename_hash_pins
!=
NULL
);
DBUG_ASSERT
(
thread
->
m_filename_hash_pins
!=
NULL
);
DBUG_ASSERT
(
pfs
!=
NULL
);
DBUG_ASSERT
(
pfs
!=
NULL
);
lf_hash_delete
(
&
filename_hash
,
thread
->
m_filename_hash_pins
,
lf_hash_delete
(
&
filename_hash
,
thread
->
m_filename_hash_pins
,
pfs
->
m_filename
,
pfs
->
m_filename_length
);
pfs
->
m_filename
,
pfs
->
m_filename_length
);
pfs
->
m_lock
.
allocated_to_free
();
pfs
->
m_lock
.
allocated_to_free
();
DBUG_VOID_RETURN
;
}
}
/**
/**
...
@@ -1023,6 +1067,7 @@ PFS_table* create_table(PFS_table_share *share, const void *identity)
...
@@ -1023,6 +1067,7 @@ PFS_table* create_table(PFS_table_share *share, const void *identity)
{
{
PFS_scan
scan
;
PFS_scan
scan
;
uint
random
=
randomized_index
(
identity
,
table_max
);
uint
random
=
randomized_index
(
identity
,
table_max
);
DBUG_ENTER
(
"create_table"
);
for
(
scan
.
init
(
random
,
table_max
);
for
(
scan
.
init
(
random
,
table_max
);
scan
.
has_pass
();
scan
.
has_pass
();
...
@@ -1043,14 +1088,14 @@ PFS_table* create_table(PFS_table_share *share, const void *identity)
...
@@ -1043,14 +1088,14 @@ PFS_table* create_table(PFS_table_share *share, const void *identity)
pfs
->
m_wait_stat
.
m_parent
=
&
share
->
m_wait_stat
;
pfs
->
m_wait_stat
.
m_parent
=
&
share
->
m_wait_stat
;
reset_single_stat_link
(
&
pfs
->
m_wait_stat
);
reset_single_stat_link
(
&
pfs
->
m_wait_stat
);
pfs
->
m_lock
.
dirty_to_allocated
();
pfs
->
m_lock
.
dirty_to_allocated
();
return
pfs
;
DBUG_RETURN
(
pfs
)
;
}
}
}
}
}
}
}
}
table_lost
++
;
table_lost
++
;
return
NULL
;
DBUG_RETURN
(
NULL
)
;
}
}
/**
/**
...
@@ -1059,53 +1104,67 @@ PFS_table* create_table(PFS_table_share *share, const void *identity)
...
@@ -1059,53 +1104,67 @@ PFS_table* create_table(PFS_table_share *share, const void *identity)
*/
*/
void
destroy_table
(
PFS_table
*
pfs
)
void
destroy_table
(
PFS_table
*
pfs
)
{
{
DBUG_ENTER
(
"destroy_table"
);
DBUG_ASSERT
(
pfs
!=
NULL
);
DBUG_ASSERT
(
pfs
!=
NULL
);
pfs
->
m_lock
.
allocated_to_free
();
pfs
->
m_lock
.
allocated_to_free
();
DBUG_VOID_RETURN
;
}
}
static
void
reset_mutex_waits_by_instance
(
void
)
static
void
reset_mutex_waits_by_instance
(
void
)
{
{
PFS_mutex
*
pfs
=
mutex_array
;
PFS_mutex
*
pfs
=
mutex_array
;
PFS_mutex
*
pfs_last
=
mutex_array
+
mutex_max
;
PFS_mutex
*
pfs_last
=
mutex_array
+
mutex_max
;
DBUG_ENTER
(
"reset_mutex_waits_by_instance"
);
for
(
;
pfs
<
pfs_last
;
pfs
++
)
for
(
;
pfs
<
pfs_last
;
pfs
++
)
reset_single_stat_link
(
&
pfs
->
m_wait_stat
);
reset_single_stat_link
(
&
pfs
->
m_wait_stat
);
DBUG_VOID_RETURN
;
}
}
static
void
reset_rwlock_waits_by_instance
(
void
)
static
void
reset_rwlock_waits_by_instance
(
void
)
{
{
PFS_rwlock
*
pfs
=
rwlock_array
;
PFS_rwlock
*
pfs
=
rwlock_array
;
PFS_rwlock
*
pfs_last
=
rwlock_array
+
rwlock_max
;
PFS_rwlock
*
pfs_last
=
rwlock_array
+
rwlock_max
;
DBUG_ENTER
(
"reset_rwlock_waits_by_instance"
);
for
(
;
pfs
<
pfs_last
;
pfs
++
)
for
(
;
pfs
<
pfs_last
;
pfs
++
)
reset_single_stat_link
(
&
pfs
->
m_wait_stat
);
reset_single_stat_link
(
&
pfs
->
m_wait_stat
);
DBUG_VOID_RETURN
;
}
}
static
void
reset_cond_waits_by_instance
(
void
)
static
void
reset_cond_waits_by_instance
(
void
)
{
{
PFS_cond
*
pfs
=
cond_array
;
PFS_cond
*
pfs
=
cond_array
;
PFS_cond
*
pfs_last
=
cond_array
+
cond_max
;
PFS_cond
*
pfs_last
=
cond_array
+
cond_max
;
DBUG_ENTER
(
"reset_cond_waits_by_instance"
);
for
(
;
pfs
<
pfs_last
;
pfs
++
)
for
(
;
pfs
<
pfs_last
;
pfs
++
)
reset_single_stat_link
(
&
pfs
->
m_wait_stat
);
reset_single_stat_link
(
&
pfs
->
m_wait_stat
);
DBUG_VOID_RETURN
;
}
}
static
void
reset_file_waits_by_instance
(
void
)
static
void
reset_file_waits_by_instance
(
void
)
{
{
PFS_file
*
pfs
=
file_array
;
PFS_file
*
pfs
=
file_array
;
PFS_file
*
pfs_last
=
file_array
+
file_max
;
PFS_file
*
pfs_last
=
file_array
+
file_max
;
DBUG_ENTER
(
"reset_file_waits_by_instance"
);
for
(
;
pfs
<
pfs_last
;
pfs
++
)
for
(
;
pfs
<
pfs_last
;
pfs
++
)
reset_single_stat_link
(
&
pfs
->
m_wait_stat
);
reset_single_stat_link
(
&
pfs
->
m_wait_stat
);
DBUG_VOID_RETURN
;
}
}
/** Reset the wait statistics per object instance. */
/** Reset the wait statistics per object instance. */
void
reset_events_waits_by_instance
(
void
)
void
reset_events_waits_by_instance
(
void
)
{
{
DBUG_ENTER
(
"reset_events_waits_by_instance"
);
reset_mutex_waits_by_instance
();
reset_mutex_waits_by_instance
();
reset_rwlock_waits_by_instance
();
reset_rwlock_waits_by_instance
();
reset_cond_waits_by_instance
();
reset_cond_waits_by_instance
();
reset_file_waits_by_instance
();
reset_file_waits_by_instance
();
DBUG_VOID_RETURN
;
}
}
/** Reset the io statistics per file instance. */
/** Reset the io statistics per file instance. */
...
@@ -1113,9 +1172,11 @@ void reset_file_instance_io(void)
...
@@ -1113,9 +1172,11 @@ void reset_file_instance_io(void)
{
{
PFS_file
*
pfs
=
file_array
;
PFS_file
*
pfs
=
file_array
;
PFS_file
*
pfs_last
=
file_array
+
file_max
;
PFS_file
*
pfs_last
=
file_array
+
file_max
;
DBUG_ENTER
(
"reset_file_instance_io"
);
for
(
;
pfs
<
pfs_last
;
pfs
++
)
for
(
;
pfs
<
pfs_last
;
pfs
++
)
reset_file_stat
(
&
pfs
->
m_file_stat
);
reset_file_stat
(
&
pfs
->
m_file_stat
);
DBUG_VOID_RETURN
;
}
}
/** @} */
/** @} */
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