📄 rpl_ndb_idempotent.result
字号:
stop slave;drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;reset master;reset slave;drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;start slave;CREATE TABLE t1 (c1 CHAR(15), c2 CHAR(15), c3 INT, PRIMARY KEY (c3)) ENGINE = NDB ;INSERT INTO t1 VALUES ("row1","will go away",1);SELECT * FROM t1 ORDER BY c3;c1 c2 c3row1 will go away 1SELECT @the_epoch:=MAX(epoch) FROM cluster_replication.apply_status;@the_epoch:=MAX(epoch)<the_epoch>SELECT * FROM t1 ORDER BY c3;c1 c2 c3row1 will go away 1SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)FROM cluster_replication.binlog_index WHERE epoch = <the_epoch> ;@the_pos:=Position @the_file:=SUBSTRING_INDEX(FILE, '/', -1)<the_pos> master-bin.000001INSERT INTO t1 VALUES ("row2","will go away",2),("row3","will change",3),("row4","D",4);DELETE FROM t1 WHERE c3 = 1;UPDATE t1 SET c2="should go away" WHERE c3 = 2;UPDATE t1 SET c2="C" WHERE c3 = 3;DELETE FROM t1 WHERE c3 = 2;SELECT * FROM t1 ORDER BY c3;c1 c2 c3row3 C 3row4 D 4SELECT * FROM t1 ORDER BY c3;c1 c2 c3row3 C 3row4 D 4SHOW SLAVE STATUS;Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master>STOP SLAVE;CHANGE MASTER TOmaster_log_file = 'master-bin.000001',master_log_pos = <the_pos> ;SHOW SLAVE STATUS;Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 No No <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master>START SLAVE;SELECT * FROM t1 ORDER BY c3;c1 c2 c3row3 C 3row4 D 4SELECT * FROM t1 ORDER BY c3;c1 c2 c3row3 C 3row4 D 4STOP SLAVE;DROP TABLE t1;RESET master;DROP TABLE t1;RESET slave;START SLAVE;CREATE TABLE t1 (c1 CHAR(15) NOT NULL, c2 CHAR(15) NOT NULL, c3 INT NOT NULL, PRIMARY KEY (c3)) ENGINE = NDB ;INSERT INTO t1 VALUES ("row1","remove on slave",1);DELETE FROM t1;BEGIN;UPDATE t1 SET c2="does not exist" WHERE c3=1;INSERT INTO t1 VALUES ("row2","new on slave",2);COMMIT;SELECT * FROM t1;c1 c2 c3row2 new on slave 2SHOW SLAVE STATUS;Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -