mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Wrap code specific to the comunity-server in additional CPP #ifdef .
Add a new autoconf paremeter --{en,dis}able-community-features . The default is disable for enterprise servers. Though this is a 5.0 tree, it is only to be merged into the 5.0-community tree and the global 5.1 tree, never to the 5.0-enterprise tree. configure.in: Add a new configure parameter, --enable-community-features for community features. mysql-test/t/profiling.test: Add testing for whether profiling is enabled or not. sql/mysqld.cc: Add additional "COMMUNITY_SERVER" cpp definition test. sql/set_var.cc: Add additional "COMMUNITY_SERVER" cpp definition test. sql/sql_class.cc: Add additional "COMMUNITY_SERVER" cpp definition test. sql/sql_class.h: Add additional "COMMUNITY_SERVER" cpp definition test. sql/sql_parse.cc: Add additional "COMMUNITY_SERVER" cpp definition test. sql/sql_prepare.cc: Add additional "COMMUNITY_SERVER" cpp definition test. sql/sql_profile.cc: Add additional "COMMUNITY_SERVER" cpp definition test. sql/sql_profile.h: Add additional "COMMUNITY_SERVER" cpp definition test. sql/sql_show.cc: Add "COMMUNITY_SERVER" cpp definition test. mysql-test/include/profiling.inc: Add testing for whether profiling is enabled or not. mysql-test/r/profiling.require: Add testing for whether profiling is enabled or not.
This commit is contained in:
27
configure.in
27
configure.in
@ -9,6 +9,7 @@ AC_CANONICAL_SYSTEM
|
|||||||
# remember to also change ndb version below and update version.c in ndb
|
# remember to also change ndb version below and update version.c in ndb
|
||||||
AM_INIT_AUTOMAKE(mysql, 5.0.39)
|
AM_INIT_AUTOMAKE(mysql, 5.0.39)
|
||||||
AM_CONFIG_HEADER(config.h)
|
AM_CONFIG_HEADER(config.h)
|
||||||
|
is_this_community_tree=yes
|
||||||
|
|
||||||
PROTOCOL_VERSION=10
|
PROTOCOL_VERSION=10
|
||||||
DOT_FRM_VERSION=6
|
DOT_FRM_VERSION=6
|
||||||
@ -612,6 +613,23 @@ then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
AC_MSG_CHECKING(whether features provided by the user community should be included.)
|
||||||
|
AC_ARG_ENABLE(community-features,
|
||||||
|
AC_HELP_STRING(
|
||||||
|
[--enable-community-features],
|
||||||
|
[Enable additional features provided by the user community.]),
|
||||||
|
[ ENABLE_COMMUNITY_FEATURES=$enableval ],
|
||||||
|
[ ENABLE_COMMUNITY_FEATURES=$is_this_community_tree ]
|
||||||
|
)
|
||||||
|
|
||||||
|
if test "$ENABLE_COMMUNITY_FEATURES" = "yes"
|
||||||
|
then
|
||||||
|
AC_DEFINE([COMMUNITY_SERVER], [1],
|
||||||
|
[Whether features provided by the user community should be included])
|
||||||
|
AC_MSG_RESULT([yes, community server])
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT([no, enterprise server])
|
||||||
|
fi
|
||||||
|
|
||||||
AC_ARG_WITH(server-suffix,
|
AC_ARG_WITH(server-suffix,
|
||||||
[ --with-server-suffix Append value to the version string.],
|
[ --with-server-suffix Append value to the version string.],
|
||||||
@ -676,16 +694,23 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Add query profiler
|
# Add query profiler
|
||||||
|
AC_MSG_CHECKING(if SHOW PROFILE should be enabled.)
|
||||||
AC_ARG_ENABLE(profiling,
|
AC_ARG_ENABLE(profiling,
|
||||||
AS_HELP_STRING([--disable-profiling], [Build a version without query profiling code]),
|
AS_HELP_STRING([--disable-profiling], [Build a version without query profiling code]),
|
||||||
[ ENABLED_PROFILING=$enableval ],
|
[ ENABLED_PROFILING=$enableval ],
|
||||||
[ ENABLED_PROFILING=yes ])
|
[ ENABLED_PROFILING=$is_this_community_tree ])
|
||||||
|
|
||||||
if test "$ENABLED_PROFILING" = "yes"
|
if test "$ENABLED_PROFILING" = "yes"
|
||||||
then
|
then
|
||||||
|
if test "$ENABLE_COMMUNITY_FEATURES" = "yes";
|
||||||
|
then
|
||||||
AC_DEFINE([ENABLED_PROFILING], [1],
|
AC_DEFINE([ENABLED_PROFILING], [1],
|
||||||
[If SHOW PROFILE should be enabled])
|
[If SHOW PROFILE should be enabled])
|
||||||
AC_MSG_RESULT([yes])
|
AC_MSG_RESULT([yes])
|
||||||
|
else
|
||||||
|
ENABLED_PROFILING="no"
|
||||||
|
AC_MSG_RESULT([no, overridden by community-features disabled])
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT([no])
|
AC_MSG_RESULT([no])
|
||||||
fi
|
fi
|
||||||
|
4
mysql-test/include/profiling.inc
Normal file
4
mysql-test/include/profiling.inc
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
-- require r/profiling.require
|
||||||
|
disable_query_log;
|
||||||
|
show variables like "profiling";
|
||||||
|
enable_query_log;
|
2
mysql-test/r/profiling.require
Normal file
2
mysql-test/r/profiling.require
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
Variable_name Value
|
||||||
|
profiling OFF
|
@ -1,3 +1,5 @@
|
|||||||
|
--source include/profiling.inc
|
||||||
|
|
||||||
# default is OFF
|
# default is OFF
|
||||||
show session variables like 'profil%';
|
show session variables like 'profil%';
|
||||||
select @@profiling;
|
select @@profiling;
|
||||||
|
@ -5346,7 +5346,7 @@ Disable with --skip-ndbcluster (will save memory).",
|
|||||||
"Maximum time in seconds to wait for the port to become free. "
|
"Maximum time in seconds to wait for the port to become free. "
|
||||||
"(Default: no wait)", (gptr*) &mysqld_port_timeout,
|
"(Default: no wait)", (gptr*) &mysqld_port_timeout,
|
||||||
(gptr*) &mysqld_port_timeout, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
(gptr*) &mysqld_port_timeout, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
#ifdef ENABLED_PROFILING
|
#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
|
||||||
{"profiling_history_size", OPT_PROFILING, "Limit of query profiling memory",
|
{"profiling_history_size", OPT_PROFILING, "Limit of query profiling memory",
|
||||||
(gptr*) &global_system_variables.profiling_history_size,
|
(gptr*) &global_system_variables.profiling_history_size,
|
||||||
(gptr*) &max_system_variables.profiling_history_size,
|
(gptr*) &max_system_variables.profiling_history_size,
|
||||||
@ -7685,7 +7685,9 @@ void refresh_status(THD *thd)
|
|||||||
|
|
||||||
/* Reset the counters of all key caches (default and named). */
|
/* Reset the counters of all key caches (default and named). */
|
||||||
process_key_caches(reset_key_cache_counters);
|
process_key_caches(reset_key_cache_counters);
|
||||||
|
#ifdef COMMUNITY_SERVER
|
||||||
flush_status_time= time((time_t*) 0);
|
flush_status_time= time((time_t*) 0);
|
||||||
|
#endif
|
||||||
pthread_mutex_unlock(&LOCK_status);
|
pthread_mutex_unlock(&LOCK_status);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -544,7 +544,7 @@ static sys_var_thd_bit sys_unique_checks("unique_checks", 0,
|
|||||||
set_option_bit,
|
set_option_bit,
|
||||||
OPTION_RELAXED_UNIQUE_CHECKS,
|
OPTION_RELAXED_UNIQUE_CHECKS,
|
||||||
1);
|
1);
|
||||||
#ifdef ENABLED_PROFILING
|
#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
|
||||||
static sys_var_thd_bit sys_profiling("profiling", NULL, set_option_bit,
|
static sys_var_thd_bit sys_profiling("profiling", NULL, set_option_bit,
|
||||||
ulonglong(OPTION_PROFILING));
|
ulonglong(OPTION_PROFILING));
|
||||||
static sys_var_thd_ulong sys_profiling_history_size("profiling_history_size",
|
static sys_var_thd_ulong sys_profiling_history_size("profiling_history_size",
|
||||||
@ -706,7 +706,7 @@ sys_var *sys_variables[]=
|
|||||||
&sys_optimizer_prune_level,
|
&sys_optimizer_prune_level,
|
||||||
&sys_optimizer_search_depth,
|
&sys_optimizer_search_depth,
|
||||||
&sys_preload_buff_size,
|
&sys_preload_buff_size,
|
||||||
#ifdef ENABLED_PROFILING
|
#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
|
||||||
&sys_profiling,
|
&sys_profiling,
|
||||||
&sys_profiling_history_size,
|
&sys_profiling_history_size,
|
||||||
#endif
|
#endif
|
||||||
@ -1021,7 +1021,7 @@ struct show_var_st init_vars[]= {
|
|||||||
{"pid_file", (char*) pidfile_name, SHOW_CHAR},
|
{"pid_file", (char*) pidfile_name, SHOW_CHAR},
|
||||||
{"port", (char*) &mysqld_port, SHOW_INT},
|
{"port", (char*) &mysqld_port, SHOW_INT},
|
||||||
{sys_preload_buff_size.name, (char*) &sys_preload_buff_size, SHOW_SYS},
|
{sys_preload_buff_size.name, (char*) &sys_preload_buff_size, SHOW_SYS},
|
||||||
#ifdef ENABLED_PROFILING
|
#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
|
||||||
{sys_profiling.name, (char*) &sys_profiling, SHOW_SYS},
|
{sys_profiling.name, (char*) &sys_profiling, SHOW_SYS},
|
||||||
{sys_profiling_history_size.name, (char*) &sys_profiling_history_size, SHOW_SYS},
|
{sys_profiling_history_size.name, (char*) &sys_profiling_history_size, SHOW_SYS},
|
||||||
#endif
|
#endif
|
||||||
|
@ -253,7 +253,7 @@ THD::THD()
|
|||||||
init();
|
init();
|
||||||
/* Initialize sub structures */
|
/* Initialize sub structures */
|
||||||
init_sql_alloc(&warn_root, WARN_ALLOC_BLOCK_SIZE, WARN_ALLOC_PREALLOC_SIZE);
|
init_sql_alloc(&warn_root, WARN_ALLOC_BLOCK_SIZE, WARN_ALLOC_PREALLOC_SIZE);
|
||||||
#ifdef ENABLED_PROFILING
|
#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
|
||||||
profiling.set_thd(this);
|
profiling.set_thd(this);
|
||||||
#endif
|
#endif
|
||||||
user_connect=(USER_CONN *)0;
|
user_connect=(USER_CONN *)0;
|
||||||
|
@ -1360,7 +1360,7 @@ public:
|
|||||||
List <MYSQL_ERROR> warn_list;
|
List <MYSQL_ERROR> warn_list;
|
||||||
uint warn_count[(uint) MYSQL_ERROR::WARN_LEVEL_END];
|
uint warn_count[(uint) MYSQL_ERROR::WARN_LEVEL_END];
|
||||||
uint total_warn_count;
|
uint total_warn_count;
|
||||||
#ifdef ENABLED_PROFILING
|
#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
|
||||||
PROFILING profiling;
|
PROFILING profiling;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2746,7 +2746,7 @@ mysql_execute_command(THD *thd)
|
|||||||
}
|
}
|
||||||
case SQLCOM_SHOW_PROFILES:
|
case SQLCOM_SHOW_PROFILES:
|
||||||
{
|
{
|
||||||
#ifdef ENABLED_PROFILING
|
#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
|
||||||
thd->profiling.store();
|
thd->profiling.store();
|
||||||
thd->profiling.discard();
|
thd->profiling.discard();
|
||||||
res= thd->profiling.show_profiles();
|
res= thd->profiling.show_profiles();
|
||||||
@ -2760,7 +2760,7 @@ mysql_execute_command(THD *thd)
|
|||||||
}
|
}
|
||||||
case SQLCOM_SHOW_PROFILE:
|
case SQLCOM_SHOW_PROFILE:
|
||||||
{
|
{
|
||||||
#ifdef ENABLED_PROFILING
|
#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
|
||||||
thd->profiling.store();
|
thd->profiling.store();
|
||||||
thd->profiling.discard(); // will get re-enabled by reset()
|
thd->profiling.discard(); // will get re-enabled by reset()
|
||||||
if (lex->profile_query_id != 0)
|
if (lex->profile_query_id != 0)
|
||||||
@ -5730,7 +5730,7 @@ mysql_init_query(THD *thd, uchar *buf, uint length)
|
|||||||
DBUG_ENTER("mysql_init_query");
|
DBUG_ENTER("mysql_init_query");
|
||||||
lex_start(thd, buf, length);
|
lex_start(thd, buf, length);
|
||||||
mysql_reset_thd_for_next_command(thd);
|
mysql_reset_thd_for_next_command(thd);
|
||||||
#ifdef ENABLED_PROFILING
|
#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
|
||||||
thd->profiling.reset();
|
thd->profiling.reset();
|
||||||
#endif
|
#endif
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
@ -5774,7 +5774,7 @@ void mysql_reset_thd_for_next_command(THD *thd)
|
|||||||
thd->total_warn_count=0; // Warnings for this query
|
thd->total_warn_count=0; // Warnings for this query
|
||||||
thd->rand_used= 0;
|
thd->rand_used= 0;
|
||||||
thd->sent_row_count= thd->examined_row_count= 0;
|
thd->sent_row_count= thd->examined_row_count= 0;
|
||||||
#ifdef ENABLED_PROFILING
|
#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
|
||||||
thd->profiling.reset();
|
thd->profiling.reset();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -2231,7 +2231,7 @@ void mysql_stmt_execute(THD *thd, char *packet_arg, uint packet_length)
|
|||||||
if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_execute")))
|
if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_execute")))
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
|
|
||||||
#ifdef ENABLED_PROFILING
|
#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
|
||||||
thd->profiling.set_query_source(stmt->query, stmt->query_length);
|
thd->profiling.set_query_source(stmt->query, stmt->query_length);
|
||||||
#endif
|
#endif
|
||||||
DBUG_PRINT("exec_query", ("%s", stmt->query));
|
DBUG_PRINT("exec_query", ("%s", stmt->query));
|
||||||
|
@ -31,7 +31,7 @@ const char * const _unknown_func_ = "<unknown>";
|
|||||||
int fill_query_profile_statistics_info(THD *thd, struct st_table_list *tables,
|
int fill_query_profile_statistics_info(THD *thd, struct st_table_list *tables,
|
||||||
Item *cond)
|
Item *cond)
|
||||||
{
|
{
|
||||||
#ifdef ENABLED_PROFILING
|
#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
|
||||||
return(thd->profiling.fill_statistics_info(thd, tables, cond));
|
return(thd->profiling.fill_statistics_info(thd, tables, cond));
|
||||||
#else
|
#else
|
||||||
return(1);
|
return(1);
|
||||||
@ -62,7 +62,7 @@ ST_FIELD_INFO query_profile_statistics_info[]=
|
|||||||
{NULL, 0, MYSQL_TYPE_STRING, 0, true, NULL}
|
{NULL, 0, MYSQL_TYPE_STRING, 0, true, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef ENABLED_PROFILING
|
#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
|
||||||
|
|
||||||
#define RUSAGE_USEC(tv) ((tv).tv_sec*1000*1000 + (tv).tv_usec)
|
#define RUSAGE_USEC(tv) ((tv).tv_sec*1000*1000 + (tv).tv_usec)
|
||||||
#define RUSAGE_DIFF_USEC(tv1, tv2) (RUSAGE_USEC((tv1))-RUSAGE_USEC((tv2)))
|
#define RUSAGE_DIFF_USEC(tv1, tv2) (RUSAGE_USEC((tv1))-RUSAGE_USEC((tv2)))
|
||||||
|
@ -53,7 +53,7 @@ int fill_query_profile_statistics_info(THD *thd, struct st_table_list *tables, I
|
|||||||
#define PROFILE_ALL (~0)
|
#define PROFILE_ALL (~0)
|
||||||
|
|
||||||
|
|
||||||
#ifndef ENABLED_PROFILING
|
#if !defined(ENABLED_PROFILING) || !defined(COMMUNITY_SERVER)
|
||||||
|
|
||||||
# define thd_proc_info(thd, msg) do { (thd)->proc_info= (msg); } while (0)
|
# define thd_proc_info(thd, msg) do { (thd)->proc_info= (msg); } while (0)
|
||||||
|
|
||||||
|
@ -1496,10 +1496,12 @@ static bool show_status_array(THD *thd, const char *wild,
|
|||||||
nr= (long) (thd->query_start() - server_start_time);
|
nr= (long) (thd->query_start() - server_start_time);
|
||||||
end= int10_to_str(nr, buff, 10);
|
end= int10_to_str(nr, buff, 10);
|
||||||
break;
|
break;
|
||||||
|
#ifdef COMMUNITY_SERVER
|
||||||
case SHOW_FLUSHTIME:
|
case SHOW_FLUSHTIME:
|
||||||
nr= (long) (thd->query_start() - flush_status_time);
|
nr= (long) (thd->query_start() - flush_status_time);
|
||||||
end= int10_to_str(nr, buff, 10);
|
end= int10_to_str(nr, buff, 10);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
case SHOW_QUESTION:
|
case SHOW_QUESTION:
|
||||||
end= int10_to_str((long) thd->query_id, buff, 10);
|
end= int10_to_str((long) thd->query_id, buff, 10);
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user