List:Commits« Previous MessageNext Message »
From:Horst Hunger Date:August 28 2008 10:46am
Subject:bzr commit into mysql-5.1 branch (horst:2660) Bug#38349, Bug#39009, WL#4288
View as plain text  
#At file:///work/bzr/mysql-5.1-rpl/

 2660 Horst Hunger	2008-08-28
      Inserted the resuts of the first quick review of the changesets of bug#38349:
      Besides code changes also better format and beautification. I also changes some tests not belonging to WL#4288 
      having the same symtoms: innodb.test, log_state.test, variables_embedded.test, log_tables.test, insert_update.test,
      profiling.test and variables.test. 
      The test "concurrent_insert_func.test" was changed due to some hints given in bug#39009. It was not the server
      but the tests client that hang due to a table locking, that now can be seen in the result.
      Be aware, that the target tree for that bug is the "5.1-rpl" team tree.
modified:
  mysql-test/r/binlog_format_basic.result
  mysql-test/r/character_set_connection_func.result
  mysql-test/r/completion_type_func.result
  mysql-test/r/concurrent_insert_func.result
  mysql-test/r/delay_key_write_func.result
  mysql-test/r/general_log_file_basic.result
  mysql-test/r/innodb.result
  mysql-test/r/innodb_autoextend_increment_basic.result
  mysql-test/r/innodb_autoinc_lock_mode_func.result
  mysql-test/r/innodb_fast_shutdown_basic.result
  mysql-test/r/innodb_max_dirty_pages_pct_func.result
  mysql-test/r/innodb_table_locks_func.result
  mysql-test/r/insert_update.result
  mysql-test/r/interactive_timeout_func.result
  mysql-test/r/key_buffer_size_func.result
  mysql-test/r/log_basic.result
  mysql-test/r/log_bin_trust_function_creators_func.result
  mysql-test/r/log_output_func.result
  mysql-test/r/log_queries_not_using_indexes_basic.result
  mysql-test/r/log_state.result
  mysql-test/r/log_tables.result
  mysql-test/r/max_allowed_packet_func.result
  mysql-test/r/max_seeks_for_key_func.result
  mysql-test/r/max_sort_length_func.result
  mysql-test/r/myisam_data_pointer_size_func.result
  mysql-test/r/myisam_stats_method_func.result
  mysql-test/r/profiling.result
  mysql-test/r/query_cache_limit_func.result
  mysql-test/r/query_cache_type_func.result
  mysql-test/r/query_prealloc_size_func.result
  mysql-test/r/rpl_init_slave_func.result
  mysql-test/r/rpl_max_binlog_size_func.result
  mysql-test/r/slow_query_log_file_basic.result
  mysql-test/r/variables-notembedded.result
  mysql-test/r/variables.result
  mysql-test/t/binlog_format_basic.test
  mysql-test/t/character_set_connection_func.test
  mysql-test/t/completion_type_func.test
  mysql-test/t/concurrent_insert_func.test
  mysql-test/t/delay_key_write_func.test
  mysql-test/t/disabled.def
  mysql-test/t/general_log_file_basic.test
  mysql-test/t/innodb.test
  mysql-test/t/innodb_autoextend_increment_basic.test
  mysql-test/t/innodb_autoinc_lock_mode_func.test
  mysql-test/t/innodb_fast_shutdown_basic.test
  mysql-test/t/innodb_max_dirty_pages_pct_func.test
  mysql-test/t/innodb_table_locks_func.test
  mysql-test/t/insert_update.test
  mysql-test/t/interactive_timeout_func.test
  mysql-test/t/key_buffer_size_func.test
  mysql-test/t/log_basic.test
  mysql-test/t/log_bin_trust_function_creators_func.test
  mysql-test/t/log_output_func.test
  mysql-test/t/log_queries_not_using_indexes_basic.test
  mysql-test/t/log_state.test
  mysql-test/t/log_tables.test
  mysql-test/t/max_allowed_packet_func.test
  mysql-test/t/max_seeks_for_key_func.test
  mysql-test/t/max_sort_length_func.test
  mysql-test/t/myisam_data_pointer_size_func.test
  mysql-test/t/myisam_stats_method_func.test
  mysql-test/t/profiling.test
  mysql-test/t/query_cache_limit_func.test
  mysql-test/t/query_cache_type_func.test
  mysql-test/t/query_prealloc_size_func.test
  mysql-test/t/rpl_init_slave_func.test
  mysql-test/t/rpl_max_binlog_size_func.test
  mysql-test/t/slow_query_log_file_basic.test
  mysql-test/t/variables-notembedded.test
  mysql-test/t/variables.test

=== modified file 'mysql-test/r/binlog_format_basic.result'
--- a/mysql-test/r/binlog_format_basic.result	2008-04-10 13:14:28 +0000
+++ b/mysql-test/r/binlog_format_basic.result	2008-08-28 08:46:29 +0000
@@ -1,4 +1,5 @@
 '#---------------------BS_STVARS_002_01----------------------#'
+SET @start_value= @@global.binlog_format;
 SELECT COUNT(@@GLOBAL.binlog_format);
 COUNT(@@GLOBAL.binlog_format)
 1
@@ -34,14 +35,14 @@ COUNT(@@GLOBAL.binlog_format)
 1
 1 Expected
 SELECT COUNT(VARIABLE_VALUE)
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
 WHERE VARIABLE_NAME='binlog_format';
 COUNT(VARIABLE_VALUE)
 1
 1 Expected
 '#---------------------BS_STVARS_002_04----------------------#'
-SELECT @@SESSION.binlog_format = VARIABLE_VALUE 
-FROM INFORMATION_SCHEMA.SESSION_VARIABLES 
+SELECT @@SESSION.binlog_format = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
 WHERE VARIABLE_NAME='binlog_format';
 @@SESSION.binlog_format = VARIABLE_VALUE
 1
@@ -51,7 +52,7 @@ COUNT(@@SESSION.binlog_format)
 1
 1 Expected
 SELECT COUNT(VARIABLE_VALUE)
-FROM INFORMATION_SCHEMA.SESSION_VARIABLES 
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
 WHERE VARIABLE_NAME='binlog_format';
 COUNT(VARIABLE_VALUE)
 1
@@ -73,3 +74,4 @@ SELECT COUNT(@@GLOBAL.binlog_format);
 COUNT(@@GLOBAL.binlog_format)
 1
 1 Expected
+SET @@global.binlog_format= @start_value;

=== modified file 'mysql-test/r/character_set_connection_func.result'
--- a/mysql-test/r/character_set_connection_func.result	2008-04-10 13:14:28 +0000
+++ b/mysql-test/r/character_set_connection_func.result	2008-08-28 08:46:29 +0000
@@ -15,7 +15,7 @@ utf8
 '#--------------------FN_DYNVARS_011_02-------------------------#'
 'connection default'
 DROP TABLE IF EXISTS t1;
-CREATE TABLE t1(b CHAR(40) character set utf8);
+CREATE TABLE t1(b CHAR(40) CHARACTER SET utf8);
 '--verify that character_set_connection converts character_set_client--'
 SET @@session.character_set_client = utf8;
 SET @@session.character_set_results = utf8;
@@ -53,3 +53,4 @@ SET @@global.character_set_connection = 
 SET @@session.character_set_connection = @session_character_set_connection;
 SET @@session.character_set_client = @session_character_set_client;
 SET @@session.character_set_results = @session_character_set_results;
+DROP TABLE t1;

=== modified file 'mysql-test/r/completion_type_func.result'
--- a/mysql-test/r/completion_type_func.result	2008-04-10 13:14:28 +0000
+++ b/mysql-test/r/completion_type_func.result	2008-08-28 08:46:29 +0000
@@ -1,67 +1,67 @@
-drop table if exists t1;
+DROP TABLE IF EXISTS t1;
 ## Creating new table ##
 CREATE TABLE t1
 (
-id INT NOT NULL auto_increment,
+id INT NOT NULL AUTO_INCREMENT,
 PRIMARY KEY (id),
-name varchar(30)
+name VARCHAR(30)
 ) ENGINE = INNODB;
 '#--------------------FN_DYNVARS_017_01-------------------------#'
 ## Creating new connection ##
-INSERT into t1(name) values('Record_1');
+INSERT INTO t1(name) VALUES('Record_1');
 SET @@autocommit = 0;
-SELECT * from t1;
+SELECT * FROM t1;
 id	name
 1	Record_1
 ## Setting value of variable to 0 ##
 SET @@session.completion_type = 0;
 ## Here commit & rollback should work normally ##
 START TRANSACTION;
-SELECT * from t1;
+SELECT * FROM t1;
 id	name
 1	Record_1
-INSERT into t1(name) values('Record_2');
-INSERT into t1(name) values('Record_3');
-SELECT * from t1;
+INSERT INTO t1(name) VALUES('Record_2');
+INSERT INTO t1(name) VALUES('Record_3');
+SELECT * FROM t1;
 id	name
 1	Record_1
 2	Record_2
 3	Record_3
-DELETE FROM t1 where id = 2;
-SELECT * from t1;
+DELETE FROM t1 WHERE id = 2;
+SELECT * FROM t1;
 id	name
 1	Record_1
 3	Record_3
 START TRANSACTION;
-SELECT * from t1;
+SELECT * FROM t1;
 id	name
 1	Record_1
 3	Record_3
-INSERT into t1(name) values('Record_4');
-INSERT into t1(name) values('Record_5');
+INSERT INTO t1(name) VALUES('Record_4');
+INSERT INTO t1(name) VALUES('Record_5');
 COMMIT;
 '#--------------------FN_DYNVARS_017_02-------------------------#'
 SET @@session.completion_type = 2;
 ## Here commit should work as COMMIT RELEASE ##
 START TRANSACTION;
-SELECT * from t1;
+SELECT * FROM t1;
 id	name
 1	Record_1
 3	Record_3
 4	Record_4
 5	Record_5
-INSERT into t1(name) values('Record_6');
-INSERT into t1(name) values('Record_7');
+INSERT INTO t1(name) VALUES('Record_6');
+INSERT INTO t1(name) VALUES('Record_7');
 COMMIT;
 ## Inserting rows should give error here because connection should ##
 ## disconnect after using COMMIT ##
-INSERT into t1(name) values('Record_4');
+INSERT INTO t1(name) VALUES('Record_4');
 Got one of the listed errors
 ## Creating new connection test_con2 ##
 SET @@session.completion_type = 2;
 ## Inserting rows and using Rollback which should Rollback & release ##
 START TRANSACTION;
-SELECT * from t1;
+SELECT * FROM t1;
 id	name
 1	Record_1
 3	Record_3
@@ -69,8 +69,9 @@ id	name
 5	Record_5
 6	Record_6
 7	Record_7
-INSERT into t1(name) values('Record_8');
-INSERT into t1(name) values('Record_9');
+INSERT INTO t1(name) VALUES('Record_8');
+INSERT INTO t1(name) VALUES('Record_9');
 ROLLBACK;
-INSERT into t1(name) values('Record_4');
+INSERT INTO t1(name) VALUES('Record_4');
 Got one of the listed errors
+DROP TABLE t1;

=== modified file 'mysql-test/r/concurrent_insert_func.result'
--- a/mysql-test/r/concurrent_insert_func.result	2008-04-10 13:14:28 +0000
+++ b/mysql-test/r/concurrent_insert_func.result	2008-08-28 08:46:29 +0000
@@ -1,73 +1,121 @@
-drop table if exists t1;
+DROP TABLE IF EXISTS t1;
 ## Creating new table ##
 CREATE TABLE t1
 (
-name varchar(30)
+name VARCHAR(30)
 );
 '#--------------------FN_DYNVARS_018_01-------------------------#'
+SET @start_value= @@global.concurrent_insert;
 ## Setting initial value of variable to 1 ##
 SET @@global.concurrent_insert = 1;
-INSERT into t1(name) values('Record_1');
-INSERT into t1(name) values('Record_2');
-INSERT into t1(name) values('Record_3');
+INSERT INTO t1(name) VALUES('Record_1');
+INSERT INTO t1(name) VALUES('Record_2');
+INSERT INTO t1(name) VALUES('Record_3');
 ## locking table ##
-lock table t1 read local;
-## Creating new connection to insert some rows in table ## 
+LOCK TABLE t1 READ LOCAL;
+## Creating new connection to insert some rows in table ##
+connection test_con1;
 ## New records should come at the end of all rows ##
-INSERT into t1(name) values('Record_4');
-SELECT * from t1;
+INSERT INTO t1(name) VALUES('Record_4');
+SELECT * FROM t1;
 name
 Record_1
 Record_2
 Record_3
 Record_4
 ## unlocking tables ##
+connection default;
 unlock tables;
-## deleting record to create hole in table ## 
-DELETE from t1 where name ='Record_2';
+## deleting record to create hole in table ##
+DELETE FROM t1 WHERE name ='Record_2';
 '#--------------------FN_DYNVARS_018_02-------------------------#'
+LOCK TABLE t1 READ LOCAL;
+connection test_con1;
+SET @@global.concurrent_insert=1;
+## send INSERT which should be blocked until unlock of the table ##
+INSERT INTO t1(name) VALUES('Record_7');
+connection default;
+## show processlist info and state ##
+SELECT state,info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE state= "Locked" AND info LIKE "INSERT INTO t1%";
+state	info
+Locked	INSERT INTO t1(name) VALUES('Record_7')
+## table contents befor UNLOCK ##
+SELECT * FROM t1;
+name
+Record_1
+Record_3
+Record_4
+UNLOCK TABLES;
+## table contens after UNLOCK ##
+SELECT * FROM t1;
+name
+Record_1
+Record_7
+Record_3
+Record_4
+INSERT INTO t1(name) VALUES('Record_6');
+connection test_con1;
+select * from t1;
+name
+Record_1
+Record_7
+Record_3
+Record_4
+Record_6
+connection default;
 '#--------------------FN_DYNVARS_018_03-------------------------#'
 ## lock table and connect with connection1 ##
-lock table t1 read local;
+LOCK TABLE t1 READ LOCAL;
+connection test_con1;
 ## setting value of concurrent_insert to 2 ##
 SET @@global.concurrent_insert=2;
 ## Inserting record in table, record should go at the end of the table ##
-INSERT into t1(name) values('Record_5');
-SELECT * from t1;
+INSERT INTO t1(name) VALUES('Record_5');
+SELECT * FROM t1;
 name
 Record_1
+Record_7
 Record_3
 Record_4
+Record_6
 Record_5
 SELECT @@concurrent_insert;
 @@concurrent_insert
 2
-## Switching to default connection ##
+connection default;
 ## Unlocking table ##
-unlock tables;
-SELECT * from t1;
+UNLOCK TABLES;
+SELECT * FROM t1;
 name
 Record_1
+Record_7
 Record_3
 Record_4
