| 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 |
|
| 7 |
################################################## |
| 8 |
# 1. Enable the generation of GIPKs in the replica |
| 9 |
[connection slave] |
| 10 |
CHANGE REPLICATION SOURCE TO REQUIRE_TABLE_PRIMARY_KEY_CHECK = GENERATE; |
| 11 |
include/start_slave.inc |
| 12 |
|
| 13 |
##################################################### |
| 14 |
# 2. Create a table with no primary key in the source |
| 15 |
# Check it was created with a GIPK in the replica |
| 16 |
[connection master] |
| 17 |
CREATE TABLE t1(f1 INT, f2 INT); |
| 18 |
include/sync_slave_sql_with_master.inc |
| 19 |
[connection slave] |
| 20 |
include/assert.inc [The table contains 3 columns] |
| 21 |
include/assert.inc [The table contains a generated invisilble primary key] |
| 22 |
|
| 23 |
############################################# |
| 24 |
# 3. Add some rows to the table in the source |
| 25 |
# Check they are present in the replica with the expected auto generated values |
| 26 |
include/save_sysvars.inc [ "GLOBAL.replica_parallel_workers" ] |
| 27 |
include/stop_slave_sql.inc |
| 28 |
SET @@GLOBAL.replica_parallel_workers= 1; |
| 29 |
include/start_slave_sql.inc |
| 30 |
[connection master] |
| 31 |
INSERT INTO t1 VALUES (1, 10); |
| 32 |
INSERT INTO t1 VALUES (2, 20); |
| 33 |
include/sync_slave_sql_with_master.inc |
| 34 |
include/assert.inc [The table contains a row with generated key 1] |
| 35 |
include/assert.inc [The table contains a row with generated key 2] |
| 36 |
INSERT INTO t1 (my_row_id,f1,f2) VALUES (3, 3, 30); |
| 37 |
[connection master] |
| 38 |
INSERT INTO t1 VALUES (4, 40); |
| 39 |
include/sync_slave_sql_with_master.inc |
| 40 |
include/assert.inc [The table contains a row with generated key 3] |
| 41 |
include/assert.inc [The table contains a row with generated key 4] |
| 42 |
|
| 43 |
########################################################### |
| 44 |
# 4. Update one of the row in the source and delete another |
| 45 |
# Check the changes are correctly propagated |
| 46 |
[connection master] |
| 47 |
UPDATE t1 SET t1.f2 = 60 WHERE t1.f1=2; |
| 48 |
DELETE FROM t1 WHERE t1.f1=1; |
| 49 |
include/sync_slave_sql_with_master.inc |
| 50 |
[connection slave] |
| 51 |
include/assert.inc [The table contains 3 row] |
| 52 |
include/assert.inc [The table was updated] |
| 53 |
|
| 54 |
########################################################### |
| 55 |
# 5. Cleanup |
| 56 |
include/restore_sysvars.inc |
| 57 |
include/stop_slave_sql.inc |
| 58 |
CHANGE REPLICATION SOURCE TO REQUIRE_TABLE_PRIMARY_KEY_CHECK = PRIMARY_KEY_CHECK_VALUE; |
| 59 |
include/start_slave_sql.inc |
| 60 |
[connection master] |
| 61 |
DROP TABLE t1; |
| 62 |
include/rpl_end.inc |