MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Jim Winstead Date:May 8 2006 11:38pm
Subject:bk commit into 5.0 tree (jimw:1.2123) BUG#19616
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of jimw. When jimw does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2123 06/05/08 16:38:45 jimw@stripped +8 -0
  Bug #1039: tmpdir and datadir not available via @@ system variable syntax
  Bug #19606: ssl variables are not displayed in show variables
  Bug #19616: log_queries_not_using_indexes  is not listed in show variables
  
    Make basedir, datadir, tmpdir, log_queries_not_using_indexes, ssl_ca,
    ssl_capath, ssl_cert, ssl_cipher, and ssl_key all available both from
    SHOW VARIABLES and as @@variables.
  
    As a side-effect of this change, log_queries_not_using_indexes can
    be changed at runtime (but only globally, not per-connection).

  sql/set_var.h
    1.75 06/05/08 16:38:42 jimw@stripped +29 -0
    Add new sys_var_constr_str_ptr class, for when we have a system variable
    that is only set via the command-line that is a pointer to a string.

  sql/set_var.cc
    1.155 06/05/08 16:38:42 jimw@stripped +66 -3
    Handle basedir, datadir, tmpdir, log_queries_not_using_indexes, and
    various ssl settings so that they are accessible as server variables
    and listed in SHOW VARIABLES.

  sql/mysqld.cc
    1.545 06/05/08 16:38:41 jimw@stripped +2 -1
    Handle opt_log_queries_not_using_indexes as extern, and define
    SSL_VARS_NO_STATIC so they can be accessed outside of mysqld.cc

  sql/mysql_priv.h
    1.385 06/05/08 16:38:41 jimw@stripped +1 -0
    Add extern for opt_log_queries_not_using_indexes

  mysql-test/t/variables.test
    1.59 06/05/08 16:38:41 jimw@stripped +30 -0
    Add new regression tests

  mysql-test/r/variables.result
    1.83 06/05/08 16:38:41 jimw@stripped +28 -0
    Add new results

  include/sslopt-vars.h
    1.6 06/05/08 16:38:41 jimw@stripped +11 -6
    Allow define of SSL_VARS_NOT_STATIC to prevent variables from not being
    made static.

  include/sslopt-longopts.h
    1.10 06/05/08 16:38:41 jimw@stripped +6 -6
    Put options in alphabetical order

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	jimw
# Host:	rama.(none)
# Root:	/home/jimw/my/mysql-5.0-1039

--- 1.9/include/sslopt-longopts.h	2003-06-12 12:59:18 -07:00
+++ 1.10/include/sslopt-longopts.h	2006-05-08 16:38:41 -07:00
@@ -20,12 +20,6 @@
    "Enable SSL for connection (automatically enabled with other flags). Disable with --skip-ssl.",
  (gptr*) &opt_use_ssl, (gptr*) &opt_use_ssl, 0, GET_BOOL, NO_ARG, 0, 0, 0,
    0, 0, 0},
-  {"ssl-key", OPT_SSL_KEY, "X509 key in PEM format (implies --ssl).",
-   (gptr*) &opt_ssl_key, (gptr*) &opt_ssl_key, 0, GET_STR, REQUIRED_ARG,
-   0, 0, 0, 0, 0, 0},
-  {"ssl-cert", OPT_SSL_CERT, "X509 cert in PEM format (implies --ssl).",
-   (gptr*) &opt_ssl_cert, (gptr*) &opt_ssl_cert, 0, GET_STR, REQUIRED_ARG,
-   0, 0, 0, 0, 0, 0},
   {"ssl-ca", OPT_SSL_CA,
    "CA file in PEM format (check OpenSSL docs, implies --ssl).",
    (gptr*) &opt_ssl_ca, (gptr*) &opt_ssl_ca, 0, GET_STR, REQUIRED_ARG,
@@ -34,8 +28,14 @@
    "CA directory (check OpenSSL docs, implies --ssl).",
    (gptr*) &opt_ssl_capath, (gptr*) &opt_ssl_capath, 0, GET_STR, REQUIRED_ARG,
    0, 0, 0, 0, 0, 0},
