Skip to content

Commit 6e5185c

Browse files
committed
MERGE: mysql-trunk-->mysql-trunk-wl5766
2 parents 4c249af + 308616d commit 6e5185c

File tree

482 files changed

+60253
-1173
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

482 files changed

+60253
-1173
lines changed

CMakeLists.txt

+22
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,28 @@ OPTION(OPTIMIZER_TRACE "Support tracing of Optimizer" ON)
267267
OPTION(INNODB_COMPILER_HINTS "Compile InnoDB with compiler hints" ON)
268268
MARK_AS_ADVANCED(INNODB_COMPILER_HINTS)
269269

270+
#
271+
# Options related to client-side protocol tracing
272+
#
273+
274+
OPTION(WITH_CLIENT_PROTOCOL_TRACING
275+
"Support for client-side protocol tracing plugins" ON)
276+
OPTION(WITH_TEST_TRACE_PLUGIN
277+
"Have a built-in test protocol trace plugin in libmysql (requires WITH_CLIENT_PROTOCOL_TRACING option)" OFF)
278+
279+
# Sanity checks for protocol tracing options
280+
281+
IF(WITH_TEST_TRACE_PLUGIN AND NOT WITH_CLIENT_PROTOCOL_TRACING)
282+
MESSAGE("WARNING: Test trace plugin was selected but client protocol tracing infrastructure is not enabled - ignoring")
283+
SET(WITH_TEST_TRACE_PLUGIN 0)
284+
ENDIF()
285+
286+
IF(WITH_TEST_TRACE_PLUGIN AND NOT CMAKE_BUILD_TYPE MATCHES "Debug")
287+
MESSAGE(SEND_ERROR
288+
"Test trace plugin was selected but it can be included only in debug binaries.
289+
Set WITH_TEST_TRACE_PLUGIN to OFF or WITH_DEBUG to ON.")
290+
ENDIF()
291+
270292
# Set DBUG_OFF and other optional release-only flags for non-debug project types
271293
FOREACH(BUILD_TYPE RELEASE RELWITHDEBINFO MINSIZEREL)
272294
FOREACH(LANG C CXX)

client/completion_hash.cc

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -41,15 +41,16 @@ uint hashpjw(const char *arKey, uint nKeyLength)
4141

4242
int completion_hash_init(HashTable *ht, uint nSize)
4343
{
44-
ht->arBuckets = (Bucket **) my_malloc(nSize* sizeof(Bucket *),
44+
ht->arBuckets = (Bucket **) my_malloc(PSI_NOT_INSTRUMENTED,
45+
nSize* sizeof(Bucket *),
4546
MYF(MY_ZEROFILL | MY_WME));
4647

4748
if (!ht->arBuckets)
4849
{
4950
ht->initialized = 0;
5051
return FAILURE;
5152
}
52-
init_alloc_root(&ht->mem_root, 8192, 0);
53+
init_alloc_root(PSI_NOT_INSTRUMENTED, &ht->mem_root, 8192, 0);
5354
ht->pHashFunction = hashpjw;
5455
ht->nTableSize = nSize;
5556
ht->initialized = 1;

client/get_password.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,12 @@ char *get_tty_password_ext(const char *opt_message,
205205

206206
#endif /* _WIN32 */
207207

208+
static char * my_strdup_fct(const char *str, myf flags)
209+
{
210+
return my_strdup(PSI_NOT_INSTRUMENTED, str, flags);
211+
}
212+
208213
char *get_tty_password(const char *opt_message)
209214
{
210-
return get_tty_password_ext(opt_message, my_strdup);
215+
return get_tty_password_ext(opt_message, my_strdup_fct);
211216
}

client/mysql.cc

+49-23
Original file line numberDiff line numberDiff line change
@@ -1210,10 +1210,12 @@ int main(int argc,char *argv[])
12101210
charset_index= get_command_index('C');
12111211
delimiter_index= get_command_index('d');
12121212
delimiter_str= delimiter;
1213-
default_prompt = my_strdup(getenv("MYSQL_PS1") ?
1213+
default_prompt = my_strdup(PSI_NOT_INSTRUMENTED,
1214+
getenv("MYSQL_PS1") ?
12141215
getenv("MYSQL_PS1") :
12151216
"mysql> ",MYF(MY_WME));
1216-
current_prompt = my_strdup(default_prompt,MYF(MY_WME));
1217+
current_prompt = my_strdup(PSI_NOT_INSTRUMENTED,
1218+
default_prompt,MYF(MY_WME));
12171219
prompt_counter=0;
12181220

12191221
outfile[0]=0; // no (default) outfile
@@ -1288,7 +1290,7 @@ int main(int argc,char *argv[])
12881290
}
12891291
glob_buffer.realloc(512);
12901292
completion_hash_init(&ht, 128);
1291-
init_alloc_root(&hash_mem_root, 16384, 0);
1293+
init_alloc_root(PSI_NOT_INSTRUMENTED, &hash_mem_root, 16384, 0);
12921294
memset(&mysql, 0, sizeof(mysql));
12931295
if (sql_connect(current_host,current_db,current_user,opt_password,
12941296
opt_silent))
@@ -1355,10 +1357,12 @@ int main(int argc,char *argv[])
13551357

13561358
/* read-history from file, default ~/.mysql_history*/
13571359
if (getenv("MYSQL_HISTFILE"))
1358-
histfile=my_strdup(getenv("MYSQL_HISTFILE"),MYF(MY_WME));
1360+
histfile=my_strdup(PSI_NOT_INSTRUMENTED,
1361+
getenv("MYSQL_HISTFILE"),MYF(MY_WME));
13591362
else if (getenv("HOME"))
13601363
{
1361-
histfile=(char*) my_malloc((uint) strlen(getenv("HOME"))
1364+
histfile=(char*) my_malloc(PSI_NOT_INSTRUMENTED,
1365+
(uint) strlen(getenv("HOME"))
13621366
+ (uint) strlen("/.mysql_history")+2,
13631367
MYF(MY_WME));
13641368
if (histfile)
@@ -1382,7 +1386,8 @@ int main(int argc,char *argv[])
13821386
if (verbose)
13831387
tee_fprintf(stdout, "Reading history-file %s\n",histfile);
13841388
read_history(histfile);
1385-
if (!(histfile_tmp= (char*) my_malloc((uint) strlen(histfile) + 5,
1389+
if (!(histfile_tmp= (char*) my_malloc(PSI_NOT_INSTRUMENTED,
1390+
(uint) strlen(histfile) + 5,
13861391
MYF(MY_WME))))
13871392
{
13881393
fprintf(stderr, "Couldn't allocate memory for temp histfile!\n");
@@ -1939,7 +1944,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
19391944
}
19401945
if (embedded_server_arg_count == MAX_SERVER_ARGS-1 ||
19411946
!(embedded_server_args[embedded_server_arg_count++]=
1942-
my_strdup(argument, MYF(MY_FAE))))
1947+
my_strdup(PSI_NOT_INSTRUMENTED,
1948+
argument, MYF(MY_FAE))))
19431949
{
19441950
put_info("Can't use server argument", INFO_ERROR);
19451951
return 0;
@@ -1985,7 +1991,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
19851991
{
19861992
char *start= argument;
19871993
my_free(opt_password);
1988-
opt_password= my_strdup(argument, MYF(MY_FAE));
1994+
opt_password= my_strdup(PSI_NOT_INSTRUMENTED,
1995+
argument, MYF(MY_FAE));
19891996
while (*argument) *argument++= 'x'; // Destroy argument
19901997
if (*start)
19911998
start[1]=0 ;
@@ -2041,7 +2048,8 @@ static int get_options(int argc, char **argv)
20412048

20422049
tmp= (char *) getenv("MYSQL_HOST");
20432050
if (tmp)
2044-
current_host= my_strdup(tmp, MYF(MY_WME));
2051+
current_host= my_strdup(PSI_NOT_INSTRUMENTED,
2052+
tmp, MYF(MY_WME));
20452053

20462054
pagpoint= getenv("PAGER");
20472055
if (!((char*) (pagpoint)))
@@ -2082,7 +2090,8 @@ static int get_options(int argc, char **argv)
20822090
{
20832091
skip_updates= 0;
20842092
my_free(current_db);
2085-
current_db= my_strdup(*argv, MYF(MY_WME));
2093+
current_db= my_strdup(PSI_NOT_INSTRUMENTED,
2094+
*argv, MYF(MY_WME));
20862095
}
20872096
if (tty_password)
20882097
opt_password= get_tty_password(NullS);
@@ -2104,6 +2113,12 @@ static int read_and_execute(bool interactive)
21042113
String buffer;
21052114
#endif
21062115

2116+
/*
2117+
line can be allocated by:
2118+
- batch_readline. Use my_free()
2119+
- my_win_console_readline. Do not free, see tmpbuf.
2120+
- readline. Use free()
2121+
*/
21072122
char *line= NULL;
21082123
char in_string=0;
21092124
ulong line_number=0;
@@ -2207,7 +2222,7 @@ static int read_and_execute(bool interactive)
22072222
free the previous entered line.
22082223
*/
22092224
if (line)
2210-
my_free(line);
2225+
free(line);
22112226
line= readline(prompt);
22122227

22132228
if (sigint_received)
@@ -2282,7 +2297,7 @@ static int read_and_execute(bool interactive)
22822297
/*
22832298
free the last entered line.
22842299
*/
2285-
my_free(line);
2300+
free(line);
22862301
#endif
22872302

22882303
/*
@@ -3213,7 +3228,8 @@ static void get_current_db()
32133228
{
32143229
MYSQL_ROW row= mysql_fetch_row(res);
32153230
if (row && row[0])
3216-
current_db= my_strdup(row[0], MYF(MY_WME));
3231+
current_db= my_strdup(PSI_NOT_INSTRUMENTED,
3232+
row[0], MYF(MY_WME));
32173233
mysql_free_result(res);
32183234
}
32193235
}
@@ -4452,12 +4468,14 @@ com_connect(String *buffer, char *line)
44524468
if (tmp && *tmp)
44534469
{
44544470
my_free(current_db);
4455-
current_db= my_strdup(tmp, MYF(MY_WME));
4471+
current_db= my_strdup(PSI_NOT_INSTRUMENTED,
4472+
tmp, MYF(MY_WME));
44564473
tmp= get_arg(buff, 1);
44574474
if (tmp)
44584475
{
44594476
my_free(current_host);
4460-
current_host=my_strdup(tmp,MYF(MY_WME));
4477+
current_host=my_strdup(PSI_NOT_INSTRUMENTED,
4478+
tmp,MYF(MY_WME));
44614479
}
44624480
}
44634481
else
@@ -4645,7 +4663,8 @@ com_use(String *buffer __attribute__((unused)), char *line)
46454663
return put_error(&mysql);
46464664
}
46474665
my_free(current_db);
4648-
current_db=my_strdup(tmp,MYF(MY_WME));
4666+
current_db=my_strdup(PSI_NOT_INSTRUMENTED,
4667+
tmp,MYF(MY_WME));
46494668
#ifdef HAVE_READLINE
46504669
if (select_db > 1)
46514670
build_completion_hash(opt_rehash, 1);
@@ -5158,7 +5177,8 @@ server_version_string(MYSQL *con)
51585177
/* version, space, comment, \0 */
51595178
size_t len= strlen(mysql_get_server_info(con)) + strlen(cur[0]) + 2;
51605179

5161-
if ((server_version= (char *) my_malloc(len, MYF(MY_WME))))
5180+
if ((server_version= (char *) my_malloc(PSI_NOT_INSTRUMENTED,
5181+
len, MYF(MY_WME))))
51625182
{
51635183
char *bufp;
51645184
bufp = strmov(server_version, mysql_get_server_info(con));
@@ -5175,7 +5195,8 @@ server_version_string(MYSQL *con)
51755195
*/
51765196

51775197
if (server_version == NULL)
5178-
server_version= my_strdup(mysql_get_server_info(con), MYF(MY_WME));
5198+
server_version= my_strdup(PSI_NOT_INSTRUMENTED,
5199+
mysql_get_server_info(con), MYF(MY_WME));
51795200
}
51805201

51815202
return server_version ? server_version : "";
@@ -5649,8 +5670,10 @@ static void init_username()
56495670
(result=mysql_use_result(&mysql)))
56505671
{
56515672
MYSQL_ROW cur=mysql_fetch_row(result);
5652-
full_username=my_strdup(cur[0],MYF(MY_WME));
5653-
part_username=my_strdup(strtok(cur[0],"@"),MYF(MY_WME));
5673+
full_username=my_strdup(PSI_NOT_INSTRUMENTED,
5674+
cur[0],MYF(MY_WME));
5675+
part_username=my_strdup(PSI_NOT_INSTRUMENTED,
5676+
strtok(cur[0],"@"),MYF(MY_WME));
56545677
(void) mysql_fetch_row(result); // Read eof
56555678
}
56565679
}
@@ -5689,15 +5712,17 @@ static void get_current_os_user() {
56895712
!(user= getenv("LOGIN")))
56905713
user= "UNKNOWN USER";
56915714
#endif /* _WIN32 */
5692-
current_os_user= my_strdup(user, MYF(MY_WME));
5715+
current_os_user= my_strdup(PSI_NOT_INSTRUMENTED,
5716+
user, MYF(MY_WME));
56935717
return;
56945718
}
56955719

56965720
// Get the current OS sudo user name (only for non-Windows platforms).
56975721
static void get_current_os_sudouser() {
56985722
#ifndef _WIN32
56995723
if (getenv("SUDO_USER"))
5700-
current_os_sudouser= my_strdup(getenv("SUDO_USER"), MYF(MY_WME));
5724+
current_os_sudouser= my_strdup(PSI_NOT_INSTRUMENTED,
5725+
getenv("SUDO_USER"), MYF(MY_WME));
57015726
#endif /* !_WIN32 */
57025727
return;
57035728
}
@@ -5708,7 +5733,8 @@ static int com_prompt(String *buffer __attribute__((unused)),
57085733
char *ptr=strchr(line, ' ');
57095734
prompt_counter = 0;
57105735
my_free(current_prompt);
5711-
current_prompt=my_strdup(ptr ? ptr+1 : default_prompt,MYF(MY_WME));
5736+
current_prompt=my_strdup(PSI_NOT_INSTRUMENTED,
5737+
ptr ? ptr+1 : default_prompt,MYF(MY_WME));
57125738
if (!ptr)
57135739
tee_fprintf(stdout, "Returning to default PROMPT of %s\n", default_prompt);
57145740
else

client/mysql_config_editor.cc

+6-3
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,8 @@ static int do_handle_options(int argc, char *argv[])
404404
exit(1);
405405
}
406406

407-
if (!(ptr= (char *) my_malloc((argc + 2) * sizeof(char *),
407+
if (!(ptr= (char *) my_malloc(PSI_NOT_INSTRUMENTED,
408+
(argc + 2) * sizeof(char *),
408409
MYF(MY_WME))))
409410
goto error;
410411

@@ -456,7 +457,8 @@ static int do_handle_options(int argc, char *argv[])
456457

457458
/* If NULL, set it to 'client' (default) */
458459
if (!opt_login_path)
459-
opt_login_path= my_strdup("client", MYF(MY_WME));
460+
opt_login_path= my_strdup(PSI_NOT_INSTRUMENTED,
461+
"client", MYF(MY_WME));
460462

461463
done:
462464
my_free(ptr);
@@ -980,7 +982,8 @@ static void remove_option(DYNAMIC_STRING *file_buf, const char *path_name,
980982
int search_len, shift_len;
981983
bool option_found= FALSE;
982984

983-
search_str= (char *) my_malloc((uint) strlen(option_name) + 2, MYF(MY_WME));
985+
search_str= (char *) my_malloc(PSI_NOT_INSTRUMENTED,
986+
(uint) strlen(option_name) + 2, MYF(MY_WME));
984987
sprintf(search_str, "\n%s", option_name);
985988

986989
if ((start= locate_login_path(file_buf, path_name)) == NULL)

0 commit comments

Comments
 (0)