403Webshell
Server IP : 172.67.216.182  /  Your IP : 108.162.226.242
Web Server : Apache
System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64
User : www ( 1000)
PHP Version : 7.4.33
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /www/server/mysql/src/mysql-test/suite/ndb_rpl/r/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/server/mysql/src/mysql-test/suite/ndb_rpl/r/ndb_rpl_conflict_epoch_trans.result
include/master-slave.inc
Warnings:
Note	####	Sending passwords in plain text without SSL/TLS is extremely insecure.
Note	####	Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
[connection master]
Setup circular replication
Setup ndb_replication and t1 exceptions table
Populate ndb_replication table as necessary
replace into mysql.ndb_replication values
("test", "t1", 3, 7, NULL),
("test", "t1", 1, 7, "NDB$EPOCH_TRANS()");
replace into mysql.ndb_replication values
("test", "t2", 3, 7, NULL),
("test", "t2", 1, 7, "NDB$EPOCH_TRANS()");
create table test.t1 (
a int primary key,
b varchar(2000)) engine=ndb;
create table test.t2 (
a int primary key,
b varchar(2000)) engine=ndb;
Add some data
insert into test.t1 values
(1, "Initial data 1"),
(2, "Initial data 2"),
(3, "Initial data 3"),
(4, "Initial data 4"),
(5, "Initial data 5"),
(6, "Initial data 6"),
(7, "Initial data 7"),
(8, "Initial data 8"),
(9, "Initial data 9"),
(10, "Initial data 10");
Show basic row-level conflict detection
---------------------------------------
stop slave;
update t1 set b="Primary first change 2" where a=2;
select * from test.t1 order by a;
a	b
1	Initial data 1
2	Primary first change 2
3	Initial data 3
4	Initial data 4
5	Initial data 5
6	Initial data 6
7	Initial data 7
8	Initial data 8
9	Initial data 9
10	Initial data 10
update t1 set b="Secondary first change 2" where a=2;
select * from test.t1 order by a;
a	b
1	Initial data 1
2	Secondary first change 2
3	Initial data 3
4	Initial data 4
5	Initial data 5
6	Initial data 6
7	Initial data 7
8	Initial data 8
9	Initial data 9
10	Initial data 10
Primary should have rejected change from Secondary, keeping its value
select * from t1 order by a;
a	b
1	Initial data 1
2	Primary first change 2
3	Initial data 3
4	Initial data 4
5	Initial data 5
6	Initial data 6
7	Initial data 7
8	Initial data 8
9	Initial data 9
10	Initial data 10
ndb_conflict_fn_epoch_trans
1
ndb_conflict_fn_epoch2_trans
0
ndb_conflict_trans_row_conflict_count
1
ndb_conflict_trans_row_reject_count
1
ndb_conflict_trans_reject_count
1
ndb_conflict_trans_detect_iter_count
1
ndb_conflict_trans_conflict_commit_count
1
ndb_epoch_delete_delete_count
0
start slave;
Secondary should have been realigned to Primary
select * from t1 order by a;
a	b
1	Initial data 1
2	Primary first change 2
3	Initial data 3
4	Initial data 4
5	Initial data 5
6	Initial data 6
7	Initial data 7
8	Initial data 8
9	Initial data 9
10	Initial data 10
Show rollback of whole secondary transaction
--------------------------------------------
stop slave;
update t1 set b="Primary second change 4" where a=4;
select * from test.t1 order by a;
a	b
1	Initial data 1
2	Primary first change 2
3	Initial data 3
4	Primary second change 4
5	Initial data 5
6	Initial data 6
7	Initial data 7
8	Initial data 8
9	Initial data 9
10	Initial data 10
begin;
update t1 set b="Secondary second change 4" where a=4;
update t1 set b="Secondary second change 5" where a=5;
commit;
select * from test.t1 order by a;
a	b
1	Initial data 1
2	Primary first change 2
3	Initial data 3
4	Secondary second change 4
5	Secondary second change 5
6	Initial data 6
7	Initial data 7
8	Initial data 8
9	Initial data 9
10	Initial data 10
Primary should have rejected secondary changes on both rows
select * from test.t1 order by a;
a	b
1	Initial data 1
2	Primary first change 2
3	Initial data 3
4	Primary second change 4
5	Initial data 5
6	Initial data 6
7	Initial data 7
8	Initial data 8
9	Initial data 9
10	Initial data 10
ndb_conflict_fn_epoch_trans
1
ndb_conflict_fn_epoch2_trans
0
ndb_conflict_trans_row_conflict_count
1
ndb_conflict_trans_row_reject_count
2
ndb_conflict_trans_reject_count
1
ndb_conflict_trans_detect_iter_count
1
ndb_conflict_trans_conflict_commit_count
1
ndb_epoch_delete_delete_count
0
start slave;
Secondary should have been realigned to Primary
select * from test.t1 order by a;
a	b
1	Initial data 1
2	Primary first change 2
3	Initial data 3
4	Primary second change 4
5	Initial data 5
6	Initial data 6
7	Initial data 7
8	Initial data 8
9	Initial data 9
10	Initial data 10
Show rollback of dependent transaction as well
----------------------------------------------
stop slave;
update t1 set b="Primary third change 1" where a=1;
select * from test.t1 order by a;
a	b
1	Primary third change 1
2	Primary first change 2
3	Initial data 3
4	Primary second change 4
5	Initial data 5
6	Initial data 6
7	Initial data 7
8	Initial data 8
9	Initial data 9
10	Initial data 10
begin;
update t1 set b="Secondary third change 3" where a=3;
update t1 set b="Secondary third change 1" where a=1;
commit;
begin;
update t1 set b="Secondary fourth change 3" where a=3;
insert into t1 values (11,"Secondary fourth change 11");
commit;
select * from test.t1 order by a;
a	b
1	Secondary third change 1
2	Primary first change 2
3	Secondary fourth change 3
4	Primary second change 4
5	Initial data 5
6	Initial data 6
7	Initial data 7
8	Initial data 8
9	Initial data 9
10	Initial data 10
11	Secondary fourth change 11
Primary should have rejected all secondary changes
select * from test.t1 order by a;
a	b
1	Primary third change 1
2	Primary first change 2
3	Initial data 3
4	Primary second change 4
5	Initial data 5
6	Initial data 6
7	Initial data 7
8	Initial data 8
9	Initial data 9
10	Initial data 10
ndb_conflict_trans_row_reject_count
4
ndb_conflict_trans_reject_count
2
ndb_epoch_delete_delete_count
0
start slave;
Secondary should have been realigned to Primary
select * from test.t1 order by a;
a	b
1	Primary third change 1
2	Primary first change 2
3	Initial data 3
4	Primary second change 4
5	Initial data 5
6	Initial data 6
7	Initial data 7
8	Initial data 8
9	Initial data 9
10	Initial data 10
Show rollback of dependent transaction across different tables
--------------------------------------------------------------
stop slave;
update t1 set b="Primary fifth change 6" where a=6;
select * from test.t1 order by a;
a	b
1	Primary third change 1
2	Primary first change 2
3	Initial data 3
4	Primary second change 4
5	Initial data 5
6	Primary fifth change 6
7	Initial data 7
8	Initial data 8
9	Initial data 9
10	Initial data 10
begin;
update t1 set b="Secondary fifth change 6" where a=6;
insert into t2 values (1, "Secondary fifth change 1");
insert into t2 values (2, "Secondary fifth change 2");
commit;
begin;
update t2 set b="Secondary sixth change 1" where a=2;
insert into t2 values (3, "Secondary sixth change 2");
commit;
select * from test.t1 order by a;
a	b
1	Primary third change 1
2	Primary first change 2
3	Initial data 3
4	Primary second change 4
5	Initial data 5
6	Secondary fifth change 6
7	Initial data 7
8	Initial data 8
9	Initial data 9
10	Initial data 10
select * from test.t2 order by a;
a	b
1	Secondary fifth change 1
2	Secondary sixth change 1
3	Secondary sixth change 2
Primary should have rejected all secondary changes
select * from test.t1 order by a;
a	b
1	Primary third change 1
2	Primary first change 2
3	Initial data 3
4	Primary second change 4
5	Initial data 5
6	Primary fifth change 6
7	Initial data 7
8	Initial data 8
9	Initial data 9
10	Initial data 10
select * from test.t2 order by a;
a	b
ndb_conflict_trans_row_reject_count
5
ndb_conflict_trans_reject_count
2
ndb_epoch_delete_delete_count
0
start slave;
Secondary should have been realigned to primary
select * from test.t1 order by a;
a	b
1	Primary third change 1
2	Primary first change 2
3	Initial data 3
4	Primary second change 4
5	Initial data 5
6	Primary fifth change 6
7	Initial data 7
8	Initial data 8
9	Initial data 9
10	Initial data 10
select * from test.t2 order by a;
a	b
Show that whole epoch is not rolled back
----------------------------------------
stop slave;
update t1 set b="Primary is king" where a=10;
begin;
update t1 set b="Secondary is emperor" where a=10;
insert into t1 values (11, "Secondary is pleni-potentiary");
commit;
begin;
insert into t1 values (12, "Secondary ruled once");
insert into t1 values (13, "This history will not be lost");
insert into t1 values (14, "Look on my works ye mighty, and despair");
commit;
Primary should have rejected conflicting trans (emperor, pleni-potentiary)
but accepted unrelated trans (history)
select * from t1 order by a;
a	b
1	Primary third change 1
2	Primary first change 2
3	Initial data 3
4	Primary second change 4
5	Initial data 5
6	Primary fifth change 6
7	Initial data 7
8	Initial data 8
9	Initial data 9
10	Primary is king
12	Secondary ruled once
13	This history will not be lost
14	Look on my works ye mighty, and despair
ndb_conflict_fn_epoch_trans
1
ndb_conflict_fn_epoch2_trans
0
ndb_conflict_trans_row_conflict_count
1
ndb_conflict_trans_row_reject_count
2
ndb_conflict_trans_reject_count
1
ndb_conflict_trans_detect_iter_count
1
ndb_conflict_trans_conflict_commit_count
1
ndb_epoch_delete_delete_count
0
start slave;
Secondary should be aligned with Primary
select * from t1 order by a;
a	b
1	Primary third change 1
2	Primary first change 2
3	Initial data 3
4	Primary second change 4
5	Initial data 5
6	Primary fifth change 6
7	Initial data 7
8	Initial data 8
9	Initial data 9
10	Primary is king
12	Secondary ruled once
13	This history will not be lost
14	Look on my works ye mighty, and despair
Show that non-conflicting ancestors are not implicated
------------------------------------------------------
stop slave;
update t1 set b="7 : Primary is king" where a=7;
Primary state
select * from test.t1 order by a;
a	b
1	Primary third change 1
2	Primary first change 2
3	Initial data 3
4	Primary second change 4
5	Initial data 5
6	Primary fifth change 6
7	7 : Primary is king
8	Initial data 8
9	Initial data 9
10	Primary is king
12	Secondary ruled once
13	This history will not be lost
14	Look on my works ye mighty, and despair
begin;
update t1 set b="8 : Secondary innocent" where a=8;
update t1 set b="9 : Secondary innocent" where a=9;
commit;
Secondary with innocent
select * from test.t1 order by a;
a	b
1	Primary third change 1
2	Primary first change 2
3	Initial data 3
4	Primary second change 4
5	Initial data 5
6	Primary fifth change 6
7	Initial data 7
8	8 : Secondary innocent
9	9 : Secondary innocent
10	Primary is king
12	Secondary ruled once
13	This history will not be lost
14	Look on my works ye mighty, and despair
begin;
update t1 set b="9 : Secondary guilty" where a=9;
update t1 set b="7 : Secondary guilty" where a=7;
commit;
Secondary with guilty overlaid
select * from test.t1 order by a;
a	b
1	Primary third change 1
2	Primary first change 2
3	Initial data 3
4	Primary second change 4
5	Initial data 5
6	Primary fifth change 6
7	7 : Secondary guilty
8	8 : Secondary innocent
9	9 : Secondary guilty
10	Primary is king
12	Secondary ruled once
13	This history will not be lost
14	Look on my works ye mighty, and despair
Primary cluster should have rejected 'guilty' secondary transaction, but
accepted 'innocent' secondary transaction.
select * from test.t1 order by a;
a	b
1	Primary third change 1
2	Primary first change 2
3	Initial data 3
4	Primary second change 4
5	Initial data 5
6	Primary fifth change 6
7	7 : Primary is king
8	8 : Secondary innocent
9	9 : Secondary innocent
10	Primary is king
12	Secondary ruled once
13	This history will not be lost
14	Look on my works ye mighty, and despair
ndb_conflict_fn_epoch_trans
1
ndb_conflict_fn_epoch2_trans
0
ndb_conflict_trans_row_conflict_count
1
ndb_conflict_trans_row_reject_count
2
ndb_conflict_trans_reject_count
1
ndb_conflict_trans_detect_iter_count
1
ndb_conflict_trans_conflict_commit_count
1
ndb_epoch_delete_delete_count
0
start slave;
Secondary cluster should be realigned with Primary
select * from test.t1 order by a;
a	b
1	Primary third change 1
2	Primary first change 2
3	Initial data 3
4	Primary second change 4
5	Initial data 5
6	Primary fifth change 6
7	7 : Primary is king
8	8 : Secondary innocent
9	9 : Secondary innocent
10	Primary is king
12	Secondary ruled once
13	This history will not be lost
14	Look on my works ye mighty, and despair
Classic banking example
-----------------------
replace into mysql.ndb_replication values
("test", "balances", 3, 7, NULL),
("test", "balances", 1, 7, "NDB$EPOCH_TRANS()");
replace into mysql.ndb_replication values
("test", "transactions", 3, 7, NULL),
("test", "transactions", 1, 7, "NDB$EPOCH_TRANS()");
create table test.balances
(name     varchar(100) primary key,
balance  int) engine=ndb;
create table test.transactions$EX
(server_id             int unsigned,
master_server_id      int unsigned,
master_epoch          bigint unsigned,
count                 int unsigned,
auto_key              int not null,
from_name             varchar(100) not null,
to_name               varchar(100) not null,
detail                varchar(100) not null,
primary key(server_id, master_server_id, master_epoch, count))
engine=ndb;
create table test.transactions
(auto_key      int auto_increment,
from_name     varchar(100),
to_name       varchar(100),
detail        varchar(100),
amount        int,
primary key(auto_key, from_name, to_name, detail)) engine=ndb;
Initialise balances across both bank sites
insert into test.balances values
("Larry", 100),
("Employee-1", 0),
("Employee-2", 0),
("Yacht dealer", 0),
("Newsagent", 0);
FLUSH LOGS;
Bank sites are disconnected
stop slave;
Larry buys a yacht using Primary bank site
begin;
insert into test.transactions (from_name, to_name, detail, amount)
values ("Larry", "Yacht dealer", "Yacht purchase", 50);
update test.balances set balance = balance - 50 where name = "Larry";
update test.balances set balance = balance + 50 where name = "Yacht dealer";
commit;
Show yacht transaction records
select * from test.transactions order by auto_key;
auto_key	from_name	to_name	detail	amount
1	Larry	Yacht dealer	Yacht purchase	50
select * from test.balances order by name;
name	balance
Employee-1	0
Employee-2	0
Larry	50
Newsagent	0
Yacht dealer	50
Larry pays employees using Secondary bank site
begin;
insert into test.transactions (from_name, to_name, detail, amount)
values ("Larry", "Employee-1", "Payment to Employee-1", 1);
update test.balances set balance = balance - 1 where name = "Larry";
update test.balances set balance = balance + 1 where name = "Employee-1";
commit;
begin;
insert into test.transactions (from_name, to_name, detail, amount)
values ("Larry", "Employee-2", "Payment to Employee-2", 1);
update test.balances set balance = balance - 1 where name = "Larry";
update test.balances set balance = balance + 1 where name = "Employee-2";
commit;
Employee-2 buys yacht magazine using Secondary bank site
begin;
insert into test.transactions (from_name, to_name, detail, amount)
values ("Employee-2", "Newsagent", "Buy yacht magazine", 1);
update test.balances set balance = balance - 1 where name = "Employee-2";
update test.balances set balance = balance + 1 where name = "Newsagent";
commit;
Show employee transactions
select * from test.transactions order by auto_key;
auto_key	from_name	to_name	detail	amount
1	Larry	Employee-1	Payment to Employee-1	1
2	Larry	Employee-2	Payment to Employee-2	1
3	Employee-2	Newsagent	Buy yacht magazine	1
select * from test.balances order by name;
name	balance
Employee-1	1
Employee-2	0
Larry	98
Newsagent	1
Yacht dealer	0
Bank sites re-connected
start slave;
Records at Primary bank site
select * from test.transactions order by auto_key;
auto_key	from_name	to_name	detail	amount
1	Larry	Yacht dealer	Yacht purchase	50
select * from test.balances order by name;
name	balance
Employee-1	0
Employee-2	0
Larry	50
Newsagent	0
Yacht dealer	50
Exceptions at Primary bank site
select server_id, master_server_id, auto_key, from_name, to_name, detail
from test.transactions$EX order by auto_key, from_name, to_name, detail;
server_id	master_server_id	auto_key	from_name	to_name	detail
1	3	1	Larry	Employee-1	Payment to Employee-1
1	3	2	Larry	Employee-2	Payment to Employee-2
1	3	3	Employee-2	Newsagent	Buy yacht magazine
Conflict handling activity at Primary bank site
Expect :
1 conflict from slave T1 on Larry's balance
1 conflict from slave T2 on Larry's balance
=2 row conflicts