+  {"ssl-cert", OPT_SSL_CERT, "X509 cert in PEM format (implies --ssl).",
+   (gptr*) &opt_ssl_cert, (gptr*) &opt_ssl_cert, 0, GET_STR, REQUIRED_ARG,
+   0, 0, 0, 0, 0, 0},
   {"ssl-cipher", OPT_SSL_CIPHER, "SSL cipher to use (implies --ssl).",
    (gptr*) &opt_ssl_cipher, (gptr*) &opt_ssl_cipher, 0, GET_STR, REQUIRED_ARG,
+   0, 0, 0, 0, 0, 0},
+  {"ssl-key", OPT_SSL_KEY, "X509 key in PEM format (implies --ssl).",
+   (gptr*) &opt_ssl_key, (gptr*) &opt_ssl_key, 0, GET_STR, REQUIRED_ARG,
    0, 0, 0, 0, 0, 0},
 
 #endif /* HAVE_OPENSSL */

--- 1.5/include/sslopt-vars.h	2001-12-06 04:10:38 -08:00
+++ 1.6/include/sslopt-vars.h	2006-05-08 16:38:41 -07:00
@@ -15,10 +15,15 @@
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
 #ifdef HAVE_OPENSSL
-static my_bool opt_use_ssl  = 0;
-static char *opt_ssl_key    = 0;
-static char *opt_ssl_cert   = 0;
-static char *opt_ssl_ca     = 0;
-static char *opt_ssl_capath = 0;
-static char *opt_ssl_cipher = 0;
+#ifdef SSL_VARS_NOT_STATIC
+#define SSL_STATIC
+#else
+#define SSL_STATIC static
+#endif
+SSL_STATIC my_bool opt_use_ssl  = 0;
+SSL_STATIC char *opt_ssl_ca     = 0;
+SSL_STATIC char *opt_ssl_capath = 0;
+SSL_STATIC char *opt_ssl_cert   = 0;
+SSL_STATIC char *opt_ssl_cipher = 0;
+SSL_STATIC char *opt_ssl_key    = 0;
 #endif

--- 1.384/sql/mysql_priv.h	2006-05-03 19:38:29 -07:00
+++ 1.385/sql/mysql_priv.h	2006-05-08 16:38:41 -07:00
@@ -1185,6 +1185,7 @@
 extern bool opt_using_transactions, mysqld_embedded;
 extern bool using_update_log, opt_large_files, server_id_supplied;
 extern bool opt_log, opt_update_log, opt_bin_log, opt_slow_log, opt_error_log;
+extern my_bool opt_log_queries_not_using_indexes;
 extern bool opt_disable_networking, opt_skip_show_db;
 extern my_bool opt_character_set_client_handshake;
 extern bool volatile abort_loop, shutdown_in_progress, grant_option;

--- 1.544/sql/mysqld.cc	2006-04-18 08:07:26 -07:00
+++ 1.545/sql/mysqld.cc	2006-05-08 16:38:41 -07:00
@@ -311,7 +311,6 @@
 static my_bool opt_debugging= 0, opt_external_locking= 0, opt_console= 0;
 static my_bool opt_bdb, opt_isam, opt_ndbcluster;
 static my_bool opt_short_log_format= 0;
-static my_bool opt_log_queries_not_using_indexes= 0;
 static uint kill_cached_threads, wake_thread;
 static ulong killed_threads, thread_created;
 static ulong max_used_connections;
@@ -337,6 +336,7 @@
 /* Global variables */
 
 bool opt_log, opt_update_log, opt_bin_log, opt_slow_log;
+my_bool opt_log_queries_not_using_indexes= 0;
 bool opt_error_log= IF_WIN(1,0);
 bool opt_disable_networking=0, opt_skip_show_db=0;
 my_bool opt_character_set_client_handshake= 1;
@@ -603,6 +603,7 @@
 HANDLE smem_event_connect_request= 0;
 #endif
 
+#define SSL_VARS_NOT_STATIC
 #include "sslopt-vars.h"
 #ifdef HAVE_OPENSSL
 #include <openssl/crypto.h>

--- 1.82/mysql-test/r/variables.result	2006-04-26 11:39:44 -07:00
+++ 1.83/mysql-test/r/variables.result	2006-05-08 16:38:41 -07:00
@@ -612,4 +612,32 @@
 @@version_compile_os;
 @@version	@@version_comment	@@version_compile_machine	@@version_compile_os
 #	#	#	#
+select @@basedir, @@datadir, @@tmpdir;
+@@basedir	@@datadir	@@tmpdir
+#	#	#
+show variables like 'basedir';
+Variable_name	Value
+basedir	#
+show variables like 'datadir';
+Variable_name	Value
+datadir	#
+show variables like 'tmpdir';
+Variable_name	Value
+tmpdir	#
+select @@ssl_ca, @@ssl_capath, @@ssl_cert, @@ssl_cipher, @@ssl_key;
+@@ssl_ca	@@ssl_capath	@@ssl_cert	@@ssl_cipher	@@ssl_key
+#	#	#	#	#
+show variables like 'ssl%';
+Variable_name	Value
+ssl_ca	#
+ssl_capath	#
+ssl_cert	#
+ssl_cipher	#
+ssl_key	#
+select @@log_queries_not_using_indexes;
+@@log_queries_not_using_indexes
+0
+show variables like 'log_queries_not_using_indexes';
+Variable_name	Value
+log_queries_not_using_indexes	OFF
 End of 5.0 tests

