1-- Copyright (c) 2008, 2013, Oracle and/or its affiliates 2-- Copyright (c) 2009, 2013, SkySQL Ab 3-- 4-- This program is free software; you can redistribute it and/or modify 5-- it under the terms of the GNU General Public License as published by 6-- the Free Software Foundation; version 2 of the License. 7-- 8-- This program is distributed in the hope that it will be useful, 9-- but WITHOUT ANY WARRANTY; without even the implied warranty of 10-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11-- GNU General Public License for more details. 12-- 13-- You should have received a copy of the GNU General Public License 14-- along with this program; if not, write to the Free Software Foundation, 15-- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA 16 17delimiter ||; 18 19use mtr|| 20 21-- 22-- Procedure used to check if server has been properly 23-- restored after testcase has been run 24-- 25CREATE DEFINER=root@localhost PROCEDURE check_testcase() 26BEGIN 27 28 -- Dump all global variables except those 29 -- that are supposed to change 30 SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 31 WHERE variable_name NOT IN ('timestamp') 32 AND variable_name not like "Last_IO_Err*" 33 AND variable_name != 'INNODB_IBUF_MAX_SIZE' 34 AND variable_name != 'INNODB_USE_NATIVE_AIO' 35 AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' 36 AND variable_name not like 'GTID%POS' 37 AND variable_name != 'GTID_BINLOG_STATE' 38 AND variable_name != 'THREAD_POOL_SIZE' 39 ORDER BY variable_name; 40 41 -- Dump all databases, there should be none 42 -- except those that was created during bootstrap 43 SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; 44 45 -- and the mtr_wsrep_notify schema which is populated by the std_data/wsrep_notify.sh script 46 -- and the suite/galera/t/galera_var_notify_cmd.test 47 -- and the wsrep_schema schema that may be created by Galera 48 SELECT * FROM INFORMATION_SCHEMA.SCHEMATA 49 WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') 50 ORDER BY BINARY SCHEMA_NAME; 51 52 -- The test database should not contain any tables 53 SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES 54 WHERE table_schema='test'; 55 56 -- Show "mysql" database, tables and columns 57 SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql 58 FROM INFORMATION_SCHEMA.TABLES 59 WHERE table_schema='mysql' 60 ORDER BY tables_in_mysql; 61 SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, 62 column_name, ordinal_position, column_default, is_nullable, 63 data_type, character_maximum_length, character_octet_length, 64 numeric_precision, numeric_scale, character_set_name, 65 collation_name, column_type, column_key, extra, column_comment 66 FROM INFORMATION_SCHEMA.COLUMNS 67 WHERE table_schema='mysql' 68 ORDER BY columns_in_mysql; 69 70 -- Dump all events, there should be none 71 SELECT * FROM INFORMATION_SCHEMA.EVENTS; 72 -- Dump all triggers except mtr internals, there should be none 73 SELECT * FROM INFORMATION_SCHEMA.TRIGGERS 74 WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); 75 -- Dump all created procedures, there should be none 76 SELECT * FROM INFORMATION_SCHEMA.ROUTINES; 77 78 SHOW STATUS LIKE 'slave_open_temp_tables'; 79 80 -- Checksum system tables to make sure they have been properly 81 -- restored after test 82 checksum table 83 mysql.columns_priv, 84 mysql.db, 85 mysql.func, 86 mysql.help_category, 87 mysql.help_keyword, 88 mysql.help_relation, 89 mysql.plugin, 90 mysql.proc, 91 mysql.procs_priv, 92 mysql.roles_mapping, 93 mysql.tables_priv, 94 mysql.time_zone, 95 mysql.time_zone_leap_second, 96 mysql.time_zone_name, 97 mysql.time_zone_transition, 98 mysql.time_zone_transition_type, 99 mysql.global_priv; 100 101 -- verify that no plugin changed its disabled/enabled state 102 SELECT * FROM INFORMATION_SCHEMA.PLUGINS; 103 104 select * from information_schema.session_variables 105 where variable_name = 'debug_sync'; 106 107END|| 108 109