Commit 0901dbc5 authored by unknown's avatar unknown

Fix up merge. Some macros are now functions. Some functions are

renamed.  Some new THD proc_info states are new.  Directories must be
encountered in make in a specific order, to have symlinks already set.
Move community-server-specific tests into own tests, so that we can 
exempt them from testing on enterprise servers.


BitKeeper/deleted/.del-profiling.inc:
  Delete: mysql-test/include/profiling.inc
BitKeeper/deleted/.del-profiling.require:
  Delete: mysql-test/r/profiling.require
configure.in:
  Set a new order of sql_client_dirs, so that the make directory traversal
  doesn't miss symlink dependencies.
mysql-test/r/not_embedded_server.result:
  Account for new "executing" state.
mysql-test/t/information_schema.test:
  Move community-feature test to another test file.
mysql-test/t/profiling.test:
  Make test more generic to community features.
sql/lex.h:
  Add symbol lost in manual merge.
sql/mysql_priv.h:
  Insert a preprocessor layer between setting the caller and the function
  that sets the thread state, so we can get caller information.
sql/mysqld.cc:
  Add new server variable "have_community_features".
sql/set_var.cc:
  Add new server variable "have_community_features".
sql/sql_class.cc:
  Insert a preprocessor layer between setting the caller and the function
  that sets the thread state, so we can get caller information.
sql/sql_profile.cc:
  Function name change, my_strndup()
sql/sql_profile.h:
  Insert a preprocessor layer between setting the caller and the function
  that sets the thread state, so we can get caller information.
mysql-test/include/have_community_features.inc:
  New BitKeeper file ``mysql-test/include/have_community_features.inc''
mysql-test/r/have_community_features.require:
  New BitKeeper file ``mysql-test/r/have_community_features.require''
mysql-test/r/variables+c.result:
  New BitKeeper file ``mysql-test/r/variables+c.result''
mysql-test/t/variables+c.test:
  New BitKeeper file ``mysql-test/t/variables+c.test''