+Record_6
 Record_5
 ## Inserting new row, this should go in the hole ##
-INSERT into t1(name) values('Record_6');
-SELECT * from t1;
+INSERT INTO t1(name) VALUES('Record_6');
+SELECT * FROM t1;
 name
 Record_1
-Record_6
+Record_7
 Record_3
 Record_4
+Record_6
 Record_5
+Record_6
 ## connection test_con1 ##
-DELETE from t1 where name ='Record_3';
-SELECT * from t1;
+DELETE FROM t1 WHERE name ='Record_3';
+SELECT * FROM t1;
 name
 Record_1
-Record_6
+Record_7
 Record_4
+Record_6
 Record_5
+Record_6
 ## Dropping table ##
-DROP table t1;
+DROP TABLE t1;
 ## Disconnecting connection ##
+SET @@global.concurrent_insert= @start_value;

=== modified file 'mysql-test/r/delay_key_write_func.result'
--- a/mysql-test/r/delay_key_write_func.result	2008-04-15 13:44:11 +0000
+++ b/mysql-test/r/delay_key_write_func.result	2008-08-28 08:46:29 +0000
@@ -1,4 +1,5 @@
 '#--------------------FN_DYNVARS_023_01-------------------------#'
+SET @start_value= @@global.delay_key_write;
 SET @@global.delay_key_write = ON;
 SELECT @@global.delay_key_write;
 @@global.delay_key_write
@@ -65,3 +66,4 @@ count(*)
 9
 DROP PROCEDURE sp_addRecords;
 DROP TABLE t1;
+SET @@global.delay_key_write= @start_value;

=== modified file 'mysql-test/r/general_log_file_basic.result'
--- a/mysql-test/r/general_log_file_basic.result	2008-05-30 09:12:07 +0000
+++ b/mysql-test/r/general_log_file_basic.result	2008-08-28 08:46:29 +0000
@@ -1,7 +1,4 @@
 SET @start_value = @@global.general_log_file;
-SELECT @start_value;
-@start_value
-test.log
 '#---------------------FN_DYNVARS_004_01-------------------------#'
 SET @@global.general_log_file = DEFAULT;
 SELECT RIGHT(@@global.general_log_file,10) AS log_file;
@@ -12,8 +9,9 @@ SET @@global.general_log_file = mytest.l
 SET @@global.general_log_file = 12;
 ERROR 42000: Incorrect argument type to variable 'general_log_file'
 '#----------------------FN_DYNVARS_004_03------------------------#'
-SELECT @@global.general_log_file = VARIABLE_VALUE 
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
+SELECT @@global.general_log_file = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
 WHERE VARIABLE_NAME='general_log_file';
 @@global.general_log_file = VARIABLE_VALUE
 1
+SET @@global.general_log_file= @start_value;

=== modified file 'mysql-test/r/innodb.result'
--- a/mysql-test/r/innodb.result	2008-05-14 08:45:32 +0000
+++ b/mysql-test/r/innodb.result	2008-08-28 08:46:29 +0000
@@ -1777,6 +1777,7 @@ set global innodb_sync_spin_loops=20;
 show variables like "innodb_sync_spin_loops";
 Variable_name	Value
 innodb_sync_spin_loops	20
+set @start_value= @@global.innodb_thread_concurrency;
 show variables like "innodb_thread_concurrency";
 Variable_name	Value
 innodb_thread_concurrency	8
@@ -1794,6 +1795,7 @@ set global innodb_thread_concurrency=16;
 show variables like "innodb_thread_concurrency";
 Variable_name	Value
 innodb_thread_concurrency	16
+set global innodb_thread_concurrency= @start_value;
 show variables like "innodb_concurrency_tickets";
 Variable_name	Value
 innodb_concurrency_tickets	500

=== modified file 'mysql-test/r/innodb_autoextend_increment_basic.result'
--- a/mysql-test/r/innodb_autoextend_increment_basic.result	2008-04-10 13:14:28 +0000
+++ b/mysql-test/r/innodb_autoextend_increment_basic.result	2008-08-28 08:46:29 +0000
@@ -1,7 +1,4 @@
 SET @global_start_value = @@global.innodb_autoextend_increment ;
-SELECT @global_start_value;
-@global_start_value
-8
 '#--------------------FN_DYNVARS_046_01------------------------#'
 SET @@global.innodb_autoextend_increment  = 0;
 Warnings:
@@ -57,16 +54,16 @@ SELECT @@global.innodb_autoextend_increm
 @@global.innodb_autoextend_increment
 1000
 '#----------------------FN_DYNVARS_046_05------------------------#'
-SELECT @@global.innodb_autoextend_increment  = VARIABLE_VALUE 
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
+SELECT @@global.innodb_autoextend_increment  = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
 WHERE VARIABLE_NAME='innodb_autoextend_increment ';
 @@global.innodb_autoextend_increment  = VARIABLE_VALUE
 1
 SELECT @@global.innodb_autoextend_increment ;
 @@global.innodb_autoextend_increment
 1000
-SELECT VARIABLE_VALUE 
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
+SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
 WHERE VARIABLE_NAME='innodb_autoextend_increment ';
 VARIABLE_VALUE
 1000
@@ -92,3 +89,4 @@ Warning	1292	Truncated incorrect autoext
 SELECT @@global.innodb_autoextend_increment ;
 @@global.innodb_autoextend_increment
 1
+SET @@global.innodb_autoextend_increment  = @global_start_value;

=== modified file 'mysql-test/r/innodb_autoinc_lock_mode_func.result'
--- a/mysql-test/r/innodb_autoinc_lock_mode_func.result	2008-04-10 13:14:28 +0000
+++ b/mysql-test/r/innodb_autoinc_lock_mode_func.result	2008-08-28 08:46:29 +0000
@@ -20,3 +20,4 @@ a	b
 100	b
 101	d
 104	e
+DROP TABLE t1;

=== modified file 'mysql-test/r/innodb_fast_shutdown_basic.result'
--- a/mysql-test/r/innodb_fast_shutdown_basic.result	2008-04-10 13:14:28 +0000
+++ b/mysql-test/r/innodb_fast_shutdown_basic.result	2008-08-28 08:46:29 +0000
@@ -93,14 +93,14 @@ ERROR HY000: Variable 'innodb_fast_shutd
 SET @@local.innodb_fast_shutdown = 0;
 ERROR HY000: Variable 'innodb_fast_shutdown' is a GLOBAL variable and should be set with SET GLOBAL
 '#----------------------FN_DYNVARS_042_06------------------------#'
-SELECT count(VARIABLE_VALUE) AS res_is_0 
-FROM INFORMATION_SCHEMA.SESSION_VARIABLES 
+SELECT count(VARIABLE_VALUE) AS res_is_0
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
 WHERE VARIABLE_NAME='innodb_fast_shutdown';
 res_is_0
 1
 '#----------------------FN_DYNVARS_042_07------------------------#'
 SELECT @@global.innodb_fast_shutdown =
-VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
+VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
 WHERE VARIABLE_NAME='innodb_fast_shutdown';
 @@global.innodb_fast_shutdown =
 VARIABLE_VALUE
@@ -125,3 +125,7 @@ SET @@global.innodb_fast_shutdown = FALS
 SELECT @@global.innodb_fast_shutdown;
 @@global.innodb_fast_shutdown
 0
+SET @@global.innodb_fast_shutdown = @global_start_value;
+SELECT @@global.innodb_fast_shutdown;
+@@global.innodb_fast_shutdown
+1

=== modified file 'mysql-test/r/innodb_max_dirty_pages_pct_func.result'
--- a/mysql-test/r/innodb_max_dirty_pages_pct_func.result	2008-07-06 17:14:41 +0000
+++ b/mysql-test/r/innodb_max_dirty_pages_pct_func.result	2008-08-28 08:46:29 +0000
@@ -1,5 +1,8 @@
 '#--------------------FN_DYNVARS_044_02-------------------------#'
-SET @old_innodb_max_dirty_pages_pct= @@global.innodb_max_dirty_pages_pct;
+SET @start_value= @@global.innodb_max_dirty_pages_pct;
+SELECT @start_value;
+@start_value
+90
 SET @@global.innodb_max_dirty_pages_pct = 80;
 'connect (con1,localhost,root,,,,)'
 'connection con1'
@@ -30,4 +33,7 @@ DROP PROCEDURE add_until;
 DROP PROCEDURE check_pct;
 DROP FUNCTION dirty_pct;
 DROP TABLE t1;
-SET @@global.innodb_max_dirty_pages_pct = @old_innodb_max_dirty_pages_pct;
+SET @@global.innodb_max_dirty_pages_pct= @start_value;
+SELECT @@global.innodb_max_dirty_pages_pct;
+@@global.innodb_max_dirty_pages_pct
+90

=== modified file 'mysql-test/r/innodb_table_locks_func.result'
--- a/mysql-test/r/innodb_table_locks_func.result	2008-04-10 13:14:28 +0000
+++ b/mysql-test/r/innodb_table_locks_func.result	2008-08-28 08:46:29 +0000
@@ -1,4 +1,8 @@
 '#--------------------FN_DYNVARS_048_01-------------------------#'
+SET @start_value= @@global.innodb_table_locks;
+SELECT @start_value;
+@start_value
+1
 SET @@global.innodb_table_locks = OFF;
 'connect (con1,localhost,root,,,,)'
 'connection con1'
@@ -30,3 +34,7 @@ COMMIT;
 'CONNECTION con2'
 UNLOCK tables;
 DROP TABLE t1;
+SET @@global.innodb_table_locks= @start_value;
+SELECT @@global.innodb_table_locks;
+@@global.innodb_table_locks
+1

=== modified file 'mysql-test/r/insert_update.result'
--- a/mysql-test/r/insert_update.result	2007-09-06 16:22:34 +0000
+++ b/mysql-test/r/insert_update.result	2008-08-28 08:46:29 +0000
@@ -393,6 +393,7 @@ id	c1	cnt
 1	0	3
 2	2	1
 DROP TABLE t1;
+DROP TABLE t2;
 create table t1(f1 int primary key,
 f2 timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP);
 insert into t1(f1) values(1);

=== modified file 'mysql-test/r/interactive_timeout_func.result'
--- a/mysql-test/r/interactive_timeout_func.result	2008-04-10 13:14:28 +0000
+++ b/mysql-test/r/interactive_timeout_func.result	2008-08-28 08:46:29 +0000
@@ -1,30 +1,39 @@
-drop table if exists t1;
+DROP TABLE IF EXISTS t1;
 ## Creating new table t1 ##
 CREATE TABLE t1
 (
-id INT NOT NULL auto_increment,
+id INT NOT NULL AUTO_INCREMENT,
 PRIMARY KEY (id),
 name VARCHAR(30)
 );
+SET @start_value= @@global.interactive_timeout;
+SELECT @start_value;
+@start_value
+28800
 '#--------------------FN_DYNVARS_052_01-------------------------#'
 ## Setting initial value of variable to 1 ##
 SET @@global.interactive_timeout = 1;
-## Creating new interactive connection test_con1 ## 
+## Creating new interactive connection test_con1 ##
 ## Inserting record in table ##
-INSERT into t1(name) values('Record_1');
-## Setting session value of interactive_timeout ## 
+INSERT INTO t1(name) VALUES('Record_1');
+## Setting session value of interactive_timeout ##
 SET @@session.interactive_timeout = 1;
-## Verifying values of variable ## 
+## Verifying values of variable ##
 SELECT @@session.interactive_timeout;
 @@session.interactive_timeout
 1
 SELECT @@global.interactive_timeout;
 @@global.interactive_timeout
 1
-## Using sleep to check timeout ## 
-SELECT * from t1;
+## Using sleep to check timeout ##
+SELECT * FROM t1;
 id	name
 1	Record_1
 'Bug#35377: Error should appear here because interactive_timeout value';
 'is 1 and connection remains idle for 5 secs';
-INSERT into t1(name) values('Record_2');
+INSERT INTO t1(name) VALUES('Record_2');
+DROP TABLE t1;
+SET @@global.interactive_timeout= @start_value;
+SELECT @@global.interactive_timeout;
+@@global.interactive_timeout
+28800

=== modified file 'mysql-test/r/key_buffer_size_func.result'
--- a/mysql-test/r/key_buffer_size_func.result	2008-04-10 13:14:28 +0000
+++ b/mysql-test/r/key_buffer_size_func.result	2008-08-28 08:46:29 +0000
@@ -1,12 +1,13 @@
-drop table if exists t1;
+DROP TABLE IF EXISTS t1;
 ## Creating new table t1 ##
 CREATE TABLE t1
 (
-id INT NOT NULL auto_increment,
+id INT NOT NULL AUTO_INCREMENT,
 PRIMARY KEY (id),
-rollno int NOT NULL,
+rollno INT NOT NULL,
 name VARCHAR(30)
 );
+SET @start_value= @@global.key_buffer_size;
 FLUSH STATUS;
 '#--------------------FN_DYNVARS_055_01-------------------------#'
 ## Setting initial value of variable to 131072 ##
@@ -18,19 +19,20 @@ SELECT @@global.key_buffer_size;
 @@global.key_buffer_size
 131072
 ## Inserting some rows in table ##
-INSERT into t1(rollno, name) values(1, 'Record_1');
-INSERT into t1(rollno, name) values(2, 'Record_2');
-INSERT into t1(rollno, name) values(1, 'Record_3');
-INSERT into t1(rollno, name) values(3, 'Record_4');
-INSERT into t1(rollno, name) values(1, 'Record_5');
-INSERT into t1(rollno, name) values(3, 'Record_6');
-INSERT into t1(rollno, name) values(4, 'Record_7');
-INSERT into t1(rollno, name) values(4, 'Record_8');
-INSERT into t1(rollno, name) values(4, 'Record_9');
-INSERT into t1(rollno, name) values(4, 'Record_10');
+INSERT INTO t1(rollno, name) VALUES(1, 'Record_1');
+INSERT INTO t1(rollno, name) VALUES(2, 'Record_2');
+INSERT INTO t1(rollno, name) VALUES(1, 'Record_3');
+INSERT INTO t1(rollno, name) VALUES(3, 'Record_4');
+INSERT INTO t1(rollno, name) VALUES(1, 'Record_5');
+INSERT INTO t1(rollno, name) VALUES(3, 'Record_6');
+INSERT INTO t1(rollno, name) VALUES(4, 'Record_7');
+INSERT INTO t1(rollno, name) VALUES(4, 'Record_8');
+INSERT INTO t1(rollno, name) VALUES(4, 'Record_9');
+INSERT INTO t1(rollno, name) VALUES(4, 'Record_10');
 ## Verifying status of reading & writing variables ##
 ## Switching to connection test_con2 ##
 ## Verifying status of reading & writing variables ##
 ## Dropping table ##
