Debian Codegraph @

mysql-test/suite/ndb_binlog/t/ndb_binlog_sighup.test

raw
1 -- source include/have_ndb.inc
2 # Test involves flushing binlog by sending SIGHUP signal using kill linux cmd to mysqld
3 --source include/not_windows.inc
4
5
6 --let MYSQLD_LOG= $MYSQL_TMP_DIR/sighup_test.log
7
8 --let $restart_parameters=restart:--log-error=$MYSQLD_LOG
9 --replace_result $MYSQLD_LOG MYSQLD_LOG
10 let $mysqld_name=mysqld.1.1;
11 --source include/restart_mysqld.inc
12
13 let MYSQLD_PIDFILE= `SELECT @@pid_file;`;
14
15 --echo #
16 --echo # Trigger problem reported by "Bug#32357856 SIGHUP CAUSES CRASH IN
17 --echo # CACHED TABLE DEF CLOSE" by creating and using a NDB table in order
18 --echo # to have it be added to open table cache and then closed by SIGHUP
19 --echo #
20 CREATE TABLE t1 (a int PRIMARY KEY) ENGINE = NDB;
21 SELECT * FROM t1;
22
23 --echo #
24 --echo # Flush the log by sending SIGHUP from perl script.
25 --echo #
26 --perl
27 use strict;
28 use warnings;
29 my $filename = $ENV{"MYSQLD_PIDFILE"} or die("pidfile not set");
30 my $pid;
31 my $wait_cnt=60;
32 open(FILE, "$filename") or die "cannot open file $filename";
33 while(<FILE>) {
34 $pid = $_;
35 }
36 close(FILE);
37 rename $ENV{"MYSQLD_LOG"}, $ENV{"MYSQLD_LOG"}.".1";
38 kill 'HUP', $pid or die "could not kill $pid: $!";
39 while (! -e $ENV{"MYSQLD_LOG"}) {
40 if($wait_cnt==0) { die "timedout waiting for error log to be flushed"; }
41 sleep 1;
42 $wait_cnt--;
43 }
44 EOF
45
46 --echo # Check that both files still exists
47 --file_exists $MYSQLD_LOG
48 --file_exists $MYSQLD_LOG.1
49
50 DROP TABLE t1;
51
52 call mtr.add_suppression("mysqld startup An incident event has been written");
53 --echo # CLEAN UP
54 --echo # Restore default settings
55 --let $restart_parameters = restart:
56 --source include/restart_mysqld.inc
57
58 --remove_file $MYSQLD_LOG
59 --remove_file $MYSQLD_LOG.1
60