| 1 |
include/master-slave.inc |
| 2 |
Warnings: |
| 3 |
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. |
| 4 |
Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information. |
| 5 |
[connection master] |
| 6 |
CREATE TABLE IF NOT EXISTS t1 (a INT) ENGINE=InnoDB; |
| 7 |
CREATE TABLE t2 (a INT) ENGINE=MyISAM; |
| 8 |
# |
| 9 |
# Verify that XA transactions' gtids can be reported |
| 10 |
# from global.gtid_executed correctly. |
| 11 |
# |
| 12 |
INSERT INTO t2 VALUES(1); |
| 13 |
XA START '1'; |
| 14 |
INSERT INTO t2 VALUES(2); |
| 15 |
INSERT INTO t1 VALUES(1); |
| 16 |
INSERT INTO t1 VALUES(2); |
| 17 |
XA END '1'; |
| 18 |
XA PREPARE '1'; |
| 19 |
XA COMMIT '1'; |
| 20 |
include/assert.inc [committed gtids SOURCE_UUID:1-6] |
| 21 |
# |
| 22 |
# Verify that specified gtid for XA transaction can be reported |
| 23 |
# from global.gtid_executed correctly. |
| 24 |
# |
| 25 |
SET @@SESSION.GTID_NEXT= 'SOURCE_UUID:17'; |
| 26 |
XA START '1'; |
| 27 |
INSERT INTO t1 VALUES(3); |
| 28 |
XA END '1'; |
| 29 |
XA PREPARE '1'; |
| 30 |
SET @@SESSION.GTID_NEXT= 'SOURCE_UUID:18'; |
| 31 |
XA COMMIT '1'; |
| 32 |
include/assert.inc [committed gtids SOURCE_UUID:1-6:17-18] |
| 33 |
# |
| 34 |
# Verify that we can store gtids SOURCE_UUID:1-6:16 in gtid_executed |
| 35 |
# table for XA transactions on binlog rotation. |
| 36 |
# |
| 37 |
SET GTID_NEXT='AUTOMATIC'; |
| 38 |
FLUSH LOGS; |
| 39 |
SELECT * FROM mysql.gtid_executed; |
| 40 |
source_uuid interval_start interval_end |
| 41 |
SOURCE_UUID 1 6 |
| 42 |
SOURCE_UUID 17 18 |
| 43 |
include/sync_slave_sql_with_master.inc |
| 44 |
# |
| 45 |
# connection slave |
| 46 |
# |
| 47 |
call mtr.add_suppression("You need to use --log-bin to make --binlog-format work"); |
| 48 |
call mtr.add_suppression("Replica SQL for channel '': Error in Xid_log_event: Commit could not " |
| 49 |
"be completed, 'Got error -1 - 'Unknown error.*' from storage engine', " |
| 50 |
"Error_code: MY-001030"); |
| 51 |
call mtr.add_suppression("Replica.*Got error -1 .* from storage engine.*Error_code: MY-001030"); |
| 52 |
call mtr.add_suppression("Replica: An error occurred at storing the GTID value"); |
| 53 |
call mtr.add_suppression("The replica coordinator and worker threads are stopped"); |
| 54 |
include/assert.inc [committed gtids SOURCE_UUID:1-6:17-18] |
| 55 |
# |
| 56 |
# Verify that the transaction is skiped if its specified gtid |
| 57 |
# is already in global.gtid_executed. |
| 58 |
# |
| 59 |
SET @@SESSION.GTID_NEXT= 'SOURCE_UUID:4'; |
| 60 |
INSERT INTO t1 VALUES(11); |
| 61 |
include/assert.inc [Table t1 must not contain 11] |
| 62 |
# |
| 63 |
# Verify that the specified gtid to GTID_NEXT is stored into |
| 64 |
# global.gtid_executed and gtid_executed table. |
| 65 |
# |
| 66 |
SET @@SESSION.GTID_NEXT= 'SOURCE_UUID:19'; |
| 67 |
COMMIT; |
| 68 |
include/assert.inc [committed gtids SOURCE_UUID:1-6:17-19] |
| 69 |
# |
| 70 |
# Verify that the gtid_executed table is compressed. |
| 71 |
# |
| 72 |
SET @debug_save= @@GLOBAL.DEBUG; |
| 73 |
SET @@GLOBAL.DEBUG= '+d,compress_gtid_table'; |
| 74 |
SET @@SESSION.GTID_NEXT= 'SOURCE_UUID:20'; |
| 75 |
COMMIT; |
| 76 |
SET GTID_NEXT='AUTOMATIC'; |
| 77 |
# Trigger compression explicitly |
| 78 |
FLUSH LOGS; |
| 79 |
SET DEBUG_SYNC='now WAIT_FOR complete_compression'; |
| 80 |
SET GLOBAL DEBUG= @debug_save; |
| 81 |
SELECT * FROM mysql.gtid_executed; |
| 82 |
source_uuid interval_start interval_end |
| 83 |
SOURCE_UUID 1 6 |
| 84 |
SOURCE_UUID 17 20 |
| 85 |
# |
| 86 |
# Verify that gtid_executed and gtid_purged are always same |
| 87 |
# when binlog is disabled. |
| 88 |
# |
| 89 |
include/assert.inc [gtid_executed and gtid_purged are always same when binlog is disabled] |
| 90 |
# |
| 91 |
# Verify that no gtid is generated for transaction |
| 92 |
# when binlog is disabled |
| 93 |
# |
| 94 |
CREATE TABLE t3 (a INT); |
| 95 |
INSERT INTO t1 VALUES(12); |
| 96 |
DROP TABLE t3; |
| 97 |
# |
| 98 |
# Stored gtids SOURCE_UUID:1-6:17-20 in gtid_executed table |
| 99 |
# on slave. |
| 100 |
SELECT * FROM mysql.gtid_executed; |
| 101 |
source_uuid interval_start interval_end |
| 102 |
SOURCE_UUID 1 6 |
| 103 |
SOURCE_UUID 17 20 |
| 104 |
SET @@SESSION.GTID_NEXT = 'automatic'; |
| 105 |
XA START 'xid_1'; |
| 106 |
INSERT INTO t1 VALUES(1); |
| 107 |
XA END 'xid_1'; |
| 108 |
XA PREPARE 'xid_1'; |
| 109 |
SET @@SESSION.GTID_NEXT = 'automatic'; |
| 110 |
XA COMMIT 'xid_1'; |
| 111 |
SET @@SESSION.GTID_NEXT = 'automatic'; |
| 112 |
SET @@SESSION.GTID_NEXT = 'automatic'; |
| 113 |
XA START 'xid_1'; |
| 114 |
INSERT INTO t1 VALUES(1); |
| 115 |
XA END 'xid_1'; |
| 116 |
XA PREPARE 'xid_1'; |
| 117 |
SET @@SESSION.GTID_NEXT = 'automatic'; |
| 118 |
XA ROLLBACK 'xid_1'; |
| 119 |
SET @@SESSION.GTID_NEXT = 'automatic'; |
| 120 |
SET @@SESSION.GTID_NEXT = 'automatic'; |
| 121 |
XA START 'xid_1'; |
| 122 |
INSERT INTO t1 VALUES(1); |
| 123 |
XA END 'xid_1'; |
| 124 |
XA PREPARE 'xid_1'; |
| 125 |
SET @@SESSION.GTID_NEXT = 'SOURCE_UUID:21'; |
| 126 |
XA ROLLBACK 'xid_1'; |
| 127 |
SET @@SESSION.GTID_NEXT = 'automatic'; |
| 128 |
SET @@SESSION.GTID_NEXT = 'SOURCE_UUID:22'; |
| 129 |
XA START 'xid_1'; |
| 130 |
INSERT INTO t1 VALUES(1); |
| 131 |
XA END 'xid_1'; |
| 132 |
XA PREPARE 'xid_1'; |
| 133 |
XA ROLLBACK 'xid_1'; |
| 134 |
ERROR HY000: When @@SESSION.GTID_NEXT is set to a GTID, you must explicitly set it to a different value after a COMMIT or ROLLBACK. Please check GTID_NEXT variable manual page for detailed explanation. Current @@SESSION.GTID_NEXT is 'SOURCE_UUID:22'. |
| 135 |
SET @@SESSION.GTID_NEXT = 'automatic'; |
| 136 |
XA ROLLBACK 'xid_1'; |
| 137 |
SET @@SESSION.GTID_NEXT = 'automatic'; |
| 138 |
DROP TABLE t1, t2; |
| 139 |
include/sync_slave_sql_with_master.inc |
| 140 |
CREATE TABLE t3 (a INT); |
| 141 |
include/sync_slave_sql_with_master.inc |
| 142 |
FLUSH LOGS; |
| 143 |
# |
| 144 |
# Verify that transaction's gtid is not stored into gtid_executed table |
| 145 |
# and the transaction is rolled back if we encounter an error |
| 146 |
# when writing gtid into table when binlog is disabled and |
| 147 |
# gtid_mode is enabled. |
| 148 |
# |
| 149 |
SET @@GLOBAL.DEBUG= '+d,simulate_err_on_write_gtid_into_table'; |
| 150 |
INSERT INTO t3 VALUES(1); |
| 151 |
include/wait_for_slave_sql_error.inc [errno=1030] |
| 152 |
SET GLOBAL DEBUG= @debug_save; |
| 153 |
include/stop_slave_io.inc |
| 154 |
# |
| 155 |
# Stored gtids SOURCE_UUID:1-15:17-22 in gtid_executed table on slave. |
| 156 |
# |
| 157 |
include/assert.inc [committed gtids SOURCE_UUID:1-15:17-22] |
| 158 |
include/assert.inc [Table t3 must not contain 1] |
| 159 |
# |
| 160 |
# Verify that the gtid_executed table is compressed. |
| 161 |
# |
| 162 |
SET @debug_save= @@GLOBAL.DEBUG; |
| 163 |
SET @@GLOBAL.DEBUG= '+d,compress_gtid_table'; |
| 164 |
SET @@SESSION.GTID_NEXT= 'SOURCE_UUID:23'; |
| 165 |
COMMIT; |
| 166 |
SET GTID_NEXT='AUTOMATIC'; |
| 167 |
# Trigger compression explicitly |
| 168 |
FLUSH LOGS; |
| 169 |
SET DEBUG_SYNC='now WAIT_FOR complete_compression'; |
| 170 |
SET GLOBAL DEBUG= @debug_save; |
| 171 |
SELECT * FROM mysql.gtid_executed; |
| 172 |
source_uuid interval_start interval_end |
| 173 |
SOURCE_UUID 1 15 |
| 174 |
SOURCE_UUID 17 23 |
| 175 |
DROP TABLE t3; |
| 176 |
CALL mtr.add_suppression("Statement is unsafe because it is being used inside a XA transaction"); |
| 177 |
DROP TABLE t3; |
| 178 |
CALL mtr.add_suppression("Statement is unsafe because it is being used inside a XA transaction"); |
| 179 |
RESET SLAVE; |
| 180 |
Warnings: |
| 181 |
Warning 1287 'RESET SLAVE' is deprecated and will be removed in a future release. Please use RESET REPLICA instead |
| 182 |
include/rpl_end.inc |