3 (user) transactions rejected
9 rows rejected (3 per transaction)
Variability : # epoch transactions, # row conflicts detected
1-3                   2-3
# detect_iter_count
1-3
We only check stable values
ndb_conflict_trans_row_reject_count
9
ndb_conflict_trans_reject_count
3
ndb_epoch_delete_delete_count
0
Records at Secondary bank site
select * from test.transactions order by auto_key;
auto_key	from_name	to_name	detail	amount
1	Larry	Yacht dealer	Yacht purchase	50
select * from test.balances order by name;
name	balance
Employee-1	0
Employee-2	0
Larry	50
Newsagent	0
Yacht dealer	50
drop table test.balances;
drop table test.transactions;
drop table test.transactions$EX;
Test mixing transactional and non transactional
-----------------------------------------------
Remove old data from t1
delete from test.t1;
Define table with row-based epoch detection
replace into mysql.ndb_replication values
("test", "t3", 3, 7, NULL),
("test", "t3", 1, 7, 'NDB$EPOCH()');
create table t3 (a int primary key, b int) engine=ndb;
create table t4 (a int primary key, b int) engine=ndb;
create table t5 (a int primary key, b longtext) engine=ndb;
Insert some data
insert into test.t1 values
(1,1),
(2,2),
(3,3),
(4,4),
(5,5),
(6,6);
insert into test.t3 values
(11,11),
(12,12),
(13,13),
(14,14),
(15,15),
(16,16);
insert into test.t4 values
(21,21),
(22,22),
(23,23),
(24,24),
(25,25),
(26,26);
insert into test.t5 values
(1, REPEAT("B", 10000)),
(2, REPEAT("E", 10000)),
(3, REPEAT("A", 10000));
Allow to propagate
FLUSH LOGS;
Case 1 : Transactional detection affects row - based entries in same trans
stop slave;
update test.t1 set b=100 where a=1;
begin;
update test.t3 set b=1100 where a=11;
update test.t4 set b=2100 where a=21;
update test.t1 set b=1000 where a=1;
commit;
Show slave transaction effect
select * from test.t1 order by a;
a	b
1	1000
2	2
3	3
4	4
5	5
6	6
select * from test.t3 order by a;
a	b
11	1100
12	12
13	13
14	14
15	15
16	16
select * from test.t4 order by a;
a	b
21	2100
22	22
23	23
24	24
25	25
26	26
Expect Primary to have rejected whole trans across 3 tables
select * from test.t1 order by a;
a	b
1	100
2	2
3	3
4	4
5	5
6	6
select * from test.t3 order by a;
a	b
11	11
12	12
13	13
14	14
15	15
16	16
select * from test.t4 order by a;
a	b
21	21
22	22
23	23
24	24
25	25
26	26
Expect 1 transaction rejected, 3 rows rejected
1 conflict row, 1 epoch, 1 iteration
ndb_conflict_fn_epoch_trans
1
ndb_conflict_fn_epoch2_trans
0
ndb_conflict_trans_row_conflict_count
1
ndb_conflict_trans_row_reject_count
3
ndb_conflict_trans_reject_count
1
ndb_conflict_trans_detect_iter_count
1
ndb_conflict_trans_conflict_commit_count
1
ndb_epoch_delete_delete_count
0
Now restart rep to Secondary, and check realignment
start slave;
select * from test.t1 order by a;
a	b
1	100
2	2
3	3
4	4
5	5
6	6
select * from test.t3 order by a;
a	b
11	11
12	12
13	13
14	14
15	15
16	16
select * from test.t4 order by a;
a	b
21	21
22	22
23	23
24	24
25	25
26	26
Case 2 : Row based detection does not affect other transaction entries
stop slave;
update test.t3 set b=1200 where a=12;
begin;
update test.t3 set b=1201 where a=12;
update test.t4 set b=2200 where a=22;
update test.t1 set b=2000 where a=2;
commit;
Show effect of transaction on Secondary
select * from test.t1 order by a;
a	b
1	100
2	2000
3	3
4	4
5	5
6	6
select * from test.t3 order by a;
a	b
11	11
12	1201
13	13
14	14
15	15
16	16
select * from test.t4 order by a;
a	b
21	21
22	2200
23	23
24	24
25	25
26	26
Show effect of transaction on Primary
Only t3 should have been reverted
select * from test.t1 order by a;
a	b
1	100
2	2000
3	3
4	4
5	5
6	6
select * from test.t3 order by a;
a	b
11	11
12	1200
13	13
14	14
15	15
16	16
select * from test.t4 order by a;
a	b
21	21
22	2200
23	23
24	24
25	25
26	26
Expect all counters to be zero
ndb_conflict_fn_epoch_trans
0
ndb_conflict_fn_epoch2_trans
0
ndb_conflict_trans_row_conflict_count
0
ndb_conflict_trans_row_reject_count
0
ndb_conflict_trans_reject_count
0
ndb_conflict_trans_detect_iter_count
0
ndb_conflict_trans_conflict_commit_count
0
ndb_epoch_delete_delete_count
0
Show effect of transaction on Secondary
start slave;
select * from test.t1 order by a;
a	b
1	100
2	2000
3	3
4	4
5	5
6	6
select * from test.t3 order by a;
a	b
11	11
12	1200
13	13
14	14
15	15
16	16
select * from test.t4 order by a;
a	b
21	21
22	2200
23	23
24	24
25	25
26	26
flush logs;
Case 3 : Check behaviour where table with Blob is implicated
in transactional conflict.  Should result in Slave
stopping with an error.
STOP SLAVE;
Setup warning suppression
begin;
update t1 set b= 11 where a=1;
commit;
begin;
update t1 set b= 111 where a=1;
update t1 set b= 222 where a=2;
update t5 set b= REPEAT("T", 10000) where a=3;
commit;
Show effect of transaction on Secondary
select * from test.t1 order by a;
a	b
1	111
2	222
3	3
4	4
5	5
6	6
select left(b,1), length(b) from test.t5 order by a;
left(b,1)	length(b)
B	10000
E	10000
T	10000
Check that Primary Slave has stopped
include/wait_for_slave_sql_error.inc [errno=1296]
Restart Primary Slave
set global sql_slave_skip_counter=1;
START SLAVE;
Restart Secondary Slave
START SLAVE;
flush logs;
drop table test.t3;
drop table test.t4;
drop table test.t5;
Fix misalignment caused above
Makes following result sets look nicer
update test.t1 set b=2 where a=2;
Show a simple row-level delete-delete conflict
PRIMARY:
insert into test.t1 values (77, "A good year");
select * from test.t1 order by a;
a	b
1	11
2	2
3	3
4	4
5	5
6	6
77	A good year
SECONDARY:
stop slave;
PRIMARY:
Primary Delete
delete from test.t1 where a=77;
Show Primary contents
select * from test.t1 order by a;
a	b
1	11
2	2
3	3
4	4
5	5
6	6
SECONDARY:
select * from test.t1 order by a;
a	b
1	11
2	2
3	3
4	4
5	5
6	6
77	A good year
Secondary Delete->Insert in separate transactions
and potentially different epochs
Delete part with related transaction op
begin;
delete from test.t1 where a=77;
insert into test.t1 values (73, "A superb year");
commit;
Unrelated transaction from Secondary
begin;
insert into test.t1 values (84, "A good vintage");
commit;
Optionally flush logs
Following Insert from Secondary - potentially in different epoch
begin;
insert into test.t1 values (77, "Exceptional");
insert into test.t1 values (80, "Poor");
commit;
Show Secondary contents
select * from test.t1 order by a;
a	b
1	11
2	2
3	3
4	4
5	5
6	6
73	A superb year
77	Exceptional
80	Poor
84	A good vintage
Allow propagation to Primary
PRIMARY:
Expect:
- Delete-Delete conflict did not result in rejection of Secondary transaction
Therefore related row from Secondary Deleting transaction (73) is present
- Unrelated transaction from Secondary (84) is present
- Following insert on delete-delete conflict row (77) is not in conflict,
so both it and the related row from the same transaction (80) are present

select * from test.t1 order by a;
a	b
1	11
2	2
3	3
4	4
5	5
6	6
73	A superb year
77	Exceptional
80	Poor
84	A good vintage
ndb_conflict_trans_row_reject_count
0
ndb_conflict_trans_reject_count
0
ndb_epoch_delete_delete_count
1
Now sync with Secondary to show outcomes
NDB$EPOCH_TRANS will have divergence as the Primary delete of
row 77 took out the newly inserted row 77.
NDB$EPOCH2_TRANS will have no divergence as the Secondary insert
is reflected after the Primary delete, and re-inserts the value.
start slave;
SECONDARY:

select * from test.t1 order by a;
a	b
1	11
2	2
3	3
4	4
5	5
6	6
73	A superb year
80	Poor
84	A good vintage
drop table mysql.ndb_replication;
drop table test.t1;
drop table test.t2;
flush logs;
stop slave;
reset slave;
include/rpl_end.inc

Youez - 2016 - github.com/yon3zu
LinuXploit