1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
|
#############################################################
# Author: Serge Kozlov <skozlov@mysql.com>
# Date: 07/01/2008
# Purpose: Testing possible affects of some system dynamic
# variables to the replication.
# Scenario for each variable:
# 1) Set different values for master and slave
# 2) Create and replicate a data from master to slave
# 3) Check results on master and slave: changes on slave
# shouldn't be affected to replicated data.
#############################################################
--source include/not_group_replication_plugin.inc
--source include/master-slave.inc
--echo
#
# MAX_HEAP_TABLE_SIZE
#
--echo * max_heap_table_size *
--let $heap_size= 16384
--let $record_size= 512
--replace_numeric_round 0
--let $row_count = `SELECT $heap_size / $record_size`
--inc $row_count
--connection slave
SET @restore_slave_max_heap_table_size=@@global.max_heap_table_size;
--replace_result $heap_size HEAP_SIZE
--eval SET @@global.max_heap_table_size=$heap_size
--replace_result $heap_size HEAP_SIZE
--eval SET @@session.max_heap_table_size=$heap_size
--connection master
--replace_result $record_size RECORD_SIZE
--eval CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b VARCHAR(10), c VARCHAR($record_size)) ENGINE=MEMORY
--let $counter=$row_count
--disable_query_log
while ($counter) {
--eval INSERT INTO t1 (b,c) VALUES ('master', REPEAT('A', $record_size));
dec $counter;
}
--enable_query_log
--replace_result $row_count ROW_COUNT
--eval SELECT COUNT(*)=$row_count FROM t1
--source include/sync_slave_sql_with_master.inc
--replace_result $row_count ROW_COUNT
--eval SELECT COUNT(*)=$row_count FROM t1 WHERE b='master' GROUP BY b ORDER BY b
# Truncate the table so that the slaves max_heap_table_size value takes effect on
# the replicted table
TRUNCATE TABLE t1;
--let $counter=$row_count
--disable_query_log
while ($counter) {
--error 0,1114
--eval INSERT INTO t1 (b,c) VALUES ('slave', REPEAT('A', $record_size))
dec $counter;
}
CREATE TABLE t2 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b VARCHAR(10), c CHAR(254)) ENGINE=MEMORY;
--let $counter=$row_count
--disable_query_log
while ($counter) {
--error 0,1114
INSERT INTO t2 (b,c) VALUES ('slave', REPEAT('A', 254));
dec $counter;
}
--enable_query_log
# We don't know how many memory used and can't check exact values so need to check following
# conditions
--replace_result $row_count ROW_COUNT
--eval SELECT COUNT(*)<$row_count AND COUNT(*)>0 FROM t1 WHERE b='slave' GROUP BY b ORDER BY b
--replace_result $row_count ROW_COUNT
--eval SELECT COUNT(*)<$row_count AND COUNT(*)>0 FROM t2 WHERE b='slave' GROUP BY b ORDER BY b
--connection master
--disable_warnings
DROP TABLE IF EXISTS t1,t2;
--enable_warnings
--echo
#
# STORAGE_ENGINE
#
--echo * storage_engine *
--connection master
SET @restore_master_storage_engine=@@global.default_storage_engine;
SET @@global.default_storage_engine=InnoDB;
SET @@session.default_storage_engine=InnoDB;
--connection slave
SET @restore_slave_storage_engine=@@global.default_storage_engine;
SET @@global.default_storage_engine=Memory;
SET @@session.default_storage_engine=Memory;
--connection master
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10));
CREATE TABLE t2 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10)) ENGINE=InnoDB;
--source include/sync_slave_sql_with_master.inc
CREATE TABLE t3 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10));
--connection master
SHOW CREATE TABLE t1;
SHOW CREATE TABLE t2;
--connection slave
SHOW CREATE TABLE t1;
SHOW CREATE TABLE t2;
SHOW CREATE TABLE t3;
SET @@global.default_storage_engine=InnoDB;
SET @@session.default_storage_engine=InnoDB;
--connection master
--disable_warnings
DROP TABLE IF EXISTS t1,t2,t3;
--enable_warnings
--echo
#
# SQL_MODE
#
--echo * sql_mode *
--connection master
SET @@global.sql_mode=ANSI;
SET @@session.sql_mode=ANSI;
--connection slave
SET @@global.sql_mode=TRADITIONAL;
SET @@session.sql_mode=TRADITIONAL;
--connection master
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10), c DATE);
INSERT INTO t1 VALUES (1, 'master', '0000-00-00');
SELECT * FROM t1 ORDER BY a;
--source include/sync_slave_sql_with_master.inc
--error 1292
INSERT INTO t1 VALUES (1, 'slave', '0000-00-00');
SELECT * FROM t1 ORDER BY a;
SET @@global.sql_mode=DEFAULT;
SET @@session.sql_mode=DEFAULT;
--connection master
SET @@global.sql_mode=DEFAULT;
SET @@session.sql_mode=DEFAULT;
DROP TABLE t1;
--echo
# Clean up
--echo *** clean up ***
SET @@global.default_storage_engine=@restore_master_storage_engine;
--source include/sync_slave_sql_with_master.inc
SET @@global.max_heap_table_size=@restore_slave_max_heap_table_size;
SET @@global.default_storage_engine=@restore_slave_storage_engine;
# Put at the end since the test otherwise emptied the table.
--echo
call mtr.add_suppression("The table 't[12]' is full");
# End of 5.1 test
--source include/rpl_end.inc
|