Commit 2b4a8956 authored by unknown's avatar unknown

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.
parent a318c75a
......@@ -9,6 +9,7 @@ AC_CANONICAL_SYSTEM
# remember to also change ndb version below and update version.c in ndb
AM_INIT_AUTOMAKE(mysql, 5.0.39)
AM_CONFIG_HEADER(config.h)
is_this_community_tree=yes
PROTOCOL_VERSION=10
DOT_FRM_VERSION=6
......@@ -612,6 +613,23 @@ then
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,
[ --with-server-suffix Append value to the version string.],
......@@ -676,16 +694,23 @@ else
fi
# Add query profiler
AC_MSG_CHECKING(if SHOW PROFILE should be enabled.)
AC_ARG_ENABLE(profiling,
AS_HELP_STRING([--disable-profiling], [Build a version without query profiling code]),
[ ENABLED_PROFILING=$enableval ],
[ ENABLED_PROFILING=yes ])
[ ENABLED_PROFILING=$is_this_community_tree ])
if test "$ENABLED_PROFILING" = "yes"
then
if test "$ENABLE_COMMUNITY_FEATURES" = "yes";
then
AC_DEFINE([ENABLED_PROFILING], [1],
[If SHOW PROFILE should be enabled])
AC_MSG_RESULT([yes])
else
ENABLED_PROFILING="no"
AC_MSG_RESULT([no, overridden by community-features disabled])
fi
else
AC_MSG_RESULT([no])
fi
......
-- require r/profiling.require
disable_query_log;
show variables like "profiling";
enable_query_log;
Variable_name Value
profiling OFF
--source include/profiling.inc
# default is OFF
show session variables like 'profil%';
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. "
"(Default: no wait)", (gptr*) &mysqld_port_timeout,
(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",
(gptr*) &global_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). */
process_key_caches(reset_key_cache_counters);
#ifdef COMMUNITY_SERVER
flush_status_time= time((time_t*) 0);
#endif
pthread_mutex_unlock(&LOCK_status);
/*
......
......@@ -544,7 +544,7 @@ static sys_var_thd_bit sys_unique_checks("unique_checks", 0,
set_option_bit,
OPTION_RELAXED_UNIQUE_CHECKS,
1);
#ifdef ENABLED_PROFILING
#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
static sys_var_thd_bit sys_profiling("profiling", NULL, set_option_bit,
ulonglong(OPTION_PROFILING));
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_search_depth,
&sys_preload_buff_size,
#ifdef ENABLED_PROFILING
#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
&sys_profiling,
&sys_profiling_history_size,
#endif
......@@ -1021,7 +1021,7 @@ struct show_var_st init_vars[]= {
{"pid_file", (char*) pidfile_name, SHOW_CHAR},
{"port", (char*) &mysqld_port, SHOW_INT},
{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_history_size.name, (char*) &sys_profiling_history_size, SHOW_SYS},
#endif
......
......@@ -253,7 +253,7 @@ THD::THD()
init();
/* Initialize sub structures */
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);
#endif
user_connect=(USER_CONN *)0;
......
......@@ -1360,7 +1360,7 @@ class THD :public Statement,
List <MYSQL_ERROR> warn_list;
uint warn_count[(uint) MYSQL_ERROR::WARN_LEVEL_END];
uint total_warn_count;
#ifdef ENABLED_PROFILING
#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
PROFILING profiling;
#endif
......
......@@ -2746,7 +2746,7 @@ mysql_execute_command(THD *thd)
}
case SQLCOM_SHOW_PROFILES:
{
#ifdef ENABLED_PROFILING
#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
thd->profiling.store();
thd->profiling.discard();
res= thd->profiling.show_profiles();
......@@ -2760,7 +2760,7 @@ mysql_execute_command(THD *thd)
}
case SQLCOM_SHOW_PROFILE:
{
#ifdef ENABLED_PROFILING
#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
thd->profiling.store();
thd->profiling.discard(); // will get re-enabled by reset()
if (lex->profile_query_id != 0)
......@@ -5730,7 +5730,7 @@ mysql_init_query(THD *thd, uchar *buf, uint length)
DBUG_ENTER("mysql_init_query");
lex_start(thd, buf, length);
mysql_reset_thd_for_next_command(thd);
#ifdef ENABLED_PROFILING
#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
thd->profiling.reset();
#endif
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->rand_used= 0;
thd->sent_row_count= thd->examined_row_count= 0;
#ifdef ENABLED_PROFILING
#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
thd->profiling.reset();
#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")))
DBUG_VOID_RETURN;
#ifdef ENABLED_PROFILING
#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
thd->profiling.set_query_source(stmt->query, stmt->query_length);
#endif
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,
Item *cond)
{
#ifdef ENABLED_PROFILING
#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
return(thd->profiling.fill_statistics_info(thd, tables, cond));
#else
return(1);
......@@ -62,7 +62,7 @@ ST_FIELD_INFO query_profile_statistics_info[]=
{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_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)
#ifndef ENABLED_PROFILING
#if !defined(ENABLED_PROFILING) || !defined(COMMUNITY_SERVER)
# 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);
end= int10_to_str(nr, buff, 10);
break;
#ifdef COMMUNITY_SERVER
case SHOW_FLUSHTIME:
nr= (long) (thd->query_start() - flush_status_time);
end= int10_to_str(nr, buff, 10);
break;
#endif
case SHOW_QUESTION:
end= int10_to_str((long) thd->query_id, buff, 10);
break;
......
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