--- 1.58/mysql-test/t/variables.test	2006-04-26 11:39:44 -07:00
+++ 1.59/mysql-test/t/variables.test	2006-05-08 16:38:41 -07:00
@@ -508,4 +508,34 @@
 select @@version, @@version_comment, @@version_compile_machine,
        @@version_compile_os;
 
+#
+# Bug #1039: make tmpdir and datadir available as @@variables (also included
+# basedir)
+#
+# Don't actually output, since it depends on the system
+--replace_column 1 # 2 # 3 #
+select @@basedir, @@datadir, @@tmpdir;
+--replace_column 2 #
+show variables like 'basedir';
+--replace_column 2 #
+show variables like 'datadir';
+--replace_column 2 #
+show variables like 'tmpdir';
+
+#
+# Bug #19606: make ssl settings available via SHOW VARIABLES and @@variables
+# 
+# Don't actually output, since it depends on the system
+--replace_column 1 # 2 # 3 # 4 # 5 #
+select @@ssl_ca, @@ssl_capath, @@ssl_cert, @@ssl_cipher, @@ssl_key;
+--replace_column 2 #
+show variables like 'ssl%';
+
+#
+# Bug #19616: make log_queries_not_using_indexes available in SHOW VARIABLES
+# and as @@log_queries_not_using_indexes
+#
+select @@log_queries_not_using_indexes;
+show variables like 'log_queries_not_using_indexes';
+
 --echo End of 5.0 tests

--- 1.154/sql/set_var.cc	2006-05-04 08:35:52 -07:00
+++ 1.155/sql/set_var.cc	2006-05-08 16:38:42 -07:00
@@ -122,6 +122,7 @@
 static byte *get_warning_count(THD *thd);
 static byte *get_prepared_stmt_count(THD *thd);
 static byte *get_have_innodb(THD *thd);
