1# ==== Purpose ====
2#
3# This test is executed twice for each test case. Before every
4# testcase it is run with mysqltest in record mode and will thus
5# produce an output file that can be compared to output from after the
6# tescase.  In that way, it is possible to check that a testcase does
7# not have any unwanted side affects.
8
9--disable_query_log
10
11# We want to ensure all slave configuration is restored.  But SHOW
12# SLAVE STATUS returns nothing for servers not configured as slaves,
13# and (after BUG#28796 was fixed) there is no way to de-configure a
14# slave.  Hence, it's impossible to clean up the replication state at
15# the end.  But we want to check that the slave is stopped, there is
16# no error, and a few other invariants.  So we issue SHOW SLAVE
17# STATUS, and if it returns no rows we fake the result.
18--let $tmp= query_get_value(SHOW SLAVE STATUS, Slave_IO_Running, 1)
19--let $tmp= `SELECT '$tmp' = 'No such row'`
20if ($tmp)
21{
22  # Note: after WL#5177, fields 13-18 shall not be filtered-out.
23  --echo Slave_IO_State
24  --echo Master_Host	127.0.0.1
25  --echo Master_User	root
26  --echo Master_Port	#
27  --echo Connect_Retry	#
28  --echo Master_Log_File	#
29  --echo Read_Master_Log_Pos	#
30  --echo Relay_Log_File	#
31  --echo Relay_Log_Pos	#
32  --echo Relay_Master_Log_File	#
33  --echo Slave_IO_Running	No
34  --echo Slave_SQL_Running	No
35  --echo Replicate_Do_DB	#
36  --echo Replicate_Ignore_DB	#
37  --echo Replicate_Do_Table	#
38  --echo Replicate_Ignore_Table	#
39  --echo Replicate_Wild_Do_Table	#
40  --echo Replicate_Wild_Ignore_Table	#
41  --echo Last_Errno	0
42  --echo Last_Error
43  --echo Skip_Counter	0
44  --echo Exec_Master_Log_Pos	#
45  --echo Relay_Log_Space	#
46  --echo Until_Condition	#
47  --echo Until_Log_File	#
48  --echo Until_Log_Pos	#
49  --echo Master_SSL_Allowed	No
50  --echo Master_SSL_CA_File
51  --echo Master_SSL_CA_Path
52  --echo Master_SSL_Cert
53  --echo Master_SSL_Cipher
54  --echo Master_SSL_Key
55  --echo Seconds_Behind_Master	NULL
56  --echo Master_SSL_Verify_Server_Cert	No
57  --echo Last_IO_Errno	0
58  --echo Last_IO_Error
59  --echo Last_SQL_Errno	0
60  --echo Last_SQL_Error
61  --echo Replicate_Ignore_Server_Ids
62  --echo Master_Server_Id	#
63  --echo Master_SSL_Crl	#
64  --echo Master_SSL_Crlpath	#
65  --echo Using_Gtid	No
66  --echo Gtid_IO_Pos	#
67  --echo Replicate_Do_Domain_Ids
68  --echo Replicate_Ignore_Domain_Ids
69  --echo Parallel_Mode	conservative
70  --echo SQL_Delay	0
71  --echo SQL_Remaining_Delay	NULL
72  --echo Slave_SQL_Running_State
73  --echo Slave_DDL_Groups	#
74  --echo Slave_Non_Transactional_Groups	#
75  --echo Slave_Transactional_Groups	#
76}
77if (!$tmp) {
78  # Note: after WL#5177, fields 13-18 shall not be filtered-out.
79  --replace_column 4 # 5 # 6 # 7 # 8 # 9 # 10 # 13 # 14 # 15 # 16 # 17 # 18 # 22 # 23 # 24 # 25 # 26 # 40 # 41 # 42 # 44 # 51 # 52 # 53 #
80  query_vertical
81  SHOW SLAVE STATUS;
82}
83
84#
85# Ensure that we don't get warnings from mysql.proc (used by check_mysqld)
86#
87
88--disable_query_log
89--disable_warnings
90--disable_result_log
91select count(*) from mysql.proc;
92--enable_result_log
93--enable_warnings
94--enable_query_log
95
96call mtr.check_testcase();
97
98let $datadir=`select @@datadir`;
99list_files $datadir mysql_upgrade_info;
100list_files_write_file $datadir.tempfiles.txt $datadir/test #sql*;
101--replace_regex /#sql-ib[0-9a-f]+\.ibd\n//
102cat_file $datadir.tempfiles.txt;
103remove_file $datadir.tempfiles.txt;
104list_files $datadir/mysql #sql*;
105
106#
107# Check that SHOW ENGINE INNODB STATUS does not show any active transactions
108# We do this only if wsrep provider is loaded, to avoid disturbing any non-Galera MTR tests
109#
110if (`SELECT COUNT(*)=1 FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME = 'wsrep' AND PLUGIN_STATUS='ACTIVE'`) {
111  if (`SELECT @@wsrep_on`) {
112    if (`SELECT COUNT(*) FROM information_schema.innodb_trx WHERE trx_mysql_thread_id != 0`) {
113      if ($before) {
114        --echo Before test start.
115      }
116      if (!$before) {
117        --echo After test end.
118      }
119      --echo There is one or more active InnoDB transaction(s) when there should be none. Dumping some diagnostics.
120
121      --let $status_locks = `SELECT @@innodb_status_output_locks`
122      --let $status_output = `SELECT @@innodb_status_output`
123      --enable_query_log
124      SET GLOBAL innodb_status_output_locks=ON;
125      SHOW ENGINE INNODB STATUS;
126      --disable_query_log
127      --eval SET GLOBAL innodb_status_output_locks=$status_locks;
128      --eval SET GLOBAL innodb_status_output=$status_output;
129      --enable_query_log
130
131      --vertical_results
132      if ($before) {
133        --replace_regex /$/ /
134      }
135      SELECT * FROM information_schema.processlist;
136
137      if ($before) {
138        --replace_regex /$/ /
139      }
140      SELECT * FROM information_schema.innodb_trx;
141
142      if ($before) {
143        --replace_regex /$/ /
144      }
145      SELECT * FROM information_schema.innodb_locks;
146
147      if ($before) {
148        --replace_regex /$/ /
149      }
150      SELECT * FROM information_schema.innodb_lock_waits;
151      --horizontal_results
152      --disable_query_log
153    }
154  }
155}
156
157--enable_query_log
158
159