diff -ruN mysql-5.5.28/sql/mysqld.cc mysql-5.5.28-new/sql/mysqld.cc --- mysql-5.5.28/sql/mysqld.cc 2012-11-21 08:50:42.000000000 -0500 +++ mysql-5.5.28-new/sql/mysqld.cc 2012-11-21 08:39:57.000000000 -0500 @@ -1536,11 +1536,13 @@ my_free(opt_bin_logname); bitmap_free(&temp_pool); free_max_user_conn(); +#ifndef EMBEDDED_LIBRARY free_global_user_stats(); free_global_client_stats(); free_global_thread_stats(); free_global_table_stats(); free_global_index_stats(); +#endif if(governor_destroy_lve){ governor_destroy_lve(); @@ -4023,9 +4025,11 @@ if (!DEFAULT_ERRMSGS[0][0]) unireg_abort(1); +#ifndef EMBEDDED_LIBRARY /* We have to initialize the storage engines before CSV logging */ init_global_table_stats(); init_global_index_stats(); +#endif if (ha_init()) { @@ -4163,9 +4167,11 @@ init_max_user_conn(); init_update_queries(); +#ifndef EMBEDDED_LIBRARY init_global_user_stats(); init_global_client_stats(); init_global_thread_stats(); +#endif DBUG_RETURN(0); } diff -ruN mysql-5.5.28/sql/sql_parse.cc mysql-5.5.28-new/sql/sql_parse.cc --- mysql-5.5.28/sql/sql_parse.cc 2012-11-21 08:50:42.000000000 -0500 +++ mysql-5.5.28-new/sql/sql_parse.cc 2012-11-21 08:40:35.000000000 -0500 @@ -5830,7 +5830,9 @@ } // Updates THD stats and the global user stats. thd->update_stats(true); +#ifndef EMBEDDED_LIBRARY update_global_user_stats(thd, true, time(NULL)); +#endif DBUG_VOID_RETURN; } diff -ruN mysql-5.5.28/sql/sql_prepare.cc mysql-5.5.28-new/sql/sql_prepare.cc --- mysql-5.5.28/sql/sql_prepare.cc 2012-11-21 08:50:28.000000000 -0500 +++ mysql-5.5.28-new/sql/sql_prepare.cc 2012-11-21 08:41:50.000000000 -0500 @@ -2281,7 +2281,9 @@ } // Updates THD stats and the global user stats. thd->update_stats(true); +#ifndef EMBEDDED_LIBRARY update_global_user_stats(thd, true, time(NULL)); +#endif DBUG_VOID_RETURN; } @@ -2732,7 +2734,10 @@ } // Updates THD stats and the global user stats. thd->update_stats(true); +#ifndef EMBEDDED_LIBRARY update_global_user_stats(thd, true, time(NULL)); +#endif + DBUG_VOID_RETURN; } @@ -2907,7 +2912,10 @@ } // Updates THD stats and the global user stats. thd->update_stats(true); +#ifndef EMBEDDED_LIBRARY update_global_user_stats(thd, true, time(NULL)); +#endif + DBUG_VOID_RETURN; } @@ -3033,7 +3041,9 @@ } // Updates THD stats and the global user stats. thd->update_stats(true); +#ifndef EMBEDDED_LIBRARY update_global_user_stats(thd, true, time(NULL)); +#endif DBUG_VOID_RETURN; } diff -ruN mysql-5.5.28/sql/sql_reload.cc mysql-5.5.28-new/sql/sql_reload.cc --- mysql-5.5.28/sql/sql_reload.cc 2012-11-21 08:50:28.000000000 -0500 +++ mysql-5.5.28-new/sql/sql_reload.cc 2012-11-21 08:48:06.000000000 -0500 @@ -322,6 +322,8 @@ #endif if (options & REFRESH_USER_RESOURCES) reset_mqh((LEX_USER *) NULL, 0); /* purecov: inspected */ + +#ifndef EMBEDDED_LIBRARY if (options & REFRESH_TABLE_STATS) { mysql_mutex_lock(&LOCK_global_table_stats); @@ -356,6 +358,7 @@ } mysql_mutex_unlock(&LOCK_global_user_client_stats); } +#endif if (*write_to_binlog != -1) *write_to_binlog= tmp_write_to_binlog; /*