-DROP table if exists t1;
+DROP TABLE IF EXISTS t1;
 ## Disconnecting both the connections ##
+SET @@global.key_buffer_size= @start_value;

=== modified file 'mysql-test/r/log_basic.result'
--- a/mysql-test/r/log_basic.result	2008-04-10 13:14:28 +0000
+++ b/mysql-test/r/log_basic.result	2008-08-28 08:46:29 +0000
@@ -1,4 +1,5 @@
 '#--------------------FN_DYNVARS_062_01------------------#'
+SET @start_log= @@global.log;
 SELECT @@global.log AS INIT_VALUE;
 INIT_VALUE
 1
@@ -10,8 +11,9 @@ SET global log = 0;
 'Bug# 34832: log is a system but it is not accessible using SET @@global.log;'
 'SET GLOBAL log; and SELECT @@global.log. SHOW VARIABLES shows the value of log.'
 '#--------------------FN_DYNVARS_062_02-------------------------#'
-SELECT VARIABLE_VALUE 
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
+SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
 WHERE VARIABLE_NAME='log';
 VARIABLE_VALUE
 OFF
+SET @@global.log= @start_log;

=== modified file 'mysql-test/r/log_bin_trust_function_creators_func.result'
--- a/mysql-test/r/log_bin_trust_function_creators_func.result	2008-07-10 16:09:39 +0000
+++ b/mysql-test/r/log_bin_trust_function_creators_func.result	2008-08-28 08:46:29 +0000
@@ -1,9 +1,9 @@
 drop table if exists t1;
 '#--------------------FN_DYNVARS_063_01-------------------------#'
+SET @start_value= @@global.log_bin_trust_function_creators;
 ## Creating new user tt ##
 CREATE user tt@localhost;
 ## Setting value of variable to 0 ##
-SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
 SET @@global.log_bin_trust_function_creators = 0;
 ## Creating new table t2 ##
 create table t2 (a INT);
@@ -69,6 +69,6 @@ f1(a)
 drop function f1;
 ## Dropping table t1 & t2 ##
 drop table t1,t2;
-## Disconnecting both the connections ##
+## Disconnecting test_con2##
 DROP USER tt@localhost;
-SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
+SET @@global.log_bin_trust_function_creators= @start_value;

=== modified file 'mysql-test/r/log_output_func.result'
--- a/mysql-test/r/log_output_func.result	2008-04-10 13:14:28 +0000
+++ b/mysql-test/r/log_output_func.result	2008-08-28 08:46:29 +0000
@@ -1,3 +1,7 @@
+SET @start_value= @@global.log_output;
+SELECT @start_value;
+@start_value
+FILE,TABLE
 '#--------------------FN_DYNVARS_065_01-------------------------#'
 SET @@global.log_output = 'NONE';
 'connect (con1,localhost,root,,,,)'
@@ -51,3 +55,4 @@ SELECT count(*) from mysql.general_log;
 count(*)
 0
 DROP TABLE t1;
+SET @@global.log_output= @start_value;

=== modified file 'mysql-test/r/log_queries_not_using_indexes_basic.result'
--- a/mysql-test/r/log_queries_not_using_indexes_basic.result	2008-04-10 13:14:28 +0000
+++ b/mysql-test/r/log_queries_not_using_indexes_basic.result	2008-08-28 08:46:29 +0000
@@ -1,3 +1,7 @@
+SET @start_value= @@global.log_queries_not_using_indexes;
+SELECT @start_value;
+@start_value
+0
 '#---------------------BS_STVARS_041_01----------------------#'
 SELECT COUNT(@@GLOBAL.log_queries_not_using_indexes);
 COUNT(@@GLOBAL.log_queries_not_using_indexes)
