mirror of
				https://github.com/MariaDB/server.git
				synced 2025-11-03 14:33:32 +03:00 
			
		
		
		
	
		
			
				
	
	
		
			74 lines
		
	
	
		
			4.2 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			74 lines
		
	
	
		
			4.2 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
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	c3
 | 
						|
row1	will go away	1
 | 
						|
SELECT @the_epoch:=MAX(epoch) FROM mysql.ndb_apply_status;
 | 
						|
@the_epoch:=MAX(epoch)
 | 
						|
<the_epoch>
 | 
						|
SELECT * FROM t1 ORDER BY c3;
 | 
						|
c1	c2	c3
 | 
						|
row1	will go away	1
 | 
						|
SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
 | 
						|
FROM mysql.ndb_binlog_index WHERE epoch = <the_epoch> ;
 | 
						|
@the_pos:=Position	@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
 | 
						|
<the_pos>	master-bin.000001
 | 
						|
INSERT 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	c3
 | 
						|
row3	C	3
 | 
						|
row4	D	4
 | 
						|
SELECT * FROM t1 ORDER BY c3;
 | 
						|
c1	c2	c3
 | 
						|
row3	C	3
 | 
						|
row4	D	4
 | 
						|
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	Master_SSL_Verify_Server_Cert
 | 
						|
<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>	No
 | 
						|
STOP SLAVE;
 | 
						|
CHANGE MASTER TO
 | 
						|
master_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	Master_SSL_Verify_Server_Cert
 | 
						|
<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>	No
 | 
						|
START SLAVE;
 | 
						|
SELECT * FROM t1 ORDER BY c3;
 | 
						|
c1	c2	c3
 | 
						|
row3	C	3
 | 
						|
row4	D	4
 | 
						|
SELECT * FROM t1 ORDER BY c3;
 | 
						|
c1	c2	c3
 | 
						|
row3	C	3
 | 
						|
row4	D	4
 | 
						|
STOP 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	c3
 | 
						|
row2	new on slave	2
 | 
						|
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	Master_SSL_Verify_Server_Cert
 | 
						|
<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>	No
 | 
						|
DROP TABLE IF EXISTS t1;
 |