List:Commits« Previous MessageNext Message »
From:Alex Ivanov Notebook Date:May 14 2006 12:41am
Subject:bk commit into 5.1 tree (aivanov:1.2395)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of alexi. When alexi 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.2395 06/05/14 04:41:03 aivanov@stripped +5 -0
  WL#3248: Adding [GLOBAL|SESSION]_VARIABLES tables to INFORMATION_SCHEMA.
   Basic implementation: XXX_VARIABLES tables contain the same data as in
   SHOW XXX VARIABLES.

  sql/table.h
    1.141 06/05/14 04:40:58 aivanov@stripped +2 -0
    WL#3248: Adding [GLOBAL|SESSION]_VARIABLES tables to INFORMATION_SCHEMA.

  sql/sql_show.cc
    1.335 06/05/14 04:40:58 aivanov@stripped +55 -7
    WL#3248: Adding [GLOBAL|SESSION]_VARIABLES tables to INFORMATION_SCHEMA.
     show_status_array(): argument 'ucase_names' is added (1 - all variable
     names should be converted to upper case).
     Added stuff needed to support XXX_VARIABLES tables.

  mysql-test/t/information_schema.test
    1.78 06/05/14 04:40:58 aivanov@stripped +11 -0
    WL#3248: Adding [GLOBAL|SESSION]_VARIABLES tables to INFORMATION_SCHEMA.
     Added test case.

  mysql-test/r/information_schema_db.result
    1.16 06/05/14 04:40:58 aivanov@stripped +2 -0
    WL#3248: Adding [GLOBAL|SESSION]_VARIABLES tables to INFORMATION_SCHEMA.
     Fixed results of test case.

  mysql-test/r/information_schema.result
    1.119 06/05/14 04:40:58 aivanov@stripped +24 -2
    WL#3248: Adding [GLOBAL|SESSION]_VARIABLES tables to INFORMATION_SCHEMA.
     Fixed results of added test case.

# 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:	aivanov
# Host:	mysqld.localdomain
# Root:	/home/alexi/dev/mysql-5.1-wl3248

--- 1.334/sql/sql_show.cc	2006-05-12 20:22:23 +04:00
+++ 1.335/sql/sql_show.cc	2006-05-14 04:40:58 +04:00
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2004 MySQL AB
+/* Copyright (C) 2000-2004 MySQL AB[18~
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -1873,11 +1873,18 @@
   }
 }
 
+inline void make_upper(char *buf)
+{
+  for (; *buf; buf++)
+    *buf= my_toupper(system_charset_info, *buf);
+}
+
 static bool show_status_array(THD *thd, const char *wild,
                               SHOW_VAR *variables,
                               enum enum_var_type value_type,
                               struct system_status_var *status_var,
-                              const char *prefix, TABLE *table)
+                              const char *prefix, TABLE *table,
+                              bool ucase_names)
 {
   char buff[SHOW_VAR_FUNC_BUFF_SIZE], *prefix_end;
   /* the variable name should not be longer then 80 characters */