@@ -51,3 +55,7 @@ COUNT(@@GLOBAL.log_queries_not_using_ind
 SELECT log_queries_not_using_indexes = @@SESSION.log_queries_not_using_indexes;
 ERROR 42S22: Unknown column 'log_queries_not_using_indexes' in 'field list'
 Expected error 'Readonly variable'
+SET @@global.log_queries_not_using_indexes= @start_value;
+SELECT @@global.log_queries_not_using_indexes;
+@@global.log_queries_not_using_indexes
+0

=== modified file 'mysql-test/r/log_state.result'
--- a/mysql-test/r/log_state.result	2008-03-28 18:46:18 +0000
+++ b/mysql-test/r/log_state.result	2008-08-28 08:46:29 +0000
@@ -1,3 +1,6 @@
+set @start_general_log= @@global.general_log;
+set @start_slow_query_log= @@global.slow_query_log;
+set @start_general_log_file= @@global.general_log_file;
 set global general_log= OFF;
 truncate table mysql.general_log;
 truncate table mysql.slow_log;
@@ -271,3 +274,6 @@ SET GLOBAL slow_query_log_file = @slow_q
 
 # -- End of Bug#32748.
 End of 5.1 tests
+set @@global.general_log= @start_general_log;
+set @@global.slow_query_log= @start_slow_query_log;
+set @@global.general_log_file= @start_general_log_file;

=== modified file 'mysql-test/r/log_tables.result'
--- a/mysql-test/r/log_tables.result	2008-02-29 13:56:50 +0000
+++ b/mysql-test/r/log_tables.result	2008-08-28 08:46:29 +0000
@@ -1,3 +1,5 @@
+SET @old_general_log_state = @@global.general_log;
+SET @old_slow_log_state = @@global.slow_query_log;
 use mysql;
 truncate table general_log;
 select * from general_log;
@@ -354,6 +356,7 @@ slow_log
 slow_log_new
 drop table slow_log_new, general_log_new;
 use test;
+SET @my_log_output= @@global.log_output;
 SET GLOBAL LOG_OUTPUT = 'TABLE';
 SET GLOBAL general_log = 0;
 FLUSH LOGS;
@@ -422,6 +425,8 @@ SET SESSION long_query_time =@old_long_q
 FLUSH LOGS;
 ALTER TABLE mysql.slow_log DROP COLUMN seq;
 ALTER TABLE mysql.slow_log ENGINE = CSV;
+SET GLOBAL general_log = @old_general_log_state;
+SET GLOBAL slow_query_log = @old_slow_log_state;
 drop procedure if exists proc25422_truncate_slow;
 drop procedure if exists proc25422_truncate_general;
 drop procedure if exists proc25422_alter_slow;
@@ -725,6 +730,8 @@ execute long_query using @lparam;
 set global general_log = off;
 select command_type, argument from mysql.general_log where thread_id = @thread_id;
 command_type	argument
+Query	set @old_general_log_state = @@global.general_log
+Query	set global general_log = on
 Query	set @lparam = "000 001 002 003 004 005 006 007 008 009"
               "010 011 012 013 014 015 016 017 018 019"
               "020 021 022 023 024 025 026 027 028 029"
@@ -858,5 +865,6 @@ TIMESTAMP	1	1	SELECT SQL_NO_CACHE 'Bug#3
 TIMESTAMP	1	1	SELECT SQL_NO_CACHE 'Bug#31700 - PK',  f1,f2,f3,SLEEP(1.1) FROM t1 WHERE f1=2
 DROP TABLE t1;
 TRUNCATE TABLE mysql.slow_log;
+SET GLOBAL log_output= @my_log_output;
 SET GLOBAL slow_query_log = @old_slow_log_state;
 SET SESSION long_query_time =@old_long_query_time;

=== modified file 'mysql-test/r/max_allowed_packet_func.result'
--- a/mysql-test/r/max_allowed_packet_func.result	2008-04-18 09:38:41 +0000
+++ b/mysql-test/r/max_allowed_packet_func.result	2008-08-28 08:46:29 +0000
@@ -1,4 +1,5 @@
-1048576
+SET @start_max_allowed_packet= @@global.max_allowed_packet;
+SET @start_value= @@global.net_buffer_length;
 drop table if exists t1;
 ## Creating new table t1 ##
 CREATE TABLE t1
@@ -42,6 +43,5 @@ SELECT @@global.net_buffer_length;
 ## Inserting and fetching data of length greater than 1024 ## 
 INSERT into t1(name) values("aaassssssssddddddddffffffgggggggg, askdlfjalsdkjfalksdjflaksdjfalkjdflaksjdflakjdflajsflajflajdfalsjfdlajfladjslfajdflajdsflajsflakjsdfla;kjflsdjkf;aljfa;lkdsfjla;sjlkajffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllakjsdffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa;;;;;;;;;;;;;;;;;;;;;;;;;;;dsklfjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjkljffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdkskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
 drop table t1;
-SET @@global.max_allowed_packet = 1048576;
-## Server disconnects after this case and error occurs that Server ##
-## has gone away ##
+SET @@global.max_allowed_packet= @start_max_allowed_packet;
+SET @@global.net_buffer_length= @start_value;

=== modified file 'mysql-test/r/max_seeks_for_key_func.result'
--- a/mysql-test/r/max_seeks_for_key_func.result	2008-04-10 13:14:28 +0000
+++ b/mysql-test/r/max_seeks_for_key_func.result	2008-08-28 08:46:29 +0000
@@ -3,6 +3,7 @@ CREATE TABLE t1
 (a int auto_increment primary key, 
 b char(20)
 );
+SET @start_value= @@global.max_seeks_for_key;
 '#--------------------FN_DYNVARS_084_01-------------------------#'
 SELECT @@global.max_seeks_for_key = 10;
 @@global.max_seeks_for_key = 10
@@ -73,3 +74,4 @@ id	select_type	table	type	possible_keys	
 1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	17	Using where; Using join buffer
 SET MAX_SEEKS_FOR_KEY=DEFAULT;
 drop table t1;
+SET @@global.max_seeks_for_key= @start_value;

=== modified file 'mysql-test/r/max_sort_length_func.result'
--- a/mysql-test/r/max_sort_length_func.result	2008-04-10 13:14:28 +0000
+++ b/mysql-test/r/max_sort_length_func.result	2008-08-28 08:46:29 +0000
@@ -1,3 +1,4 @@
+SET @start_value= @@global.max_sort_length;
 SET @session_max_sort_length = @@Session.max_sort_length;
 DROP TABLE IF EXISTS t;
 ** creating tables **
@@ -296,3 +297,4 @@ SET @@SESSION.max_sort_length = @session
 DROP TABLE IF EXISTS t;
 DROP TABLE IF EXISTS t1;
 DROP TABLE IF EXISTS t2;
+SET @@global.max_sort_length= @start_value;

=== modified file 'mysql-test/r/myisam_data_pointer_size_func.result'
--- a/mysql-test/r/myisam_data_pointer_size_func.result	2008-04-10 13:14:28 +0000
+++ b/mysql-test/r/myisam_data_pointer_size_func.result	2008-08-28 08:46:29 +0000
@@ -1,4 +1,5 @@
 '#--------------------FN_DYNVARS_093_01-------------------------#'
+SET @start_value= @@global.myisam_data_pointer_size;
 SET @@global.myisam_data_pointer_size = 2;
 'connect (con1,localhost,root,,,,)'
 'connection con1'
@@ -40,3 +41,4 @@ count(*)
 65536
 DROP PROCEDURE  sp_addRec;
 DROP TABLE t1;
+SET @@global.myisam_data_pointer_size= @start_value;

=== modified file 'mysql-test/r/myisam_stats_method_func.result'
--- a/mysql-test/r/myisam_stats_method_func.result	2008-04-10 13:14:28 +0000
+++ b/mysql-test/r/myisam_stats_method_func.result	2008-08-28 08:46:29 +0000
@@ -1,4 +1,5 @@
 '#--------------------FN_DYNVARS_097_01-------------------------#'
+SET @start_value= @@global.myisam_stats_method;
 SET @@global.myisam_stats_method = nulls_equal;
 'connect (con1,localhost,root,,,,)'
 'connection con1'
@@ -83,3 +84,4 @@ t1	1	a	3	c	A	0	NULL	NULL	YES	BTREE	
 t1	1	a	4	d	A	0	NULL	NULL	YES	BTREE	
 SET myisam_stats_method=DEFAULT;
 DROP TABLE t1;
+SET @@global.myisam_stats_method= @start_value;

=== modified file 'mysql-test/r/profiling.result'
--- a/mysql-test/r/profiling.result	2007-12-14 13:57:37 +0000
+++ b/mysql-test/r/profiling.result	2008-08-28 08:46:29 +0000
@@ -11,6 +11,7 @@ select @@profiling;
 0
 set global profiling = ON;
 ERROR HY000: Variable 'profiling' is a SESSION variable and can't be used with SET GLOBAL
+set @start_value= @@global.profiling_history_size;
 set global profiling_history_size=100;
 show global variables like 'profil%';
 Variable_name	Value
@@ -412,4 +413,5 @@ Warnings:
 Note	1051	Unknown table 'test.v1'
 drop function if exists f1;
 set session profiling = OFF;
+set global profiling_history_size= @start_value;
 End of 5.0 tests

=== modified file 'mysql-test/r/query_cache_limit_func.result'
--- a/mysql-test/r/query_cache_limit_func.result	2008-04-10 13:14:28 +0000
+++ b/mysql-test/r/query_cache_limit_func.result	2008-08-28 08:46:29 +0000
@@ -1,6 +1,8 @@
 ** Setup **
 
 SET @global_query_cache_limit = @@global.query_cache_limit;
+SET @global_query_cache_size= @@global.query_cache_size;
+SET @global_query_cache_type= @@global.query_cache_type;
 ** warnings **
 DROP TABLE IF EXISTS t;
 ** creating table **
@@ -112,4 +114,6 @@ Variable_name	Value
 Qcache_queries_in_cache	1
 1 Expected
 SET @@GLOBAL.query_cache_limit = @global_query_cache_limit;
+SET GLOBAL query_cache_size = @global_query_cache_size;
+SET GLOBAL query_cache_type = @global_query_cache_type;
 DROP TABLE IF EXISTS t;

=== modified file 'mysql-test/r/query_cache_type_func.result'
--- a/mysql-test/r/query_cache_type_func.result	2008-04-10 13:14:28 +0000
+++ b/mysql-test/r/query_cache_type_func.result	2008-08-28 08:46:29 +0000
@@ -4,6 +4,7 @@
 ** Connection con0 **
 SET @start_global_value = @@GLOBAL.query_cache_type;
 SET @start_session_value = @@SESSION.query_cache_type;
+SET @start_query_cache_size= @@global.query_cache_size;
 CREATE TABLE t1(id int, value varchar(10));
 INSERT INTO t1 VALUES(1, 'val1');
 INSERT INTO t1 VALUES(2, 'val2');
@@ -216,6 +217,7 @@ Disconnecting con1,con2,con3
 ** Connection con0 **
 SET @@GLOBAL.query_cache_type = @start_global_value;
 SET @@SESSION.query_cache_type = @start_session_value;
+SET GLOBAL query_cache_size = @start_query_cache_size;
 DROP TABLE t1;
 DROP PROCEDURE testProcHit;
 Disconnecting con0

=== modified file 'mysql-test/r/query_prealloc_size_func.result'
--- a/mysql-test/r/query_prealloc_size_func.result	2008-04-10 13:14:28 +0000
+++ b/mysql-test/r/query_prealloc_size_func.result	2008-08-28 08:46:29 +0000
@@ -1,5 +1,6 @@
 ** Setup **
 
+SET @start_value= @@global.query_prealloc_size;
 CREATE TABLE t1 (id int auto_increment primary key, val text(200));
 INSERT INTO t1 values(NULL,'a');
 INSERT INTO t1 values(NULL,'b');
@@ -36,3 +37,5 @@ SELECT @@GLOBAL.query_prealloc_size;
 @@GLOBAL.query_prealloc_size
 8192
 Expected Value : 8192;
+DROP TABLE t1;
+SET @@global.query_prealloc_size= @start_value;

=== modified file 'mysql-test/r/rpl_init_slave_func.result'
--- a/mysql-test/r/rpl_init_slave_func.result	2008-04-10 13:14:28 +0000
+++ b/mysql-test/r/rpl_init_slave_func.result	2008-08-28 08:46:29 +0000
@@ -5,6 +5,7 @@ reset slave;
 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 start slave;
 '#--------------------FN_DYNVARS_037_01-------------------------#'
+SET @start_value= @@global.init_slave;
 SET @@global.init_slave = "SET @a = 10";
 'connect (con1,localhost,root,,)'
 'connection con1'
@@ -45,3 +46,4 @@ SELECT @a;
 NULL
 'Bug#35365 SET statement in init_slave not execute if slave is restarted'
 set global max_connections= default;
+SET @@global.init_slave= @start_value;

=== modified file 'mysql-test/r/rpl_max_binlog_size_func.result'
--- a/mysql-test/r/rpl_max_binlog_size_func.result	2008-05-30 09:12:07 +0000
+++ b/mysql-test/r/rpl_max_binlog_size_func.result	2008-08-28 08:46:29 +0000
@@ -1,8 +1,14 @@
 DROP TABLE IF EXISTS t1;
+SET @start_value= @@global.max_binlog_size;
+SELECT @start_value;
+@start_value
+1073741824
 '--- check if log file is rotated after 4096 bytes ----' 
-SET @saved_max_binlog_size= @@global.max_binlog_size;
 SET @@global.max_binlog_size = 4096;
 CREATE TABLE t1(a CHAR(5));
 'mylog.000002 exists'
-SET @@global.max_binlog_size= @saved_max_binlog_size;
 DROP TABLE t1;
+SET @@global.max_binlog_size= @start_value;
+SELECT @@global.max_binlog_size;
+@@global.max_binlog_size
+1073741824

=== modified file 'mysql-test/r/slow_query_log_file_basic.result'
--- a/mysql-test/r/slow_query_log_file_basic.result	2008-05-30 09:12:07 +0000
+++ b/mysql-test/r/slow_query_log_file_basic.result	2008-08-28 08:46:29 +0000
@@ -1,7 +1,4 @@
 SET @start_value = @@global.slow_query_log_file;
-SELECT @start_value;
-@start_value
-slowtest.log
 '#---------------------FN_DYNVARS_004_01-------------------------#'
 SET @@global.slow_query_log_file = DEFAULT;
 SELECT RIGHT(@@global.slow_query_log_file,15);
@@ -17,3 +14,4 @@ FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
 WHERE VARIABLE_NAME='slow_query_log_file';
 @@global.slow_query_log_file = VARIABLE_VALUE
 1
+SET @@global.slow_query_log_file= @start_value;

=== modified file 'mysql-test/r/variables-notembedded.result'
--- a/mysql-test/r/variables-notembedded.result	2008-02-15 12:54:04 +0000
+++ b/mysql-test/r/variables-notembedded.result	2008-08-28 08:46:29 +0000
@@ -15,3 +15,4 @@ slave_skip_errors	3,100,137,643,1752
 ---- Clean Up ----
 set global slave_net_timeout=default;
 set global sql_slave_skip_counter= 0;
+set @@global.slave_net_timeout= @my_slave_net_timeout;

=== modified file 'mysql-test/r/variables.result'
--- a/mysql-test/r/variables.result	2008-03-28 15:10:04 +0000
+++ b/mysql-test/r/variables.result	2008-08-28 08:46:29 +0000
@@ -15,6 +15,7 @@ set @my_max_heap_table_size       =@@glo
 set @my_max_insert_delayed_threads=@@global.max_insert_delayed_threads;
 set @my_max_join_size             =@@global.max_join_size;
 set @my_myisam_data_pointer_size  =@@global.myisam_data_pointer_size;
+set @my_myisam_max_sort_file_size =@@global.myisam_max_sort_file_size;
 set @my_net_buffer_length         =@@global.net_buffer_length;
 set @my_net_write_timeout         =@@global.net_write_timeout;
 set @my_net_read_timeout          =@@global.net_read_timeout;
@@ -988,7 +989,7 @@ set global delayed_queue_size        =@m
 set global flush                     =@my_flush;
 set global flush_time                =@my_flush_time;
 set global key_buffer_size           =@my_key_buffer_size;
-set global max_binlog_cache_size     =default;
+set global max_binlog_cache_size     =@my_max_binlog_cache_size;
 set global max_binlog_size           =@my_max_binlog_size;
 set global max_connect_errors        =@my_max_connect_errors;
 set global max_connections           =@my_max_connections;
@@ -999,6 +1000,7 @@ set global max_join_size             =@m
 set global max_user_connections      =default;
 set global max_write_lock_count      =default;
 set global myisam_data_pointer_size  =@my_myisam_data_pointer_size;
+set global myisam_max_sort_file_size =@my_myisam_max_sort_file_size;
 set global net_buffer_length         =@my_net_buffer_length;
 set global net_write_timeout         =@my_net_write_timeout;
 set global net_read_timeout          =@my_net_read_timeout;

=== modified file 'mysql-test/t/binlog_format_basic.test'
--- a/mysql-test/t/binlog_format_basic.test	2008-04-10 13:14:28 +0000
+++ b/mysql-test/t/binlog_format_basic.test	2008-08-28 08:46:29 +0000
@@ -1,5 +1,3 @@
-
-
 ################## mysql-test\t\binlog_format_basic.test ######################
 #                                                                             #
 # Variable Name: binlog_format                                                #
@@ -17,8 +15,8 @@
 #              * Value Check                                                  #
 #              * Scope Check                                                  #
 #                                                                             #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/                          #
-#  server-system-variables.html                                               #
+# Reference:                                                                  #
+#    http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html      #
 #                                                                             #
 ###############################################################################
 
@@ -26,6 +24,8 @@
 ####################################################################
 #   Displaying default value                                       #
 ####################################################################
+SET @start_value= @@global.binlog_format;
+
 SELECT COUNT(@@GLOBAL.binlog_format);
 --echo 1 Expected
 
@@ -36,7 +36,7 @@ SELECT COUNT(@@SESSION.binlog_format);
 ####################################################################
 #   Check if Value can set                                         #
 ####################################################################
-
+# ML: Why disabled?
 #--error ER_INCORRECT_GLOBAL_LOCAL_VAR
 SET @@GLOBAL.binlog_format=1;
 --echo Expected error 'Read only variable'
@@ -44,8 +44,6 @@ SET @@GLOBAL.binlog_format=1;
 SELECT COUNT(@@GLOBAL.binlog_format);
 --echo 1 Expected
 
-
-
 #--error ER_INCORRECT_GLOBAL_LOCAL_VAR
 SET @@SESSION.binlog_format=1;
 --echo Expected error 'Read only variable'
@@ -54,7 +52,6 @@ SELECT COUNT(@@SESSION.binlog_format);
 --echo 1 Expected
 
 
-
 --echo '#---------------------BS_STVARS_002_03----------------------#'
 #################################################################
 # Check if the value in GLOBAL Table matches value in variable  #
@@ -69,7 +66,7 @@ SELECT COUNT(@@GLOBAL.binlog_format);
 --echo 1 Expected
 
 SELECT COUNT(VARIABLE_VALUE)
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
 WHERE VARIABLE_NAME='binlog_format';
 --echo 1 Expected
 
@@ -79,8 +76,8 @@ WHERE VARIABLE_NAME='binlog_format';
 # Check if the value in SESSION Table matches value in variable #
 #################################################################
 
-SELECT @@SESSION.binlog_format = VARIABLE_VALUE 
-FROM INFORMATION_SCHEMA.SESSION_VARIABLES 
+SELECT @@SESSION.binlog_format = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
 WHERE VARIABLE_NAME='binlog_format';
 --echo 1 Expected
 
@@ -88,13 +85,11 @@ SELECT COUNT(@@SESSION.binlog_format);
 --echo 1 Expected
 
 SELECT COUNT(VARIABLE_VALUE)
-FROM INFORMATION_SCHEMA.SESSION_VARIABLES 
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
 WHERE VARIABLE_NAME='binlog_format';
 --echo 1 Expected
 
 
-
-
 --echo '#---------------------BS_STVARS_002_05----------------------#'
 ################################################################################
 #   Check if binlog_format can be accessed with and without @@ sign            #
@@ -109,5 +104,5 @@ SELECT COUNT(@@SESSION.binlog_format);
 SELECT COUNT(@@GLOBAL.binlog_format);
 --echo 1 Expected
 
-
+SET @@global.binlog_format= @start_value;
 

=== modified file 'mysql-test/t/character_set_connection_func.test'
--- a/mysql-test/t/character_set_connection_func.test	2008-04-10 13:14:28 +0000
+++ b/mysql-test/t/character_set_connection_func.test	2008-08-28 08:46:29 +0000
@@ -14,14 +14,14 @@
 # Description: Test Cases of Dynamic System Variable character_set_connection #
 #              that checks the behavior of this variable                      #
 #                                                                             #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/                          #
-#  server-system-variables.html                                               #
+# Reference:                                                                  #
+#    http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html      #
 #                                                                             #
 ###############################################################################
 
 --echo '#--------------------FN_DYNVARS_011_01-------------------------#'
 ##########################################################################
-# Check if setting character_set_connection is changed in new connection # 
+# Check if setting character_set_connection is changed in new connection #
 ##########################################################################
 
 #save
@@ -35,7 +35,7 @@ SET @@global.character_set_connection = 
 --echo 'connect (con1,localhost,root,,,,)'
 connect (con1,localhost,root,,,,);
 --echo 'connection con1'
-connection con1; 
+connection con1;
 SELECT @@global.character_set_connection;
 SELECT @@session.character_set_connection;
 disconnect con1;
@@ -51,7 +51,7 @@ connection default;
 --disable_warnings
 DROP TABLE IF EXISTS t1;
 --enable_warnings
-CREATE TABLE t1(b CHAR(40) character set utf8);
+CREATE TABLE t1(b CHAR(40) CHARACTER SET utf8);
 #==============================================================================
 --echo '--verify that character_set_connection converts character_set_client--'
 #==============================================================================
@@ -90,13 +90,16 @@ INSERT INTO t1 VALUES('ЁЂЃЄ');
 SELECT * FROM t1;
 TRUNCATE TABLE t1;
 
-#restore
-#save
+
+# Cleanup
 SET @@global.character_set_connection = @global_character_set_connection;
 SET @@session.character_set_connection = @session_character_set_connection;
 SET @@session.character_set_client = @session_character_set_client;
 SET @@session.character_set_results = @session_character_set_results;
 
+DROP TABLE t1;
+
 #############################################################
 # End of functionality Testing for character_set_connection #
 #############################################################
+

=== modified file 'mysql-test/t/completion_type_func.test'
--- a/mysql-test/t/completion_type_func.test	2008-04-16 08:23:07 +0000
+++ b/mysql-test/t/completion_type_func.test	2008-08-28 08:46:29 +0000
@@ -1,4 +1,4 @@
-############## mysql-test\t\completion_type_func.test #########################
+############## mysql-test\t\completion_type_func.test ##########################
 #                                                                              #
 # Variable Name: completion_type                                               #
 # Scope: GLOBAL & SESSION                                                      #
@@ -12,7 +12,7 @@
 # Author:  Salman Rawala                                                       #
 #                                                                              #
 # Description: Test Cases of Dynamic System Variable "completion_type"         #
-#              that checks functinality of this variable                       #
+#              that checks functionality of this variable                      #
 #                                                                              #
 # Reference: http://dev.mysql.com/doc/refman/5.1/en/                           #
 #          server-system-variables.html#option_mysqld_completion_type          #
@@ -22,7 +22,7 @@
 --source include/have_innodb.inc
 
 --disable_warnings
-drop table if exists t1;
+DROP TABLE IF EXISTS t1;
 --enable_warnings
 
 #########################
@@ -32,62 +32,62 @@ drop table if exists t1;
 --echo ## Creating new table ##
 CREATE TABLE t1
 (
-id INT NOT NULL auto_increment,
+id INT NOT NULL AUTO_INCREMENT,
 PRIMARY KEY (id),
-name varchar(30)
+name VARCHAR(30)
 ) ENGINE = INNODB;
 
 --echo '#--------------------FN_DYNVARS_017_01-------------------------#'
 #########################################################
-#    Setting initial value of completion_type to zero   # 
+#    Setting initial value of completion_type to zero   #
 #########################################################
 
 --echo ## Creating new connection ##
 connect (test_con1,localhost,root,,);
 connection test_con1;
 
-INSERT into t1(name) values('Record_1');
+INSERT INTO t1(name) VALUES('Record_1');
 SET @@autocommit = 0;
-SELECT * from t1;
+SELECT * FROM t1;
 
 --echo ## Setting value of variable to 0 ##
 SET @@session.completion_type = 0;
 
 --echo ## Here commit & rollback should work normally ##
 START TRANSACTION;
-SELECT * from t1;
-INSERT into t1(name) values('Record_2');
-INSERT into t1(name) values('Record_3');
-SELECT * from t1;
-DELETE FROM t1 where id = 2;
-SELECT * from t1;
+SELECT * FROM t1;
+INSERT INTO t1(name) VALUES('Record_2');
+INSERT INTO t1(name) VALUES('Record_3');
+SELECT * FROM t1;
+DELETE FROM t1 WHERE id = 2;
+SELECT * FROM t1;
 
 
 START TRANSACTION;
-SELECT * from t1;
-INSERT into t1(name) values('Record_4');
-INSERT into t1(name) values('Record_5');
+SELECT * FROM t1;
+INSERT INTO t1(name) VALUES('Record_4');
+INSERT INTO t1(name) VALUES('Record_5');
 COMMIT;
 
 
 --echo '#--------------------FN_DYNVARS_017_02-------------------------#'
 #########################################################
-#    Setting initial value of completion_type to 2      # 
+#    Setting initial value of completion_type to 2      #
 #########################################################
 
 SET @@session.completion_type = 2;
 
 --echo ## Here commit should work as COMMIT RELEASE ##
 START TRANSACTION;
-SELECT * from t1;
-INSERT into t1(name) values('Record_6');
-INSERT into t1(name) values('Record_7');
+SELECT * FROM t1;
+INSERT INTO t1(name) VALUES('Record_6');
+INSERT INTO t1(name) VALUES('Record_7');
 COMMIT;
 
 --echo ## Inserting rows should give error here because connection should ##
 --echo ## disconnect after using COMMIT ##
 --Error 2006,2013,1053
-INSERT into t1(name) values('Record_4');
+INSERT INTO t1(name) VALUES('Record_4');
 
 --echo ## Creating new connection test_con2 ##
 connect (test_con2,localhost,root,,);
@@ -96,11 +96,17 @@ SET @@session.completion_type = 2;
 
 --echo ## Inserting rows and using Rollback which should Rollback & release ##
 START TRANSACTION;
-SELECT * from t1;
-INSERT into t1(name) values('Record_8');
-INSERT into t1(name) values('Record_9');
+SELECT * FROM t1;
+INSERT INTO t1(name) VALUES('Record_8');
+INSERT INTO t1(name) VALUES('Record_9');
 ROLLBACK;
 
 --Error 2006,2013,1053
-INSERT into t1(name) values('Record_4');
+INSERT INTO t1(name) VALUES('Record_4');
+
+connection default;
+disconnect test_con1;
+disconnect test_con2;
+
+DROP TABLE t1;
 

=== modified file 'mysql-test/t/concurrent_insert_func.test'
--- a/mysql-test/t/concurrent_insert_func.test	2008-04-10 13:14:28 +0000
+++ b/mysql-test/t/concurrent_insert_func.test	2008-08-28 08:46:29 +0000
@@ -14,14 +14,14 @@
 # Description: Test Cases of Dynamic System Variable "concurrent_insert"       #
 #              that checks functionality of this variable                      #
 #                                                                              #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/                           #
-#    server-system-variables.html#option_mysqld_concurrent_insert              #
+# Reference:                                                                   #
+#  http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html         #  
 #                                                                              #
 ################################################################################
 
 
 --disable_warnings
-drop table if exists t1;
+DROP TABLE IF EXISTS t1;
 --enable_warnings
 
 #########################
@@ -31,110 +31,132 @@ drop table if exists t1;
 --echo ## Creating new table ##
 CREATE TABLE t1
 (
-name varchar(30)
+name VARCHAR(30)
 );
 
 --echo '#--------------------FN_DYNVARS_018_01-------------------------#'
 ####################################################################
-#    Setting initial value of concurrent_insert to 1  
-#    concurrent_insert = 1 means Enables concurrent insert 
+#    Setting initial value of concurrent_insert to 1
+#    concurrent_insert = 1 means Enables concurrent insert
 #    for MyISAM tables that don't have holes
 ####################################################################
 
+SET @start_value= @@global.concurrent_insert;
+
 --echo ## Setting initial value of variable to 1 ##
 SET @@global.concurrent_insert = 1;
-INSERT into t1(name) values('Record_1');
-INSERT into t1(name) values('Record_2');	
-INSERT into t1(name) values('Record_3');
+INSERT INTO t1(name) VALUES('Record_1');
+INSERT INTO t1(name) VALUES('Record_2');
+INSERT INTO t1(name) VALUES('Record_3');
 
 --echo ## locking table ##
-lock table t1 read local;
+LOCK TABLE t1 READ LOCAL;
 
---echo ## Creating new connection to insert some rows in table ## 
+--echo ## Creating new connection to insert some rows in table ##
 connect (test_con1,localhost,root,,);
+--echo connection test_con1;
 connection test_con1;
 
 --echo ## New records should come at the end of all rows ##
-INSERT into t1(name) values('Record_4');	
-SELECT * from t1;
+INSERT INTO t1(name) VALUES('Record_4');
+SELECT * FROM t1;
 
 
 --echo ## unlocking tables ##
+--echo connection default;
 connection default;
 unlock tables;
 
---echo ## deleting record to create hole in table ## 
-DELETE from t1 where name ='Record_2';
+--echo ## deleting record to create hole in table ##
+DELETE FROM t1 WHERE name ='Record_2';
 
 
 --echo '#--------------------FN_DYNVARS_018_02-------------------------#'
 ####################################################################
-#    Setting initial value of concurrent_insert to 1  
-#    concurrent_insert = 1 and trying to insert some values  
+#    Setting initial value of concurrent_insert to 1
+#    concurrent_insert = 1 and trying to insert some values
 #    in MyISAM tables that have holes
 ####################################################################
+# Disabled due to bug#39009
 
 # lock table and connect with connection1
-#lock table t1 read local;
-#connection test_con1;
+LOCK TABLE t1 READ LOCAL;
+--echo connection test_con1;
+connection test_con1;
 
 # setting value of concurrent_insert to 1
-#SET @@global.concurrent_insert=1;
-
-#INSERT into t1(name) values('Record_7');
-#SELECT * from t1;
-
-#connection default;
-#unlock tables;
+SET @@global.concurrent_insert=1;
 
-#SELECT * from t1;
-#INSERT into t1(name) values('Record_6');
-
-# On inserting rows in hole while the value of concurrent_insert is 1
-# MySQL server hangs.
+--echo ## send INSERT which should be blocked until unlock of the table ##
+send INSERT INTO t1(name) VALUES('Record_7');
 
+--echo connection default;
+connection default;
+# wait until INSERT will be locked (low performance)
+let $wait_condition= SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
+                     WHERE state= "Locked" AND info LIKE "INSERT INTO t1%";
+--source include/wait_condition.inc
+
+--echo ## show processlist info and state ##
+SELECT state,info FROM INFORMATION_SCHEMA.PROCESSLIST
+                     WHERE state= "Locked" AND info LIKE "INSERT INTO t1%";
+--echo ## table contents befor UNLOCK ##
+SELECT * FROM t1;
+UNLOCK TABLES;
+--echo ## table contens after UNLOCK ##
+SELECT * FROM t1;
+INSERT INTO t1(name) VALUES('Record_6');
 
+--echo connection test_con1;
+connection test_con1;
+# to complete the send above^
+reap;
+select * from t1;
+--echo connection default;
+connection default;
 
 --echo '#--------------------FN_DYNVARS_018_03-------------------------#'
-###############################################################################
+################################################################################
 #    Setting value of concurrent_insert to 2 to verify values after inserting
 #    it into table with holes
-#    concurrent_insert = 2 means Enables concurrent insert 
+#    concurrent_insert = 2 means Enables concurrent insert
 #    for MyISAM tables that have holes but inserts values at the end of all rows
-###############################################################################
+################################################################################
 
 --echo ## lock table and connect with connection1 ##
-lock table t1 read local;
+LOCK TABLE t1 READ LOCAL;
+--echo connection test_con1;
 connection test_con1;
-
 --echo ## setting value of concurrent_insert to 2 ##
 SET @@global.concurrent_insert=2;
 
 --echo ## Inserting record in table, record should go at the end of the table ##
-INSERT into t1(name) values('Record_5');
-SELECT * from t1;
+INSERT INTO t1(name) VALUES('Record_5');
+SELECT * FROM t1;
 SELECT @@concurrent_insert;
 
---echo ## Switching to default connection ##
+--echo connection default;
 connection default;
 
 --echo ## Unlocking table ##
-unlock tables;
+UNLOCK TABLES;
 
-SELECT * from t1;
+SELECT * FROM t1;
 
 --echo ## Inserting new row, this should go in the hole ##
-INSERT into t1(name) values('Record_6');
-SELECT * from t1;
+INSERT INTO t1(name) VALUES('Record_6');
+SELECT * FROM t1;
 
 --echo ## connection test_con1 ##
 
-DELETE from t1 where name ='Record_3';
-SELECT * from t1;
+DELETE FROM t1 WHERE name ='Record_3';
+SELECT * FROM t1;
 
 --echo ## Dropping table ##
-DROP table t1;
+DROP TABLE t1;
 
 --echo ## Disconnecting connection ##
 disconnect test_con1;
 
+SET @@global.concurrent_insert= @start_value;
+

=== modified file 'mysql-test/t/delay_key_write_func.test'
--- a/mysql-test/t/delay_key_write_func.test	2008-04-15 13:44:11 +0000
+++ b/mysql-test/t/delay_key_write_func.test	2008-08-28 08:46:29 +0000
@@ -14,8 +14,8 @@
 # Description: Test Cases of Dynamic System Variable delay_key_write          #
 #              that checks the behavior of this variable                      #
 #                                                                             #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/                          #
-#  server-system-variables.html                                               #
+# Reference:                                                                  #
+#  http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html        #
 #                                                                             #
 ###############################################################################
 
@@ -24,6 +24,7 @@
 # Check if setting delay_key_write is changed in every new connection # 
 #######################################################################
 
+SET @start_value= @@global.delay_key_write;
 
 SET @@global.delay_key_write = ON;
 SELECT @@global.delay_key_write;
@@ -143,7 +144,12 @@ select count(*) from t1;
 
 DROP PROCEDURE sp_addRecords;
 DROP TABLE t1;
+disconnect user1;
+
+connection default;
+SET @@global.delay_key_write= @start_value;
 
 ####################################################
 # End of functionality testing for delay_key_write #
 ####################################################
+

=== modified file 'mysql-test/t/disabled.def'
--- a/mysql-test/t/disabled.def	2008-08-14 09:38:22 +0000
+++ b/mysql-test/t/disabled.def	2008-08-28 08:46:29 +0000
@@ -25,3 +25,4 @@ slow_query_log_func                   : 
 sql_low_priority_updates_func         : BUG#37962 2008-07-08 sven *_func tests containing sleeps/race conditions
 timestamp_func                        : BUG#37962 2008-07-08 sven *_func tests containing sleeps/race conditions
 log_output_func                       : BUG#37766 2008-07-10 sven main.log_output_func randomly fails in pushbuild
+

=== modified file 'mysql-test/t/general_log_file_basic.test'
--- a/mysql-test/t/general_log_file_basic.test	2008-05-20 18:23:58 +0000
+++ b/mysql-test/t/general_log_file_basic.test	2008-08-28 08:46:29 +0000
@@ -35,13 +35,11 @@
 ########################################################################
 
 SET @start_value = @@global.general_log_file;
-SELECT @start_value;
-
 
 --echo '#---------------------FN_DYNVARS_004_01-------------------------#'
-############################################### 
+###############################################
 #     Verify default value of variable        #
-############################################### 
+###############################################
 
 SET @@global.general_log_file = DEFAULT;
 SELECT RIGHT(@@global.general_log_file,10) AS log_file;
@@ -49,7 +47,7 @@ SELECT RIGHT(@@global.general_log_file,1
 
 --echo '#--------------------FN_DYNVARS_004_02------------------------#'
 #######################################################################
-#        Change the value of general_log_file to a invalid value      #
+#     Change the value of general_log_file to an invalid value        #
 #######################################################################
 
 # Assumed text if no quotes or numbers.
@@ -59,15 +57,17 @@ SET @@global.general_log_file = 12;
 
 
 --echo '#----------------------FN_DYNVARS_004_03------------------------#'
-############################################################################## 
+##############################################################################
 # Check if the value in GLOBAL Tables matches values in variable             #
 ##############################################################################
 
-SELECT @@global.general_log_file = VARIABLE_VALUE 
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
+SELECT @@global.general_log_file = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
 WHERE VARIABLE_NAME='general_log_file';
 
+SET @@global.general_log_file= @start_value;
 
 #####################################################
 #       END OF general_log_file TESTS               #
 #####################################################
+

=== modified file 'mysql-test/t/innodb.test'
--- a/mysql-test/t/innodb.test	2008-05-30 09:12:07 +0000
+++ b/mysql-test/t/innodb.test	2008-08-28 08:46:29 +0000
@@ -1316,6 +1316,7 @@ set global innodb_sync_spin_loops=20;
 show variables like "innodb_sync_spin_loops";
 
 # Test for innodb_thread_concurrency variable
+set @start_value= @@global.innodb_thread_concurrency;
 show variables like "innodb_thread_concurrency";
 set global innodb_thread_concurrency=1001;
 show variables like "innodb_thread_concurrency";
@@ -1323,6 +1324,7 @@ set global innodb_thread_concurrency=0;
 show variables like "innodb_thread_concurrency";
 set global innodb_thread_concurrency=16;
 show variables like "innodb_thread_concurrency";
+set global innodb_thread_concurrency= @start_value;
 
 # Test for innodb_concurrency_tickets variable
 show variables like "innodb_concurrency_tickets";

=== modified file 'mysql-test/t/innodb_autoextend_increment_basic.test'
--- a/mysql-test/t/innodb_autoextend_increment_basic.test	2008-04-14 15:21:18 +0000
+++ b/mysql-test/t/innodb_autoextend_increment_basic.test	2008-08-28 08:46:29 +0000
@@ -1,99 +1,87 @@
-################# mysql-test\t\innodb_autoextend_increment _basic.test ###################
-#                                                                             #
-# Variable Name: innodb_autoextend_increment                                  #
-# Scope: GLOBAL                                                               #
-# Access Type: Dynamic                                                        #
-# Data Type: Numeric                                                          #
-# Default Value: 8                                                            #
-# Range: 0,1                                                                  #
-#                                                                             #
-#                                                                             #
-# Creation Date: 2008-02-07                                                   #
-# Author:  Rizwan                                                             #
-#                                                                             #
-#Description:Test Cases of Dynamic System Variable innodb_autoextend_increment#
-#             that checks the behavior of this variable in the following ways #
-#              * Default Value                                                #
-#              * Valid & Invalid values                                       #
-#              * Scope & Access method                                        #
-#              * Data Integrity                                               #
-#                                                                             #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/                          #
-#  server-system-variables.html                                               #
-#                                                                             #
-###############################################################################
+################# mysql-test\t\innodb_autoextend_increment _basic.test ###########
+#                                                                                #
+# Variable Name: innodb_autoextend_increment                                     #
+# Scope: GLOBAL                                                                  #
+# Access Type: Dynamic                                                           #
+# Data Type: Numeric                                                             #
+# Default Value: 8                                                               #
+# Range: 0,1                                                                     #
+#                                                                                #
+#                                                                                #
+# Creation Date: 2008-02-07                                                      #
+# Author:  Rizwan                                                                #
+#                                                                                #
+# Description:                                                                   #
+#    Test Cases of Dynamic System Variable innodb_autoextend_increment that      #
+#    checks the behavior of this variable in the following ways                  #
+#       * Default Value                                                          #
+#       * Valid & Invalid values                                                 #
+#       * Scope & Access method                                                  #
+#       * Data Integrity                                                         #
+#                                                                                #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
+#                                                                                #
+##################################################################################
 
 --source include/have_innodb.inc
 --source include/load_sysvars.inc
 
-######################################################################## 
+########################################################################
 #                    START OF innodb_autoextend_increment  TESTS       #
-######################################################################## 
+########################################################################
 
 
-################################################################################ 
-#   Saving initial value of innodb_autoextend_increment  in a temporary variable#
-################################################################################ 
+###############################################################################
+# Saving initial value of innodb_autoextend_increment in a temporary variable #
+###############################################################################
 
 
 SET @global_start_value = @@global.innodb_autoextend_increment ;
-SELECT @global_start_value;
-
-
 
 --echo '#--------------------FN_DYNVARS_046_01------------------------#'
-######################################################################## 
+########################################################################
 #           Display the DEFAULT value of innodb_autoextend_increment   #
-######################################################################## 
-
-
+########################################################################
 
 SET @@global.innodb_autoextend_increment  = 0;
 SET @@global.innodb_autoextend_increment  = DEFAULT;
 SELECT @@global.innodb_autoextend_increment ;
 
 --echo '#---------------------FN_DYNVARS_046_02-------------------------#'
-#################################################################################### 
+####################################################################################
 #   Check if innodb_autoextend_increment  can be accessed with and without @@ sign #
-#################################################################################### 
+####################################################################################
 
 --Error ER_GLOBAL_VARIABLE
 SET innodb_autoextend_increment  = 1;
 SELECT @@innodb_autoextend_increment ;
 
-
 --Error ER_UNKNOWN_TABLE
 SELECT local.innodb_autoextend_increment ;
 
-
 SET global innodb_autoextend_increment  = 0;
 SELECT @@global.innodb_autoextend_increment ;
 
 
 --echo '#--------------------FN_DYNVARS_046_03------------------------#'
-########################################################################## 
-#      change the value of innodb_autoextend_increment  to a valid value            #
-########################################################################## 
-
-
+##########################################################################
+#    change the value of innodb_autoextend_increment  to a valid value   #
+##########################################################################
 
 SET @@global.innodb_autoextend_increment  = 1;
 SELECT @@global.innodb_autoextend_increment ;
 SET @@global.innodb_autoextend_increment  = 1000;
 SELECT @@global.innodb_autoextend_increment ;
 
---echo '#--------------------FN_DYNVARS_046_04-------------------------#'
-########################################################################### 
-#       Change the value of innodb_autoextend_increment  to invalid value            #
-########################################################################### 
-
-
 
+--echo '#--------------------FN_DYNVARS_046_04-------------------------#'
+###########################################################################
+# Change the value of innodb_autoextend_increment  to invalid value       #
+###########################################################################
 
 SET @@global.innodb_autoextend_increment  = -1;
 SELECT @@global.innodb_autoextend_increment;
 
-
 --Error ER_WRONG_TYPE_FOR_VAR
 SET @@global.innodb_autoextend_increment  = "T";
 SELECT @@global.innodb_autoextend_increment;
@@ -102,31 +90,28 @@ SELECT @@global.innodb_autoextend_increm
 SET @@global.innodb_autoextend_increment  = "Y";
 SELECT @@global.innodb_autoextend_increment;
 
-
 SET @@global.innodb_autoextend_increment  = 1001;
 SELECT @@global.innodb_autoextend_increment;
 
 
-
-
 --echo '#----------------------FN_DYNVARS_046_05------------------------#'
-######################################################################### 
+#########################################################################
 #     Check if the value in GLOBAL Table matches value in variable      #
 #########################################################################
 
-SELECT @@global.innodb_autoextend_increment  = VARIABLE_VALUE 
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
+SELECT @@global.innodb_autoextend_increment  = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
 WHERE VARIABLE_NAME='innodb_autoextend_increment ';
 SELECT @@global.innodb_autoextend_increment ;
-SELECT VARIABLE_VALUE 
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
+SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
 WHERE VARIABLE_NAME='innodb_autoextend_increment ';
 
 
 --echo '#---------------------FN_DYNVARS_046_06-------------------------#'
-################################################################### 
+###################################################################
 #        Check if ON and OFF values can be used on variable       #
-################################################################### 
+###################################################################
 
 --ERROR ER_WRONG_TYPE_FOR_VAR
 SET @@global.innodb_autoextend_increment  = OFF;
@@ -136,25 +121,25 @@ SELECT @@global.innodb_autoextend_increm
 SET @@global.innodb_autoextend_increment  = ON;
 SELECT @@global.innodb_autoextend_increment ;
 
+
 --echo '#---------------------FN_DYNVARS_046_07----------------------#'
-################################################################### 
+###################################################################
 #      Check if TRUE and FALSE values can be used on variable     #
-################################################################### 
-
+###################################################################
 
 SET @@global.innodb_autoextend_increment  = TRUE;
 SELECT @@global.innodb_autoextend_increment ;
 SET @@global.innodb_autoextend_increment  = FALSE;
 SELECT @@global.innodb_autoextend_increment ;
 
-##############################  
+
+##############################
 #   Restore initial value    #
 ##############################
 
+SET @@global.innodb_autoextend_increment  = @global_start_value;
 
-#SET @@global.innodb_autoextend_increment  = @global_start_value;
-#SELECT @@global.innodb_autoextend_increment ;
-
 ###############################################################
-#                    END OF innodb_autoextend_increment  TESTS           #
-############################################################### 
+#         END OF innodb_autoextend_increment  TESTS           #
+###############################################################
+

=== modified file 'mysql-test/t/innodb_autoinc_lock_mode_func.test'
--- a/mysql-test/t/innodb_autoinc_lock_mode_func.test	2008-04-10 13:14:28 +0000
+++ b/mysql-test/t/innodb_autoinc_lock_mode_func.test	2008-08-28 08:46:29 +0000
@@ -11,11 +11,12 @@
 # Creation Date: 2008-03-08                                                   #
 # Author:  Rizwan Maredia                                                     #
 #                                                                             #
-#Description:Test Cases of Dynamic System Variable innodb_autoextend_increment#
-#             that checks the behavior of this variable                       #
+# Description:                                                                #
+#    Test Cases of Dynamic System Variable innodb_autoextend_increment that   #
+#    checks the behavior of this variable                                     #
 #                                                                             #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/                          #
-#  server-system-variables.html                                               #
+# Reference:                                                                  #
+#    http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html      #
 #                                                                             #
 ###############################################################################
 
@@ -50,6 +51,8 @@ INSERT INTO t1 (a,b) VALUES (NULL,'e');
 --echo 'the new auto incremented value should be 104'
 SELECT * from t1;
 
+DROP TABLE t1;
+
 ###############################################################
 # End of functionality Testing for innodb_autoinc_lock_mode   #
 ###############################################################

=== modified file 'mysql-test/t/innodb_fast_shutdown_basic.test'
--- a/mysql-test/t/innodb_fast_shutdown_basic.test	2008-04-14 15:21:18 +0000
+++ b/mysql-test/t/innodb_fast_shutdown_basic.test	2008-08-28 08:46:29 +0000
@@ -9,54 +9,51 @@
 #                                                                             #
 #                                                                             #
 # Creation Date: 2008-02-20                                                   #
-# Author:  Sharique Abdullah                                                            #
+# Author:  Sharique Abdullah                                                  #
 #                                                                             #
-# Description: Test Cases of Dynamic System Variable innodb_fast_shutdown     #
-#              that checks the behavior of this variable in the following ways#
+# Description:                                                                #
+#    Test Cases of Dynamic System Variable innodb_fast_shutdown that checks   #
+#    the behavior of this variable in the following ways                      #
 #              * Default Value                                                #
 #              * Valid & Invalid values                                       #
 #              * Scope & Access method                                        #
 #              * Data Integrity                                               #
 #                                                                             #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/                          #
-#  server-system-variables.html                                               #
+# Reference:                                                                  #
+#    http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html      #
 #                                                                             #
 ###############################################################################
 
 --source include/have_innodb.inc
 --source include/load_sysvars.inc
 
-######################################################################## 
+########################################################################
 #                    START OF innodb_fast_shutdown TESTS               #
-######################################################################## 
+########################################################################
 
 
-############################################################################## 
+##############################################################################
 #      Saving initial value of innodb_fast_shutdown in a temporary variable  #
-############################################################################## 
-
-
+##############################################################################
 
 SET @global_start_value = @@global.innodb_fast_shutdown;
 SELECT @@global.innodb_fast_shutdown;
-                 
+
 
 --echo '#--------------------FN_DYNVARS_042_01------------------------#'
-######################################################################## 
+########################################################################
 #           Display the DEFAULT value of innodb_fast_shutdown          #
-######################################################################## 
+########################################################################
 
 SET @@global.innodb_fast_shutdown = 0;
 SET @@global.innodb_fast_shutdown = DEFAULT;
 SELECT @@global.innodb_fast_shutdown;
 
 
-
 --echo '#---------------------FN_DYNVARS_042_02-------------------------#'
-############################################################################# 
+#############################################################################
 #   Check if innodb_fast_shutdown can be accessed with and without @@ sign  #
-############################################################################# 
-
+#############################################################################
 
 --ERROR ER_GLOBAL_VARIABLE
 SET innodb_fast_shutdown = 1;
@@ -70,25 +67,26 @@ SELECT @@global.innodb_fast_shutdown;
 
 
 --echo '#--------------------FN_DYNVARS_042_03------------------------#'
-######################################################################## 
-#              Change the value of innodb_fast_shutdown to a valid value         #
-######################################################################## 
+##########################################################################
+#              Change the value of innodb_fast_shutdown to a valid value #
+##########################################################################
 
 SET @@global.innodb_fast_shutdown = 0;
 SELECT @@global.innodb_fast_shutdown;
 
 SET @@global.innodb_fast_shutdown = 1;
 SELECT @@global.innodb_fast_shutdown;
-## a value of 2 is used to just flush logs and then shutdown cold. Not supported on Netware
+## A value of 2 is used to just flush logs and then shutdown cold.
+## Not supported on Netware
 
 SET @@global.innodb_fast_shutdown = 2;
 SELECT @@global.innodb_fast_shutdown;
 
+
 --echo '#--------------------FN_DYNVARS_042_04-------------------------#'
-########################################################################### 
+###########################################################################
 #               Change the value of innodb_fast_shutdown to invalid value #
-########################################################################### 
-
+###########################################################################
 
 SET @@global.innodb_fast_shutdown = -1;
 SELECT @@global.innodb_fast_shutdown;
@@ -121,11 +119,10 @@ SET @@global.innodb_fast_shutdown = "0";
 SELECT @@global.innodb_fast_shutdown;
 
 
-
 --echo '#-------------------FN_DYNVARS_042_05----------------------------#'
-########################################################################### 
+###########################################################################
 #           Test if accessing session innodb_fast_shutdown gives error    #
-########################################################################### 
+###########################################################################
 
 --Error ER_GLOBAL_VARIABLE
 SET @@session.innodb_fast_shutdown = 0;
@@ -136,32 +133,30 @@ SET @@innodb_fast_shutdown = 0;
 SET @@local.innodb_fast_shutdown = 0;
 
 
-
 --echo '#----------------------FN_DYNVARS_042_06------------------------#'
-######################################################################### 
+#########################################################################
 #     Check if the value in SESSION Table contains variable value       #
 #########################################################################
 
-SELECT count(VARIABLE_VALUE) AS res_is_0 
-FROM INFORMATION_SCHEMA.SESSION_VARIABLES 
+SELECT count(VARIABLE_VALUE) AS res_is_0
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
 WHERE VARIABLE_NAME='innodb_fast_shutdown';
 
 
 --echo '#----------------------FN_DYNVARS_042_07------------------------#'
-######################################################################### 
-#     Check if the value in GLOBAL Table matches value in variable     #
+#########################################################################
+#      Check if the value in GLOBAL Table matches value in variable     #
 #########################################################################
 
 SELECT @@global.innodb_fast_shutdown =
-VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
+VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
 WHERE VARIABLE_NAME='innodb_fast_shutdown';
 
 
 --echo '#---------------------FN_DYNVARS_042_08-------------------------#'
-################################################################### 
+###################################################################
 #        Check if ON and OFF values can be used on variable       #
-################################################################### 
-
+###################################################################
 
 --Error ER_WRONG_TYPE_FOR_VAR
 SET @@global.innodb_fast_shutdown = OFF;
@@ -171,23 +166,25 @@ SELECT @@global.innodb_fast_shutdown;
 SET @@global.innodb_fast_shutdown = ON;
 SELECT @@global.innodb_fast_shutdown;
 
+
 --echo '#---------------------FN_DYNVARS_042_09----------------------#'
-################################################################### 
+###################################################################
 #      Check if TRUE and FALSE values can be used on variable     #
-################################################################### 
+###################################################################
 
 SET @@global.innodb_fast_shutdown = TRUE;
 SELECT @@global.innodb_fast_shutdown;
 SET @@global.innodb_fast_shutdown = FALSE;
 SELECT @@global.innodb_fast_shutdown;
 
-##############################  
+
+##############################
 #   Restore initial value    #
 ##############################
 
-#SET @@innodb_fast_shutdown = @global_start_value;
-#SELECT @@innodb_fast_shutdown;
+SET @@global.innodb_fast_shutdown = @global_start_value;
+SELECT @@global.innodb_fast_shutdown;
 
-######################################################################## 
+########################################################################
 #                    END OF innodb_fast_shutdown TESTS                 #
-######################################################################## 
+########################################################################

=== modified file 'mysql-test/t/innodb_max_dirty_pages_pct_func.test'
--- a/mysql-test/t/innodb_max_dirty_pages_pct_func.test	2008-07-06 17:14:41 +0000
+++ b/mysql-test/t/innodb_max_dirty_pages_pct_func.test	2008-08-28 08:46:29 +0000
@@ -11,21 +11,23 @@
 # Creation Date: 2008-03-08                                                   #
 # Author:  Rizwan                                                             #
 #                                                                             #
-#Description: Test Cases of Dynamic System Variable innodb_max_dirty_pages_pct#
-#             that checks the behavior of this variable                       #
+# Description:                                                                #
+#    Test cases of Dynamic System Variable innodb_max_dirty_pages_pct that    #
+#    checks the behavior of this variable                                     #
 #                                                                             #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/                          #
-#  server-system-variables.html                                               #
+# Reference:                                                                  #
+#    http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html      #
 #                                                                             #
 ###############################################################################
 
 --source include/have_innodb.inc
 --echo '#--------------------FN_DYNVARS_044_02-------------------------#'
-###########################################################################
-# Check if setting innodb_max_dirty_pages_pct is changed in new connection# 
-###########################################################################
+############################################################################
+# Check if setting innodb_max_dirty_pages_pct is changed in new connection #
+############################################################################
 
-SET @old_innodb_max_dirty_pages_pct= @@global.innodb_max_dirty_pages_pct;
+SET @start_value= @@global.innodb_max_dirty_pages_pct;
+SELECT @start_value;
 
 SET @@global.innodb_max_dirty_pages_pct = 80;
 --echo 'connect (con1,localhost,root,,,,)'
@@ -42,6 +44,7 @@ SELECT @@global.innodb_max_dirty_pages_p
 disconnect con2;
 disconnect con1;
 
+
 --echo '#--------------------FN_DYNVARS_044_02-------------------------#'
 ###################################################################
 # Begin the functionality Testing of innodb_max_dirty_pages_pct   #
@@ -76,21 +79,21 @@ BEGIN
   DECLARE res DECIMAL(20,17);
   DECLARE a1,b1 VARCHAR(256);
   DECLARE a2,b2 VARCHAR(256);
-  DECLARE dirty CURSOR FOR SELECT * FROM information_schema.global_status 
+  DECLARE dirty CURSOR FOR SELECT * FROM information_schema.global_status
                 WHERE variable_name LIKE 'Innodb_buffer_pool_pages_dirty'
-                     UNION SELECT * FROM information_schema.session_status 
+                     UNION SELECT * FROM information_schema.session_status
                 WHERE variable_name LIKE 'Innodb_buffer_pool_pages_dirty';
   DECLARE total CURSOR FOR SELECT * FROM information_schema.global_status
                 WHERE variable_name LIKE 'Innodb_buffer_pool_pages_total'
                      UNION SELECT * FROM information_schema.session_status
                 WHERE variable_name LIKE 'Innodb_buffer_pool_pages_total';
- 
+
   OPEN dirty;
   OPEN total;
 
   FETCH dirty INTO a1, b1;
   FETCH total INTO a2, b2;
-  
+
   SET res = ( CONVERT(b1,DECIMAL)*100)/CONVERT(b2,DECIMAL);
 
   CLOSE dirty;
@@ -141,10 +144,10 @@ SET @@global.innodb_max_dirty_pages_pct 
 
 FLUSH STATUS;
 
-# add rows until dirty pages pct is less than this value
+# Add rows until dirty pages pct is less than this value
 CALL add_until(10);
 
-# give server some time to flush dirty pages
+# Give the server some time to flush dirty pages
 FLUSH TABLES;
 CALL add_records(500);
 --echo '--sleep 5'
@@ -160,7 +163,9 @@ DROP PROCEDURE add_until;
 DROP PROCEDURE check_pct;
 DROP FUNCTION dirty_pct;
 DROP TABLE t1;
-SET @@global.innodb_max_dirty_pages_pct = @old_innodb_max_dirty_pages_pct;
+
+SET @@global.innodb_max_dirty_pages_pct= @start_value;
+SELECT @@global.innodb_max_dirty_pages_pct;
 
 ##################################################################
 # End of functionality Testing for innodb_max_dirty_pages_pct    #

=== modified file 'mysql-test/t/innodb_table_locks_func.test'
--- a/mysql-test/t/innodb_table_locks_func.test	2008-04-22 13:04:10 +0000
+++ b/mysql-test/t/innodb_table_locks_func.test	2008-08-28 08:46:29 +0000
@@ -14,8 +14,8 @@
 # Description: Test Cases of Dynamic System Variable innodb_table_locks       #
 #              that checks the behavior of this variable                      #
 #                                                                             #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/                          #
-#  server-system-variables.html                                               #
+# Reference:                                                                  #
+#    http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html      #
 #                                                                             #
 ###############################################################################
 
@@ -24,9 +24,12 @@
 
 --echo '#--------------------FN_DYNVARS_048_01-------------------------#'
 ####################################################################
-# Check if setting innodb_table_locks is changed in new connection # 
+# Check if setting innodb_table_locks is changed in new connection #
 ####################################################################
 
+SET @start_value= @@global.innodb_table_locks;
+SELECT @start_value;
+
 SET @@global.innodb_table_locks = OFF;
 --echo 'connect (con1,localhost,root,,,,)'
 connect (con1,localhost,root,,,,);
@@ -80,6 +83,9 @@ UNLOCK tables;
 DROP TABLE t1;
 disconnect con2;
 
+connection default;
+SET @@global.innodb_table_locks= @start_value;
+SELECT @@global.innodb_table_locks;
 
 ##########################################################
 # End of functionality Testing for innodb_table_locks    #

=== modified file 'mysql-test/t/insert_update.test'
--- a/mysql-test/t/insert_update.test	2007-09-06 16:22:34 +0000
+++ b/mysql-test/t/insert_update.test	2008-08-28 08:46:29 +0000
@@ -290,6 +290,7 @@ INSERT IGNORE INTO t1 (id,c1) SELECT * F
 SELECT * FROM t1;
 
 DROP TABLE t1;
+DROP TABLE t2;
 
 #
 # Bug#28904: INSERT .. ON DUPLICATE was silently updating rows when it

=== modified file 'mysql-test/t/interactive_timeout_func.test'
--- a/mysql-test/t/interactive_timeout_func.test	2008-04-10 13:14:28 +0000
+++ b/mysql-test/t/interactive_timeout_func.test	2008-08-28 08:46:29 +0000
@@ -14,14 +14,14 @@
 # Description: Test Cases of Dynamic System Variable interactive_timeout      #
 #              that checks the functionality of this variable                 #
 #                                                                             #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/                          #
-#  server-system-variables.html                                               #
+# Reference:                                                                  #
+#    http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html      #
 #                                                                             #
 ###############################################################################
 
 
 --disable_warnings
-drop table if exists t1;
+DROP TABLE IF EXISTS t1;
 --enable_warnings
 
 ##############################
@@ -31,11 +31,13 @@ drop table if exists t1;
 --echo ## Creating new table t1 ##
 CREATE TABLE t1
 (
-id INT NOT NULL auto_increment,
+id INT NOT NULL AUTO_INCREMENT,
 PRIMARY KEY (id),
 name VARCHAR(30)
 );
 
+SET @start_value= @@global.interactive_timeout;
+SELECT @start_value;
 
 --echo '#--------------------FN_DYNVARS_052_01-------------------------#'
 #######################################################################
@@ -46,25 +48,35 @@ name VARCHAR(30)
 --echo ## Setting initial value of variable to 1 ##
 SET @@global.interactive_timeout = 1;
 
---echo ## Creating new interactive connection test_con1 ## 
+--echo ## Creating new interactive connection test_con1 ##
 connect (test_con1, localhost, root,);
 connection test_con1;
 
 --echo ## Inserting record in table ##
-INSERT into t1(name) values('Record_1');
+INSERT INTO t1(name) VALUES('Record_1');
 
---echo ## Setting session value of interactive_timeout ## 
+--echo ## Setting session value of interactive_timeout ##
 SET @@session.interactive_timeout = 1;
 
---echo ## Verifying values of variable ## 
+--echo ## Verifying values of variable ##
 SELECT @@session.interactive_timeout;
 SELECT @@global.interactive_timeout;
 
---echo ## Using sleep to check timeout ## 
+--echo ## Using sleep to check timeout ##
 sleep 5;
-SELECT * from t1;
+SELECT * FROM t1;
 
 --echo 'Bug#35377: Error should appear here because interactive_timeout value';
 --echo 'is 1 and connection remains idle for 5 secs';
 
-INSERT into t1(name) values('Record_2');
+INSERT INTO t1(name) VALUES('Record_2');
+
+connection default;
+
+disconnect test_con1;
+
+DROP TABLE t1;
+
+SET @@global.interactive_timeout= @start_value;
+SELECT @@global.interactive_timeout;
+

=== modified file 'mysql-test/t/key_buffer_size_func.test'
--- a/mysql-test/t/key_buffer_size_func.test	2008-04-10 13:14:28 +0000
+++ b/mysql-test/t/key_buffer_size_func.test	2008-08-28 08:46:29 +0000
@@ -14,13 +14,13 @@
 # Description: Test Cases of Dynamic System Variable key_buffer_size          #
 #              that checks the functionality of this variable                 #
 #                                                                             #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/                          #
-#  server-system-variables.html                                               #
+# Reference:                                                                  #
+#    http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html      #
 #                                                                             #
 ###############################################################################
 
 --disable_warnings
-drop table if exists t1;
+DROP TABLE IF EXISTS t1;
 --enable_warnings
 
 #########################
@@ -30,12 +30,14 @@ drop table if exists t1;
 --echo ## Creating new table t1 ##
 CREATE TABLE t1
 (
-id INT NOT NULL auto_increment,
+id INT NOT NULL AUTO_INCREMENT,
 PRIMARY KEY (id),
-rollno int NOT NULL,
+rollno INT NOT NULL,
 name VARCHAR(30)
 );
 
+SET @start_value= @@global.key_buffer_size;
+
 FLUSH STATUS;
 
 --echo '#--------------------FN_DYNVARS_055_01-------------------------#'
@@ -64,16 +66,16 @@ SELECT @@global.key_buffer_size;
 
 
 --echo ## Inserting some rows in table ##
-INSERT into t1(rollno, name) values(1, 'Record_1');
-INSERT into t1(rollno, name) values(2, 'Record_2');
-INSERT into t1(rollno, name) values(1, 'Record_3');
-INSERT into t1(rollno, name) values(3, 'Record_4');
-INSERT into t1(rollno, name) values(1, 'Record_5');
-INSERT into t1(rollno, name) values(3, 'Record_6');
-INSERT into t1(rollno, name) values(4, 'Record_7');
-INSERT into t1(rollno, name) values(4, 'Record_8');
-INSERT into t1(rollno, name) values(4, 'Record_9');
-INSERT into t1(rollno, name) values(4, 'Record_10');
+INSERT INTO t1(rollno, name) VALUES(1, 'Record_1');
+INSERT INTO t1(rollno, name) VALUES(2, 'Record_2');
+INSERT INTO t1(rollno, name) VALUES(1, 'Record_3');
+INSERT INTO t1(rollno, name) VALUES(3, 'Record_4');
+INSERT INTO t1(rollno, name) VALUES(1, 'Record_5');
+INSERT INTO t1(rollno, name) VALUES(3, 'Record_6');
+INSERT INTO t1(rollno, name) VALUES(4, 'Record_7');
+INSERT INTO t1(rollno, name) VALUES(4, 'Record_8');
+INSERT INTO t1(rollno, name) VALUES(4, 'Record_9');
+INSERT INTO t1(rollno, name) VALUES(4, 'Record_10');
 
 --echo ## Verifying status of reading & writing variables ##
 # Disabled due to differences in results
@@ -91,10 +93,12 @@ connection test_con2;
 ############################################################
 
 --echo ## Dropping table ##
-DROP table if exists t1;
+DROP TABLE IF EXISTS t1;
 
 --echo ## Disconnecting both the connections ##
 DISCONNECT test_con2;
 DISCONNECT test_con1;
 
+connection default;
+SET @@global.key_buffer_size= @start_value;
 

=== modified file 'mysql-test/t/log_basic.test'
--- a/mysql-test/t/log_basic.test	2008-04-10 13:14:28 +0000
+++ b/mysql-test/t/log_basic.test	2008-08-28 08:46:29 +0000
@@ -1,6 +1,6 @@
 ###################### mysql-test\t\log_basic.test ############################
 #                                                                             #
-# Variable Name: log_basic                                                    # 
+# Variable Name: log_basic                                                    #
 # Scope: GLOBAL                                                               #
 # Access Type: Dynamic                                                        #
 # Data Type: string                                                           #
@@ -11,15 +11,16 @@
 # Creation Date: 2008-02-07                                                   #
 # Author:  Rizwan                                                             #
 #                                                                             #
-# Description: Test Cases of Dynamic System Variable log                      #
-#              that checks the behavior of this variable in the following ways#
+# Description:                                                                #
+#    Test Cases of Dynamic System Variable log that checks the behavior of    #
+#    this variable in the following ways                                      #
 #              * Default Value                                                #
 #              * Valid & Invalid values                                       #
 #              * Scope & Access method                                        #
 #              * Data Integrity                                               #
 #                                                                             #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/                          #
-#  server-system-variables.html                                               #
+# Reference:                                                                  #
+#    http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html      #
 #                                                                             #
 ###############################################################################
 
@@ -34,6 +35,8 @@
 #                 Accessing variable                        #
 #############################################################
 
+SET @start_log= @@global.log;
+
 SELECT @@global.log AS INIT_VALUE;
 
 SELECT @@log AS INIT_VALUE;
@@ -47,14 +50,17 @@ SET global log = 0;
 
 
 --echo '#--------------------FN_DYNVARS_062_02-------------------------#'
-###################################################################################
-#     Check if the value in GLOBAL Table matches value in variable                #
-###################################################################################
+################################################################################
+#     Check if the value in GLOBAL Table matches value in variable             #
+################################################################################
 # We can only access log value from information schema global_variables table
-SELECT VARIABLE_VALUE 
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
+SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
 WHERE VARIABLE_NAME='log';
 
+SET @@global.log= @start_log;
+
 ############################################
 #                 END OF log TESTS         #
 ############################################
+

=== modified file 'mysql-test/t/log_bin_trust_function_creators_func.test'
--- a/mysql-test/t/log_bin_trust_function_creators_func.test	2008-07-10 16:09:39 +0000
+++ b/mysql-test/t/log_bin_trust_function_creators_func.test	2008-08-28 08:46:29 +0000
@@ -30,12 +30,12 @@ drop table if exists t1;
 #    Setting initial value of variable to 0 and verifying whether user
 #    is allowed to create function or not.
 ########################################################################
+SET @start_value= @@global.log_bin_trust_function_creators;
 
 --echo ## Creating new user tt ##
 CREATE user tt@localhost;
 
 --echo ## Setting value of variable to 0 ##
-SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
 SET @@global.log_bin_trust_function_creators = 0;
 
 --echo ## Creating new table t2 ##
@@ -117,10 +117,11 @@ drop function f1;
 --echo ## Dropping table t1 & t2 ##
 drop table t1,t2;
 
---echo ## Disconnecting both the connections ##
+--echo ## Disconnecting test_con2##
 disconnect test_con2;
 
 connection default;
 
 DROP USER tt@localhost;
-SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
+SET @@global.log_bin_trust_function_creators= @start_value;
+

=== modified file 'mysql-test/t/log_output_func.test'
--- a/mysql-test/t/log_output_func.test	2008-04-10 13:14:28 +0000
+++ b/mysql-test/t/log_output_func.test	2008-08-28 08:46:29 +0000
@@ -23,6 +23,9 @@
 # ps-protocol. So, it is switched off.
 --disable_ps_protocol
 
+SET @start_value= @@global.log_output;
+SELECT @start_value;
+
 --echo '#--------------------FN_DYNVARS_065_01-------------------------#'
 ##################################################################
 # Check if setting log_output is changed in every new connection # 
@@ -106,7 +109,13 @@ SELECT count(*) from mysql.general_log;
 
 DROP TABLE t1;
 
+disconnect con1;
+
+connection default;
+SET @@global.log_output= @start_value;
+
 --enable_ps_protocol
 ####################################################
 # Endo of functionality Testing for log_output     #
 ####################################################
+

=== modified file 'mysql-test/t/log_queries_not_using_indexes_basic.test'
--- a/mysql-test/t/log_queries_not_using_indexes_basic.test	2008-04-10 13:14:28 +0000
+++ b/mysql-test/t/log_queries_not_using_indexes_basic.test	2008-08-28 08:46:29 +0000
@@ -1,5 +1,3 @@
-
-
 ################## mysql-test\t\log_queries_not_using_indexes_basic.test ######
 #                                                                             #
 # Variable Name: log_queries_not_using_indexes                                #
@@ -9,19 +7,22 @@
 #                                                                             #
 #                                                                             #
 # Creation Date: 2008-02-07                                                   #
-# Author : Sharique Abdullah                                                      #
-#                                                                             #
+# Author : Sharique Abdullah                                                  #
 #                                                                             #
-# Description:Test Cases of Dynamic System Variable log_queries_not_using_indexes#
+# Description:Test Cases of Dynamic System Variable                           #
+#             log_queries_not_using_indexes                                   #
 #             that checks the behavior of this variable in the following ways #
 #              * Value Check                                                  #
 #              * Scope Check                                                  #
 #                                                                             #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/                          #
-#  server-system-variables.html                                               #
+# Reference:                                                                  #
+#  http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html        #
 #                                                                             #
 ###############################################################################
 
+SET @start_value= @@global.log_queries_not_using_indexes;
+SELECT @start_value;
+
 --echo '#---------------------BS_STVARS_041_01----------------------#'
 ####################################################################
 #   Displaying default value                                       #
@@ -45,9 +46,6 @@ SET @@GLOBAL.log_queries_not_using_index
 SELECT COUNT(@@GLOBAL.log_queries_not_using_indexes);
 --echo 1 Expected
 
-
-
-
 --echo '#---------------------BS_STVARS_041_03----------------------#'
 #################################################################
 # Check if the value in GLOBAL Table matches value in variable  #
@@ -78,9 +76,10 @@ SELECT @@log_queries_not_using_indexes =
 
 
 --echo '#---------------------BS_STVARS_041_05----------------------#'
-################################################################################
-#   Check if log_queries_not_using_indexes can be accessed with and without @@ sign #
-################################################################################
+#########################################################################
+# Check if log_queries_not_using_indexes can be accessed                #
+# with and without @@ sign                                              #
+#########################################################################
 
 SELECT COUNT(@@log_queries_not_using_indexes);
 --echo 1 Expected
@@ -100,4 +99,6 @@ SELECT COUNT(@@GLOBAL.log_queries_not_us
 SELECT log_queries_not_using_indexes = @@SESSION.log_queries_not_using_indexes;
 --echo Expected error 'Readonly variable'
 
+SET @@global.log_queries_not_using_indexes= @start_value;
+SELECT @@global.log_queries_not_using_indexes;
 

=== modified file 'mysql-test/t/log_state.test'
--- a/mysql-test/t/log_state.test	2008-05-30 09:12:07 +0000
+++ b/mysql-test/t/log_state.test	2008-08-28 08:46:29 +0000
@@ -1,7 +1,15 @@
+# hhunger 08.22.2008: with check-testcases differences due to bug#38889 using 
+# slow_query_log_file or general_log_file
+
 -- source include/not_embedded.inc
 --source include/have_csv.inc
 
 --disable_ps_protocol
+# save default value to set them back at the end of the test
+set @start_general_log= @@global.general_log;
+set @start_slow_query_log= @@global.slow_query_log;
+set @start_general_log_file= @@global.general_log_file;
+
 set global general_log= OFF;
 truncate table mysql.general_log;
 truncate table mysql.slow_log;
@@ -267,6 +275,11 @@ SET GLOBAL slow_query_log_file = @slow_q
 # Cleanup (must be done last to avoid delayed 'Quit' message in general log)
 #
 disconnect con1;
+# set back the saved default values
+connection default;
+set @@global.general_log= @start_general_log;
+set @@global.slow_query_log= @start_slow_query_log;
+set @@global.general_log_file= @start_general_log_file;
 
 # Remove the log files that was created in the "default location"
 # i.e var/run

=== modified file 'mysql-test/t/log_tables.test'
--- a/mysql-test/t/log_tables.test	2008-02-29 13:56:50 +0000
+++ b/mysql-test/t/log_tables.test	2008-08-28 08:46:29 +0000
@@ -7,6 +7,9 @@
 # check that CSV engine was compiled in
 --source include/have_csv.inc
 
+SET @old_general_log_state = @@global.general_log;
+SET @old_slow_log_state = @@global.slow_query_log;
+
 --disable_ps_protocol
 use mysql;
 
@@ -444,6 +447,7 @@ use test;
 #            AUTO_INCREMENT numbers)
 #
 
+SET @my_log_output= @@global.log_output;
 SET GLOBAL LOG_OUTPUT = 'TABLE';
 
 ## test the general log
@@ -509,6 +513,9 @@ FLUSH LOGS;
 ALTER TABLE mysql.slow_log DROP COLUMN seq;
 ALTER TABLE mysql.slow_log ENGINE = CSV;
 
+SET GLOBAL general_log = @old_general_log_state;
+SET GLOBAL slow_query_log = @old_slow_log_state;
+
 #
 # Bug#25422 (Hang with log tables)
 #
@@ -964,5 +971,7 @@ DROP TABLE t1;
 
 TRUNCATE TABLE mysql.slow_log;
 
+SET GLOBAL log_output= @my_log_output;
 SET GLOBAL slow_query_log = @old_slow_log_state;
 SET SESSION long_query_time =@old_long_query_time;
+

=== modified file 'mysql-test/t/max_allowed_packet_func.test'
--- a/mysql-test/t/max_allowed_packet_func.test	2008-04-23 09:36:17 +0000
+++ b/mysql-test/t/max_allowed_packet_func.test	2008-08-28 08:46:29 +0000
@@ -14,16 +14,16 @@
 # Description: Test Cases of Dynamic System Variable max_allowed_packet       #
 #              that checks the functionality of this variable                 #
 #                                                                             #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/                          #
-#  server-system-variables.html                                               #
+# Reference:                                                                  #
+#  http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html        #
 #                                                                             #
 ###############################################################################
 
 #due to lost connection on win64
 --source include/not_windows.inc
 
-let $start_global_value = `SELECT @@global.max_allowed_packet`;
---echo $start_global_value
+SET @start_max_allowed_packet= @@global.max_allowed_packet;
+SET @start_value= @@global.net_buffer_length;
 
 --disable_warnings
 drop table if exists t1;
@@ -43,8 +43,8 @@ name BLOB
 
 --echo '#--------------------FN_DYNVARS_070_01-------------------------#'
 ###############################################################################
-#    Setting initial value of max_allowed_packet to 1024 at session level and
-#    verifying its behavior after inserting data greater than 1024 bytes     
+#    Setting initial value of max_allowed_packet to 1024 at session level and #
+#    verifying its behavior after inserting data greater than 1024 bytes      #   
 ###############################################################################
 
 --echo ## Setting value of max_allowed packet and net_buffer_length to 1024 ## 
@@ -87,9 +87,6 @@ INSERT into t1(name) values("aaassssssss
 disconnect test_con1;
 connection default;
 drop table t1;
-eval SET @@global.max_allowed_packet = $start_global_value;
-
---echo ## Server disconnects after this case and error occurs that Server ##
---echo ## has gone away ##
-
+SET @@global.max_allowed_packet= @start_max_allowed_packet;
+SET @@global.net_buffer_length= @start_value;
 

=== modified file 'mysql-test/t/max_seeks_for_key_func.test'
--- a/mysql-test/t/max_seeks_for_key_func.test	2008-04-10 13:14:28 +0000
+++ b/mysql-test/t/max_seeks_for_key_func.test	2008-08-28 08:46:29 +0000
@@ -1,8 +1,4 @@
-
-
-
-#Test for max_seeks_for_key#
-
+# Test for max_seeks_for_key #
 
 --disable_warnings
 drop table if exists t1;
@@ -18,7 +14,7 @@ CREATE TABLE t1
 b char(20)
 );
 
-
+SET @start_value= @@global.max_seeks_for_key;
 
 --echo '#--------------------FN_DYNVARS_084_01-------------------------#'
 ##########################################################
@@ -73,11 +69,6 @@ INSERT into t1(b) values("BREc");
 INSERT into t1(b) values("CRec");
 explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
 
-
-
-
-
-
 #####################################################
 #   Inserting values in  table t and analyzing table #
 #####################################################
@@ -99,6 +90,11 @@ SET MAX_SEEKS_FOR_KEY=1;
 explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
 SET MAX_SEEKS_FOR_KEY=DEFAULT;
 
+connection default;
+disconnect test_con1;
+disconnect test_con2;
+
 drop table t1;
 
+SET @@global.max_seeks_for_key= @start_value;
 

=== modified file 'mysql-test/t/max_sort_length_func.test'
--- a/mysql-test/t/max_sort_length_func.test	2008-04-10 13:14:28 +0000
+++ b/mysql-test/t/max_sort_length_func.test	2008-08-28 08:46:29 +0000
@@ -9,14 +9,14 @@
 #                                                                              #
 #                                                                              #
 # Creation Date: 2008-03-02                                                    #
-# Author:  Sharique Abdullah                                                       #
+# Author:  Sharique Abdullah                                                   #
 #                                                                              #
-# Description: Test Cases of Dynamic System Variable max_prepared_stmt_count_fn#
+# Description: Test Cases of Dynamic System Variable max_sort_length           #
 #              that checks behavior of this variable in the following ways     #
 #              * Functionality based on different values                       #
 #                                                                              #
-#Reference: http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html#
-#  option_mysqld_max_sort_length                                               #
+# Reference:                                                                   #
+#   http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html        #
 #                                                                              #
 ################################################################################
 
@@ -24,6 +24,8 @@
 # Setup
 #
 
+SET @start_value= @@global.max_sort_length;
+
 SET @session_max_sort_length = @@Session.max_sort_length;
 
 
@@ -186,7 +188,7 @@ SELECT c from t ORDER BY c, id;
 #Check if sorting is applied on BLOB type #
 ###########################################
 --echo Testing type BLOB
-## Setting global value of variable and inserting data in table
+# Setting global value of variable and inserting data in table
 SET @@global.max_sort_length = 30;
 SELECT @@global.max_sort_length;
 INSERT INTO t1 set c = repeat('x',29);
@@ -211,7 +213,7 @@ SELECT c from t1 ORDER BY c, id;
 #Check if sorting is applied on CHAR type #
 ###########################################
 --echo Testing type CHAR
-## Setting global value of variable and inserting data in table
+# Setting global value of variable and inserting data in table
 SET @@global.max_sort_length = 30;
 SELECT @@global.max_sort_length;
 INSERT INTO t2 set c = repeat('x',29);
@@ -251,3 +253,5 @@ DROP TABLE IF EXISTS t1;
 DROP TABLE IF EXISTS t2;
 --enable_warnings
 
+SET @@global.max_sort_length= @start_value;
+

=== modified file 'mysql-test/t/myisam_data_pointer_size_func.test'
--- a/mysql-test/t/myisam_data_pointer_size_func.test	2008-04-10 13:14:28 +0000
+++ b/mysql-test/t/myisam_data_pointer_size_func.test	2008-08-28 08:46:29 +0000
@@ -14,8 +14,8 @@
 # Description: Test Cases of Dynamic System Variable myisam_data_pointer_size  #
 #              that checks the behavior of this variable                       #
 #                                                                              #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/                           #
-#  server-system-variables.html                                                #
+# Reference:                                                                   #
+#  http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html         #
 #                                                                              #
 ################################################################################
 
@@ -24,6 +24,7 @@
 # Check if setting myisam_data_pointer_size is changed in every new connection# 
 ###############################################################################
 
+SET @start_value= @@global.myisam_data_pointer_size;
 SET @@global.myisam_data_pointer_size = 2;
 # con1 will be default connection from now on
 --echo 'connect (con1,localhost,root,,,,)'
@@ -105,6 +106,9 @@ SELECT count(*) from t1;
 DROP PROCEDURE  sp_addRec;
 DROP TABLE t1;
 
+connection default;
+SET @@global.myisam_data_pointer_size= @start_value;
+
 ################################################################
 # End of functionality Testing for myisam_data_pointer_size    #
 ################################################################

=== modified file 'mysql-test/t/myisam_stats_method_func.test'
--- a/mysql-test/t/myisam_stats_method_func.test	2008-04-10 13:14:28 +0000
+++ b/mysql-test/t/myisam_stats_method_func.test	2008-08-28 08:46:29 +0000
@@ -14,8 +14,8 @@
 # Description: Test Cases of Dynamic System Variable myisam_stats_method      #
 #              that checks the behavior of this variable                      #
 #                                                                             #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/                          #
-#  server-system-variables.html                                               #
+# Reference:                                                                  # 
+#  http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html        #
 #                                                                             #
 ###############################################################################
 
@@ -24,6 +24,8 @@
 # Check if Setting myisam_stats_method is changed in new connection # 
 #####################################################################
 
+SET @start_value= @@global.myisam_stats_method;
+
 SET @@global.myisam_stats_method = nulls_equal;
 --echo 'connect (con1,localhost,root,,,,)'
 connect (con1,localhost,root,,,,);
@@ -101,6 +103,9 @@ SHOW INDEX FROM t1;
 SET myisam_stats_method=DEFAULT;
 DROP TABLE t1;
 
+SET @@global.myisam_stats_method= @start_value;
+
 ########################################################
 # End of functionality Testing for myisam_stats_method #
 ########################################################
+

=== modified file 'mysql-test/t/profiling.test'
--- a/mysql-test/t/profiling.test	2007-12-14 13:57:37 +0000
+++ b/mysql-test/t/profiling.test	2008-08-28 08:46:29 +0000
@@ -14,6 +14,7 @@ select @@profiling;
 set global profiling = ON;
 
 # But size is okay
+set @start_value= @@global.profiling_history_size;
 set global profiling_history_size=100;
 show global variables like 'profil%';
 
@@ -261,6 +262,6 @@ drop function if exists f1;
 
 ## last thing in the file
 set session profiling = OFF;
-
+set global profiling_history_size= @start_value;
 ##
 --echo End of 5.0 tests