List:Commits« Previous MessageNext Message »
From:jonas oreland Date:July 8 2011 12:32pm
Subject:bzr push into mysql-5.1-telco-7.1 branch (jonas.oreland:4249 to 4250)
View as plain text  
 4250 jonas oreland	2011-07-08 [merge]
      ndb - merge 70 to 71

    added:
      mysql-test/suite/ndb_rpl/r/ndb_rpl_conflict_epoch.result
      mysql-test/suite/ndb_rpl/t/ndb_rpl_conflict_epoch.cnf
      mysql-test/suite/ndb_rpl/t/ndb_rpl_conflict_epoch.test
      mysql-test/suite/ndb_rpl/t/ndb_rpl_conflict_epoch_1.inc
    modified:
      mysql-test/suite/ndb/r/ndb_basic.result
      mysql-test/suite/ndb_rpl/r/ndb_rpl_conflict_max.result
      mysql-test/suite/ndb_rpl/r/ndb_rpl_conflict_max_delete_win.result
      mysql-test/suite/ndb_rpl/r/ndb_rpl_conflict_old.result
      mysql-test/suite/ndb_rpl/t/ndb_conflict_info.inc
      mysql-test/suite/ndb_rpl/t/ndb_conflict_info_init.inc
      sql/ha_ndbcluster.cc
      sql/ha_ndbcluster.h
      sql/ha_ndbcluster_binlog.cc
 4249 Jonas Oreland	2011-07-07 [merge]
      ndb - merge 70 to 71

    modified:
      mysql-test/suite/ndb/r/ndb_share.result
      mysql-test/suite/ndb/t/ndb_share.cnf
      mysql-test/suite/ndb/t/ndb_share.test
=== modified file 'mysql-test/suite/ndb/r/ndb_basic.result'
--- a/mysql-test/suite/ndb/r/ndb_basic.result	2011-07-06 06:33:09 +0000
+++ b/mysql-test/suite/ndb/r/ndb_basic.result	2011-07-07 14:48:06 +0000
@@ -65,6 +65,7 @@ Ndb_api_wait_scan_result_count_slave	#
 Ndb_cluster_node_id	#
 Ndb_config_from_host	#
 Ndb_config_from_port	#
+Ndb_conflict_fn_epoch	#
 Ndb_conflict_fn_max	#
 Ndb_conflict_fn_max_del_win	#
 Ndb_conflict_fn_old	#

