Commit 5323968d authored by Ingo Struewing's avatar Ingo Struewing

No commit message

No commit message
parents 4ffe3bce 47cd41b0
SET @start_value= @@global.log_output;
SET @start_general_log= @@global.general_log;
SET @start_general_log_file= @@global.general_log_file;
'#--------------------FN_DYNVARS_065_01-------------------------#' '#--------------------FN_DYNVARS_065_01-------------------------#'
SET @@global.log_output = 'NONE'; SET @@global.log_output = 'NONE';
'connect (con1,localhost,root,,,,)' 'connect (con1,localhost,root,,,,)'
'connection con1'
SELECT @@global.log_output;
@@global.log_output
NONE
SET @@global.log_output = 'TABLE,FILE'; SET @@global.log_output = 'TABLE,FILE';
'connect (con2,localhost,root,,,,)' 'connect (con2,localhost,root,,,,)'
'connection con2'
SELECT @@global.log_output; SELECT @@global.log_output;
@@global.log_output @@global.log_output
FILE,TABLE FILE,TABLE
...@@ -18,7 +16,7 @@ SET @@global.log_output = 'NONE'; ...@@ -18,7 +16,7 @@ SET @@global.log_output = 'NONE';
TRUNCATE TABLE mysql.general_log; TRUNCATE TABLE mysql.general_log;
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INT); CREATE TABLE t1(a INT);
INSERT INTO t1 value(1); INSERT INTO t1 VALUE(1);
SELECT 'abc'; SELECT 'abc';
abc abc
abc abc
...@@ -29,25 +27,33 @@ count(*) ...@@ -29,25 +27,33 @@ count(*)
SET @@global.log_output = 'TABLE'; SET @@global.log_output = 'TABLE';
TRUNCATE TABLE mysql.general_log; TRUNCATE TABLE mysql.general_log;
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
create table t1(a int); CREATE TABLE t1(a int);
INSERT INTO t1 value(1); INSERT INTO t1 VALUE(1);
SELECT 'abc'; SELECT 'abc';
abc abc
abc abc
SELECT count(*) from mysql.general_log; SELECT count(*)>4 FROM mysql.general_log;
count(*) count(*)>4
5 1
'Bug#35371: Changing general_log file is crashing server' SET @@global.general_log = 'OFF';
'SET @@global.general_log_file = @log_file;' FLUSH LOGS;
SET @@global.general_log_file = 'MYSQLTEST_VARDIR/run/mytest.log';
SET @@global.general_log = 'ON';
SET @@global.log_output = 'FILE'; SET @@global.log_output = 'FILE';
TRUNCATE TABLE mysql.general_log; TRUNCATE TABLE mysql.general_log;
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
create table t1(a int); CREATE TABLE t1(a INT);
INSERT INTO t1 value(1); INSERT INTO t1 VALUE(1);
SELECT 'abc'; SELECT 'abc';
abc abc
abc abc
SELECT count(*) from mysql.general_log; SELECT count(*) FROM mysql.general_log;
count(*) count(*)
0 0
DROP TABLE t1; DROP TABLE t1;
connection default;
SET @@global.general_log= 'OFF';
SET @@global.general_log_file= @start_general_log_file;
SET @@global.log_output= @start_value;
SET @@global.general_log= @start_general_log;
SET @@global.general_log= 'ON';
...@@ -10,12 +10,13 @@ ...@@ -10,12 +10,13 @@
# # # #
# Creation Date: 2008-03-08 # # Creation Date: 2008-03-08 #
# Author: Rizwan # # Author: Rizwan #
# Modified: HHunger 2008-08-29
# # # #
# Description: Test Cases of Dynamic System Variable log_output # # Description: Test Cases of Dynamic System Variable log_output #
# that checks the behavior of this variable # # that checks the behavior of this variable #
# # # #
# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # # Reference: #
# server-system-variables.html # # http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
# # # #
############################################################################### ###############################################################################
...@@ -23,6 +24,10 @@ ...@@ -23,6 +24,10 @@
# ps-protocol. So, it is switched off. # ps-protocol. So, it is switched off.
--disable_ps_protocol --disable_ps_protocol
SET @start_value= @@global.log_output;
SET @start_general_log= @@global.general_log;
SET @start_general_log_file= @@global.general_log_file;
--echo '#--------------------FN_DYNVARS_065_01-------------------------#' --echo '#--------------------FN_DYNVARS_065_01-------------------------#'
################################################################## ##################################################################
# Check if setting log_output is changed in every new connection # # Check if setting log_output is changed in every new connection #
...@@ -32,17 +37,12 @@ SET @@global.log_output = 'NONE'; ...@@ -32,17 +37,12 @@ SET @@global.log_output = 'NONE';
# con1 will be default connection from now on # con1 will be default connection from now on
--echo 'connect (con1,localhost,root,,,,)' --echo 'connect (con1,localhost,root,,,,)'
connect (con1,localhost,root,,,,); connect (con1,localhost,root,,,,);
--echo 'connection con1'
connection con1;
SELECT @@global.log_output;
SET @@global.log_output = 'TABLE,FILE'; SET @@global.log_output = 'TABLE,FILE';
# Test that the effect is global
--echo 'connect (con2,localhost,root,,,,)' --echo 'connect (con2,localhost,root,,,,)'
connect (con2,localhost,root,,,,); connect (con2,localhost,root,,,,);
--echo 'connection con2'
connection con2;
SELECT @@global.log_output; SELECT @@global.log_output;
disconnect con2;
--echo '#--------------------FN_DYNVARS_065_02-------------------------#' --echo '#--------------------FN_DYNVARS_065_02-------------------------#'
#################################################### ####################################################
...@@ -52,10 +52,9 @@ disconnect con2; ...@@ -52,10 +52,9 @@ disconnect con2;
--echo 'connection con1' --echo 'connection con1'
connection con1; connection con1;
#===============================================================
#=======================================================================
--echo '---Checking general_log when log_output is NONE---' --echo '---Checking general_log when log_output is NONE---'
#======================================================================= #===============================================================
SET @@global.log_output = 'NONE'; SET @@global.log_output = 'NONE';
TRUNCATE TABLE mysql.general_log; TRUNCATE TABLE mysql.general_log;
...@@ -64,13 +63,13 @@ TRUNCATE TABLE mysql.general_log; ...@@ -64,13 +63,13 @@ TRUNCATE TABLE mysql.general_log;
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
--enable_warnings --enable_warnings
CREATE TABLE t1(a INT); CREATE TABLE t1(a INT);
INSERT INTO t1 value(1); INSERT INTO t1 VALUE(1);
SELECT 'abc'; SELECT 'abc';
SELECT count(*) FROM mysql.general_log; SELECT count(*) FROM mysql.general_log;
#============================================================================== #===============================================================
--echo '---Checking general_log when log_output is TABLE---' --echo '---Checking general_log when log_output is TABLE---'
#============================================================================== #===============================================================
SET @@global.log_output = 'TABLE'; SET @@global.log_output = 'TABLE';
TRUNCATE TABLE mysql.general_log; TRUNCATE TABLE mysql.general_log;
...@@ -78,35 +77,49 @@ TRUNCATE TABLE mysql.general_log; ...@@ -78,35 +77,49 @@ TRUNCATE TABLE mysql.general_log;
--disable_warnings --disable_warnings
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
--enable_warnings --enable_warnings
create table t1(a int); CREATE TABLE t1(a int);
INSERT INTO t1 value(1); INSERT INTO t1 VALUE(1);
SELECT 'abc'; SELECT 'abc';
SELECT count(*) from mysql.general_log; # At least the last 4 statement should be logged.
SELECT count(*)>4 FROM mysql.general_log;
#=========================================================== #===============================================================
# Checking general_log when log_output is FILE # Checking general_log when log_output is FILE
#=========================================================== #===============================================================
#SET @log_file = "mytest.log";
#SET @@global.general_log = 0;
#FLUSH LOGS;
#SET @@global.general_log_file = @log_file;
--echo 'Bug#35371: Changing general_log file is crashing server'
--echo 'SET @@global.general_log_file = @log_file;'
SET @@global.general_log = 'OFF';
FLUSH LOGS;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval SET @@global.general_log_file = '$MYSQLTEST_VARDIR/run/mytest.log';
SET @@global.general_log = 'ON';
SET @@global.log_output = 'FILE'; SET @@global.log_output = 'FILE';
TRUNCATE TABLE mysql.general_log; TRUNCATE TABLE mysql.general_log;
--disable_warnings --disable_warnings
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
--enable_warnings --enable_warnings
create table t1(a int); CREATE TABLE t1(a INT);
INSERT INTO t1 value(1); INSERT INTO t1 VALUE(1);
SELECT 'abc'; SELECT 'abc';
SELECT count(*) from mysql.general_log; SELECT count(*) FROM mysql.general_log;
DROP TABLE t1; DROP TABLE t1;
file_exists $MYSQLTEST_VARDIR/run/mytest.log ;
#==============================================================
# Clean up
#==============================================================
--echo connection default;
connection default;
SET @@global.general_log= 'OFF';
SET @@global.general_log_file= @start_general_log_file;
SET @@global.log_output= @start_value;
SET @@global.general_log= @start_general_log;
SET @@global.general_log= 'ON';
--enable_ps_protocol --enable_ps_protocol
#################################################### ####################################################
# Endo of functionality Testing for log_output # # End of functionality Testing for log_output #
#################################################### ####################################################
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment