1
### t/log_tables_debug.test
3
# Log-related tests requiring a debug-build server.
6
# extra clean-up required due to Bug#38124, set to 1 when behavior has
7
# changed (see explanation in log_state.test)
8
let $fixed_bug38124 = 0;
10
--source include/have_debug.inc
12
# Several subtests modify global variables. Save the initial values only here,
13
# but reset to the initial values per subtest.
14
SET @old_general_log= @@global.general_log;
15
SET @old_general_log_file= @@global.general_log_file;
16
SET @old_slow_query_log= @@global.slow_query_log;
17
SET @old_slow_query_log_file= @@global.slow_query_log_file;
21
--echo # Bug#45387 Information about statement id for prepared
22
--echo # statements missed from general log
25
let MYSQLD_DATADIR= `SELECT @@datadir`;
27
# set logging to our specific bug log to control the entries added
28
SET @@global.general_log = ON;
29
SET @@global.general_log_file = 'bug45387_general.log';
31
# turn on output of timestamps on all log file entries
32
SET SESSION debug='+d,reset_log_last_time';
34
let CONN_ID= `SELECT CONNECTION_ID()`;
38
SET @@global.general_log = @old_general_log;
39
SET @@global.general_log_file = @old_general_log_file;
40
SET SESSION debug='-d';
43
# get the relevant info from the surrounding perl invocation
44
$datadir= $ENV{'MYSQLD_DATADIR'};
45
$conn_id= $ENV{'CONN_ID'};
47
# loop through the log file looking for the stmt querying for conn id
48
open(FILE, "$datadir/bug45387_general.log") or
49
die("Unable to read log file $datadir/bug45387_general.log: $!\n");
51
if (/\d{6}\s+\d+:\d+:\d+[ \t]+(\d+)[ \t]+Query[ \t]+SELECT CONNECTION_ID/) {
58
if ($found == $conn_id) {
59
print "Bug#45387: ID match.\n";
61
print "Bug#45387: Expected ID '$conn_id', found '$found' in log file.\n";
62
print "Contents of log file:\n";
64
while($line= <FILE>) {
72
--remove_file $MYSQLD_DATADIR/bug45387_general.log
74
--echo End of 5.1 tests
81
# Reset global system variables to initial values if forgotten somewhere above.
82
SET global general_log = @old_general_log;
83
SET global general_log_file = @old_general_log_file;
84
SET global slow_query_log = @old_slow_query_log;
85
SET global slow_query_log_file = @old_slow_query_log_file;
89
let $my_var = `SELECT @old_general_log_file`;
90
eval SET @@global.general_log_file = '$my_var';
91
let $my_var = `SELECT @old_slow_query_log_file`;
92
eval SET @@global.slow_query_log_file = '$my_var';