=== added file 'mysql-test/suite/ndb_rpl/r/ndb_rpl_conflict_epoch.result'
--- a/mysql-test/suite/ndb_rpl/r/ndb_rpl_conflict_epoch.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/ndb_rpl/r/ndb_rpl_conflict_epoch.result	2011-07-07 14:48:06 +0000
@@ -0,0 +1,2879 @@
+include/master-slave.inc
+[connection master]
+Setup circular replication
+RESET MASTER;
+select @slave_server_id:=(variable_value+0)
+from information_schema.global_variables
+where variable_name like 'server_id';
+@slave_server_id:=(variable_value+0)
+3
+CHANGE MASTER TO master_host="127.0.0.1",master_port=SLAVE_PORT,master_user="root";
+START SLAVE;
+select @master_server_id:=(variable_value+0)
+from information_schema.global_variables
+where variable_name like 'server_id';
+@master_server_id:=(variable_value+0)
+1
+Setup ndb_replication and t1 exceptions table
+Populate ndb_replication table as necessary
+-- 0 extra gci bits
+replace into mysql.ndb_replication values
+("test", "t1", 3, 7, NULL),
+("test", "t1", 1, 7, "NDB$EPOCH(0)");
+create table `test`.`t1$EX`
+  (server_id int unsigned,
+master_server_id int unsigned,
+master_epoch bigint unsigned,
+count int unsigned,
+a int not null,
+d int,
+primary key(server_id, master_server_id, master_epoch, count)) engine ndb;
+Create table
+create table test.t1(a int primary key, b varchar(255)) engine = ndb;
+Create other table
+create table test.t2(a int primary key, b int) engine = ndb;
+----------------------------------
+Test 1 : Basic two-way replication
+----------------------------------
+insert into test.t1 values (1, "Metropole");
+-- Give time for a new epoch on the Master
+-- Insert something to ensure the new epoch is noticed
+replace into test.t2 values (2, 1);
+-- Flushed to slave
+select * from test.t1 order by a;
+a	b
+1	Metropole
+-- Flushed back to Master
+select * from test.t1 order by a;
+a	b
+1	Metropole
+-- Now update data on slave
+update test.t1 set b="Favorit" where a=1;
+-- Now check data on master
+select * from test.t1 order by a;
+a	b
+1	Favorit
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+-- Now perform multiple consecutive updates on the slave
+update test.t1 set b="Elephant house" where a=1;
+update test.t1 set b="Beach house" where a=1;
+select * from test.t1 order by a;
+a	b
+1	Beach house
+-- Now check they've applied on the master
+select * from test.t1 order by a;
+a	b
+1	Beach house
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+--------------------------------------------
+Test 2 : Normal Insert from Secondary Master
+--------------------------------------------
+-- Insert a new row on the Slave
+insert into test.t1 values (2, "Forrest");
+-- Check it exists on the Master
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Forrest
+-- Update from the slave
+update test.t1 set b="Reds" where a=2;
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Reds
+delete from test.t1 where a=2;
+select * from test.t1 order by a;
+a	b
+1	Beach house
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+-------------------------------
+Test 3 : Insert-Insert conflict
+-------------------------------
+stop slave;
+-- Insert a row on the Primary Master
+insert into test.t1 values (2, "Loopy Lornas");
+-- Insert a row on the secondary Master
+insert into test.t1 values (2, "Cloisters");
+-- Examine data on Primary Master (should be unaffected)
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Loopy Lornas
+-- Examine conflict indicators on Primary Master
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+1
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	2	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+-- Examine data on isolated secondary Master (should be as-set)
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Cloisters
+-- Restart secondary Masters slave
+start slave;
+-- Reexamine secondary Master's data (should be same as Primary Masters)
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Loopy Lornas
+-------------------------------
+Test 4 : Update-Update conflict
+-------------------------------
+-- Stop replication to secondary master
+stop slave;
+-- Update row on Primary Master
+update test.t1 set b="Peters Yard" where a=2;
+-- Show data on Primary Master
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Peters Yard
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+1
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	2	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+-- Update row on Secondary Master
+update test.t1 set b="Toast" where a=2;
+-- Examine data on Primary Master - should be unaffected
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Peters Yard
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+2
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+1	3	#	2	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+-- Check data on secondary - should be as set
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Toast
+-- Now restart slave, will re-align row
+start slave;
+-- Check that Secondary is re-aligned
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Peters Yard
+-------------------------------
+Test 5 : Update-Delete conflict
+-------------------------------
+-- Stop Secondary slave
+stop slave;
+-- Update on Primary Master
+update test.t1 set b="Pear tree" where a = 2;
+-- Delete on Secondary Master
+delete from test.t1 where a = 2;
+-- Examine data on Primary Master, should be unaffected
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Pear tree
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+3
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+1	3	#	2	#	#
+1	3	#	3	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+-- Examine data on Secondary Master before slave restart, still missing
+select * from test.t1 order by a;
+a	b
+1	Beach house
+-- Restart Secondary Master slave
+start slave;
+-- Examine data on Secondary Master after slave restart, aligned with Master
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Pear tree
+-------------------------------
+Test 6 : Delete-Update conflict
+-------------------------------
+-- Stop Secondary slave
+stop slave;
+-- Delete on Primary Master
+delete from test.t1 where a=2;
+-- Update on Secondary Master
+update test.t1 set b="Black pig" where a=2;
+-- Examine data on Primary Master, should be unaffected (no row)
+select * from test.t1 order by a;
+a	b
+1	Beach house
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+4
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+1	3	#	2	#	#
+1	3	#	3	#	#
+1	3	#	4	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+-- Examine data on Secondary Master before slave restart, should be as inserted
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Black pig
+-- Restart Secondary Master slave
+start slave;
+-- Examine data on Secondary Master after slave restart, aligned with Master (deleted)
+select * from test.t1 order by a;
+a	b
+1	Beach house
+-------------------------------
+Test 7 : Delete-Delete conflict
+-------------------------------
+-- Stop Secondary slave
+stop slave;
+-- Delete on Primary Master
+delete from test.t1 where a=1;
+-- Delete on Secondary Master
+delete from test.t1 where a=1;
+-- Examine data on Primary Master, no row
+select * from test.t1 order by a;
+a	b
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+5
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+1	3	#	2	#	#
+1	3	#	3	#	#
+1	3	#	4	#	#
+1	3	#	5	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	1	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+-- Examine data on Secondary Master before slave restart, no row
+select * from test.t1 order by a;
+a	b
+-- Restart Secondary Master slave
+start slave;
+-- Examine data on Secondary Master after slave restart, no row
+select * from test.t1 order by a;
+a	b
+------------------------------------------------
+Test 8 : Delete-Delete, Insert conflict exposure
+------------------------------------------------
+-- Insert a row on Secondary Master
+insert into test.t1 values (3, "Espy");
+-- Check it's present on Primary Master
+select * from test.t1 order by a;
+a	b
+3	Espy
+-- Stop replication in both directions
+stop slave;
+stop slave;
+-- Delete row from both clusters
+delete from test.t1 where a=3;
+delete from test.t1 where a=3;
+-- Follow up with Insert from Secondary master
+insert into test.t1 values (3, "Dalriada");
+-- Restart replication in both directions
+start slave;
+start slave;
+-- Check data on both sites - diverged
+-- Secondary master :
+select * from test.t1 order by a;
+a	b
+-- Primary master :
+select * from test.t1 order by a;
+a	b
+3	Dalriada
+--Remove extra row
+delete from test.t1 where a=3;
+-- Note that Delete-Delete conflict detected below
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+6
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+1	3	#	2	#	#
+1	3	#	3	#	#
+1	3	#	4	#	#
+1	3	#	5	#	#
+1	3	#	6	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	1	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	3	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+------------------------------------------------
+Test 9 : Insert, Insert-Update-Delete conflict
+------------------------------------------------
+-- Stop replication on Secondary Master
+stop slave;
+-- Insert row on Primary Master
+insert into test.t1 values (4, "Haymarket");
+-- Insert row on Secondary Master
+insert into test.t1 values (4, "Outhouse");
+-- Update row on Secondary Master
+update test.t1 set b="Mathers" where a = 4;
+-- Delete row on Secondary Master
+delete from test.t1 where a=4;
+-- Examine data (none) on Secondary Master
+select * from test.t1 order by a;
+a	b
+-- Examine data on Primary Master, should be unaffected
+select * from test.t1 order by a;
+a	b
+4	Haymarket
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+9
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+1	3	#	2	#	#
+1	3	#	3	#	#
+1	3	#	4	#	#
+1	3	#	5	#	#
+1	3	#	6	#	#
+1	3	#	7	#	#
+1	3	#	8	#	#
+1	3	#	9	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	1	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	3	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+-- Examine data on Secondary Master (none)
+select * from test.t1 order by a;
+a	b
+-- Restart Secondary Master's slave
+start slave;
+-- Check data on Secondary Master, should be same as Primary Master
+select * from test.t1;
+a	b
+4	Haymarket
+------------------------------------------------
+Test 10 : Update, Delete-Insert-Update conflict
+------------------------------------------------
+-- Stop replication on Secondary Master
+stop slave;
+-- Update row on Primary Master
+update test.t1 set b="Blind poet" where a=4;
+-- Delete row on Secondary Master
+delete from test.t1 where a=4;
+-- Insert row on Secondary Master
+insert into test.t1 values (4, "Drouthy Neebors");
+-- Update row on Secondary Master
+update test.t1 set b="The Tankard" where a=4;
+-- Check data on Primary Master, should be unaffected
+select * from test.t1 order by a;
+a	b
+4	Blind poet
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+12
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+1	3	#	2	#	#
+1	3	#	3	#	#
+1	3	#	4	#	#
+1	3	#	5	#	#
+1	3	#	6	#	#
+1	3	#	7	#	#
+1	3	#	8	#	#
+1	3	#	9	#	#
+1	3	#	10	#	#
+1	3	#	11	#	#
+1	3	#	12	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	1	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	3	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+-- Check data on Secondary Master, as set
+select * from test.t1 order by a;
+a	b
+4	The Tankard
+-- Restart Secondary Master slave
+start slave;
+-- Check data on Secondary Master - should be as Primary
+select * from test.t1 order by a;
+a	b
+4	Blind poet
+------------------------------------------------------------------------
+Test 11 : Test Secondary insert-update-delete accepted
+------------------------------------------------------------------------
+Insert row on Secondary
+insert into test.t1 values (5, "Minders");
+Update row on Secondary
+update test.t1 set b="Southsider" where a=5;
+Delete row on Secondary
+delete from test.t1 where a=5;
+Check data on Primary, should be none.  No new conflicts
+select * from test.t1 order by a;
+a	b
+4	Blind poet
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+12
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+1	3	#	2	#	#
+1	3	#	3	#	#
+1	3	#	4	#	#
+1	3	#	5	#	#
+1	3	#	6	#	#
+1	3	#	7	#	#
+1	3	#	8	#	#
+1	3	#	9	#	#
+1	3	#	10	#	#
+1	3	#	11	#	#
+1	3	#	12	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	1	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	3	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+12
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+1	3	#	2	#	#
+1	3	#	3	#	#
+1	3	#	4	#	#
+1	3	#	5	#	#
+1	3	#	6	#	#
+1	3	#	7	#	#
+1	3	#	8	#	#
+1	3	#	9	#	#
+1	3	#	10	#	#
+1	3	#	11	#	#
+1	3	#	12	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	1	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	3	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+drop table test.t1;
+drop table test.t2;
+drop table test.t1$EX;
+Populate ndb_replication table as necessary
+-- 1 extra gci bits
+replace into mysql.ndb_replication values
+("test", "t1", 3, 7, NULL),
+("test", "t1", 1, 7, "NDB$EPOCH(1)");
+create table `test`.`t1$EX`
+  (server_id int unsigned,
+master_server_id int unsigned,
+master_epoch bigint unsigned,
+count int unsigned,
+a int not null,
+d int,
+primary key(server_id, master_server_id, master_epoch, count)) engine ndb;
+Create table
+create table test.t1(a int primary key, b varchar(255)) engine = ndb;
+Create other table
+create table test.t2(a int primary key, b int) engine = ndb;
+----------------------------------
+Test 1 : Basic two-way replication
+----------------------------------
+insert into test.t1 values (1, "Metropole");
+-- Give time for a new epoch on the Master
+-- Insert something to ensure the new epoch is noticed
+replace into test.t2 values (2, 1);
+-- Flushed to slave
+select * from test.t1 order by a;
+a	b
+1	Metropole
+-- Flushed back to Master
+select * from test.t1 order by a;
+a	b
+1	Metropole
+-- Now update data on slave
+update test.t1 set b="Favorit" where a=1;
+-- Now check data on master
+select * from test.t1 order by a;
+a	b
+1	Favorit
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+-- Now perform multiple consecutive updates on the slave
+update test.t1 set b="Elephant house" where a=1;
+update test.t1 set b="Beach house" where a=1;
+select * from test.t1 order by a;
+a	b
+1	Beach house
+-- Now check they've applied on the master
+select * from test.t1 order by a;
+a	b
+1	Beach house
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+--------------------------------------------
+Test 2 : Normal Insert from Secondary Master
+--------------------------------------------
+-- Insert a new row on the Slave
+insert into test.t1 values (2, "Forrest");
+-- Check it exists on the Master
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Forrest
+-- Update from the slave
+update test.t1 set b="Reds" where a=2;
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Reds
+delete from test.t1 where a=2;
+select * from test.t1 order by a;
+a	b
+1	Beach house
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+-------------------------------
+Test 3 : Insert-Insert conflict
+-------------------------------
+stop slave;
+-- Insert a row on the Primary Master
+insert into test.t1 values (2, "Loopy Lornas");
+-- Insert a row on the secondary Master
+insert into test.t1 values (2, "Cloisters");
+-- Examine data on Primary Master (should be unaffected)
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Loopy Lornas
+-- Examine conflict indicators on Primary Master
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+1
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	2	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+-- Examine data on isolated secondary Master (should be as-set)
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Cloisters
+-- Restart secondary Masters slave
+start slave;
+-- Reexamine secondary Master's data (should be same as Primary Masters)
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Loopy Lornas
+-------------------------------
+Test 4 : Update-Update conflict
+-------------------------------
+-- Stop replication to secondary master
+stop slave;
+-- Update row on Primary Master
+update test.t1 set b="Peters Yard" where a=2;
+-- Show data on Primary Master
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Peters Yard
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+1
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	2	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+-- Update row on Secondary Master
+update test.t1 set b="Toast" where a=2;
+-- Examine data on Primary Master - should be unaffected
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Peters Yard
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+2
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+1	3	#	2	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+-- Check data on secondary - should be as set
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Toast
+-- Now restart slave, will re-align row
+start slave;
+-- Check that Secondary is re-aligned
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Peters Yard
+-------------------------------
+Test 5 : Update-Delete conflict
+-------------------------------
+-- Stop Secondary slave
+stop slave;
+-- Update on Primary Master
+update test.t1 set b="Pear tree" where a = 2;
+-- Delete on Secondary Master
+delete from test.t1 where a = 2;
+-- Examine data on Primary Master, should be unaffected
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Pear tree
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+3
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+1	3	#	2	#	#
+1	3	#	3	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+-- Examine data on Secondary Master before slave restart, still missing
+select * from test.t1 order by a;
+a	b
+1	Beach house
+-- Restart Secondary Master slave
+start slave;
+-- Examine data on Secondary Master after slave restart, aligned with Master
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Pear tree
+-------------------------------
+Test 6 : Delete-Update conflict
+-------------------------------
+-- Stop Secondary slave
+stop slave;
+-- Delete on Primary Master
+delete from test.t1 where a=2;
+-- Update on Secondary Master
+update test.t1 set b="Black pig" where a=2;
+-- Examine data on Primary Master, should be unaffected (no row)
+select * from test.t1 order by a;
+a	b
+1	Beach house
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+4
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+1	3	#	2	#	#
+1	3	#	3	#	#
+1	3	#	4	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+-- Examine data on Secondary Master before slave restart, should be as inserted
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Black pig
+-- Restart Secondary Master slave
+start slave;
+-- Examine data on Secondary Master after slave restart, aligned with Master (deleted)
+select * from test.t1 order by a;
+a	b
+1	Beach house
+-------------------------------
+Test 7 : Delete-Delete conflict
+-------------------------------
+-- Stop Secondary slave
+stop slave;
+-- Delete on Primary Master
+delete from test.t1 where a=1;
+-- Delete on Secondary Master
+delete from test.t1 where a=1;
+-- Examine data on Primary Master, no row
+select * from test.t1 order by a;
+a	b
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+5
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+1	3	#	2	#	#
+1	3	#	3	#	#
+1	3	#	4	#	#
+1	3	#	5	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	1	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+-- Examine data on Secondary Master before slave restart, no row
+select * from test.t1 order by a;
+a	b
+-- Restart Secondary Master slave
+start slave;
+-- Examine data on Secondary Master after slave restart, no row
+select * from test.t1 order by a;
+a	b
+------------------------------------------------
+Test 8 : Delete-Delete, Insert conflict exposure
+------------------------------------------------
+-- Insert a row on Secondary Master
+insert into test.t1 values (3, "Espy");
+-- Check it's present on Primary Master
+select * from test.t1 order by a;
+a	b
+3	Espy
+-- Stop replication in both directions
+stop slave;
+stop slave;
+-- Delete row from both clusters
+delete from test.t1 where a=3;
+delete from test.t1 where a=3;
+-- Follow up with Insert from Secondary master
+insert into test.t1 values (3, "Dalriada");
+-- Restart replication in both directions
+start slave;
+start slave;
+-- Check data on both sites - diverged
+-- Secondary master :
+select * from test.t1 order by a;
+a	b
+-- Primary master :
+select * from test.t1 order by a;
+a	b
+3	Dalriada
+--Remove extra row
+delete from test.t1 where a=3;
+-- Note that Delete-Delete conflict detected below
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+6
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+1	3	#	2	#	#
+1	3	#	3	#	#
+1	3	#	4	#	#
+1	3	#	5	#	#
+1	3	#	6	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	1	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	3	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+------------------------------------------------
+Test 9 : Insert, Insert-Update-Delete conflict
+------------------------------------------------
+-- Stop replication on Secondary Master
+stop slave;
+-- Insert row on Primary Master
+insert into test.t1 values (4, "Haymarket");
+-- Insert row on Secondary Master
+insert into test.t1 values (4, "Outhouse");
+-- Update row on Secondary Master
+update test.t1 set b="Mathers" where a = 4;
+-- Delete row on Secondary Master
+delete from test.t1 where a=4;
+-- Examine data (none) on Secondary Master
+select * from test.t1 order by a;
+a	b
+-- Examine data on Primary Master, should be unaffected
+select * from test.t1 order by a;
+a	b
+4	Haymarket
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+9
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+1	3	#	2	#	#
+1	3	#	3	#	#
+1	3	#	4	#	#
+1	3	#	5	#	#
+1	3	#	6	#	#
+1	3	#	7	#	#
+1	3	#	8	#	#
+1	3	#	9	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	1	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	3	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+-- Examine data on Secondary Master (none)
+select * from test.t1 order by a;
+a	b
+-- Restart Secondary Master's slave
+start slave;
+-- Check data on Secondary Master, should be same as Primary Master
+select * from test.t1;
+a	b
+4	Haymarket
+------------------------------------------------
+Test 10 : Update, Delete-Insert-Update conflict
+------------------------------------------------
+-- Stop replication on Secondary Master
+stop slave;
+-- Update row on Primary Master
+update test.t1 set b="Blind poet" where a=4;
+-- Delete row on Secondary Master
+delete from test.t1 where a=4;
+-- Insert row on Secondary Master
+insert into test.t1 values (4, "Drouthy Neebors");
+-- Update row on Secondary Master
+update test.t1 set b="The Tankard" where a=4;
+-- Check data on Primary Master, should be unaffected
+select * from test.t1 order by a;
+a	b
+4	Blind poet
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+12
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+1	3	#	2	#	#
+1	3	#	3	#	#
+1	3	#	4	#	#
+1	3	#	5	#	#
+1	3	#	6	#	#
+1	3	#	7	#	#
+1	3	#	8	#	#
+1	3	#	9	#	#
+1	3	#	10	#	#
+1	3	#	11	#	#
+1	3	#	12	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	1	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	3	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+-- Check data on Secondary Master, as set
+select * from test.t1 order by a;
+a	b
+4	The Tankard
+-- Restart Secondary Master slave
+start slave;
+-- Check data on Secondary Master - should be as Primary
+select * from test.t1 order by a;
+a	b
+4	Blind poet
+------------------------------------------------------------------------
+Test 11 : Test Secondary insert-update-delete accepted
+------------------------------------------------------------------------
+Insert row on Secondary
+insert into test.t1 values (5, "Minders");
+Update row on Secondary
+update test.t1 set b="Southsider" where a=5;
+Delete row on Secondary
+delete from test.t1 where a=5;
+Check data on Primary, should be none.  No new conflicts
+select * from test.t1 order by a;
+a	b
+4	Blind poet
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+12
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+1	3	#	2	#	#
+1	3	#	3	#	#
+1	3	#	4	#	#
+1	3	#	5	#	#
+1	3	#	6	#	#
+1	3	#	7	#	#
+1	3	#	8	#	#
+1	3	#	9	#	#
+1	3	#	10	#	#
+1	3	#	11	#	#
+1	3	#	12	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	1	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	3	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+12
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+1	3	#	2	#	#
+1	3	#	3	#	#
+1	3	#	4	#	#
+1	3	#	5	#	#
+1	3	#	6	#	#
+1	3	#	7	#	#
+1	3	#	8	#	#
+1	3	#	9	#	#
+1	3	#	10	#	#
+1	3	#	11	#	#
+1	3	#	12	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	1	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	3	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+drop table test.t1;
+drop table test.t2;
+drop table test.t1$EX;
+Populate ndb_replication table as necessary
+-- 31 extra gci bits
+replace into mysql.ndb_replication values
+("test", "t1", 3, 7, NULL),
+("test", "t1", 1, 7, "NDB$EPOCH(31)");
+create table `test`.`t1$EX`
+  (server_id int unsigned,
+master_server_id int unsigned,
+master_epoch bigint unsigned,
+count int unsigned,
+a int not null,
+d int,
+primary key(server_id, master_server_id, master_epoch, count)) engine ndb;
+Create table
+create table test.t1(a int primary key, b varchar(255)) engine = ndb;
+Create other table
+create table test.t2(a int primary key, b int) engine = ndb;
+----------------------------------
+Test 1 : Basic two-way replication
+----------------------------------
+insert into test.t1 values (1, "Metropole");
+-- Give time for a new epoch on the Master
+-- Insert something to ensure the new epoch is noticed
+replace into test.t2 values (2, 1);
+-- Flushed to slave
+select * from test.t1 order by a;
+a	b
+1	Metropole
+-- Flushed back to Master
+select * from test.t1 order by a;
+a	b
+1	Metropole
+-- Now update data on slave
+update test.t1 set b="Favorit" where a=1;
+-- Now check data on master
+select * from test.t1 order by a;
+a	b
+1	Favorit
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+-- Now perform multiple consecutive updates on the slave
+update test.t1 set b="Elephant house" where a=1;
+update test.t1 set b="Beach house" where a=1;
+select * from test.t1 order by a;
+a	b
+1	Beach house
+-- Now check they've applied on the master
+select * from test.t1 order by a;
+a	b
+1	Beach house
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+--------------------------------------------
+Test 2 : Normal Insert from Secondary Master
+--------------------------------------------
+-- Insert a new row on the Slave
+insert into test.t1 values (2, "Forrest");
+-- Check it exists on the Master
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Forrest
+-- Update from the slave
+update test.t1 set b="Reds" where a=2;
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Reds
+delete from test.t1 where a=2;
+select * from test.t1 order by a;
+a	b
+1	Beach house
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+-------------------------------
+Test 3 : Insert-Insert conflict
+-------------------------------
+stop slave;
+-- Insert a row on the Primary Master
+insert into test.t1 values (2, "Loopy Lornas");
+-- Insert a row on the secondary Master
+insert into test.t1 values (2, "Cloisters");
+-- Examine data on Primary Master (should be unaffected)
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Loopy Lornas
+-- Examine conflict indicators on Primary Master
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+1
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	2	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+-- Examine data on isolated secondary Master (should be as-set)
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Cloisters
+-- Restart secondary Masters slave
+start slave;
+-- Reexamine secondary Master's data (should be same as Primary Masters)
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Loopy Lornas
+-------------------------------
+Test 4 : Update-Update conflict
+-------------------------------
+-- Stop replication to secondary master
+stop slave;
+-- Update row on Primary Master
+update test.t1 set b="Peters Yard" where a=2;
+-- Show data on Primary Master
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Peters Yard
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+1
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	2	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+-- Update row on Secondary Master
+update test.t1 set b="Toast" where a=2;
+-- Examine data on Primary Master - should be unaffected
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Peters Yard
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+2
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+1	3	#	2	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+-- Check data on secondary - should be as set
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Toast
+-- Now restart slave, will re-align row
+start slave;
+-- Check that Secondary is re-aligned
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Peters Yard
+-------------------------------
+Test 5 : Update-Delete conflict
+-------------------------------
+-- Stop Secondary slave
+stop slave;
+-- Update on Primary Master
+update test.t1 set b="Pear tree" where a = 2;
+-- Delete on Secondary Master
+delete from test.t1 where a = 2;
+-- Examine data on Primary Master, should be unaffected
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Pear tree
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+3
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+1	3	#	2	#	#
+1	3	#	3	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+-- Examine data on Secondary Master before slave restart, still missing
+select * from test.t1 order by a;
+a	b
+1	Beach house
+-- Restart Secondary Master slave
+start slave;
+-- Examine data on Secondary Master after slave restart, aligned with Master
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Pear tree
+-------------------------------
+Test 6 : Delete-Update conflict
+-------------------------------
+-- Stop Secondary slave
+stop slave;
+-- Delete on Primary Master
+delete from test.t1 where a=2;
+-- Update on Secondary Master
+update test.t1 set b="Black pig" where a=2;
+-- Examine data on Primary Master, should be unaffected (no row)
+select * from test.t1 order by a;
+a	b
+1	Beach house
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+4
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+1	3	#	2	#	#
+1	3	#	3	#	#
+1	3	#	4	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+-- Examine data on Secondary Master before slave restart, should be as inserted
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Black pig
+-- Restart Secondary Master slave
+start slave;
+-- Examine data on Secondary Master after slave restart, aligned with Master (deleted)
+select * from test.t1 order by a;
+a	b
+1	Beach house
+-------------------------------
+Test 7 : Delete-Delete conflict
+-------------------------------
+-- Stop Secondary slave
+stop slave;
+-- Delete on Primary Master
+delete from test.t1 where a=1;
+-- Delete on Secondary Master
+delete from test.t1 where a=1;
+-- Examine data on Primary Master, no row
+select * from test.t1 order by a;
+a	b
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+5
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+1	3	#	2	#	#
+1	3	#	3	#	#
+1	3	#	4	#	#
+1	3	#	5	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	1	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+-- Examine data on Secondary Master before slave restart, no row
+select * from test.t1 order by a;
+a	b
+-- Restart Secondary Master slave
+start slave;
+-- Examine data on Secondary Master after slave restart, no row
+select * from test.t1 order by a;
+a	b
+------------------------------------------------
+Test 8 : Delete-Delete, Insert conflict exposure
+------------------------------------------------
+-- Insert a row on Secondary Master
+insert into test.t1 values (3, "Espy");
+-- Check it's present on Primary Master
+select * from test.t1 order by a;
+a	b
+3	Espy
+-- Stop replication in both directions
+stop slave;
+stop slave;
+-- Delete row from both clusters
+delete from test.t1 where a=3;
+delete from test.t1 where a=3;
+-- Follow up with Insert from Secondary master
+insert into test.t1 values (3, "Dalriada");
+-- Restart replication in both directions
+start slave;
+start slave;
+-- Check data on both sites - diverged
+-- Secondary master :
+select * from test.t1 order by a;
+a	b
+-- Primary master :
+select * from test.t1 order by a;
+a	b
+3	Dalriada
+--Remove extra row
+delete from test.t1 where a=3;
+-- Note that Delete-Delete conflict detected below
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+6
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+1	3	#	2	#	#
+1	3	#	3	#	#
+1	3	#	4	#	#
+1	3	#	5	#	#
+1	3	#	6	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	1	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	3	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+------------------------------------------------
+Test 9 : Insert, Insert-Update-Delete conflict
+------------------------------------------------
+-- Stop replication on Secondary Master
+stop slave;
+-- Insert row on Primary Master
+insert into test.t1 values (4, "Haymarket");
+-- Insert row on Secondary Master
+insert into test.t1 values (4, "Outhouse");
+-- Update row on Secondary Master
+update test.t1 set b="Mathers" where a = 4;
+-- Delete row on Secondary Master
+delete from test.t1 where a=4;
+-- Examine data (none) on Secondary Master
+select * from test.t1 order by a;
+a	b
+-- Examine data on Primary Master, should be unaffected
+select * from test.t1 order by a;
+a	b
+4	Haymarket
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+9
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+1	3	#	2	#	#
+1	3	#	3	#	#
+1	3	#	4	#	#
+1	3	#	5	#	#
+1	3	#	6	#	#
+1	3	#	7	#	#
+1	3	#	8	#	#
+1	3	#	9	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	1	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	3	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+-- Examine data on Secondary Master (none)
+select * from test.t1 order by a;
+a	b
+-- Restart Secondary Master's slave
+start slave;
+-- Check data on Secondary Master, should be same as Primary Master
+select * from test.t1;
+a	b
+4	Haymarket
+------------------------------------------------
+Test 10 : Update, Delete-Insert-Update conflict
+------------------------------------------------
+-- Stop replication on Secondary Master
+stop slave;
+-- Update row on Primary Master
+update test.t1 set b="Blind poet" where a=4;
+-- Delete row on Secondary Master
+delete from test.t1 where a=4;
+-- Insert row on Secondary Master
+insert into test.t1 values (4, "Drouthy Neebors");
+-- Update row on Secondary Master
+update test.t1 set b="The Tankard" where a=4;
+-- Check data on Primary Master, should be unaffected
+select * from test.t1 order by a;
+a	b
+4	Blind poet
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+12
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+1	3	#	2	#	#
+1	3	#	3	#	#
+1	3	#	4	#	#
+1	3	#	5	#	#
+1	3	#	6	#	#
+1	3	#	7	#	#
+1	3	#	8	#	#
+1	3	#	9	#	#
+1	3	#	10	#	#
+1	3	#	11	#	#
+1	3	#	12	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	1	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	3	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+-- Check data on Secondary Master, as set
+select * from test.t1 order by a;
+a	b
+4	The Tankard
+-- Restart Secondary Master slave
+start slave;
+-- Check data on Secondary Master - should be as Primary
+select * from test.t1 order by a;
+a	b
+4	Blind poet
+------------------------------------------------------------------------
+Test 11 : Test Secondary insert-update-delete accepted
+------------------------------------------------------------------------
+Insert row on Secondary
+insert into test.t1 values (5, "Minders");
+Update row on Secondary
+update test.t1 set b="Southsider" where a=5;
+Delete row on Secondary
+delete from test.t1 where a=5;
+Check data on Primary, should be none.  No new conflicts
+select * from test.t1 order by a;
+a	b
+4	Blind poet
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+12
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+1	3	#	2	#	#
+1	3	#	3	#	#
+1	3	#	4	#	#
+1	3	#	5	#	#
+1	3	#	6	#	#
+1	3	#	7	#	#
+1	3	#	8	#	#
+1	3	#	9	#	#
+1	3	#	10	#	#
+1	3	#	11	#	#
+1	3	#	12	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	1	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	3	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+12
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+1	3	#	2	#	#
+1	3	#	3	#	#
+1	3	#	4	#	#
+1	3	#	5	#	#
+1	3	#	6	#	#
+1	3	#	7	#	#
+1	3	#	8	#	#
+1	3	#	9	#	#
+1	3	#	10	#	#
+1	3	#	11	#	#
+1	3	#	12	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	1	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	3	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+drop table test.t1;
+drop table test.t2;
+drop table test.t1$EX;
+Populate ndb_replication table as necessary
+-- Default extra Gci bits
+replace into mysql.ndb_replication values
+("test", "t1", 3, 7, NULL),
+("test", "t1", 1, 7, "NDB$EPOCH()");
+create table `test`.`t1$EX`
+  (server_id int unsigned,
+master_server_id int unsigned,
+master_epoch bigint unsigned,
+count int unsigned,
+a int not null,
+d int,
+primary key(server_id, master_server_id, master_epoch, count)) engine ndb;
+Create table
+create table test.t1(a int primary key, b varchar(255)) engine = ndb;
+Create other table
+create table test.t2(a int primary key, b int) engine = ndb;
+----------------------------------
+Test 1 : Basic two-way replication
+----------------------------------
+insert into test.t1 values (1, "Metropole");
+-- Give time for a new epoch on the Master
+-- Insert something to ensure the new epoch is noticed
+replace into test.t2 values (2, 1);
+-- Flushed to slave
+select * from test.t1 order by a;
+a	b
+1	Metropole
+-- Flushed back to Master
+select * from test.t1 order by a;
+a	b
+1	Metropole
+-- Now update data on slave
+update test.t1 set b="Favorit" where a=1;
+-- Now check data on master
+select * from test.t1 order by a;
+a	b
+1	Favorit
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+-- Now perform multiple consecutive updates on the slave
+update test.t1 set b="Elephant house" where a=1;
+update test.t1 set b="Beach house" where a=1;
+select * from test.t1 order by a;
+a	b
+1	Beach house
+-- Now check they've applied on the master
+select * from test.t1 order by a;
+a	b
+1	Beach house
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+--------------------------------------------
+Test 2 : Normal Insert from Secondary Master
+--------------------------------------------
+-- Insert a new row on the Slave
+insert into test.t1 values (2, "Forrest");
+-- Check it exists on the Master
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Forrest
+-- Update from the slave
+update test.t1 set b="Reds" where a=2;
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Reds
+delete from test.t1 where a=2;
+select * from test.t1 order by a;
+a	b
+1	Beach house
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+-------------------------------
+Test 3 : Insert-Insert conflict
+-------------------------------
+stop slave;
+-- Insert a row on the Primary Master
+insert into test.t1 values (2, "Loopy Lornas");
+-- Insert a row on the secondary Master
+insert into test.t1 values (2, "Cloisters");
+-- Examine data on Primary Master (should be unaffected)
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Loopy Lornas
+-- Examine conflict indicators on Primary Master
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+1
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	2	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+-- Examine data on isolated secondary Master (should be as-set)
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Cloisters
+-- Restart secondary Masters slave
+start slave;
+-- Reexamine secondary Master's data (should be same as Primary Masters)
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Loopy Lornas
+-------------------------------
+Test 4 : Update-Update conflict
+-------------------------------
+-- Stop replication to secondary master
+stop slave;
+-- Update row on Primary Master
+update test.t1 set b="Peters Yard" where a=2;
+-- Show data on Primary Master
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Peters Yard
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+1
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	2	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+-- Update row on Secondary Master
+update test.t1 set b="Toast" where a=2;
+-- Examine data on Primary Master - should be unaffected
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Peters Yard
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+2
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+1	3	#	2	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+-- Check data on secondary - should be as set
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Toast
+-- Now restart slave, will re-align row
+start slave;
+-- Check that Secondary is re-aligned
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Peters Yard
+-------------------------------
+Test 5 : Update-Delete conflict
+-------------------------------
+-- Stop Secondary slave
+stop slave;
+-- Update on Primary Master
+update test.t1 set b="Pear tree" where a = 2;
+-- Delete on Secondary Master
+delete from test.t1 where a = 2;
+-- Examine data on Primary Master, should be unaffected
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Pear tree
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+3
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+1	3	#	2	#	#
+1	3	#	3	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+-- Examine data on Secondary Master before slave restart, still missing
+select * from test.t1 order by a;
+a	b
+1	Beach house
+-- Restart Secondary Master slave
+start slave;
+-- Examine data on Secondary Master after slave restart, aligned with Master
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Pear tree
+-------------------------------
+Test 6 : Delete-Update conflict
+-------------------------------
+-- Stop Secondary slave
+stop slave;
+-- Delete on Primary Master
+delete from test.t1 where a=2;
+-- Update on Secondary Master
+update test.t1 set b="Black pig" where a=2;
+-- Examine data on Primary Master, should be unaffected (no row)
+select * from test.t1 order by a;
+a	b
+1	Beach house
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+4
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+1	3	#	2	#	#
+1	3	#	3	#	#
+1	3	#	4	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+-- Examine data on Secondary Master before slave restart, should be as inserted
+select * from test.t1 order by a;
+a	b
+1	Beach house
+2	Black pig
+-- Restart Secondary Master slave
+start slave;
+-- Examine data on Secondary Master after slave restart, aligned with Master (deleted)
+select * from test.t1 order by a;
+a	b
+1	Beach house
+-------------------------------
+Test 7 : Delete-Delete conflict
+-------------------------------
+-- Stop Secondary slave
+stop slave;
+-- Delete on Primary Master
+delete from test.t1 where a=1;
+-- Delete on Secondary Master
+delete from test.t1 where a=1;
+-- Examine data on Primary Master, no row
+select * from test.t1 order by a;
+a	b
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+5
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+1	3	#	2	#	#
+1	3	#	3	#	#
+1	3	#	4	#	#
+1	3	#	5	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	1	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+-- Examine data on Secondary Master before slave restart, no row
+select * from test.t1 order by a;
+a	b
+-- Restart Secondary Master slave
+start slave;
+-- Examine data on Secondary Master after slave restart, no row
+select * from test.t1 order by a;
+a	b
+------------------------------------------------
+Test 8 : Delete-Delete, Insert conflict exposure
+------------------------------------------------
+-- Insert a row on Secondary Master
+insert into test.t1 values (3, "Espy");
+-- Check it's present on Primary Master
+select * from test.t1 order by a;
+a	b
+3	Espy
+-- Stop replication in both directions
+stop slave;
+stop slave;
+-- Delete row from both clusters
+delete from test.t1 where a=3;
+delete from test.t1 where a=3;
+-- Follow up with Insert from Secondary master
+insert into test.t1 values (3, "Dalriada");
+-- Restart replication in both directions
+start slave;
+start slave;
+-- Check data on both sites - diverged
+-- Secondary master :
+select * from test.t1 order by a;
+a	b
+-- Primary master :
+select * from test.t1 order by a;
+a	b
+3	Dalriada
+--Remove extra row
+delete from test.t1 where a=3;
+-- Note that Delete-Delete conflict detected below
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+6
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+1	3	#	2	#	#
+1	3	#	3	#	#
+1	3	#	4	#	#
+1	3	#	5	#	#
+1	3	#	6	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	1	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	3	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+------------------------------------------------
+Test 9 : Insert, Insert-Update-Delete conflict
+------------------------------------------------
+-- Stop replication on Secondary Master
+stop slave;
+-- Insert row on Primary Master
+insert into test.t1 values (4, "Haymarket");
+-- Insert row on Secondary Master
+insert into test.t1 values (4, "Outhouse");
+-- Update row on Secondary Master
+update test.t1 set b="Mathers" where a = 4;
+-- Delete row on Secondary Master
+delete from test.t1 where a=4;
+-- Examine data (none) on Secondary Master
+select * from test.t1 order by a;
+a	b
+-- Examine data on Primary Master, should be unaffected
+select * from test.t1 order by a;
+a	b
+4	Haymarket
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+9
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+1	3	#	2	#	#
+1	3	#	3	#	#
+1	3	#	4	#	#
+1	3	#	5	#	#
+1	3	#	6	#	#
+1	3	#	7	#	#
+1	3	#	8	#	#
+1	3	#	9	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	1	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	3	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+-- Examine data on Secondary Master (none)
+select * from test.t1 order by a;
+a	b
+-- Restart Secondary Master's slave
+start slave;
+-- Check data on Secondary Master, should be same as Primary Master
+select * from test.t1;
+a	b
+4	Haymarket
+------------------------------------------------
+Test 10 : Update, Delete-Insert-Update conflict
+------------------------------------------------
+-- Stop replication on Secondary Master
+stop slave;
+-- Update row on Primary Master
+update test.t1 set b="Blind poet" where a=4;
+-- Delete row on Secondary Master
+delete from test.t1 where a=4;
+-- Insert row on Secondary Master
+insert into test.t1 values (4, "Drouthy Neebors");
+-- Update row on Secondary Master
+update test.t1 set b="The Tankard" where a=4;
+-- Check data on Primary Master, should be unaffected
+select * from test.t1 order by a;
+a	b
+4	Blind poet
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+12
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+1	3	#	2	#	#
+1	3	#	3	#	#
+1	3	#	4	#	#
+1	3	#	5	#	#
+1	3	#	6	#	#
+1	3	#	7	#	#
+1	3	#	8	#	#
+1	3	#	9	#	#
+1	3	#	10	#	#
+1	3	#	11	#	#
+1	3	#	12	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	1	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	3	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+-- Check data on Secondary Master, as set
+select * from test.t1 order by a;
+a	b
+4	The Tankard
+-- Restart Secondary Master slave
+start slave;
+-- Check data on Secondary Master - should be as Primary
+select * from test.t1 order by a;
+a	b
+4	Blind poet
+------------------------------------------------------------------------
+Test 11 : Test Secondary insert-update-delete accepted
+------------------------------------------------------------------------
+Insert row on Secondary
+insert into test.t1 values (5, "Minders");
+Update row on Secondary
+update test.t1 set b="Southsider" where a=5;
+Delete row on Secondary
+delete from test.t1 where a=5;
+Check data on Primary, should be none.  No new conflicts
+select * from test.t1 order by a;
+a	b
+4	Blind poet
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+12
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+1	3	#	2	#	#
+1	3	#	3	#	#
+1	3	#	4	#	#
+1	3	#	5	#	#
+1	3	#	6	#	#
+1	3	#	7	#	#
+1	3	#	8	#	#
+1	3	#	9	#	#
+1	3	#	10	#	#
+1	3	#	11	#	#
+1	3	#	12	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	1	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	3	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+12
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	1	#	#
+1	3	#	2	#	#
+1	3	#	3	#	#
+1	3	#	4	#	#
+1	3	#	5	#	#
+1	3	#	6	#	#
+1	3	#	7	#	#
+1	3	#	8	#	#
+1	3	#	9	#	#
+1	3	#	10	#	#
+1	3	#	11	#	#
+1	3	#	12	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+1	3	#	#	1	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	2	NULL
+1	3	#	#	3	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+1	3	#	#	4	NULL
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+drop table test.t1;
+drop table test.t2;
+drop table test.t1$EX;
+Now test batched conflict detection/handling
+create table test.t1 (
+a int primary key,
+b int,
+c varchar(2000)) engine=ndb;
+-- Stop replication from Primary -> Secondary
+stop slave;
+-- Insert a row on Primary
+insert into test.t1 values (1,1,repeat('B', 2000));
+-- Generate a large batch of inserts with early + late conflicts
+create procedure test.doit (rows int)
+begin
+set @x = 0;
+START TRANSACTION;
+repeat
+insert into test.t1 values (@x, @x, repeat('B', 2000));
+set @x = @x + 1;
+until @x = rows
+end repeat;
+COMMIT;
+START TRANSACTION;
+update test.t1 set b=999, c=repeat('E',2000) where a=1;
+COMMIT;
+START TRANSACTION;
+delete from test.t1 where a=1;
+COMMIT;
+START TRANSACTION;
+insert into test.t1 values (1,1,'A');
+COMMIT;
+end%
+call test.doit(100);
+drop procedure test.doit;
+-- Look at Primary status, expect 4 conflicts
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+4
+SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t1$EX` ORDER BY a, d;
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
+start slave;
+-- Look at Seconday row
+select a,b,sha1(c) from test.t1 where a=1;
+a	b	sha1(c)
+1	1	6d41e1d402596dff36396d1f0f288d17a4b9800a
+-- Check it's the same on the Secondary
+select a,b,sha1(c) from test.t1 where a=1;
+a	b	sha1(c)
+1	1	6d41e1d402596dff36396d1f0f288d17a4b9800a
+Test batching of DELETE vs DELETE with following INSERT
+delete from test.t1;
+insert into test.t1 values (1, 1, "Ma Brows");
+-- Stop Slave in both directions
+stop slave;
+stop slave;
+-- Delete row on Primary Cluster
+delete from test.t1 where a=1;
+-- Delete row on Secondary Cluster, followed by Insert in later 'batch'
+create procedure test.doit (rows int)
+begin
+set @x = 2;
+START TRANSACTION;
+delete from test.t1 where a=1;
+repeat
+insert into test.t1 values (@x, @x, repeat('B', 2000));
+set @x = @x + 1;
+until @x = (rows + 2)
+end repeat;
+COMMIT;
+START TRANSACTION;
+insert into test.t1 values (1, 1, 'Malleny arms');
+COMMIT;
+end%
+call test.doit(200);
+-- Restart slave on Primary Cluster
+start slave;
+-- Show data on Primary Cluster (should have row inserted on Secondary)
+select * from test.t1 where a=1;
+a	b	c
+1	1	Malleny arms
+-- Show data on Secondary Cluster (should have row inserted on Secondary)
+select * from test.t1 where a=1;
+a	b	c
+1	1	Malleny arms
+--Restart slave on Secondary Cluster
+start slave;
+-- Show data on Secondary Cluster (should now be missing)
+Clusters are diverged as expected with delete vs delete conflict
+followed closely by Insert
+select * from test.t1 where a=1;
+a	b	c
+-- Force wait for master to be in-sync with slave
+To avoid race between DML and table drop
+flush logs;
+drop procedure test.doit;
+drop table test.t1;
+delete from mysql.ndb_replication;
+insert into mysql.ndb_replication values
+("test", "t3", 0, 7, "NDB\$EPOCH(32)"),
+("test", "t4", 0, 7, "NDB\$EPOCH(-1)");
+create table test.t3 (a int primary key) engine=ndb;
+ERROR HY000: Can't create table 'test.t3' (errno: 1627)
+show warnings;
+Level	Code	Message
+Error	1627	Error in parsing conflict function. Message: NDB$EPOCH(32), Too many extra Gci bits at ')'
+Error	1005	Can't create table 'test.t3' (errno: 1627)
+create table test.t4 (a int primary key) engine=ndb;
+ERROR HY000: Can't create table 'test.t4' (errno: 1627)
+show warnings;
+Level	Code	Message
+Error	1627	Error in parsing conflict function. Message: NDB$EPOCH(-1), Too many extra Gci bits at ')'
+Error	1005	Can't create table 'test.t4' (errno: 1627)
+-- Force sync before dropping table to avoid race
+flush logs;
+flush logs;
+drop table mysql.ndb_replication;
+-- Attempt to get system back in pre-test state
+stop slave;
+reset slave;
+change master to master_host='';
+include/rpl_end.inc

=== modified file 'mysql-test/suite/ndb_rpl/r/ndb_rpl_conflict_max.result'
--- a/mysql-test/suite/ndb_rpl/r/ndb_rpl_conflict_max.result	2011-06-16 14:34:56 +0000
+++ b/mysql-test/suite/ndb_rpl/r/ndb_rpl_conflict_max.result	2011-07-07 14:48:06 +0000
@@ -44,6 +44,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
@@ -73,6 +76,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
@@ -96,6 +102,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
@@ -126,6 +135,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
@@ -177,6 +189,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 2	1	#	1	#	#
@@ -222,6 +237,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 2	1	#	1	#	#
@@ -292,6 +310,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
@@ -321,6 +342,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
@@ -344,6 +368,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
@@ -374,6 +401,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
@@ -425,6 +455,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 2	1	#	1	#	#
@@ -470,6 +503,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 2	1	#	1	#	#
@@ -540,6 +576,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 2	1	#	1	#	#
@@ -575,6 +614,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 2	1	#	1	#	#
@@ -606,6 +648,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 2	1	#	1	#	#
@@ -644,6 +689,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
@@ -695,6 +743,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 2	1	#	5	#	#
@@ -740,6 +791,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 2	1	#	5	#	#
@@ -814,6 +868,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
@@ -843,6 +900,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
@@ -866,6 +926,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
@@ -896,6 +959,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
@@ -947,6 +1013,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 2	1	#	1	#	#
@@ -995,6 +1064,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 2	1	#	1	#	#

=== modified file 'mysql-test/suite/ndb_rpl/r/ndb_rpl_conflict_max_delete_win.result'
--- a/mysql-test/suite/ndb_rpl/r/ndb_rpl_conflict_max_delete_win.result	2011-06-16 14:34:56 +0000
+++ b/mysql-test/suite/ndb_rpl/r/ndb_rpl_conflict_max_delete_win.result	2011-07-07 14:48:06 +0000
@@ -44,6 +44,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
@@ -73,6 +76,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
@@ -96,6 +102,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
@@ -126,6 +135,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
@@ -177,6 +189,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 3
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 2	1	#	1	#	#
@@ -222,6 +237,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 3
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 2	1	#	1	#	#
@@ -292,6 +310,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
@@ -321,6 +342,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
@@ -344,6 +368,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
@@ -374,6 +401,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
@@ -425,6 +455,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 3
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 2	1	#	1	#	#
@@ -470,6 +503,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 3
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 2	1	#	1	#	#
@@ -540,6 +576,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 3
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 2	1	#	1	#	#
@@ -575,6 +614,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 4
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 2	1	#	1	#	#
@@ -606,6 +648,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 4
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 2	1	#	1	#	#
@@ -644,6 +689,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
@@ -695,6 +743,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 3
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 2	1	#	5	#	#
@@ -740,6 +791,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 6
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 2	1	#	5	#	#
@@ -814,6 +868,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
@@ -843,6 +900,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
@@ -866,6 +926,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
@@ -896,6 +959,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
@@ -947,6 +1013,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 3
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 2	1	#	1	#	#
@@ -992,6 +1061,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 3
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 2	1	#	1	#	#

=== modified file 'mysql-test/suite/ndb_rpl/r/ndb_rpl_conflict_old.result'
--- a/mysql-test/suite/ndb_rpl/r/ndb_rpl_conflict_old.result	2011-06-16 14:34:56 +0000
+++ b/mysql-test/suite/ndb_rpl/r/ndb_rpl_conflict_old.result	2011-07-07 14:48:06 +0000
@@ -44,6 +44,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
@@ -73,6 +76,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
@@ -96,6 +102,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
@@ -126,6 +135,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
@@ -177,6 +189,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 2	1	#	1	#	#
@@ -222,6 +237,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 2	1	#	1	#	#
@@ -296,6 +314,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
@@ -325,6 +346,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
@@ -348,6 +372,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
@@ -378,6 +405,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
@@ -429,6 +459,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 2	1	#	1	#	#
@@ -474,6 +507,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 2	1	#	1	#	#
@@ -548,6 +584,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 2	1	#	1	#	#
@@ -583,6 +622,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 2	1	#	1	#	#
@@ -614,6 +656,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 2	1	#	1	#	#
@@ -652,6 +697,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
@@ -703,6 +751,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 2	1	#	5	#	#
@@ -748,6 +799,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 2	1	#	5	#	#
@@ -822,6 +876,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
@@ -851,6 +908,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
@@ -874,6 +934,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
@@ -904,6 +967,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
@@ -955,6 +1021,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 2	1	#	1	#	#
@@ -1003,6 +1072,9 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_old
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win
 0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
+VARIABLE_VALUE-@init_ndb_conflict_fn_epoch
+0
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 server_id	master_server_id	master_epoch	count	a	d
 2	1	#	1	#	#

=== modified file 'mysql-test/suite/ndb_rpl/t/ndb_conflict_info.inc'
--- a/mysql-test/suite/ndb_rpl/t/ndb_conflict_info.inc	2011-06-16 14:34:56 +0000
+++ b/mysql-test/suite/ndb_rpl/t/ndb_conflict_info.inc	2011-07-07 14:48:06 +0000
@@ -1,6 +1,7 @@
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max_del_win FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_epoch FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
 --replace_column 3 # 5 # 6 #
 --error 0,1146
 SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;

=== modified file 'mysql-test/suite/ndb_rpl/t/ndb_conflict_info_init.inc'
--- a/mysql-test/suite/ndb_rpl/t/ndb_conflict_info_init.inc	2011-06-16 14:34:56 +0000
+++ b/mysql-test/suite/ndb_rpl/t/ndb_conflict_info_init.inc	2011-07-07 14:48:06 +0000
@@ -3,6 +3,7 @@
 SELECT @init_ndb_conflict_fn_max:=(VARIABLE_VALUE+0) FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
 SELECT @init_ndb_conflict_fn_old:=(VARIABLE_VALUE+0) FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
 SELECT @init_ndb_conflict_fn_max_del_win:=(VARIABLE_VALUE+0) FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX_DEL_WIN";
+SELECT @init_ndb_conflict_fn_epoch:=(VARIABLE_VALUE+0) FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_EPOCH";
 --error 0,1146
 DELETE FROM `t1$EX`;
 --enable_query_log

=== added file 'mysql-test/suite/ndb_rpl/t/ndb_rpl_conflict_epoch.cnf'
--- a/mysql-test/suite/ndb_rpl/t/ndb_rpl_conflict_epoch.cnf	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/ndb_rpl/t/ndb_rpl_conflict_epoch.cnf	2011-07-07 14:48:06 +0000
@@ -0,0 +1,40 @@
+!include ../my.cnf
+
+# 2 clusters, each with 2 MySQLDs
+# All MySQLDs log-slave-updates
+# Potential infinite loops are broken by both servers
+# on each cluster having the same server-id
+
+[mysqld]
+log-slave-updates
+ndb-log-apply-status
+
+[mysqld.1.1]
+server-id= 1
+log-bin = pref-master-1
+
+[mysqld.2.1]
+server-id= 2
+log-bin = pref-master-2
+
+[mysqld.1.slave]
+server-id= 3
+log-bin = sec-master-1
+skip-slave-start
+
+[mysqld.2.slave]
+server-id= 4
+log-bin = sec-master-2
+master-host=		127.0.0.1
+master-port=		@mysqld.2.1.port
+master-password=	@mysqld.2.1.#password
+master-user=		@mysqld.2.1.#user
+master-connect-retry=	1
+init-rpl-role=		slave
+skip-slave-start
+ndb_connectstring=	@mysql_cluster.slave.ndb_connectstring
+
+[ENV]
+
+SLAVE_MYPORT1=		@mysqld.2.slave.port
+SLAVE_MYSOCK1=		@mysqld.2.slave.socket

=== added file 'mysql-test/suite/ndb_rpl/t/ndb_rpl_conflict_epoch.test'
--- a/mysql-test/suite/ndb_rpl/t/ndb_rpl_conflict_epoch.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/ndb_rpl/t/ndb_rpl_conflict_epoch.test	2011-07-07 14:48:06 +0000
@@ -0,0 +1,261 @@
+#
+# 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
+
+--connection slave
+RESET MASTER;
+select @slave_server_id:=(variable_value+0)
+       from information_schema.global_variables
+       where variable_name like 'server_id';
+let $SLAVE_SERVER_ID= query_get_value('select @slave_server_id as v',v,1);
+
+--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;
+select @master_server_id:=(variable_value+0)
+       from information_schema.global_variables
+       where variable_name like 'server_id';
+let $MASTER_SERVER_ID= query_get_value('select @master_server_id as v',v,1);
+
+--echo Setup ndb_replication and t1$EX exceptions table
+
+--disable_warnings
+--disable_query_log
+--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
+--enable_query_log
+
+--echo Populate ndb_replication table as necessary
+--echo -- 0 extra gci bits
+eval replace into mysql.ndb_replication values
+  ("test", "t1", $SLAVE_SERVER_ID, 7, NULL),
+  ("test", "t1", $MASTER_SERVER_ID, 7, "NDB\$EPOCH(0)");
+
+--source suite/ndb_rpl/t/ndb_rpl_conflict_epoch_1.inc
+
+--echo Populate ndb_replication table as necessary
+--echo -- 1 extra gci bits
+eval replace into mysql.ndb_replication values
+  ("test", "t1", $SLAVE_SERVER_ID, 7, NULL),
+  ("test", "t1", $MASTER_SERVER_ID, 7, "NDB\$EPOCH(1)");
+
+--source suite/ndb_rpl/t/ndb_rpl_conflict_epoch_1.inc
+
+--echo Populate ndb_replication table as necessary
+--echo -- 31 extra gci bits
+eval replace into mysql.ndb_replication values
+  ("test", "t1", $SLAVE_SERVER_ID, 7, NULL),
+  ("test", "t1", $MASTER_SERVER_ID, 7, "NDB\$EPOCH(31)");
+
+--source suite/ndb_rpl/t/ndb_rpl_conflict_epoch_1.inc
+
+--echo Populate ndb_replication table as necessary
+--echo -- Default extra Gci bits
+eval replace into mysql.ndb_replication values
+  ("test", "t1", $SLAVE_SERVER_ID, 7, NULL),
+  ("test", "t1", $MASTER_SERVER_ID, 7, "NDB\$EPOCH()");
+
+--source suite/ndb_rpl/t/ndb_rpl_conflict_epoch_1.inc
+
+--source suite/ndb_rpl/t/ndb_conflict_info_init.inc
+
+--echo Now test batched conflict detection/handling
+--connection master
+
+create table test.t1 (
+  a int primary key,
+  b int,
+  c varchar(2000)) engine=ndb;
+
+--sync_slave_with_master slave
+--connection slave
+--echo -- Stop replication from Primary -> Secondary
+stop slave;
+--connection master
+--echo -- Insert a row on Primary
+insert into test.t1 values (1,1,repeat('B', 2000));
+
+--connection slave
+--echo -- Generate a large batch of inserts with early + late conflicts
+delimiter %;
+
+create procedure test.doit (rows int)
+begin
+  set @x = 0;
+  START TRANSACTION;
+    repeat
+      insert into test.t1 values (@x, @x, repeat('B', 2000));
+      set @x = @x + 1;
+    until @x = rows
+    end repeat;
+  COMMIT;
+  START TRANSACTION;
+    update test.t1 set b=999, c=repeat('E',2000) where a=1;
+  COMMIT;
+  START TRANSACTION;
+    delete from test.t1 where a=1;
+  COMMIT;
+  START TRANSACTION;
+    insert into test.t1 values (1,1,'A');
+  COMMIT;
+end%
+
+delimiter ;%
+
+call test.doit(100);
+
+drop procedure test.doit;
+
+--sync_slave_with_master master
+--connection master
+
+--echo -- Look at Primary status, expect 4 conflicts
+--source suite/ndb_rpl/t/ndb_conflict_info.inc
+
+--connection slave
+start slave;
+
+--connection master
+--echo -- Look at Seconday row
+select a,b,sha1(c) from test.t1 where a=1;
+
+--sync_slave_with_master slave
+--echo -- Check it's the same on the Secondary
+select a,b,sha1(c) from test.t1 where a=1;
+
+--connection master
+--echo Test batching of DELETE vs DELETE with following INSERT
+--connection master
+delete from test.t1;
+insert into test.t1 values (1, 1, "Ma Brows");
+--sync_slave_with_master slave
+--connection slave
+--sync_slave_with_master master
+--connection master
+--echo -- Stop Slave in both directions
+stop slave;
+--connection slave
+stop slave;
+--connection master
+--echo -- Delete row on Primary Cluster
+delete from test.t1 where a=1;
+
+--connection slave
+--echo -- Delete row on Secondary Cluster, followed by Insert in later 'batch'
+delimiter %;
+
+create procedure test.doit (rows int)
+begin
+  set @x = 2;
+  START TRANSACTION;
+    delete from test.t1 where a=1;
+    repeat
+      insert into test.t1 values (@x, @x, repeat('B', 2000));
+      set @x = @x + 1;
+    until @x = (rows + 2)
+    end repeat;
+  COMMIT;
+  START TRANSACTION;
+    insert into test.t1 values (1, 1, 'Malleny arms');
+  COMMIT;
+end%
+
+delimiter ;%
+
+call test.doit(200);
+
+--echo -- Restart slave on Primary Cluster
+--connection master
+# TODO : Reenable with new slave counts
+#--source suite/ndb_rpl/include/ndb_init_slave_counts.inc
+start slave;
+
+--connection slave
+--sync_slave_with_master master
+
+--connection master
+# TODO : Reenable with new slave counts
+#--disable_result_log
+# Don't include results as they vary depending on epoch boundaries
+#--source suite/ndb_rpl/include/ndb_slave_counts.inc
+#--enable_result_log
+#--echo -- Verify that batching occurred when replicating the above
+#select (@ndb_slave_execute_count - @ndb_slave_commit_count) > 1;
+--echo -- Show data on Primary Cluster (should have row inserted on Secondary)
+select * from test.t1 where a=1;
+
+--echo -- Show data on Secondary Cluster (should have row inserted on Secondary)
+--connection slave
+select * from test.t1 where a=1;
+
+--echo --Restart slave on Secondary Cluster
+start slave;
+--connection master
+--sync_slave_with_master slave
+--connection slave
+
+--echo -- Show data on Secondary Cluster (should now be missing)
+--echo    Clusters are diverged as expected with delete vs delete conflict
+--echo    followed closely by Insert
+--connection slave
+select * from test.t1 where a=1;
+
+--echo -- Force wait for master to be in-sync with slave
+--echo    To avoid race between DML and table drop
+flush logs;
+--sync_slave_with_master master
+
+--connection master
+drop procedure test.doit;
+drop table test.t1;
+
+delete from mysql.ndb_replication;
+insert into mysql.ndb_replication values
+  ("test", "t3", 0, 7, "NDB\$EPOCH(32)"),
+  ("test", "t4", 0, 7, "NDB\$EPOCH(-1)");
+
+--error 1005
+create table test.t3 (a int primary key) engine=ndb;
+show warnings;
+
+--error 1005
+create table test.t4 (a int primary key) engine=ndb;
+show warnings;
+
+--echo -- Force sync before dropping table to avoid race
+--connection master
+flush logs;
+--sync_slave_with_master slave
+--connection slave
+flush logs;
+--sync_slave_with_master master
+
+--connection master
+drop table mysql.ndb_replication;
+
+--sync_slave_with_master slave
+
+--echo -- Attempt to get system back in pre-test state
+--connection master
+stop slave;
+reset slave;
+change master to master_host='';
+
+--source include/rpl_end.inc

=== added file 'mysql-test/suite/ndb_rpl/t/ndb_rpl_conflict_epoch_1.inc'
--- a/mysql-test/suite/ndb_rpl/t/ndb_rpl_conflict_epoch_1.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/ndb_rpl/t/ndb_rpl_conflict_epoch_1.inc	2011-07-07 14:48:06 +0000
@@ -0,0 +1,490 @@
+#
+# Include file for testing ndb$epoch conflict function
+#
+#
+
+create table `test`.`t1$EX`
+  (server_id int unsigned,
+   master_server_id int unsigned,
+   master_epoch bigint unsigned,
+   count int unsigned,
+   a int not null,
+   d int,
+   primary key(server_id, master_server_id, master_epoch, count)) engine ndb;
+
+
+--echo Create table
+create table test.t1(a int primary key, b varchar(255)) engine = ndb;
+
+--echo Create other table
+create table test.t2(a int primary key, b int) engine = ndb;
+
+--source suite/ndb_rpl/t/ndb_conflict_info_init.inc
+
+--echo ----------------------------------
+--echo Test 1 : Basic two-way replication
+--echo ----------------------------------
+
+insert into test.t1 values (1, "Metropole");
+
+--echo -- Give time for a new epoch on the Master
+# This is 3 seconds to be > GCP_Save time, so that the next epoch
+# will be visibly greater than the one inserted above
+# (e.g. if we have 4 bits of extra GCI resolution, the max
+#  representable GCI is XXX/15.  If we insert at XXX/16, we
+#  need to wait until we get to XXX+1/0 at least, to avoid
+#  the Primary Master undoing the update)
+#
+--sleep 3
+
+--echo -- Insert something to ensure the new epoch is noticed
+#
+# Required in case our initial insert's epoch gets rounded up to
+# 0xffffffff, in which case 'later' updates from the slave will
+# be in conflict until some newer gci_hi is the MaxReplicatedEpoch
+#
+replace into test.t2 values (2, 1);
+--sync_slave_with_master slave
+--connection slave
+--echo -- Flushed to slave
+select * from test.t1 order by a;
+--sync_slave_with_master master
+--connection master
+--echo -- Flushed back to Master
+select * from test.t1 order by a;
+--connection slave
+
+--echo -- Now update data on slave
+update test.t1 set b="Favorit" where a=1;
+
+--sync_slave_with_master master
+
+--connection master
+--echo -- Now check data on master
+select * from test.t1 order by a;
+
+--source suite/ndb_rpl/t/ndb_conflict_info.inc
+
+--connection slave
+--echo -- Now perform multiple consecutive updates on the slave
+
+update test.t1 set b="Elephant house" where a=1;
+update test.t1 set b="Beach house" where a=1;
+
+select * from test.t1 order by a;
+
+--sync_slave_with_master master
+--connection master
+--echo -- Now check they've applied on the master
+select * from test.t1 order by a;
+
+--source suite/ndb_rpl/t/ndb_conflict_info.inc
+
+--echo --------------------------------------------
+--echo Test 2 : Normal Insert from Secondary Master
+--echo --------------------------------------------
+
+--connection slave
+--echo -- Insert a new row on the Slave
+insert into test.t1 values (2, "Forrest");
+
+--sync_slave_with_master master
+--connection master
+--echo -- Check it exists on the Master
+select * from test.t1 order by a;
+
+--connection slave
+--echo -- Update from the slave
+update test.t1 set b="Reds" where a=2;
+
+--sync_slave_with_master master
+--connection master
+select * from test.t1 order by a;
+
+--connection slave
+delete from test.t1 where a=2;
+
+--sync_slave_with_master master
+--connection master
+select * from test.t1 order by a;
+
+--source suite/ndb_rpl/t/ndb_conflict_info.inc
+
+--echo -------------------------------
+--echo Test 3 : Insert-Insert conflict
+--echo -------------------------------
+
+--connection slave
+stop slave;
+--connection master
+
+--echo -- Insert a row on the Primary Master
+insert into test.t1 values (2, "Loopy Lornas");
+
+--connection slave
+--echo -- Insert a row on the secondary Master
+insert into test.t1 values (2, "Cloisters");
+
+--sync_slave_with_master master
+--connection master
+--echo -- Examine data on Primary Master (should be unaffected)
+select * from test.t1 order by a;
+
+--echo -- Examine conflict indicators on Primary Master
+--source suite/ndb_rpl/t/ndb_conflict_info.inc
+
+--echo -- Examine data on isolated secondary Master (should be as-set)
+--connection slave
+select * from test.t1 order by a;
+
+--echo -- Restart secondary Masters slave
+start slave;
+
+--connection master
+--sync_slave_with_master slave
+--connection slave
+
+--echo -- Reexamine secondary Master's data (should be same as Primary Masters)
+select * from test.t1 order by a;
+
+--echo -------------------------------
+--echo Test 4 : Update-Update conflict
+--echo -------------------------------
+
+--connection slave
+--echo -- Stop replication to secondary master
+stop slave;
+
+--connection master
+--echo -- Update row on Primary Master
+
+update test.t1 set b="Peters Yard" where a=2;
+
+--echo -- Show data on Primary Master
+
+select * from test.t1 order by a;
+--source suite/ndb_rpl/t/ndb_conflict_info.inc
+
+--connection slave
+
+--echo -- Update row on Secondary Master
+update test.t1 set b="Toast" where a=2;
+
+--sync_slave_with_master master
+
+--echo -- Examine data on Primary Master - should be unaffected
+
+select * from test.t1 order by a;
+--source suite/ndb_rpl/t/ndb_conflict_info.inc
+
+--connection slave
+--echo -- Check data on secondary - should be as set
+
+select * from test.t1 order by a;
+
+--echo -- Now restart slave, will re-align row
+start slave;
+
+--connection master
+--sync_slave_with_master slave
+
+--connection slave
+--echo -- Check that Secondary is re-aligned
+
+select * from test.t1 order by a;
+
+
+--echo -------------------------------
+--echo Test 5 : Update-Delete conflict
+--echo -------------------------------
+
+--connection slave
+--echo -- Stop Secondary slave
+stop slave;
+
+--connection master
+--echo -- Update on Primary Master
+
+update test.t1 set b="Pear tree" where a = 2;
+
+--connection slave
+--echo -- Delete on Secondary Master
+
+delete from test.t1 where a = 2;
+
+--sync_slave_with_master master
+
+--echo -- Examine data on Primary Master, should be unaffected
+
+select * from test.t1 order by a;
+--source suite/ndb_rpl/t/ndb_conflict_info.inc
+
+--echo -- Examine data on Secondary Master before slave restart, still missing
+--connection slave
+select * from test.t1 order by a;
+
+--echo -- Restart Secondary Master slave
+start slave;
+
+--connection master
+--sync_slave_with_master slave
+--connection slave
+
+--echo -- Examine data on Secondary Master after slave restart, aligned with Master
+select * from test.t1 order by a;
+
+--echo -------------------------------
+--echo Test 6 : Delete-Update conflict
+--echo -------------------------------
+
+--connection slave
+--echo -- Stop Secondary slave
+stop slave;
+
+--connection master
+--echo -- Delete on Primary Master
+
+delete from test.t1 where a=2;
+
+--connection slave
+--echo -- Update on Secondary Master
+
+update test.t1 set b="Black pig" where a=2;
+
+--sync_slave_with_master master
+
+--echo -- Examine data on Primary Master, should be unaffected (no row)
+
+select * from test.t1 order by a;
+--source suite/ndb_rpl/t/ndb_conflict_info.inc
+
+--echo -- Examine data on Secondary Master before slave restart, should be as inserted
+--connection slave
+select * from test.t1 order by a;
+
+--echo -- Restart Secondary Master slave
+start slave;
+
+--connection master
+--sync_slave_with_master slave
+--connection slave
+
+--echo -- Examine data on Secondary Master after slave restart, aligned with Master (deleted)
+select * from test.t1 order by a;
+
+--echo -------------------------------
+--echo Test 7 : Delete-Delete conflict
+--echo -------------------------------
+
+--connection slave
+--echo -- Stop Secondary slave
+stop slave;
+
+--connection master
+--echo -- Delete on Primary Master
+
+delete from test.t1 where a=1;
+
+--connection slave
+--echo -- Delete on Secondary Master
+
+delete from test.t1 where a=1;
+
+--sync_slave_with_master master
+
+--echo -- Examine data on Primary Master, no row
+
+select * from test.t1 order by a;
+--source suite/ndb_rpl/t/ndb_conflict_info.inc
+
+--echo -- Examine data on Secondary Master before slave restart, no row
+--connection slave
+select * from test.t1 order by a;
+
+--echo -- Restart Secondary Master slave
+start slave;
+
+--connection master
+--sync_slave_with_master slave
+--connection slave
+
+--echo -- Examine data on Secondary Master after slave restart, no row
+select * from test.t1 order by a;
+
+
+--echo ------------------------------------------------
+--echo Test 8 : Delete-Delete, Insert conflict exposure
+--echo ------------------------------------------------
+# This occurs as the Primary Master's Delete is still
+# in-flight when the Secondary Master's Insert arrives,
+# but as there is no knowledge of this at the Primary
+# Master, it accepts the Insert.
+#
+
+--connection slave
+--echo -- Insert a row on Secondary Master
+insert into test.t1 values (3, "Espy");
+--sync_slave_with_master master
+
+--connection master
+--echo -- Check it's present on Primary Master
+select * from test.t1 order by a;
+
+--echo -- Stop replication in both directions
+stop slave;
+
+--connection slave
+stop slave;
+
+--echo -- Delete row from both clusters
+delete from test.t1 where a=3;
+
+--connection master
+delete from test.t1 where a=3;
+
+--echo -- Follow up with Insert from Secondary master
+--connection slave
+
+insert into test.t1 values (3, "Dalriada");
+
+--echo -- Restart replication in both directions
+start slave;
+
+--connection master
+start slave;
+
+--sync_slave_with_master slave
+--connection slave
+--sync_slave_with_master master
+
+--connection slave
+--echo -- Check data on both sites - diverged
+--echo -- Secondary master :
+select * from test.t1 order by a;
+--echo -- Primary master :
+--connection master
+select * from test.t1 order by a;
+
+--echo --Remove extra row
+delete from test.t1 where a=3;
+
+--echo -- Note that Delete-Delete conflict detected below
+--source suite/ndb_rpl/t/ndb_conflict_info.inc
+
+--echo ------------------------------------------------
+--echo Test 9 : Insert, Insert-Update-Delete conflict
+--echo ------------------------------------------------
+
+--connection slave
+--echo -- Stop replication on Secondary Master
+stop slave;
+
+--connection master
+--echo -- Insert row on Primary Master
+insert into test.t1 values (4, "Haymarket");
+
+--connection slave
+--echo -- Insert row on Secondary Master
+insert into test.t1 values (4, "Outhouse");
+--echo -- Update row on Secondary Master
+update test.t1 set b="Mathers" where a = 4;
+--echo -- Delete row on Secondary Master
+delete from test.t1 where a=4;
+
+--echo -- Examine data (none) on Secondary Master
+select * from test.t1 order by a;
+
+--sync_slave_with_master master
+--connection master
+--echo -- Examine data on Primary Master, should be unaffected
+
+select * from test.t1 order by a;
+--source suite/ndb_rpl/t/ndb_conflict_info.inc
+
+--connection slave
+--echo -- Examine data on Secondary Master (none)
+select * from test.t1 order by a;
+
+--echo -- Restart Secondary Master's slave
+start slave;
+
+--connection master
+--sync_slave_with_master slave
+--connection slave
+--echo -- Check data on Secondary Master, should be same as Primary Master
+select * from test.t1;
+
+--echo ------------------------------------------------
+--echo Test 10 : Update, Delete-Insert-Update conflict
+--echo ------------------------------------------------
+--connection slave
+--echo -- Stop replication on Secondary Master
+stop slave;
+
+--connection master
+--echo -- Update row on Primary Master
+update test.t1 set b="Blind poet" where a=4;
+
+--connection slave
+--echo -- Delete row on Secondary Master
+delete from test.t1 where a=4;
+
+--echo -- Insert row on Secondary Master
+insert into test.t1 values (4, "Drouthy Neebors");
+
+--echo -- Update row on Secondary Master
+update test.t1 set b="The Tankard" where a=4;
+
+--sync_slave_with_master master
+
+--connection master
+
+--echo -- Check data on Primary Master, should be unaffected
+select * from test.t1 order by a;
+--source suite/ndb_rpl/t/ndb_conflict_info.inc
+
+--connection slave
+--echo -- Check data on Secondary Master, as set
+
+select * from test.t1 order by a;
+
+--echo -- Restart Secondary Master slave
+start slave;
+
+--connection master
+--sync_slave_with_master slave
+--connection slave
+
+--echo -- Check data on Secondary Master - should be as Primary
+select * from test.t1 order by a;
+
+--sync_slave_with_master master
+
+--echo ------------------------------------------------------------------------
+--echo Test 11 : Test Secondary insert-update-delete accepted
+--echo ------------------------------------------------------------------------
+--connection slave
+--echo Insert row on Secondary
+insert into test.t1 values (5, "Minders");
+--echo Update row on Secondary
+update test.t1 set b="Southsider" where a=5;
+--echo Delete row on Secondary
+delete from test.t1 where a=5;
+
+--sync_slave_with_master master
+
+--connection master
+--echo Check data on Primary, should be none.  No new conflicts
+select * from test.t1 order by a;
+--source suite/ndb_rpl/t/ndb_conflict_info.inc
+
+--connection master
+--source suite/ndb_rpl/t/ndb_conflict_info.inc
+
+drop table test.t1;
+drop table test.t2;
+drop table test.t1$EX;
+
+--sync_slave_with_master slave
+
+--connection master
\ No newline at end of file

=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc	2011-07-06 06:51:12 +0000
+++ b/sql/ha_ndbcluster.cc	2011-07-08 12:31:38 +0000
@@ -798,6 +798,7 @@ SHOW_VAR ndb_status_conflict_variables[]
   {"fn_max",       (char*) &g_ndb_slave_state.total_violation_count[CFT_NDB_MAX], SHOW_LONGLONG},
   {"fn_old",       (char*) &g_ndb_slave_state.total_violation_count[CFT_NDB_OLD], SHOW_LONGLONG},
   {"fn_max_del_win", (char*) &g_ndb_slave_state.total_violation_count[CFT_NDB_MAX_DEL_WIN], SHOW_LONGLONG},
+  {"fn_epoch",     (char*) &g_ndb_slave_state.total_violation_count[CFT_NDB_EPOCH], SHOW_LONGLONG},
   {NullS, NullS, SHOW_LONG}
 };
 
@@ -972,6 +973,7 @@ handle_conflict_op_error(Thd_ndb* thd_nd
 
 int
 handle_row_conflict(NDB_CONFLICT_FN_SHARE* cfn_share,
+                    const char* tab_name,
                     const NdbRecord* key_rec,
                     const uchar* pk_row,
                     enum_conflicting_op_type op_type,
@@ -981,6 +983,8 @@ handle_row_conflict(NDB_CONFLICT_FN_SHAR
                     NdbError& err);
 #endif
 
+static const Uint32 error_op_after_refresh_op = 920;
+
 inline int
 check_completed_operations_pre_commit(Thd_ndb *thd_ndb, NdbTransaction *trans,
                                       const NdbOperation *first,
@@ -1054,6 +1058,8 @@ check_completed_operations_pre_commit(Th
   */
   if (trans->getLastDefinedOperation() != lastUserOp)
   {
+    const NdbOperation* last_conflict_op = trans->getLastDefinedOperation();
+
     if (trans->execute(NdbTransaction::NoCommit,
                        NdbOperation::AO_IgnoreError,
                        thd_ndb->m_force_send))
@@ -1061,9 +1067,41 @@ check_completed_operations_pre_commit(Th
       abort();
       //err= trans->getNdbError();
     }
+
     if (trans->getNdbError().code)
     {
-      sql_print_error("NDB slave: write conflict row error code %d", trans->getNdbError().code);
+      /* Check the result codes of the operations we added */
+      const NdbOperation* conflict_op = NULL;
+      do
+      {
+        conflict_op = trans->getNextCompletedOperation(conflict_op);
+        assert(conflict_op != NULL);
+        /* We will ignore 920 which represents a refreshOp or other op
+         * arriving after a refreshOp
+         */
+        const NdbError& err = conflict_op->getNdbError();
+        if ((err.code != 0) &&
+            (err.code != (int) error_op_after_refresh_op))
+        {
+          if (err.status == NdbError::TemporaryError)
+          {
+            /* Slave will roll back and retry entire transaction. */
+            ERR_RETURN(err);
+          }
+          else
+          {
+            char msg[FN_REFLEN];
+            my_snprintf(msg, sizeof(msg), "Executing extra operations for "
+                        "conflict handling hit Ndb error %d '%s'",
+                        err.code, err.message);
+            push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
+                                ER_EXCEPTIONS_WRITE_ERROR,
+                                ER(ER_EXCEPTIONS_WRITE_ERROR), msg);
+            /* Slave will stop replication. */
+            DBUG_RETURN(ER_EXCEPTIONS_WRITE_ERROR);
+          }
+        }
+      } while (conflict_op != last_conflict_op);
     }
   }
 #endif
@@ -1096,7 +1134,9 @@ check_completed_operations(Thd_ndb *thd_
         err.classification != NdbError::NoDataFound)
     {
 #ifdef HAVE_NDB_BINLOG
-      DBUG_ASSERT(err.code != 9999 && err.code != 9998);
+      /* All conflict detection etc should be done before commit */
+      DBUG_ASSERT((err.code != (int) error_conflict_fn_violation) &&
+                  (err.code != (int) error_op_after_refresh_op));
 #endif
       DBUG_RETURN(err.code);
     }
@@ -2224,7 +2264,8 @@ int ha_ndbcluster::get_metadata(THD *thd
     my_free(pack_data, MYF(MY_ALLOW_ZERO_PTR));
     DBUG_RETURN(1);
   }
-    
+
+  ndb->setDatabaseName(m_dbname);
   Ndb_table_guard ndbtab_g(dict, m_tabname);
   if (!(tab= ndbtab_g.get_table()))
     ERR_RETURN(dict->getNdbError());
@@ -4225,6 +4266,7 @@ handle_conflict_op_error(Thd_ndb* thd_nd
   DBUG_PRINT("info", ("ndb error: %d", err.code));
 
   if ((err.code == (int) error_conflict_fn_violation) ||
+      (err.code == (int) error_op_after_refresh_op) ||
       (err.classification == NdbError::ConstraintViolation) ||
       (err.classification == NdbError::NoDataFound))
   {
@@ -4240,7 +4282,8 @@ handle_conflict_op_error(Thd_ndb* thd_nd
 
     enum_conflict_cause conflict_cause;
 
-    if (err.code == (int) error_conflict_fn_violation)
+    if ((err.code == (int) error_conflict_fn_violation) ||
+        (err.code == (int) error_op_after_refresh_op))
     {
       conflict_cause= ROW_IN_CONFLICT;
     }
@@ -4275,6 +4318,7 @@ handle_conflict_op_error(Thd_ndb* thd_nd
       {
         NdbError handle_error;
         if (handle_row_conflict(cfn_share,
+                                share->table_name,
                                 key_rec,
                                 row,
                                 op_type,
@@ -4412,7 +4456,7 @@ int ha_ndbcluster::ndb_write_row(uchar *
   NdbTransaction *trans;
   uint32 part_id;
   int error;
-  NdbOperation::SetValueSpec sets[2];
+  NdbOperation::SetValueSpec sets[3];
   Uint32 num_sets= 0;
   DBUG_ENTER("ha_ndbcluster::ndb_write_row");
 
@@ -4541,6 +4585,16 @@ int ha_ndbcluster::ndb_write_row(uchar *
   eventSetAnyValue(thd, &options); 
   bool need_flush= add_row_check_if_batch_full(thd_ndb);
 
+  const Uint32 authorValue = 1;
+  if ((thd->slave_thread) &&
+      (m_table->getExtraRowAuthorBits()))
+  {
+    /* Set author to indicate slave updated last */
+    sets[num_sets].column= NdbDictionary::Column::ROW_AUTHOR;
+    sets[num_sets].value= &authorValue;
+    num_sets++;
+  }
+
   if (m_user_defined_partitioning)
   {
     options.optionsPresent |= NdbOperation::OperationOptions::OO_PARTITION_ID;
@@ -4773,9 +4827,9 @@ int ha_ndbcluster::primary_key_cmp(const
 }
 
 #ifdef HAVE_NDB_BINLOG
-
 int
 handle_row_conflict(NDB_CONFLICT_FN_SHARE* cfn_share,
+                    const char* table_name,
                     const NdbRecord* key_rec,
                     const uchar* pk_row,
                     enum_conflicting_op_type op_type,
@@ -4786,6 +4840,90 @@ handle_row_conflict(NDB_CONFLICT_FN_SHAR
 {
   DBUG_ENTER("handle_row_conflict");
 
+  if (cfn_share->m_flags & CFF_REFRESH_ROWS)
+  {
+    /* A conflict has been detected between an applied replicated operation
+     * and the data in the DB.
+     * The attempt to change the local DB will have been rejected.
+     * We now take steps to generate a refresh Binlog event so that
+     * other clusters will be re-aligned.
+     */
+    DBUG_PRINT("info", ("Conflict on table %s.  Operation type : %s, "
+                        "conflict cause :%s, conflict error : %u : %s",
+                        table_name,
+                        ((op_type == WRITE_ROW)? "WRITE_ROW":
+                         (op_type == UPDATE_ROW)? "UPDATE_ROW":
+                         "DELETE_ROW"),
+                        ((conflict_cause == ROW_ALREADY_EXISTS)?"ROW_ALREADY_EXISTS":
+                         (conflict_cause == ROW_DOES_NOT_EXIST)?"ROW_DOES_NOT_EXIST":
+                         "ROW_IN_CONFLICT"),
+                        conflict_error.code,
+                        conflict_error.message));
+
+    assert(key_rec != NULL);
+    assert(pk_row != NULL);
+
+    /* When the slave splits an epoch into batches, a conflict row detected
+     * and refreshed in an early batch can be written to by operations in
+     * a later batch.  As the operations will not have applied, and the
+     * row has already been refreshed, we need not attempt to refresh
+     * it again
+     */
+    if ((conflict_cause == ROW_IN_CONFLICT) &&
+        (conflict_error.code == (int) error_op_after_refresh_op))
+    {
+      /* Attempt to apply an operation after the row was refreshed
+       * Ignore the error
+       */
+      DBUG_PRINT("info", ("Operation after refresh error - ignoring"));
+      DBUG_RETURN(0);
+    }
+
+    /* When a delete operation finds that the row does not exist, it indicates
+     * a DELETE vs DELETE conflict.  If we refresh the row then we can get
+     * non deterministic behaviour depending on slave batching as follows :
+     *   Row is deleted
+     *
+     *     Case 1
+     *       Slave applied DELETE, INSERT in 1 batch
+     *
+     *         After first batch, the row is present (due to INSERT), it is
+     *         refreshed.
+     *
+     *     Case 2
+     *       Slave applied DELETE in 1 batch, INSERT in 2nd batch
+     *
+     *         After first batch, the row is not present, it is refreshed
+     *         INSERT is then rejected.
+     *
+     * The problem of not being able to 'record' a DELETE vs DELETE conflict
+     * is known.  We attempt at least to give consistent behaviour for
+     * DELETE vs DELETE conflicts by :
+     *   NOT refreshing a row when a DELETE vs DELETE conflict is detected
+     * This should map all batching scenarios onto Case1.
+     */
+    if ((op_type == DELETE_ROW) &&
+        (conflict_cause == ROW_DOES_NOT_EXIST))
+    {
+      DBUG_PRINT("info", ("Delete vs Delete detected, NOT refreshing"));
+      DBUG_RETURN(0);
+    }
+
+    /* Create a refresh to operation to realign other clusters */
+    // TODO AnyValue
+    // TODO Do we ever get non-PK key?
+    //      Keyless table?
+    //      Unique index
+    const NdbOperation* refresh_op= conflict_trans->refreshTuple(key_rec,
+                                                                 (const char*) pk_row);
+
+    if (!refresh_op)
+    {
+      err= conflict_trans->getNdbError();
+      DBUG_RETURN(1);
+    }
+  } /* if (cfn_share->m_flags & CFF_REFRESH_ROWS) */
+
   DBUG_RETURN(0);
 };
 #endif /* HAVE_NDB_BINLOG */
@@ -4960,7 +5098,8 @@ int ha_ndbcluster::ndb_update_row(const
                    primary_key_cmp(old_data, new_data));
   bool batch_allowed= !m_update_cannot_batch && 
     (is_bulk_update || thd_allow_batch(thd));
-  NdbOperation::SetValueSpec sets[1];
+  NdbOperation::SetValueSpec sets[2];
+  Uint32 num_sets= 0;
 
   DBUG_ENTER("ndb_update_row");
   DBUG_ASSERT(trans);
@@ -5067,11 +5206,9 @@ int ha_ndbcluster::ndb_update_row(const
       func_value_uint32= INT_MAX32;
     else
       func_value_uint32= (uint32)func_value;
-    sets[0].column= get_partition_id_column();
-    sets[0].value= &func_value_uint32;
-    options.optionsPresent|= NdbOperation::OperationOptions::OO_SETVALUE;
-    options.extraSetValues= sets;
-    options.numExtraSetValues= 1;
+    sets[num_sets].column= get_partition_id_column();
+    sets[num_sets].value= &func_value_uint32;
+    num_sets++;
 
     if (!cursor)
     {
@@ -5084,6 +5221,23 @@ int ha_ndbcluster::ndb_update_row(const
   
   bool need_flush= add_row_check_if_batch_full(thd_ndb);
 
+ const Uint32 authorValue = 1;
+ if ((thd->slave_thread) &&
+     (m_table->getExtraRowAuthorBits()))
+ {
+   /* Set author to indicate slave updated last */
+   sets[num_sets].column= NdbDictionary::Column::ROW_AUTHOR;
+   sets[num_sets].value= &authorValue;
+   num_sets++;
+ }
+
+ if (num_sets)
+ {
+   options.optionsPresent|= NdbOperation::OperationOptions::OO_SETVALUE;
+   options.extraSetValues= sets;
+   options.numExtraSetValues= num_sets;
+ }
+
   if (thd->slave_thread || THDVAR(thd, deferred_constraints))
   {
     options.optionsPresent |=
@@ -8589,6 +8743,35 @@ int ha_ndbcluster::create(const char *na
   ndb->setDatabaseName(m_dbname);
 
   /* Use ndb_replication information as required */
+  if (conflict_fn != NULL)
+  {
+    switch(conflict_fn->type)
+    {
+    case CFT_NDB_EPOCH:
+    {
+      /* Default 6 extra Gci bits allows 2^6 == 64
+       * epochs / saveGCP, a comfortable default
+       */
+      Uint32 numExtraGciBits = 6;
+      Uint32 numExtraAuthorBits = 1;
+
+      if ((num_args == 1) &&
+          (args[0].type == CFAT_EXTRA_GCI_BITS))
+      {
+        numExtraGciBits = args[0].extraGciBits;
+      }
+      DBUG_PRINT("info", ("Setting ExtraRowGciBits to %u, "
+                          "ExtraAuthorBits to %u",
+                          numExtraGciBits,
+                          numExtraAuthorBits));
+
+      tab.setExtraRowGciBits(numExtraGciBits);
+      tab.setExtraRowAuthorBits(numExtraAuthorBits);
+    }
+    default:
+      break;
+    }
+  }
 #endif
 
   if ((dict->beginSchemaTrans() == -1))
@@ -10032,26 +10215,47 @@ int ha_ndbcluster::open(const char *name
     m_key_fields[i]= NULL;
   }
 
-  // Init table lock structure 
-  /* ndb_share reference handler */
-  if (!(m_share=get_share(name, table)))
+  set_dbname(name);
+  set_tabname(name);
+
+  if ((res= check_ndb_connection(thd)) != 0)
   {
     local_close(thd, FALSE);
-    DBUG_RETURN(1);
+    DBUG_RETURN(res);
   }
+
+  // Init table lock structure
+  /* ndb_share reference handler */
+  if ((m_share=get_share(name, table, FALSE)) == 0)
+  {
+    /**
+     * No share present...we must create one
+     */
+    if (opt_ndb_extra_logging > 19)
+    {
+      sql_print_information("Calling ndbcluster_create_binlog_setup(%s) in ::open",
+                            name);
+    }
+    Ndb* ndb= check_ndb_in_thd(thd);
+    ndbcluster_create_binlog_setup(thd, ndb, name, strlen(name),
+                                   m_dbname, m_tabname, FALSE);
+    if ((m_share=get_share(name, table, FALSE)) == 0)
+    {
+      local_close(thd, FALSE);
+      DBUG_RETURN(1);
+    }
+  }
+
   DBUG_PRINT("NDB_SHARE", ("%s handler  use_count: %u",
                            m_share->key, m_share->use_count));
   thr_lock_data_init(&m_share->lock,&m_lock,(void*) 0);
-  
-  set_dbname(name);
-  set_tabname(name);
-  
-  if ((res= check_ndb_connection(thd)) ||
-      (res= get_metadata(thd, name)))
+
+  if ((res= get_metadata(thd, name)))
   {
     local_close(thd, FALSE);
     DBUG_RETURN(res);
   }
+
   if ((res= update_stats(thd, 1, true)) ||
       (res= info(HA_STATUS_CONST)))
   {

=== modified file 'sql/ha_ndbcluster.h'
--- a/sql/ha_ndbcluster.h	2011-07-06 06:51:12 +0000
+++ b/sql/ha_ndbcluster.h	2011-07-08 12:31:38 +0000
@@ -126,6 +126,7 @@ enum enum_conflict_fn_type
   ,CFT_NDB_MAX
   ,CFT_NDB_OLD
   ,CFT_NDB_MAX_DEL_WIN
+  ,CFT_NDB_EPOCH
   ,CFT_NUMBER_OF_CFTS /* End marker */
 };
 
@@ -136,6 +137,7 @@ enum enum_conflict_fn_arg_type
 {
   CFAT_END
   ,CFAT_COLUMN_NAME
+  ,CFAT_EXTRA_GCI_BITS
 };
 
 struct st_conflict_fn_arg
@@ -143,7 +145,11 @@ struct st_conflict_fn_arg
   enum_conflict_fn_arg_type type;
   const char *ptr;
   uint32 len;
-  uint32 fieldno; // CFAT_COLUMN_NAME
+  union
+  {
+    uint32 fieldno;      // CFAT_COLUMN_NAME
+    uint32 extraGciBits; // CFAT_EXTRA_GCI_BITS
+  };
 };
 
 struct st_conflict_fn_arg_def
@@ -197,9 +203,10 @@ struct Ndb_exceptions_data {
   enum_conflicting_op_type op_type;
 };
 
-enum enum_conflict_fn_flags
+enum enum_conflict_fn_table_flags
 {
-  CFF_NONE = 0
+  CFF_NONE         = 0,
+  CFF_REFRESH_ROWS = 1
 };
 
 typedef struct st_ndbcluster_conflict_fn_share {

=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc	2011-07-06 06:51:12 +0000
+++ b/sql/ha_ndbcluster_binlog.cc	2011-07-08 12:31:38 +0000
@@ -4163,6 +4163,73 @@ row_conflict_fn_max_del_win(st_ndbcluste
   }
 };
 
+
+/**
+  CFT_NDB_EPOCH
+
+*/
+
+int
+row_conflict_fn_epoch(st_ndbcluster_conflict_fn_share* cfn_share,
+                      enum_conflicting_op_type op_type,
+                      const uchar* old_data,
+                      const uchar* new_data,
+                      const MY_BITMAP* write_set,
+                      NdbInterpretedCode* code)
+{
+  DBUG_ENTER("row_conflict_fn_epoch");
+  switch(op_type)
+  {
+  case WRITE_ROW:
+    abort();
+    DBUG_RETURN(1);
+  case UPDATE_ROW:
+  case DELETE_ROW:
+  {
+    const uint label_0= 0;
+    const Uint32
+      RegAuthor= 1, RegZero= 2,
+      RegMaxRepEpoch= 1, RegRowEpoch= 2;
+    int r;
+
+    r= code->load_const_u32(RegZero, 0);
+    assert(r == 0);
+    r= code->read_attr(RegAuthor, NdbDictionary::Column::ROW_AUTHOR);
+    assert(r == 0);
+    /* If last author was not local, assume no conflict */
+    r= code->branch_ne(RegZero, RegAuthor, label_0);
+    assert(r == 0);
+
+    /*
+     * Load registers RegMaxRepEpoch and RegRowEpoch
+     */
+    r= code->load_const_u64(RegMaxRepEpoch, g_ndb_slave_state.max_rep_epoch);
+    assert(r == 0);
+    r= code->read_attr(RegRowEpoch, NdbDictionary::Column::ROW_GCI64);
+    assert(r == 0);
+
+    /*
+     * if RegRowEpoch <= RegMaxRepEpoch goto label_0
+     * else raise error for this row
+     */
+    r= code->branch_le(RegRowEpoch, RegMaxRepEpoch, label_0);
+    assert(r == 0);
+    r= code->interpret_exit_nok(error_conflict_fn_violation);
+    assert(r == 0);
+    r= code->def_label(label_0);
+    assert(r == 0);
+    r= code->interpret_exit_ok();
+    assert(r == 0);
+    r= code->finalise();
+    assert(r == 0);
+    DBUG_RETURN(r);
+  }
+  default:
+    abort();
+    DBUG_RETURN(1);
+  }
+};
+
 static const st_conflict_fn_arg_def resolve_col_args[]=
 {
   /* Arg type              Optional */
@@ -4170,6 +4237,13 @@ static const st_conflict_fn_arg_def reso
   { CFAT_END,              false }
 };
 
+static const st_conflict_fn_arg_def epoch_fn_args[]=
+{
+  /* Arg type              Optional */
+  { CFAT_EXTRA_GCI_BITS,   true  },
+  { CFAT_END,              false }
+};
+
 static const st_conflict_fn_def conflict_fns[]=
 {
   { "NDB$MAX_DELETE_WIN", CFT_NDB_MAX_DEL_WIN,
@@ -4178,6 +4252,8 @@ static const st_conflict_fn_def conflict
     &resolve_col_args[0], row_conflict_fn_max         },
   { "NDB$OLD",            CFT_NDB_OLD,
     &resolve_col_args[0], row_conflict_fn_old         },
+  { "NDB$EPOCH",          CFT_NDB_EPOCH,
+    &epoch_fn_args[0],    row_conflict_fn_epoch       }
 };
 
 static unsigned n_conflict_fns=
@@ -4307,6 +4383,24 @@ parse_conflict_fn_spec(const char* confl
         }
         break;
       }
+      case CFAT_EXTRA_GCI_BITS:
+      {
+        /* Map string to number and check it's in range etc */
+        char* end_of_arg = (char*) end_arg;
+        Uint32 bits = strtoul(start_arg, &end_of_arg, 0);
+        DBUG_PRINT("info", ("Using %u as the number of extra bits", bits));
+
+        if (bits > 31)
+        {
+          arg_processing_error= true;
+          error_str= "Too many extra Gci bits";
+          DBUG_PRINT("info", ("%s", error_str));
+          break;
+        }
+        /* Num bits seems ok */
+        args[no_args].extraGciBits = bits;
+        break;
+      }
       case CFAT_END:
         abort();
       }
@@ -4413,6 +4507,57 @@ setup_conflict_fn(THD *thd, NDB_SHARE *s
     }
     break;
   }
+  case CFT_NDB_EPOCH:
+  {
+    if (num_args > 1)
+    {
+      my_snprintf(msg, msg_len,
+                  "Too many arguments to conflict function");
+      DBUG_PRINT("info", ("%s", msg));
+      DBUG_RETURN(-1);
+    }
+
+    /* Check that table doesn't have Blobs as we don't support that */
+    if (share->flags & NSF_BLOB_FLAG)
+    {
+      my_snprintf(msg, msg_len, "Table has Blob column(s), not suitable for NDB$EPOCH.");
+      DBUG_PRINT("info", ("%s", msg));
+      DBUG_RETURN(-1);
+    }
+
+    /* Check that table has required extra meta-columns */
+    /* Todo : Could warn if extra gcibits is insufficient to
+     * represent SavePeriod/EpochPeriod
+     */
+    if (ndbtab->getExtraRowGciBits() == 0)
+      sql_print_information("Ndb Slave : CFT_NDB_EPOCH, low epoch resolution");
+
+    if (ndbtab->getExtraRowAuthorBits() == 0)
+    {
+      my_snprintf(msg, msg_len, "No extra row author bits in table.");
+      DBUG_PRINT("info", ("%s", msg));
+      DBUG_RETURN(-1);
+    }
+
+    if (slave_set_resolve_fn(thd, share, ndbtab,
+                             0, // field_no
+                             0, // resolve_col_sz
+                             conflict_fn, table, CFF_REFRESH_ROWS))
+    {
+      my_snprintf(msg, msg_len,
+                  "unable to setup conflict resolution");
+      DBUG_PRINT("info", ("%s", msg));
+      DBUG_RETURN(-1);
+    }
+    if (opt_ndb_extra_logging)
+    {
+      sql_print_information("NDB Slave: Table %s.%s using conflict_fn %s.",
+                            table->s->db.str,
+                            table->s->table_name.str,
+                            conflict_fn->name);
+    }
+    break;
+  }
   case CFT_NUMBER_OF_CFTS:
   case CFT_NDB_UNDEF:
     abort();
@@ -5095,10 +5240,15 @@ int ndbcluster_create_binlog_setup(THD *
                       "FAILED CREATE (DISCOVER) EVENT OPERATIONS Event: %s",
                       event_name.c_ptr());
       /* a warning has been issued to the client */
-      DBUG_RETURN(0);
+      break;
     }
     DBUG_RETURN(0);
   }
+
+  if (share)
+  {
+    free_share(&share);
+  }
   DBUG_RETURN(-1);
 }
 

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.1-telco-7.1 branch (jonas.oreland:4249 to 4250) jonas oreland10 Jul