summaryrefslogtreecommitdiff
path: root/libmysqld
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2020-01-29 13:50:26 +0100
committerSergei Golubchik <serg@mariadb.org>2020-03-10 19:24:22 +0100
commit7c58e97bf6f80a251046c5b3e7bce826fe058bd6 (patch)
tree7d32d26b320cf83296ee0ede2ea164ad116c4de8 /libmysqld
parent2ac3121af2767186c489054db5d4871d04b8eef4 (diff)
downloadmariadb-git-7c58e97bf6f80a251046c5b3e7bce826fe058bd6.tar.gz
perfschema memory related instrumentation changes
Diffstat (limited to 'libmysqld')
-rw-r--r--libmysqld/emb_qcache.cc2
-rw-r--r--libmysqld/lib_sql.cc16
-rw-r--r--libmysqld/libmysql.c28
-rw-r--r--libmysqld/libmysqld.c4
4 files changed, 24 insertions, 26 deletions
diff --git a/libmysqld/emb_qcache.cc b/libmysqld/emb_qcache.cc
index fb623f91458..33de60e92ac 100644
--- a/libmysqld/emb_qcache.cc
+++ b/libmysqld/emb_qcache.cc
@@ -418,7 +418,7 @@ int emb_load_querycache_result(THD *thd, Querycache_stream *src)
if (!data)
goto err;
- init_alloc_root(&data->alloc, "embedded_query_cache", 8192,0,MYF(0));
+ init_alloc_root(PSI_NOT_INSTRUMENTED, &data->alloc, 8192, 0, MYF(0));
f_alloc= &data->alloc;
data->fields= src->load_int();
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
index c6a7486e399..d5810f5e48e 100644
--- a/libmysqld/lib_sql.cc
+++ b/libmysqld/lib_sql.cc
@@ -491,8 +491,8 @@ char **copy_arguments(int argc, char **argv)
for (from=argv ; from != end ; from++)
length+= strlen(*from);
- if ((res= (char**) my_malloc(sizeof(argv)*(argc+1)+length+argc,
- MYF(MY_WME))))
+ if ((res= (char**) my_malloc(PSI_NOT_INSTRUMENTED,
+ sizeof(argv)*(argc+1)+length+argc, MYF(MY_WME))))
{
char **to= res, *to_str= (char*) (res+argc+1);
for (from=argv ; from != end ;)
@@ -664,7 +664,7 @@ void init_embedded_mysql(MYSQL *mysql, int client_flag)
thd->mysql= mysql;
mysql->server_version= server_version;
mysql->client_flag= client_flag;
- init_alloc_root(&mysql->field_alloc, "fields", 8192, 0, MYF(0));
+ init_alloc_root(PSI_NOT_INSTRUMENTED, &mysql->field_alloc, 8192, 0, MYF(0));
}
/**
@@ -758,7 +758,7 @@ int check_embedded_connection(MYSQL *mysql, const char *db)
sctx->host_or_ip= sctx->host= (char*) my_localhost;
strmake_buf(sctx->priv_host, (char*) my_localhost);
strmake_buf(sctx->priv_user, mysql->user);
- sctx->user= my_strdup(mysql->user, MYF(0));
+ sctx->user= my_strdup(PSI_NOT_INSTRUMENTED, mysql->user, MYF(0));
sctx->proxy_user[0]= 0;
sctx->master_access= GLOBAL_ACLS; // Full rights
emb_transfer_connect_attrs(mysql);
@@ -918,10 +918,8 @@ MYSQL_DATA *THD::alloc_new_dataset()
{
MYSQL_DATA *data;
struct embedded_query_result *emb_data;
- if (!my_multi_malloc(MYF(MY_WME | MY_ZEROFILL),
- &data, sizeof(*data),
- &emb_data, sizeof(*emb_data),
- NULL))
+ if (!my_multi_malloc(PSI_NOT_INSTRUMENTED, MYF(MY_WME | MY_ZEROFILL),
+ &data, sizeof(*data), &emb_data, sizeof(*emb_data), NULL))
return NULL;
emb_data->prev_ptr= &data->data;
@@ -984,7 +982,7 @@ bool Protocol::begin_dataset()
return 1;
alloc= &data->alloc;
/* Assume rowlength < 8192 */
- init_alloc_root(alloc, "protocol", 8192, 0, MYF(0));
+ init_alloc_root(PSI_NOT_INSTRUMENTED, alloc, 8192, 0, MYF(0));
alloc->min_malloc= sizeof(MYSQL_ROWS);
return 0;
}
diff --git a/libmysqld/libmysql.c b/libmysqld/libmysql.c
index 8ede487e413..dce7a000c0c 100644
--- a/libmysqld/libmysql.c
+++ b/libmysqld/libmysql.c
@@ -399,9 +399,9 @@ my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
my_free(saved_db);
/* alloc new connect information */
- mysql->user= my_strdup(mysql->user, MYF(MY_WME));
- mysql->passwd= my_strdup(mysql->passwd, MYF(MY_WME));
- mysql->db= db ? my_strdup(db, MYF(MY_WME)) : 0;
+ mysql->user= my_strdup(PSI_NOT_INSTRUMENTED, mysql->user, MYF(MY_WME));
+ mysql->passwd= my_strdup(PSI_NOT_INSTRUMENTED, mysql->passwd, MYF(MY_WME));
+ mysql->db= db ? my_strdup(PSI_NOT_INSTRUMENTED, db, MYF(MY_WME)) : 0;
}
else
{
@@ -482,7 +482,7 @@ my_bool handle_local_infile(MYSQL *mysql, const char *net_filename)
}
/* copy filename into local memory and allocate read buffer */
- if (!(buf=my_malloc(packet_length, MYF(0))))
+ if (!(buf=my_malloc(PSI_NOT_INSTRUMENTED, packet_length, MYF(0))))
{
set_mysql_error(mysql, CR_OUT_OF_MEMORY, unknown_sqlstate);
DBUG_RETURN(1);
@@ -580,7 +580,8 @@ static int default_local_infile_init(void **ptr, const char *filename,
char tmp_name[FN_REFLEN];
if (!(*ptr= data= ((default_local_infile_data *)
- my_malloc(sizeof(default_local_infile_data), MYF(0)))))
+ my_malloc(PSI_NOT_INSTRUMENTED,
+ sizeof(default_local_infile_data), MYF(0)))))
return 1; /* out of memory */
data->error_msg[0]= 0;
@@ -865,7 +866,7 @@ mysql_list_fields(MYSQL *mysql, const char *table, const char *wild)
!(fields= (*mysql->methods->list_fields)(mysql)))
DBUG_RETURN(NULL);
- if (!(result = (MYSQL_RES *) my_malloc(sizeof(MYSQL_RES),
+ if (!(result = (MYSQL_RES *) my_malloc(PSI_NOT_INSTRUMENTED, sizeof(MYSQL_RES),
MYF(MY_WME | MY_ZEROFILL))))
DBUG_RETURN(NULL);
@@ -1543,10 +1544,10 @@ mysql_stmt_init(MYSQL *mysql)
DBUG_ENTER("mysql_stmt_init");
if (!(stmt=
- (MYSQL_STMT *) my_malloc(sizeof (MYSQL_STMT),
+ (MYSQL_STMT *) my_malloc(PSI_NOT_INSTRUMENTED, sizeof (MYSQL_STMT),
MYF(MY_WME | MY_ZEROFILL))) ||
!(stmt->extension=
- (MYSQL_STMT_EXT *) my_malloc(sizeof (MYSQL_STMT_EXT),
+ (MYSQL_STMT_EXT *) my_malloc(PSI_NOT_INSTRUMENTED, sizeof (MYSQL_STMT_EXT),
MYF(MY_WME | MY_ZEROFILL))))
{
set_mysql_error(mysql, CR_OUT_OF_MEMORY, unknown_sqlstate);
@@ -1554,9 +1555,8 @@ mysql_stmt_init(MYSQL *mysql)
DBUG_RETURN(NULL);
}
- init_alloc_root(&stmt->mem_root, "stmt", 2048,2048, MYF(MY_THREAD_SPECIFIC));
- init_alloc_root(&stmt->result.alloc, "result", 4096, 4096,
- MYF(MY_THREAD_SPECIFIC));
+ init_alloc_root(PSI_NOT_INSTRUMENTED, &stmt->mem_root, 2048,2048, MYF(MY_THREAD_SPECIFIC));
+ init_alloc_root(PSI_NOT_INSTRUMENTED, &stmt->result.alloc, 4096, 4096, MYF(MY_THREAD_SPECIFIC));
stmt->result.alloc.min_malloc= sizeof(MYSQL_ROWS);
mysql->stmts= list_add(mysql->stmts, &stmt->list);
stmt->list.data= stmt;
@@ -1567,7 +1567,7 @@ mysql_stmt_init(MYSQL *mysql)
strmov(stmt->sqlstate, not_error_sqlstate);
/* The rest of statement members was bzeroed inside malloc */
- init_alloc_root(&stmt->extension->fields_mem_root, "extension", 2048, 0,
+ init_alloc_root(PSI_NOT_INSTRUMENTED, &stmt->extension->fields_mem_root, 2048, 0,
MYF(MY_THREAD_SPECIFIC));
DBUG_RETURN(stmt);
@@ -1854,7 +1854,7 @@ mysql_stmt_result_metadata(MYSQL_STMT *stmt)
if (!stmt->field_count)
DBUG_RETURN(0);
- if (!(result=(MYSQL_RES*) my_malloc(sizeof(*result),
+ if (!(result=(MYSQL_RES*) my_malloc(PSI_NOT_INSTRUMENTED, sizeof(*result),
MYF(MY_WME | MY_ZEROFILL))))
{
set_stmt_error(stmt, CR_OUT_OF_MEMORY, unknown_sqlstate, NULL);
@@ -2212,7 +2212,7 @@ int cli_stmt_execute(MYSQL_STMT *stmt)
}
length= (ulong) (net->write_pos - net->buff);
/* TODO: Look into avoding the following memdup */
- if (!(param_data= my_memdup(net->buff, length, MYF(0))))
+ if (!(param_data= my_memdup(PSI_NOT_INSTRUMENTED, net->buff, length, MYF(0))))
{
set_stmt_error(stmt, CR_OUT_OF_MEMORY, unknown_sqlstate, NULL);
DBUG_RETURN(1);
diff --git a/libmysqld/libmysqld.c b/libmysqld/libmysqld.c
index 6de86927a38..d29126467e2 100644
--- a/libmysqld/libmysqld.c
+++ b/libmysqld/libmysqld.c
@@ -157,7 +157,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
put extra 'my_free's in mysql_close.
So we alloc it with the 'user' string to be freed at once
*/
- mysql->user= my_strdup(user, MYF(0));
+ mysql->user= my_strdup(PSI_NOT_INSTRUMENTED, user, MYF(0));
port=0;
unix_socket=0;
@@ -175,7 +175,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
if (db)
client_flag|=CLIENT_CONNECT_WITH_DB;
- mysql->info_buffer= my_malloc(MYSQL_ERRMSG_SIZE, MYF(0));
+ mysql->info_buffer= my_malloc(PSI_NOT_INSTRUMENTED, MYSQL_ERRMSG_SIZE, MYF(0));
mysql->thd= create_embedded_thd(client_flag);
init_embedded_mysql(mysql, client_flag);