+static byte *get_tmpdir(THD *thd);
 
 /*
   Variable definition list
@@ -138,6 +139,7 @@
 sys_var_bool_ptr	sys_automatic_sp_privileges("automatic_sp_privileges",
 					      &sp_automatic_privileges);
 
+sys_var_const_str       sys_basedir("basedir", mysql_home);
 sys_var_long_ptr	sys_binlog_cache_size("binlog_cache_size",
 					      &binlog_cache_size);
 sys_var_thd_ulong	sys_bulk_insert_buff_size("bulk_insert_buffer_size",
@@ -161,6 +163,7 @@
                                               &myisam_concurrent_insert);
 sys_var_long_ptr	sys_connect_timeout("connect_timeout",
 					    &connect_timeout);
+sys_var_const_str       sys_datadir("datadir", mysql_real_data_home);
 sys_var_enum		sys_delay_key_write("delay_key_write",
 					    &delay_key_write_options,
 					    &delay_key_write_typelib,
@@ -208,6 +211,9 @@
 sys_var_bool_ptr
 sys_trust_function_creators("log_bin_trust_function_creators",
                             &trust_function_creators);
+sys_var_bool_ptr
+  sys_log_queries_not_using_indexes("log_queries_not_using_indexes",
+                                    &opt_log_queries_not_using_indexes);
 sys_var_thd_ulong	sys_log_warnings("log_warnings", &SV::log_warnings);
 sys_var_thd_ulong	sys_long_query_time("long_query_time",
 					     &SV::long_query_time);
@@ -331,6 +337,7 @@
 sys_var_thd_ulong	sys_query_prealloc_size("query_prealloc_size",
 						&SV::query_prealloc_size,
 						0, fix_thd_mem_root);
+sys_var_readonly        sys_tmpdir("tmpdir", OPT_GLOBAL, SHOW_CHAR, get_tmpdir);
 sys_var_thd_ulong	sys_trans_alloc_block_size("transaction_alloc_block_size",
 						   &SV::trans_alloc_block_size,
 						   0, fix_trans_mem_root);
@@ -367,6 +374,21 @@
 					&SV::sortbuff_size);
 sys_var_thd_sql_mode    sys_sql_mode("sql_mode",
                                      &SV::sql_mode);
+#ifdef HAVE_OPENSSL
+extern char *opt_ssl_ca, *opt_ssl_capath, *opt_ssl_cert, *opt_ssl_cipher,
+            *opt_ssl_key;
+sys_var_const_str_ptr	sys_ssl_ca("ssl_ca", &opt_ssl_ca);
+sys_var_const_str_ptr	sys_ssl_capath("ssl_capath", &opt_ssl_capath);
+sys_var_const_str_ptr	sys_ssl_cert("ssl_cert", &opt_ssl_cert);
+sys_var_const_str_ptr	sys_ssl_cipher("ssl_cipher", &opt_ssl_cipher);
+sys_var_const_str_ptr	sys_ssl_key("ssl_key", &opt_ssl_key);
+#else
+sys_var_const_str	sys_ssl_ca("ssl_ca", NULL);
+sys_var_const_str	sys_ssl_capath("ssl_capath", NULL);
+sys_var_const_str	sys_ssl_cert("ssl_cert", NULL);
+sys_var_const_str	sys_ssl_cipher("ssl_cipher", NULL);
+sys_var_const_str	sys_ssl_key("ssl_key", NULL);
+#endif
 sys_var_thd_enum
 sys_updatable_views_with_limit("updatable_views_with_limit",
                                &SV::updatable_views_with_limit,
@@ -582,6 +604,7 @@
   &sys_auto_increment_offset,
   &sys_autocommit,
   &sys_automatic_sp_privileges,
+  &sys_basedir,
   &sys_big_tables,
   &sys_big_selects,
   &sys_binlog_cache_size,
@@ -600,6 +623,7 @@
   &sys_completion_type,
   &sys_concurrent_insert,
   &sys_connect_timeout,
+  &sys_datadir,
   &sys_date_format,
   &sys_datetime_format,
   &sys_div_precincrement,
@@ -631,6 +655,7 @@
   &sys_local_infile,
   &sys_log_binlog,
   &sys_log_off,
+  &sys_log_queries_not_using_indexes,
   &sys_log_update,
   &sys_log_warnings,
   &sys_long_query_time,
@@ -710,6 +735,11 @@
   &sys_sql_mode,
   &sys_sql_warnings,
   &sys_sql_notes,
+  &sys_ssl_ca,
+  &sys_ssl_capath,
+  &sys_ssl_cert,
+  &sys_ssl_cipher,
+  &sys_ssl_key,
   &sys_storage_engine,
 #ifdef HAVE_REPLICATION
   &sys_sync_binlog_period,
@@ -724,6 +754,7 @@
   &sys_timed_mutexes,
   &sys_timestamp,
   &sys_time_zone,
+  &sys_tmpdir,
   &sys_tmp_table_size,
   &sys_trans_alloc_block_size,
   &sys_trans_prealloc_size,
@@ -775,7 +806,7 @@
   {"auto_increment_offset",   (char*) &sys_auto_increment_offset, SHOW_SYS},
   {sys_automatic_sp_privileges.name,(char*) &sys_automatic_sp_privileges,       SHOW_SYS},
   {"back_log",                (char*) &back_log,                    SHOW_LONG},
-  {"basedir",                 mysql_home,                           SHOW_CHAR},
+  {sys_basedir.name,          (char*) &sys_basedir,                 SHOW_SYS},
 #ifdef HAVE_BERKELEY_DB
   {"bdb_cache_size",          (char*) &berkeley_cache_size,         SHOW_LONG},
   {"bdb_home",                (char*) &berkeley_home,               SHOW_CHAR_PTR},
@@ -801,7 +832,7 @@
   {sys_completion_type.name,  (char*) &sys_completion_type,	    SHOW_SYS},
   {sys_concurrent_insert.name,(char*) &sys_concurrent_insert,       SHOW_SYS},
   {sys_connect_timeout.name,  (char*) &sys_connect_timeout,         SHOW_SYS},
-  {"datadir",                 mysql_real_data_home,                 SHOW_CHAR},
+  {sys_datadir.name,          (char*) &sys_datadir,                 SHOW_SYS},
   {sys_date_format.name,      (char*) &sys_date_format,		    SHOW_SYS},
   {sys_datetime_format.name,  (char*) &sys_datetime_format,	    SHOW_SYS},
   {sys_default_week_format.name, (char*) &sys_default_week_format,  SHOW_SYS},
@@ -899,6 +930,8 @@
   {"log_bin",                 (char*) &opt_bin_log,                 SHOW_BOOL},
   {sys_trust_function_creators.name,(char*) &sys_trust_function_creators, SHOW_SYS},
   {"log_error",               (char*) log_error_file,               SHOW_CHAR},
+  {sys_log_queries_not_using_indexes.name,
+    (char*) &sys_log_queries_not_using_indexes, SHOW_SYS},
 #ifdef HAVE_REPLICATION
   {"log_slave_updates",       (char*) &opt_log_slave_updates,       SHOW_MY_BOOL},
 #endif
@@ -1017,6 +1050,11 @@
   {sys_sql_mode.name,         (char*) &sys_sql_mode,                SHOW_SYS},
   {"sql_notes",               (char*) &sys_sql_notes,               SHOW_SYS},
   {"sql_warnings",            (char*) &sys_sql_warnings,            SHOW_SYS},
+  {sys_ssl_ca.name,           (char*) &sys_ssl_ca,                  SHOW_SYS},
+  {sys_ssl_capath.name,       (char*) &sys_ssl_capath,              SHOW_SYS},
+  {sys_ssl_cert.name,         (char*) &sys_ssl_cert,                SHOW_SYS},
+  {sys_ssl_cipher.name,       (char*) &sys_ssl_cipher,              SHOW_SYS},
+  {sys_ssl_key.name,          (char*) &sys_ssl_key,                 SHOW_SYS},
   {sys_storage_engine.name,   (char*) &sys_storage_engine,          SHOW_SYS},
 #ifdef HAVE_REPLICATION
   {sys_sync_binlog_period.name,(char*) &sys_sync_binlog_period,     SHOW_SYS},
@@ -1037,7 +1075,7 @@
   {"time_zone",               (char*) &sys_time_zone,               SHOW_SYS},
   {sys_timed_mutexes.name,    (char*) &sys_timed_mutexes,       SHOW_SYS},
   {sys_tmp_table_size.name,   (char*) &sys_tmp_table_size,	    SHOW_SYS},
-  {"tmpdir",                  (char*) &opt_mysql_tmpdir,            SHOW_CHAR_PTR},
+  {sys_tmpdir.name,           (char*) &sys_tmpdir,	            SHOW_SYS},
   {sys_trans_alloc_block_size.name, (char*) &sys_trans_alloc_block_size,
    SHOW_SYS},
   {sys_trans_prealloc_size.name, (char*) &sys_trans_prealloc_size,  SHOW_SYS},
@@ -2861,6 +2899,31 @@
   thd->sys_var_tmp.ulong_value= prepared_stmt_count;
   pthread_mutex_unlock(&LOCK_prepared_stmt_count);
   return (byte*) &thd->sys_var_tmp.ulong_value;
+}
+
+
+/*
+  Get the tmpdir that was specified or chosen by default
+
+  SYNOPSIS
+    get_tmpdir()
+    thd		thread handle
+
+  DESCRIPTION
+    This is necessary because if the user does not specify a temporary
+    directory via the command line, one is chosen based on the environment
+    or system defaults.  But we can't just always use mysql_tmpdir, because
+    that is actually a call to my_tmpdir() which cycles among possible
+    temporary directories.
+
+  RETURN VALUES
+    ptr		pointer to NUL-terminated string
+ */
+static byte *get_tmpdir(THD *thd)
+{
+  if (opt_mysql_tmpdir)
+    return (byte *)opt_mysql_tmpdir;
+  return (byte*)mysql_tmpdir;
 }
 
 /****************************************************************************

--- 1.74/sql/set_var.h	2006-04-12 07:30:47 -07:00
+++ 1.75/sql/set_var.h	2006-05-08 16:38:42 -07:00
@@ -222,6 +222,35 @@
 };
 
 
+class sys_var_const_str_ptr :public sys_var
+{
+public:
+  char **value;					// Pointer to const value
+  sys_var_const_str_ptr(const char *name_arg, char **value_arg)
+    :sys_var(name_arg),value(value_arg)
+  {}
+  bool check(THD *thd, set_var *var)
+  {
+    return 1;
+  }
+  bool update(THD *thd, set_var *var)
+  {
+    return 1;
+  }
+  SHOW_TYPE type() { return SHOW_CHAR; }
+  byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
+  {
+    return (byte*) *value;
+  }
+  bool check_update_type(Item_result type)
+  {
+    return 1;
+  }
+  bool check_default(enum_var_type type) { return 1; }
+  bool is_readonly() const { return 1; }
+};
+
+
 class sys_var_enum :public sys_var
 {
   uint	*value; 
Thread
bk commit into 5.0 tree (jimw:1.2123) BUG#19616Jim Winstead9 May