⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.124
Server IP:
50.28.103.30
Server:
Linux host.jcukjv-lwsites.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
Server Software:
nginx/1.28.0
PHP Version:
8.3.12
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
www
/
server
/
mysql
/
mysql-test
/
suite
/
ndb_rpl
/
t
/
View File Name :
ndb_rpl_last_conflict_epoch_var.test
# # Test engine native conflict resolution for ndb # NDB$EPOCH() function # # --source include/have_ndb.inc --source include/have_binlog_format_mixed_or_row.inc --source suite/ndb_rpl/ndb_master-slave.inc --echo Setup circular replication --disable_query_log --connection slave RESET MASTER; let $SLAVE_SERVER_ID= `select @@server_id`; echo SLAVE_SERVER_ID: $SLAVE_SERVER_ID; --connection master --replace_result $SLAVE_MYPORT SLAVE_PORT --eval CHANGE MASTER TO master_host="127.0.0.1",master_port=$SLAVE_MYPORT,master_user="root" START SLAVE; let $MASTER_SERVER_ID= `select @@server_id`; echo MASTER_SERVER_ID: $MASTER_SERVER_ID; --echo Setup ndb_replication and t1$EX exceptions table --disable_warnings --connection master drop table if exists mysql.ndb_replication; CREATE TABLE mysql.ndb_replication (db VARBINARY(63), table_name VARBINARY(63), server_id INT UNSIGNED, binlog_type INT UNSIGNED, conflict_fn VARBINARY(128), PRIMARY KEY USING HASH (db,table_name,server_id)) ENGINE=NDB PARTITION BY KEY(db,table_name); --enable_warnings --echo Populate ndb_replication table as necessary eval replace into mysql.ndb_replication values ("test", "t1", $SLAVE_SERVER_ID, 7, NULL), ("test", "t1", $MASTER_SERVER_ID, 7, "NDB\$EPOCH()"); --enable_query_log create table test.t1 ( a int primary key, b int, c varchar(2000)) engine=ndb; insert into test.t1 values (1,1,repeat("B", 1000)); --sync_slave_with_master slave --connection slave --echo Stopping Primary -> Secondary replication stop slave; --connection master --echo Stopping Secondary -> Primary replication stop slave; --echo Making change on Primary update test.t1 set b=2 where a=1; --echo Making conflicting change on Secondary --connection slave begin; update test.t1 set b=3 where a=1; insert into test.t1 values (2,2,repeat("A", 1000)); commit; --disable_query_log --disable_result_log --connection master --echo Capturing session epoch from Master select @master_session_epoch:=Variable_value from information_schema.global_status where Variable_name="Ndb_last_commit_epoch_session"; --enable_result_log --echo Show that last_conflict_epoch is 0 show status like 'ndb_conflict_last_conflict_epoch'; --echo Restart Secondary->Primary replication start slave; --connection slave --sync_slave_with_master master --connection master --echo Check that max_replicated_epoch is --echo still < the saved session epoch --disable_result_log select @max_replicated_epoch:=Variable_value from information_schema.global_status where Variable_name="Ndb_slave_max_replicated_epoch"; --enable_result_log --echo Max replicated epoch should be < committed epoch select @max_replicated_epoch < @master_session_epoch; --disable_result_log select @conflict_detected_epoch:=Variable_value from information_schema.global_status where Variable_name="ndb_conflict_last_conflict_epoch"; --enable_result_log --echo Some invariants : select @conflict_detected_epoch != 0; select @conflict_detected_epoch > @max_replicated_epoch; --echo Primary has detected the problem, but Secondary --echo is unaware as the slave is offline. --echo Now bring it back --connection slave start slave; --echo Now sync up --connection master --sync_slave_with_master slave --connection slave --sync_slave_with_master master --connection master --echo Now lets check that the max replicated epoch --echo on the Primary is == the last_conflict_epoch --disable_result_log select @max_replicated_epoch:=Variable_value from information_schema.global_status where Variable_name="Ndb_slave_max_replicated_epoch"; select @conflict_detected_epoch:=Variable_value from information_schema.global_status where Variable_name="ndb_conflict_last_conflict_epoch"; --enable_result_log select @max_replicated_epoch = @conflict_detected_epoch; --echo Cleanup drop table test.t1; drop table mysql.ndb_replication; --sync_slave_with_master slave --connection slave --sync_slave_with_master master --connection master stop slave; --source include/rpl_end.inc