| 1 |
# |
| 2 |
# 1) Reset the master and set max_binlog_size to a smaller value 4KB. |
| 3 |
# |
| 4 |
SET @save_max_binlog_size=@@global.max_binlog_size; |
| 5 |
SET GLOBAL max_binlog_size=4096; |
| 6 |
RESET MASTER; |
| 7 |
# |
| 8 |
# 2) Start a XA transaction which is more than max_binlog_size (4KB). |
| 9 |
# |
| 10 |
CREATE TABLE t1(i varchar(4096)); |
| 11 |
XA START 'xa1'; |
| 12 |
INSERT INTO t1 VALUES (REPEAT('a', 4096)); |
| 13 |
XA END 'xa1'; |
| 14 |
# |
| 15 |
# 3) Prepare the XA trx. |
| 16 |
# (trx content will be written to binlog.000001 and the binlog |
| 17 |
# will be rotated because of the size limit). |
| 18 |
XA PREPARE 'xa1'; |
| 19 |
# |
| 20 |
# 4) Commit the XA trx (commit will be written to binlog.000002). |
| 21 |
# |
| 22 |
XA COMMIT 'xa1'; |
| 23 |
# |
| 24 |
# 5) Save the binlog dump for the reapply purpose. |
| 25 |
# |
| 26 |
# |
| 27 |
# 6) Cleanup the server and make it ready to apply the binlog dump. |
| 28 |
# |
| 29 |
RENAME TABLE t1 TO t2; |
| 30 |
RESET MASTER; |
| 31 |
# |
| 32 |
# 7) Apply the binlog dump. |
| 33 |
# |
| 34 |
# |
| 35 |
# 8) Verify that the old data is restorted properly without any issues. |
| 36 |
# |
| 37 |
include/diff_tables.inc [default:t1, default:t2] |
| 38 |
# |
| 39 |
# 9) Cleanup |
| 40 |
# |
| 41 |
DROP TABLE t1,t2; |
| 42 |
SET GLOBAL max_binlog_size=@save_max_binlog_size; |