@@ -1899,6 +1906,8 @@
   {
     strnmov(prefix_end, variables->name, len);
     name_buffer[sizeof(name_buffer)-1]=0;       /* Safety */
+    if (ucase_names)
+      make_upper(name_buffer);
 
     /*
       if var->type is SHOW_FUNC, call the function.
@@ -1910,8 +1919,8 @@
     SHOW_TYPE show_type=var->type;
     if (show_type == SHOW_ARRAY)
     {
-      show_status_array(thd, wild, (SHOW_VAR *) var->value,
-                        value_type, status_var, name_buffer, table);
+      show_status_array(thd, wild, (SHOW_VAR *) var->value, value_type,
+                        status_var, name_buffer, table, ucase_names);
     }
     else
     {
@@ -1920,7 +1929,7 @@
       {
         char *value=var->value;
         const char *pos, *end;                  // We assign a lot of const's
-        long nr;
+
         if (show_type == SHOW_SYS)
         {
           show_type= ((sys_var*) value)->type();
@@ -2002,6 +2011,7 @@
         table->field[0]->store(name_buffer, strlen(name_buffer),
                                system_charset_info);
         table->field[1]->store(pos, (uint32) (end - pos), system_charset_info);
+        table->field[1]->set_notnull();
         if (schema_table_store_record(thd, table))
           DBUG_RETURN(TRUE);
       }
@@ -4259,7 +4269,7 @@
   const char *wild= lex->wild ? lex->wild->ptr() : NullS;
   pthread_mutex_lock(&LOCK_global_system_variables);
   res= show_status_array(thd, wild, init_vars,
-                         lex->option_type, 0, "", tables->table);
+                         lex->option_type, 0, "", tables->table, 0);
   pthread_mutex_unlock(&LOCK_global_system_variables);
   DBUG_RETURN(res);
 }
@@ -4279,7 +4289,7 @@
                          (SHOW_VAR *)all_status_vars.buffer,
                          OPT_GLOBAL,
                          (lex->option_type == OPT_GLOBAL ?
-                          &tmp: &thd->status_var), "",tables->table);
+                          &tmp: &thd->status_var), "", tables->table, 0);
   pthread_mutex_unlock(&LOCK_status);
   DBUG_RETURN(res);
 }
@@ -4861,6 +4871,32 @@
   DBUG_RETURN(0);
 }
 
+int fill_schema_global_variables(THD *thd, TABLE_LIST *tables, COND *cond)
+{
+  int res= 0;
+  DBUG_ENTER("fill_schema_global_variables");
+
+  pthread_mutex_lock(&LOCK_global_system_variables);
+  res= show_status_array(thd, "", init_vars, OPT_GLOBAL, NULL, "",
+                         tables->table, 1);
+  pthread_mutex_unlock(&LOCK_global_system_variables);
+
+  DBUG_RETURN(res);
+}
+
+int fill_schema_session_variables(THD *thd, TABLE_LIST *tables, COND *cond)
+{
+  int res= 0;
+  DBUG_ENTER("fill_schema_session_variables");
+
+  pthread_mutex_lock(&LOCK_global_system_variables);
+  res= show_status_array(thd, "", init_vars, OPT_SESSION, NULL, "",
+                         tables->table, 1);
+  pthread_mutex_unlock(&LOCK_global_system_variables);
+
+  DBUG_RETURN(res);
+}
+
 ST_FIELD_INFO schema_fields_info[]=
 {
   {"CATALOG_NAME", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0},
@@ -5212,6 +5248,14 @@
 };
 
 
+ST_FIELD_INFO system_variables_fields_info[]=
+{
+  {"VARIABLE_NAME",  64, MYSQL_TYPE_STRING, 0, 0, "Variable_name"},
+  {"VARIABLE_VALUE", 64, MYSQL_TYPE_STRING, 0, 1, "Value"},
+  {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
+};
+
+
 ST_FIELD_INFO processlist_fields_info[]=
 {
   {"ID", 4, MYSQL_TYPE_LONG, 0, 0, "Id"},
@@ -5324,6 +5368,8 @@
    fill_schema_events, make_old_format, 0, -1, -1, 0},
   {"FILES", files_fields_info, create_schema_table,
    fill_schema_files, 0, 0, -1, -1, 0},
+  {"GLOBAL_VARIABLES", system_variables_fields_info, create_schema_table,
+   fill_schema_global_variables, make_old_format, 0, -1, -1, 0},
   {"KEY_COLUMN_USAGE", key_column_usage_fields_info, create_schema_table,
     get_all_tables, 0, get_schema_key_column_usage_record, 4, 5, 0},
   {"OPEN_TABLES", open_tables_fields_info, create_schema_table,
@@ -5343,6 +5389,8 @@
    fill_schema_shemata, make_schemata_old_format, 0, 1, -1, 0},
   {"SCHEMA_PRIVILEGES", schema_privileges_fields_info, create_schema_table,
     fill_schema_schema_privileges, 0, 0, -1, -1, 0},
+  {"SESSION_VARIABLES", system_variables_fields_info, create_schema_table,
+   fill_schema_session_variables, make_old_format, 0, -1, -1, 0},
   {"STATISTICS", stat_fields_info, create_schema_table, 
     get_all_tables, make_old_format, get_schema_stat_record, 1, 2, 0},
   {"STATUS", variables_fields_info, create_schema_table, fill_status, 

--- 1.140/sql/table.h	2006-05-12 20:22:23 +04:00
+++ 1.141/sql/table.h	2006-05-14 04:40:58 +04:00
@@ -357,6 +357,7 @@
   SCH_ENGINES,
   SCH_EVENTS,
   SCH_FILES,
+  SCH_GLOBAL_VARIABLES,
   SCH_KEY_COLUMN_USAGE,
   SCH_OPEN_TABLES,
   SCH_PARTITIONS,
@@ -366,6 +367,7 @@
   SCH_PROCEDURES,
   SCH_SCHEMATA,
   SCH_SCHEMA_PRIVILEGES,
+  SCH_SESSION_VARIABLES,
   SCH_STATISTICS,
   SCH_STATUS,
   SCH_TABLES,

--- 1.118/mysql-test/r/information_schema.result	2006-05-12 10:42:00 +04:00
+++ 1.119/mysql-test/r/information_schema.result	2006-05-14 04:40:58 +04:00
@@ -46,6 +46,7 @@
 ENGINES
 EVENTS
 FILES
+GLOBAL_VARIABLES
 KEY_COLUMN_USAGE
 PARTITIONS
 PLUGINS
@@ -54,6 +55,7 @@
 ROUTINES
 SCHEMATA
 SCHEMA_PRIVILEGES
+SESSION_VARIABLES
 STATISTICS
 TABLES
 TABLE_CONSTRAINTS
@@ -746,7 +748,7 @@
 CREATE VIEW a1 (t_CRASHME) AS SELECT f1 FROM t_crashme GROUP BY f1;
 CREATE VIEW a2 AS SELECT t_CRASHME FROM a1;
 count(*)
-113
+115
 drop view a2, a1;
 drop table t_crashme;
 select table_schema,table_name, column_name from
@@ -846,7 +848,7 @@
 SELECT table_schema, count(*) FROM information_schema.TABLES GROUP BY TABLE_SCHEMA;
 table_schema	count(*)
 cluster	1
-information_schema	23
+information_schema	25
 mysql	21
 create table t1 (i int, j int);
 create trigger trg1 before insert on t1 for each row
@@ -1145,3 +1147,23 @@
 user	db
 user3148	test
 drop user user3148@localhost;
+show global variables like "%wait_timeout";
+Variable_name	Value
+innodb_lock_wait_timeout	50
+table_lock_wait_timeout	50
+wait_timeout	28800
+select * from information_schema.global_variables where variable_name like "%wait_timeout";
+VARIABLE_NAME	VARIABLE_VALUE
+INNODB_LOCK_WAIT_TIMEOUT	50
+TABLE_LOCK_WAIT_TIMEOUT	50
+WAIT_TIMEOUT	28800
+show session variables like "%wait_timeout";
+Variable_name	Value
+innodb_lock_wait_timeout	50
+table_lock_wait_timeout	50
+wait_timeout	28800
+select * from information_schema.session_variables where variable_name like "%wait_timeout";
+VARIABLE_NAME	VARIABLE_VALUE
+INNODB_LOCK_WAIT_TIMEOUT	50
+TABLE_LOCK_WAIT_TIMEOUT	50
+WAIT_TIMEOUT	28800

--- 1.77/mysql-test/t/information_schema.test	2006-05-12 10:42:00 +04:00
+++ 1.78/mysql-test/t/information_schema.test	2006-05-14 04:40:58 +04:00
@@ -826,4 +826,15 @@
 connection default;
 drop user user3148@localhost;
 
+#
+# INFORMATION_SCHEMA.[GLOBAL|SESSION]_VARIABLES
+#
+# The following pairs of queries should return similar results
+#
+
+show global variables like "%wait_timeout";
+select * from information_schema.global_variables where variable_name like "%wait_timeout";
+
+show session variables like "%wait_timeout";
+select * from information_schema.session_variables where variable_name like "%wait_timeout";
 

--- 1.15/mysql-test/r/information_schema_db.result	2006-05-02 15:31:32 +04:00
+++ 1.16/mysql-test/r/information_schema_db.result	2006-05-14 04:40:58 +04:00
@@ -9,6 +9,7 @@
 ENGINES
 EVENTS
 FILES
+GLOBAL_VARIABLES
 KEY_COLUMN_USAGE
 PARTITIONS
 PLUGINS
@@ -17,6 +18,7 @@
 ROUTINES
 SCHEMATA
 SCHEMA_PRIVILEGES
+SESSION_VARIABLES
 STATISTICS
 TABLES
 TABLE_CONSTRAINTS
Thread
bk commit into 5.1 tree (aivanov:1.2395)Alex Ivanov Notebook13 May