parent 4687fe01
...@@ -2496,16 +2496,17 @@ thread_dirs= ...@@ -2496,16 +2496,17 @@ thread_dirs=
dnl This probably should be cleaned up more - for now the threaded dnl This probably should be cleaned up more - for now the threaded
dnl client is just using plain-old libs. dnl client is just using plain-old libs.
sql_client_dirs="strings regex mysys libmysql client" sql_client_dirs="strings regex mysys libmysql"
AM_CONDITIONAL(THREAD_SAFE_CLIENT, test "$THREAD_SAFE_CLIENT" != "no") AM_CONDITIONAL(THREAD_SAFE_CLIENT, test "$THREAD_SAFE_CLIENT" != "no")
if test "$THREAD_SAFE_CLIENT" != "no" if test "$THREAD_SAFE_CLIENT" != "no"
then then
sql_client_dirs="libmysql_r $sql_client_dirs" sql_client_dirs="$sql_client_dirs libmysql_r"
AC_CONFIG_FILES(libmysql_r/Makefile) AC_CONFIG_FILES(libmysql_r/Makefile)
AC_DEFINE([THREAD_SAFE_CLIENT], [1], [Should the client be thread safe]) AC_DEFINE([THREAD_SAFE_CLIENT], [1], [Should the client be thread safe])
fi fi
sql_client_dirs="$sql_client_dirs client"
CLIENT_LIBS="$NON_THREADED_LIBS $openssl_libs $ZLIB_LIBS $STATIC_NSS_FLAGS" CLIENT_LIBS="$NON_THREADED_LIBS $openssl_libs $ZLIB_LIBS $STATIC_NSS_FLAGS"
......
--require r/have_community_features.require
--disable_query_log
show variables like "have_community_features";
--enable_query_log
-- require r/profiling.require
disable_query_log;
show variables like "profiling";
enable_query_log;
Variable_name Value Variable_name Value
profiling OFF have_community_features YES
prepare stmt1 from ' SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND!=\'Daemon\' '; prepare stmt1 from ' SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND!=\'Daemon\' ';
execute stmt1; execute stmt1;
ID USER HOST DB COMMAND TIME STATE INFO ID USER HOST DB COMMAND TIME STATE INFO
number root localhost test Query time preparing SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND!='Daemon' number root localhost test Query time executing SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND!='Daemon'
deallocate prepare stmt1; deallocate prepare stmt1;
show global status like "Uptime_%";
Variable_name Value
Uptime_since_flush_status #
flush status;
show global status like "Uptime_%";
Variable_name Value
Uptime_since_flush_status #
...@@ -1023,14 +1023,6 @@ where t.table_schema = 'information_schema' and ...@@ -1023,14 +1023,6 @@ where t.table_schema = 'information_schema' and
(c2.column_type = 'varchar(7)' or c2.column_type = 'varchar(20)') (c2.column_type = 'varchar(7)' or c2.column_type = 'varchar(20)')
group by c2.column_type order by num limit 1) group by c2.column_type order by num limit 1)
group by t.table_name order by num1, t.table_name; group by t.table_name order by num1, t.table_name;
# Bug#24822: Patch: uptime_since_flush_status
#
--replace_column 2 #
show global status like "Uptime_%";
flush status;
--replace_column 2 #
show global status like "Uptime_%"; # Almost certainly zero
--echo End of 5.0 tests. --echo End of 5.0 tests.
# #
......
--source include/profiling.inc --source include/have_community_features.inc
# default is OFF # default is OFF
show session variables like 'profil%'; show session variables like 'profil%';
......
--source include/have_community_features.inc
#
# Bug#24822: Patch: uptime_since_flush_status
#
--replace_column 2 #
show global status like "Uptime_%";
flush status;
--replace_column 2 #
show global status like "Uptime_%"; # Almost certainly zero
...@@ -387,6 +387,7 @@ static SYMBOL symbols[] = { ...@@ -387,6 +387,7 @@ static SYMBOL symbols[] = {
{ "PACK_KEYS", SYM(PACK_KEYS_SYM)}, { "PACK_KEYS", SYM(PACK_KEYS_SYM)},
{ "PARSER", SYM(PARSER_SYM)}, { "PARSER", SYM(PARSER_SYM)},
{ "PARTIAL", SYM(PARTIAL)}, { "PARTIAL", SYM(PARTIAL)},
{ "PAGE", SYM(PAGE_SYM)},
{ "PARTITION", SYM(PARTITION_SYM)}, { "PARTITION", SYM(PARTITION_SYM)},
{ "PARTITIONING", SYM(PARTITIONING_SYM)}, { "PARTITIONING", SYM(PARTITIONING_SYM)},
{ "PARTITIONS", SYM(PARTITIONS_SYM)}, { "PARTITIONS", SYM(PARTITIONS_SYM)},
......
...@@ -496,6 +496,8 @@ enum enum_parsing_place ...@@ -496,6 +496,8 @@ enum enum_parsing_place
}; };
struct st_table; struct st_table;
#define thd_proc_info(thd, msg) set_thd_proc_info(thd, msg, __func__, __FILE__, __LINE__)
class THD; class THD;
/* Struct to handle simple linked lists */ /* Struct to handle simple linked lists */
...@@ -1756,6 +1758,7 @@ extern SHOW_COMP_OPTION have_innodb; ...@@ -1756,6 +1758,7 @@ extern SHOW_COMP_OPTION have_innodb;
extern SHOW_COMP_OPTION have_csv_db; extern SHOW_COMP_OPTION have_csv_db;
extern SHOW_COMP_OPTION have_ndbcluster; extern SHOW_COMP_OPTION have_ndbcluster;
extern SHOW_COMP_OPTION have_partition_db; extern SHOW_COMP_OPTION have_partition_db;
extern SHOW_COMP_OPTION have_community_features;
extern handlerton *partition_hton; extern handlerton *partition_hton;
extern handlerton *myisam_hton; extern handlerton *myisam_hton;
......
...@@ -576,6 +576,7 @@ MY_LOCALE *my_default_lc_time_names; ...@@ -576,6 +576,7 @@ MY_LOCALE *my_default_lc_time_names;
SHOW_COMP_OPTION have_ssl, have_symlink, have_dlopen, have_query_cache; SHOW_COMP_OPTION have_ssl, have_symlink, have_dlopen, have_query_cache;
SHOW_COMP_OPTION have_geometry, have_rtree_keys; SHOW_COMP_OPTION have_geometry, have_rtree_keys;
SHOW_COMP_OPTION have_crypt, have_compress; SHOW_COMP_OPTION have_crypt, have_compress;
SHOW_COMP_OPTION have_community_features;
/* Thread specific variables */ /* Thread specific variables */
...@@ -6529,6 +6530,7 @@ static int show_starttime(THD *thd, SHOW_VAR *var, char *buff) ...@@ -6529,6 +6530,7 @@ static int show_starttime(THD *thd, SHOW_VAR *var, char *buff)
return 0; return 0;
} }
#ifdef COMMUNITY_SERVER
static int show_flushstatustime(THD *thd, SHOW_VAR *var, char *buff) static int show_flushstatustime(THD *thd, SHOW_VAR *var, char *buff)
{ {
var->type= SHOW_LONG; var->type= SHOW_LONG;
...@@ -6536,6 +6538,7 @@ static int show_flushstatustime(THD *thd, SHOW_VAR *var, char *buff) ...@@ -6536,6 +6538,7 @@ static int show_flushstatustime(THD *thd, SHOW_VAR *var, char *buff)
*((long *)buff)= (long) (thd->query_start() - flush_status_time); *((long *)buff)= (long) (thd->query_start() - flush_status_time);
return 0; return 0;
} }
#endif
#ifdef HAVE_REPLICATION #ifdef HAVE_REPLICATION
static int show_rpl_status(THD *thd, SHOW_VAR *var, char *buff) static int show_rpl_status(THD *thd, SHOW_VAR *var, char *buff)
...@@ -7089,7 +7092,9 @@ SHOW_VAR status_vars[]= { ...@@ -7089,7 +7092,9 @@ SHOW_VAR status_vars[]= {
{"Threads_created", (char*) &thread_created, SHOW_LONG_NOFLUSH}, {"Threads_created", (char*) &thread_created, SHOW_LONG_NOFLUSH},
{"Threads_running", (char*) &thread_running, SHOW_INT}, {"Threads_running", (char*) &thread_running, SHOW_INT},
{"Uptime", (char*) &show_starttime, SHOW_FUNC}, {"Uptime", (char*) &show_starttime, SHOW_FUNC},
#ifdef COMMUNITY_SERVER
{"Uptime_since_flush_status",(char*) &show_flushstatustime, SHOW_FUNC}, {"Uptime_since_flush_status",(char*) &show_flushstatustime, SHOW_FUNC},
#endif
{NullS, NullS, SHOW_LONG} {NullS, NullS, SHOW_LONG}
}; };
...@@ -7314,6 +7319,11 @@ static void mysql_init_variables(void) ...@@ -7314,6 +7319,11 @@ static void mysql_init_variables(void)
#else #else
have_partition_db= SHOW_OPTION_NO; have_partition_db= SHOW_OPTION_NO;
#endif #endif
#ifdef COMMUNITY_SERVER
have_community_features = SHOW_OPTION_YES;
#else
have_community_features = SHOW_OPTION_NO;
#endif
#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE #ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
have_ndbcluster=SHOW_OPTION_DISABLED; have_ndbcluster=SHOW_OPTION_DISABLED;
global_system_variables.ndb_index_stat_enable=FALSE; global_system_variables.ndb_index_stat_enable=FALSE;
......
...@@ -692,6 +692,7 @@ sys_var_have_variable sys_have_query_cache("have_query_cache", ...@@ -692,6 +692,7 @@ sys_var_have_variable sys_have_query_cache("have_query_cache",
&have_query_cache); &have_query_cache);
sys_var_have_variable sys_have_rtree_keys("have_rtree_keys", &have_rtree_keys); sys_var_have_variable sys_have_rtree_keys("have_rtree_keys", &have_rtree_keys);
sys_var_have_variable sys_have_symlink("have_symlink", &have_symlink); sys_var_have_variable sys_have_symlink("have_symlink", &have_symlink);
sys_var_have_variable sys_have_community_features("have_community_features", &have_community_features);
/* Global read-only variable describing server license */ /* Global read-only variable describing server license */
sys_var_const_str sys_license("license", STRINGIFY_ARG(LICENSE)); sys_var_const_str sys_license("license", STRINGIFY_ARG(LICENSE));
/* Global variables which enable|disable logging */ /* Global variables which enable|disable logging */
...@@ -803,6 +804,7 @@ SHOW_VAR init_vars[]= { ...@@ -803,6 +804,7 @@ SHOW_VAR init_vars[]= {
{sys_var_general_log_path.name, (char*) &sys_var_general_log_path, SHOW_SYS}, {sys_var_general_log_path.name, (char*) &sys_var_general_log_path, SHOW_SYS},
{sys_group_concat_max_len.name, (char*) &sys_group_concat_max_len, SHOW_SYS}, {sys_group_concat_max_len.name, (char*) &sys_group_concat_max_len, SHOW_SYS},
{sys_hostname.name, (char*) &sys_hostname, SHOW_SYS}, {sys_hostname.name, (char*) &sys_hostname, SHOW_SYS},
{sys_have_community_features.name, (char*) &have_community_features, SHOW_HAVE},
{sys_have_compress.name, (char*) &have_compress, SHOW_HAVE}, {sys_have_compress.name, (char*) &have_compress, SHOW_HAVE},
{sys_have_crypt.name, (char*) &have_crypt, SHOW_HAVE}, {sys_have_crypt.name, (char*) &have_crypt, SHOW_HAVE},
{sys_have_csv_db.name, (char*) &have_csv_db, SHOW_HAVE}, {sys_have_csv_db.name, (char*) &have_csv_db, SHOW_HAVE},
......
...@@ -181,9 +181,16 @@ my_bool thd_tablespace_op(const THD *thd) ...@@ -181,9 +181,16 @@ my_bool thd_tablespace_op(const THD *thd)
} }
const char *thd_proc_info(THD *thd, const char *info) const char *set_thd_proc_info(THD *thd, const char *info,
const char *calling_function,
const char *calling_file,
const unsigned int calling_line)
{ {
const char *old_info= thd->proc_info; const char *old_info= thd->proc_info;
DBUG_PRINT("proc_info", ("%s:%d %s", calling_file, calling_line, info));
#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
thd->profiling.status_change(info, calling_function, calling_file, calling_line);
#endif
thd->proc_info= info; thd->proc_info= info;
return old_info; return old_info;
} }
......
...@@ -177,7 +177,7 @@ void QUERY_PROFILE::set_query_source(char *query_source_arg, ...@@ -177,7 +177,7 @@ void QUERY_PROFILE::set_query_source(char *query_source_arg,
DBUG_ASSERT(query_source == NULL); DBUG_ASSERT(query_source == NULL);
if (query_source_arg != NULL) if (query_source_arg != NULL)
query_source= my_strdup_with_length(query_source_arg, length, MYF(0)); query_source= my_strndup(query_source_arg, length, MYF(0));
} }
QUERY_PROFILE::~QUERY_PROFILE() QUERY_PROFILE::~QUERY_PROFILE()
......
...@@ -53,24 +53,7 @@ int fill_query_profile_statistics_info(THD *thd, struct st_table_list *tables, I ...@@ -53,24 +53,7 @@ int fill_query_profile_statistics_info(THD *thd, struct st_table_list *tables, I
#define PROFILE_ALL (~0) #define PROFILE_ALL (~0)
#if !defined(ENABLED_PROFILING) || !defined(COMMUNITY_SERVER) #if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
# define thd_proc_info(thd, msg) do { (thd)->proc_info= (msg); } while (0)
#else
# define thd_proc_info(thd, msg) \
do { \
if (unlikely(((thd)->options & OPTION_PROFILING) != 0)) \
{ \
(thd)->profiling.status_change((msg), __func__, __FILE__, __LINE__); \
} \
else \
{ \
(thd)->proc_info= (msg); \
} \
} while (0)
#include "mysql_priv.h" #include "mysql_priv.h"
#ifdef HAVE_SYS_RESOURCE_H #ifdef HAVE_SYS_RESOURCE_H
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment