Debian Codegraph @

mysql-test/suite/innodb/r/innodb-import-partition-rpl.result

raw
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 DROP TABLE IF EXISTS t1;
7 # On slave
8 set global innodb_file_per_table = 1;
9 # On master
10 set global innodb_file_per_table = 1;
11 # Create partitioned table on master
12 CREATE TABLE t1 ( i INT ) ENGINE = InnoDB PARTITION BY HASH(i) PARTITIONS 3;
13 CREATE TABLE t2 ( i INT ) ENGINE = InnoDB PARTITION BY KEY(i) PARTITIONS 3;
14 INSERT INTO t1 VALUES (1),(111),(321);
15 INSERT INTO t2 VALUES (0),(1),(2);
16 FLUSH TABLES t1,t2 FOR EXPORT;
17 include/sync_slave_sql_with_master.inc
18 # set MYSQLD_DATADIR with master datadir to copy idb and cfg files
19 backup: t1#p#p0
20 backup: t1#p#p1
21 backup: t1#p#p2
22 backup: t2#p#p0
23 backup: t2#p#p1
24 # On slave
25 # check table created on slave
26 SELECT * FROM t1;
27 i
28 111
29 321
30 1
31 SELECT * FROM t2;
32 i
33 0
34 1
35 2
36 # On master
37 # DISCARD TABLESPACE on master.It will be also discarded from slave.
38 UNLOCK TABLES;
39 ALTER TABLE t1 DISCARD TABLESPACE;
40 ALTER TABLE t2 DISCARD PARTITION p0,p1 TABLESPACE;
41 include/sync_slave_sql_with_master.inc
42 # Copy back ibd and cfg files on master
43 restore: t1#p#p0 .ibd and .cfg files
44 restore: t1#p#p1 .ibd and .cfg files
45 restore: t1#p#p2 .ibd and .cfg files
46 restore: t2#p#p0 .ibd and .cfg files
47 restore: t2#p#p1 .ibd and .cfg files
48 # Copy back ibd and cfg files on slave
49 restore: t1#p#p0 .ibd and .cfg files
50 restore: t1#p#p1 .ibd and .cfg files
51 restore: t1#p#p2 .ibd and .cfg files
52 restore: t2#p#p0 .ibd and .cfg files
53 restore: t2#p#p1 .ibd and .cfg files
54 # IMPORT TABLESPACE on master.It will be also imported on slave.
55 ALTER TABLE t1 IMPORT TABLESPACE;
56 SELECT * FROM t1;
57 i
58 111
59 321
60 1
61 ALTER TABLE t2 IMPORT PARTITION p0,p1 TABLESPACE;
62 SELECT * FROM t2;
63 i
64 0
65 1
66 2
67 include/sync_slave_sql_with_master.inc
68 # On slave
69 # Verify table data on slave
70 SELECT * FROM t1;
71 i
72 111
73 321
74 1
75 SELECT * FROM t2;
76 i
77 0
78 1
79 2
80 set global innodb_file_per_table = 1;
81 set global innodb_file_per_table = 1;
82 DROP TABLE t1;
83 DROP TABLE t2;
84 include/rpl_end.inc
85 call mtr.add_suppression("Got error -1 when reading table '.*'");
86 call mtr.add_suppression("Error: tablespace id and flags in file '.*'.*");
87 call mtr.add_suppression("The table .* doesn't have a corresponding tablespace, it was discarded");