summaryrefslogtreecommitdiff
path: root/libmysql
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2015-06-15 18:07:41 +0500
committerAlexey Botchkov <holyfoot@askmonty.org>2015-06-15 18:07:41 +0500
commit02421aa284bf3ff2c56c0e8d58defe2846824d19 (patch)
tree8913e5cd4ca1e4fd7fff5f6af9296b4583a19912 /libmysql
parenta1170303772cd083290fd09ebbd3f0d6dd305299 (diff)
downloadmariadb-git-02421aa284bf3ff2c56c0e8d58defe2846824d19.tar.gz
MDEV-7871 Tests fail massively on "Assertion `status_var.memory_used == 0'" when run with --ps --embedded.
As the MF_THREAD_SPECIFIC was introduced to the alloc_root's and the prealloc added to the statement::mem_root and statement::result.alloc, we have to adjust the embedded server to it. The preallocation was removed for the embedded server as it makes no sence for it. The msyqltest should free the statement inside the proper thead to make the memory statistics happy.
Diffstat (limited to 'libmysql')
-rw-r--r--libmysql/libmysql.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index e0919deae60..3af4a032e5b 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -1508,6 +1508,12 @@ my_bool cli_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt)
memory
*/
+#ifdef EMBEDDED_LIBRARY
+#define STMT_INIT_PREALLOC(S) 0
+#else
+#define STMT_INIT_PREALLOC(S) S
+#endif /*EMBEDDED_LIBRARY*/
+
MYSQL_STMT * STDCALL
mysql_stmt_init(MYSQL *mysql)
{
@@ -1526,8 +1532,10 @@ mysql_stmt_init(MYSQL *mysql)
DBUG_RETURN(NULL);
}
- init_alloc_root(&stmt->mem_root, 2048, 2048, MYF(MY_THREAD_SPECIFIC));
- init_alloc_root(&stmt->result.alloc, 4096, 4096, MYF(MY_THREAD_SPECIFIC));
+ init_alloc_root(&stmt->mem_root, 2048, STMT_INIT_PREALLOC(2048),
+ MYF(MY_THREAD_SPECIFIC));
+ init_alloc_root(&stmt->result.alloc, 4096, STMT_INIT_PREALLOC(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;
@@ -1544,6 +1552,8 @@ mysql_stmt_init(MYSQL *mysql)
DBUG_RETURN(stmt);
}
+#undef STMT_INIT_PREALLOC
+
/*
Prepare server side statement with query.