diff options
author | cmiller@zippy.cornsilk.net <> | 2007-04-24 18:11:55 -0400 |
---|---|---|
committer | cmiller@zippy.cornsilk.net <> | 2007-04-24 18:11:55 -0400 |
commit | 93e804a6168d6e12deb5fdc26a2422f21a05db92 (patch) | |
tree | dc6a44bf8c50bd1fc1d33f5a47a8887065892cb4 | |
parent | bbd8b850cd61b1326849c45153a2a0c694cb12b1 (diff) | |
download | mariadb-git-93e804a6168d6e12deb5fdc26a2422f21a05db92.tar.gz |
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.
-rw-r--r-- | configure.in | 33 | ||||
-rw-r--r-- | mysql-test/include/profiling.inc | 4 | ||||
-rw-r--r-- | mysql-test/r/profiling.require | 2 | ||||
-rw-r--r-- | mysql-test/t/profiling.test | 2 | ||||
-rw-r--r-- | sql/mysqld.cc | 4 | ||||
-rw-r--r-- | sql/set_var.cc | 6 | ||||
-rw-r--r-- | sql/sql_class.cc | 2 | ||||
-rw-r--r-- | sql/sql_class.h | 2 | ||||
-rw-r--r-- | sql/sql_parse.cc | 8 | ||||
-rw-r--r-- | sql/sql_prepare.cc | 2 | ||||
-rw-r--r-- | sql/sql_profile.cc | 4 | ||||
-rw-r--r-- | sql/sql_profile.h | 2 | ||||
-rw-r--r-- | sql/sql_show.cc | 2 |
13 files changed, 55 insertions, 18 deletions
diff --git a/configure.in b/configure.in index f1a71d49359..a4ad7b5d875 100644 --- a/configure.in +++ b/configure.in @@ -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 - AC_DEFINE([ENABLED_PROFILING], [1], - [If SHOW PROFILE should be enabled]) - AC_MSG_RESULT([yes]) + 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 diff --git a/mysql-test/include/profiling.inc b/mysql-test/include/profiling.inc new file mode 100644 index 00000000000..bc2228eaa10 --- /dev/null +++ b/mysql-test/include/profiling.inc @@ -0,0 +1,4 @@ +-- require r/profiling.require +disable_query_log; +show variables like "profiling"; +enable_query_log; diff --git a/mysql-test/r/profiling.require b/mysql-test/r/profiling.require new file mode 100644 index 00000000000..a5f2b71f22a --- /dev/null +++ b/mysql-test/r/profiling.require @@ -0,0 +1,2 @@ +Variable_name Value +profiling OFF diff --git a/mysql-test/t/profiling.test b/mysql-test/t/profiling.test index fd7562f6f16..549d075d227 100644 --- a/mysql-test/t/profiling.test +++ b/mysql-test/t/profiling.test @@ -1,3 +1,5 @@ +--source include/profiling.inc + # default is OFF show session variables like 'profil%'; select @@profiling; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 864570f67b4..8ea6d99c0e1 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -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); /* diff --git a/sql/set_var.cc b/sql/set_var.cc index 49d224595c5..7c79dd0be5c 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -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 diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 7a2f58a1376..2d056328220 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -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; diff --git a/sql/sql_class.h b/sql/sql_class.h index a9a828e80c8..34d230ae5a7 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1360,7 +1360,7 @@ public: 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 diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 3eb61e29270..14a84abd7ae 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -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 } diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 9d2c23c720f..99cd5638d40 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -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)); diff --git a/sql/sql_profile.cc b/sql/sql_profile.cc index 91b0b062e4f..77dea4f9954 100644 --- a/sql/sql_profile.cc +++ b/sql/sql_profile.cc @@ -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))) diff --git a/sql/sql_profile.h b/sql/sql_profile.h index b82b5ce090c..c070f2f72d7 100644 --- a/sql/sql_profile.h +++ b/sql/sql_profile.h @@ -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) diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 7da4ac55e92..8022efbc71d 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -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; |