summaryrefslogtreecommitdiff
path: root/mysql-test/r
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/r')
-rw-r--r--mysql-test/r/drop.result2
-rw-r--r--mysql-test/r/have_ndb_extra.require3
-rw-r--r--mysql-test/r/information_schema.result7
-rw-r--r--mysql-test/r/mysqlcheck.result1
-rw-r--r--mysql-test/r/mysqltest.result3
-rw-r--r--mysql-test/r/ndb_alter_table.result29
-rw-r--r--mysql-test/r/ndb_alter_table_row.result26
-rw-r--r--mysql-test/r/ndb_alter_table_stm.result30
-rw-r--r--mysql-test/r/ndb_basic.result7
-rw-r--r--mysql-test/r/ndb_binlog_basic.result62
-rw-r--r--mysql-test/r/ndb_binlog_multi.result43
-rw-r--r--mysql-test/r/ndb_multi.result1
-rw-r--r--mysql-test/r/ndb_multi_row.result69
-rw-r--r--mysql-test/r/not_ndb.require2
-rw-r--r--mysql-test/r/ps_1general.result1
-rw-r--r--mysql-test/r/rpl000009.result3
-rw-r--r--mysql-test/r/rpl_create_database.result4
-rw-r--r--mysql-test/r/rpl_loaddata_m.result1
-rw-r--r--mysql-test/r/rpl_ndb_bank.result120
-rw-r--r--mysql-test/r/rpl_ndb_basic.result90
-rw-r--r--mysql-test/r/rpl_ndb_disk.result73
-rw-r--r--mysql-test/r/rpl_ndb_idempotent.result72
-rw-r--r--mysql-test/r/rpl_ndb_load.result42
-rw-r--r--mysql-test/r/rpl_ndb_multi.result55
-rw-r--r--mysql-test/r/rpl_ndb_sync.result95
-rw-r--r--mysql-test/r/rpl_row_basic_11bugs.result2
-rw-r--r--mysql-test/r/rpl_row_basic_7ndb.result426
-rw-r--r--mysql-test/r/schema.result1
-rw-r--r--mysql-test/r/show_check.result1
29 files changed, 1239 insertions, 32 deletions
diff --git a/mysql-test/r/drop.result b/mysql-test/r/drop.result
index 979e5d48871..02342485c04 100644
--- a/mysql-test/r/drop.result
+++ b/mysql-test/r/drop.result
@@ -47,6 +47,7 @@ create database mysqltest;
show databases;
Database
information_schema
+cluster_replication
mysql
mysqltest
test
@@ -58,6 +59,7 @@ drop database mysqltest;
show databases;
Database
information_schema
+cluster_replication
mysql
test
drop database mysqltest;
diff --git a/mysql-test/r/have_ndb_extra.require b/mysql-test/r/have_ndb_extra.require
new file mode 100644
index 00000000000..8f7c125196a
--- /dev/null
+++ b/mysql-test/r/have_ndb_extra.require
@@ -0,0 +1,3 @@
+select 1;
+1
+1
diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result
index 5357220b6c5..9cb96c2d73b 100644
--- a/mysql-test/r/information_schema.result
+++ b/mysql-test/r/information_schema.result
@@ -14,6 +14,7 @@ NULL test latin1 latin1_swedish_ci NULL
select schema_name from information_schema.schemata;
schema_name
information_schema
+cluster_replication
mysql
test
show databases like 't%';
@@ -22,6 +23,7 @@ test
show databases;
Database
information_schema
+cluster_replication
mysql
test
show databases where `database` = 't%';
@@ -55,6 +57,7 @@ TABLE_PRIVILEGES
TRIGGERS
VIEWS
USER_PRIVILEGES
+binlog_index
columns_priv
db
event
@@ -331,6 +334,7 @@ create view v0 (c) as select schema_name from information_schema.schemata;
select * from v0;
c
information_schema
+cluster_replication
mysql
test
explain select * from v0;
@@ -728,7 +732,7 @@ CREATE TABLE t_crashme ( f1 BIGINT);
CREATE VIEW a1 (t_CRASHME) AS SELECT f1 FROM t_crashme GROUP BY f1;
CREATE VIEW a2 AS SELECT t_CRASHME FROM a1;
count(*)
-106
+107
drop view a2, a1;
drop table t_crashme;
select table_schema,table_name, column_name from
@@ -810,6 +814,7 @@ delete from mysql.db where user='mysqltest_4';
flush privileges;
SELECT table_schema, count(*) FROM information_schema.TABLES GROUP BY TABLE_SCHEMA;
table_schema count(*)
+cluster_replication 1
information_schema 19
mysql 19
create table t1 (i int, j int);
diff --git a/mysql-test/r/mysqlcheck.result b/mysql-test/r/mysqlcheck.result
index 1d6bfda0f55..e6251dd9422 100644
--- a/mysql-test/r/mysqlcheck.result
+++ b/mysql-test/r/mysqlcheck.result
@@ -1,3 +1,4 @@
+cluster_replication.binlog_index OK
mysql.columns_priv OK
mysql.db OK
mysql.event OK
diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result
index 067054510c2..ed474265b9b 100644
--- a/mysql-test/r/mysqltest.result
+++ b/mysql-test/r/mysqltest.result
@@ -215,12 +215,11 @@ a long $where variable content
mysqltest: At line 1: Missing arguments to let
mysqltest: At line 1: Missing variable name in let
-mysqltest: At line 1: Variable name in hi=hi does not start with '$'
mysqltest: At line 1: Missing assignment operator in let
mysqltest: At line 1: Missing assignment operator in let
mysqltest: At line 1: Missing arguments to let
mysqltest: At line 1: Missing variable name in let
-mysqltest: At line 1: Variable name in =hi does not start with '$'
+mysqltest: At line 1: Missing variable name in let
mysqltest: At line 1: Missing assignment operator in let
mysqltest: At line 1: Missing file name in source
mysqltest: At line 1: Could not open file ./non_existingFile
diff --git a/mysql-test/r/ndb_alter_table.result b/mysql-test/r/ndb_alter_table.result
index 7526e7348d6..a0220a0bad8 100644
--- a/mysql-test/r/ndb_alter_table.result
+++ b/mysql-test/r/ndb_alter_table.result
@@ -170,35 +170,6 @@ c
4
5
drop table t1;
-create table t1 ( a int primary key, b varchar(10), c varchar(10), index (b) )
-engine=ndb;
-insert into t1 values (1,'one','one'), (2,'two','two'), (3,'three','three');
-create index c on t1(c);
-select * from t1 where b = 'two';
-a b c
-2 two two
-alter table t1 drop index c;
-select * from t1 where b = 'two';
-ERROR HY000: Can't lock file (errno: 159)
-select * from t1 where b = 'two';
-a b c
-2 two two
-drop table t1;
-create table t3 (a int primary key) engine=ndbcluster;
-begin;
-insert into t3 values (1);
-alter table t3 rename t4;
-delete from t3;
-insert into t3 values (1);
-commit;
-select * from t3;
-ERROR HY000: Can't lock file (errno: 155)
-select * from t4;
-a
-1
-drop table t4;
-show tables;
-Tables_in_test
create table t1 (
ai bigint auto_increment,
c001 int(11) not null,
diff --git a/mysql-test/r/ndb_alter_table_row.result b/mysql-test/r/ndb_alter_table_row.result
new file mode 100644
index 00000000000..450b2c9a5af
--- /dev/null
+++ b/mysql-test/r/ndb_alter_table_row.result
@@ -0,0 +1,26 @@
+DROP TABLE IF EXISTS t1;
+create table t1 ( a int primary key, b varchar(10), c varchar(10), index (b) )
+engine=ndb;
+insert into t1 values (1,'one','one'), (2,'two','two'), (3,'three','three');
+create index c on t1(c);
+select * from t1 where c = 'two';
+a b c
+2 two two
+alter table t1 drop index c;
+select * from t1 where c = 'two';
+a b c
+2 two two
+drop table t1;
+create table t3 (a int primary key) engine=ndbcluster;
+begin;
+insert into t3 values (1);
+alter table t3 rename t4;
+commit;
+select * from t3;
+ERROR 42S02: Table 'test.t3' doesn't exist
+select * from t4;
+a
+1
+drop table t4;
+show tables;
+Tables_in_test
diff --git a/mysql-test/r/ndb_alter_table_stm.result b/mysql-test/r/ndb_alter_table_stm.result
new file mode 100644
index 00000000000..a48c23f3cbd
--- /dev/null
+++ b/mysql-test/r/ndb_alter_table_stm.result
@@ -0,0 +1,30 @@
+DROP TABLE IF EXISTS t1;
+create table t1 ( a int primary key, b varchar(10), c varchar(10), index (b) )
+engine=ndb;
+insert into t1 values (1,'one','one'), (2,'two','two'), (3,'three','three');
+create index c on t1(c);
+select * from t1 where c = 'two';
+a b c
+2 two two
+alter table t1 drop index c;
+select * from t1 where c = 'two';
+ERROR HY000: Can't lock file (errno: 159)
+select * from t1 where c = 'two';
+a b c
+2 two two
+drop table t1;
+create table t3 (a int primary key) engine=ndbcluster;
+begin;
+insert into t3 values (1);
+alter table t3 rename t4;
+delete from t3;
+insert into t3 values (1);
+commit;
+select * from t3;
+ERROR HY000: Can't lock file (errno: 155)
+select * from t4;
+a
+1
+drop table t4;
+show tables;
+Tables_in_test
diff --git a/mysql-test/r/ndb_basic.result b/mysql-test/r/ndb_basic.result
index 00308720792..1e863c9012f 100644
--- a/mysql-test/r/ndb_basic.result
+++ b/mysql-test/r/ndb_basic.result
@@ -6,6 +6,13 @@ attr1 INT NOT NULL,
attr2 INT,
attr3 VARCHAR(10)
) ENGINE=ndbcluster;
+drop table t1;
+CREATE TABLE t1 (
+pk1 INT NOT NULL PRIMARY KEY,
+attr1 INT NOT NULL,
+attr2 INT,
+attr3 VARCHAR(10)
+) ENGINE=ndbcluster;
SHOW INDEX FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 0 PRIMARY 1 pk1 A 0 NULL NULL BTREE
diff --git a/mysql-test/r/ndb_binlog_basic.result b/mysql-test/r/ndb_binlog_basic.result
new file mode 100644
index 00000000000..d84a331ee16
--- /dev/null
+++ b/mysql-test/r/ndb_binlog_basic.result
@@ -0,0 +1,62 @@
+drop table if exists t1, t2;
+drop database if exists mysqltest;
+create database mysqltest;
+use mysqltest;
+drop database mysqltest;
+use test;
+create table t1 (a int primary key) engine=ndb;
+insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+select @max_epoch:=max(epoch)-1 from cluster_replication.binlog_index;
+@max_epoch:=max(epoch)-1
+#
+delete from t1;
+alter table t1 add (b int);
+insert into t1 values (3,3),(4,4);
+alter table t1 rename t2;
+begin;
+insert into t2 values (1,1),(2,2);
+update t2 set b=1 where a=3;
+delete from t2 where a=4;
+commit;
+drop table t2;
+select inserts from cluster_replication.binlog_index where epoch > @max_epoch and inserts > 5;
+inserts
+10
+select deletes from cluster_replication.binlog_index where epoch > @max_epoch and deletes > 5;
+deletes
+10
+select inserts,updates,deletes from
+cluster_replication.binlog_index where epoch > @max_epoch and updates > 0;
+inserts updates deletes
+2 1 1
+select schemaops from
+cluster_replication.binlog_index where epoch > @max_epoch and schemaops > 0;
+schemaops
+1
+1
+1
+flush logs;
+purge master logs before now();
+select count(*) from cluster_replication.binlog_index;
+count(*)
+0
+create table t1 (a int primary key, b int) engine=ndb;
+create database mysqltest;
+use mysqltest;
+create table t1 (c int, d int primary key) engine=ndb;
+use test;
+insert into mysqltest.t1 values (2,1),(2,2);
+select @max_epoch:=max(epoch)-1 from cluster_replication.binlog_index;
+@max_epoch:=max(epoch)-1
+#
+drop table t1;
+drop database mysqltest;
+select inserts,updates,deletes from
+cluster_replication.binlog_index where epoch > @max_epoch and inserts > 0;
+inserts updates deletes
+2 0 0
+select schemaops from
+cluster_replication.binlog_index where epoch > @max_epoch and schemaops > 0;
+schemaops
+1
+1
diff --git a/mysql-test/r/ndb_binlog_multi.result b/mysql-test/r/ndb_binlog_multi.result
new file mode 100644
index 00000000000..5f739327db2
--- /dev/null
+++ b/mysql-test/r/ndb_binlog_multi.result
@@ -0,0 +1,43 @@
+drop table if exists t1,t2;
+drop table if exists t1,t2;
+SHOW TABLES;
+Tables_in_test
+CREATE TABLE t2 (a INT PRIMARY KEY, b int) ENGINE = NDB;
+show tables;
+Tables_in_test
+t2
+INSERT INTO t2 VALUES (1,1),(2,2);
+select * from t2 order by a;
+a b
+1 1
+2 2
+SELECT @the_epoch:=epoch,inserts,updates,deletes,schemaops FROM
+cluster_replication.binlog_index ORDER BY epoch DESC LIMIT 1;
+@the_epoch:=epoch inserts updates deletes schemaops
+<the_epoch> 2 0 0 0
+SELECT * FROM t2 ORDER BY a;
+a b
+1 1
+2 2
+SELECT inserts,updates,deletes,schemaops FROM
+cluster_replication.binlog_index WHERE epoch=<the_epoch>;
+inserts updates deletes schemaops
+2 0 0 0
+DROP TABLE t2;
+CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = NDB;
+INSERT INTO t1 VALUES (1),(2);
+SELECT @the_epoch2:=epoch,inserts,updates,deletes,schemaops FROM
+cluster_replication.binlog_index ORDER BY epoch DESC LIMIT 1;
+@the_epoch2:=epoch inserts updates deletes schemaops
+<the_epoch2> 2 0 0 0
+SELECT inserts,updates,deletes,schemaops FROM
+cluster_replication.binlog_index WHERE epoch > <the_epoch> AND epoch < <the_epoch2>;
+inserts updates deletes schemaops
+0 0 0 1
+drop table t1;
+SHOW TABLES;
+Tables_in_test
+SELECT inserts,updates,deletes,schemaops FROM
+cluster_replication.binlog_index WHERE epoch > <the_epoch> AND epoch < <the_epoch2>;
+inserts updates deletes schemaops
+0 0 0 1
diff --git a/mysql-test/r/ndb_multi.result b/mysql-test/r/ndb_multi.result
index 8409ccab1ea..5147d052d6e 100644
--- a/mysql-test/r/ndb_multi.result
+++ b/mysql-test/r/ndb_multi.result
@@ -1,4 +1,5 @@
drop table if exists t1, t2, t3, t4;
+drop table if exists t1, t2, t3, t4;
flush status;
create table t1 (a int) engine=ndbcluster;
create table t2 (a int) engine=ndbcluster;
diff --git a/mysql-test/r/ndb_multi_row.result b/mysql-test/r/ndb_multi_row.result
new file mode 100644
index 00000000000..ac94ebc3e5c
--- /dev/null
+++ b/mysql-test/r/ndb_multi_row.result
@@ -0,0 +1,69 @@
+drop table if exists t1, t2, t3, t4;
+drop table if exists t1, t2, t3, t4;
+flush status;
+create table t1 (a int) engine=ndbcluster;
+create table t2 (a int) engine=ndbcluster;
+insert into t1 value (2);
+insert into t2 value (3);
+select * from t1;
+a
+2
+select * from t2;
+a
+3
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 0
+select * from t1;
+a
+2
+drop table t1;
+create table t1 (a int) engine=ndbcluster;
+insert into t1 value (2);
+select * from t1;
+a
+2
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 0
+drop table t1;
+create table t1 (a int) engine=ndbcluster;
+insert into t1 value (2);
+select * from t1;
+a
+2
+flush status;
+select * from t1;
+a
+2
+update t1 set a=3 where a=2;
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 0
+create table t3 (a int not null primary key, b varchar(22),
+c int, last_col text) engine=ndb;
+insert into t3 values(1, 'Hi!', 89, 'Longtext column');
+create table t4 (pk int primary key, b int) engine=ndb;
+select * from t1;
+a
+3
+select * from t3;
+a b c last_col
+1 Hi! 89 Longtext column
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 1
+show tables like 't4';
+Tables_in_test (t4)
+t4
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 2
+show tables;
+Tables_in_test
+t1
+t2
+t3
+t4
+drop table t1, t2, t3, t4;
+drop table t1, t3, t4;
diff --git a/mysql-test/r/not_ndb.require b/mysql-test/r/not_ndb.require
new file mode 100644
index 00000000000..36fcf7958d4
--- /dev/null
+++ b/mysql-test/r/not_ndb.require
@@ -0,0 +1,2 @@
+Variable_name Value
+have_ndbcluster NO
diff --git a/mysql-test/r/ps_1general.result b/mysql-test/r/ps_1general.result
index 756772c16a5..cf858cc1d32 100644
--- a/mysql-test/r/ps_1general.result
+++ b/mysql-test/r/ps_1general.result
@@ -259,6 +259,7 @@ prepare stmt4 from ' show databases ';
execute stmt4;
Database
information_schema
+cluster_replication
mysql
test
prepare stmt4 from ' show tables from test like ''t2%'' ';
diff --git a/mysql-test/r/rpl000009.result b/mysql-test/r/rpl000009.result
index a4dbf54f39b..9a3a2e7af3f 100644
--- a/mysql-test/r/rpl000009.result
+++ b/mysql-test/r/rpl000009.result
@@ -33,6 +33,7 @@ create database mysqltest;
show databases;
Database
information_schema
+cluster_replication
mysql
mysqltest
mysqltest2
@@ -50,6 +51,7 @@ set sql_log_bin = 1;
show databases;
Database
information_schema
+cluster_replication
mysql
test
create database mysqltest2;
@@ -69,6 +71,7 @@ load data from master;
show databases;
Database
information_schema
+cluster_replication
mysql
mysqltest
mysqltest2
diff --git a/mysql-test/r/rpl_create_database.result b/mysql-test/r/rpl_create_database.result
index 82ab8c6f434..74708c8ec9a 100644
--- a/mysql-test/r/rpl_create_database.result
+++ b/mysql-test/r/rpl_create_database.result
@@ -23,6 +23,7 @@ ALTER DATABASE mysqltest_bob CHARACTER SET latin1;
SHOW DATABASES;
Database
information_schema
+cluster_replication
mysql
mysqltest_bob
mysqltest_prometheus
@@ -31,6 +32,7 @@ test
SHOW DATABASES;
Database
information_schema
+cluster_replication
mysql
mysqltest_prometheus
mysqltest_sisyfos
@@ -45,6 +47,7 @@ CREATE TABLE t2 (a INT);
SHOW DATABASES;
Database
information_schema
+cluster_replication
mysql
mysqltest_bob
mysqltest_prometheus
@@ -53,6 +56,7 @@ test
SHOW DATABASES;
Database
information_schema
+cluster_replication
mysql
mysqltest_prometheus
mysqltest_sisyfos
diff --git a/mysql-test/r/rpl_loaddata_m.result b/mysql-test/r/rpl_loaddata_m.result
index 1d263a41e1b..54348df9aaa 100644
--- a/mysql-test/r/rpl_loaddata_m.result
+++ b/mysql-test/r/rpl_loaddata_m.result
@@ -21,6 +21,7 @@ COUNT(*)
SHOW DATABASES;
Database
information_schema
+cluster_replication
mysql
mysqltest
test
diff --git a/mysql-test/r/rpl_ndb_bank.result b/mysql-test/r/rpl_ndb_bank.result
new file mode 100644
index 00000000000..2d2d54c9170
--- /dev/null
+++ b/mysql-test/r/rpl_ndb_bank.result
@@ -0,0 +1,120 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE DATABASE IF NOT EXISTS BANK;
+DROP DATABASE BANK;
+CREATE DATABASE BANK default charset=latin1 default collate=latin1_bin;
+USE BANK;
+CREATE TABLE GL ( TIME BIGINT UNSIGNED NOT NULL,
+ACCOUNT_TYPE INT UNSIGNED NOT NULL,
+BALANCE INT UNSIGNED NOT NULL,
+DEPOSIT_COUNT INT UNSIGNED NOT NULL,
+DEPOSIT_SUM INT UNSIGNED NOT NULL,
+WITHDRAWAL_COUNT INT UNSIGNED NOT NULL,
+WITHDRAWAL_SUM INT UNSIGNED NOT NULL,
+PURGED INT UNSIGNED NOT NULL,
+PRIMARY KEY USING HASH (TIME,ACCOUNT_TYPE))
+ENGINE = NDB;
+CREATE TABLE ACCOUNT ( ACCOUNT_ID INT UNSIGNED NOT NULL,
+OWNER INT UNSIGNED NOT NULL,
+BALANCE INT UNSIGNED NOT NULL,
+ACCOUNT_TYPE INT UNSIGNED NOT NULL,
+PRIMARY KEY USING HASH (ACCOUNT_ID))
+ENGINE = NDB;
+CREATE TABLE TRANSACTION ( TRANSACTION_ID BIGINT UNSIGNED NOT NULL,
+ACCOUNT INT UNSIGNED NOT NULL,
+ACCOUNT_TYPE INT UNSIGNED NOT NULL,
+OTHER_ACCOUNT INT UNSIGNED NOT NULL,
+TRANSACTION_TYPE INT UNSIGNED NOT NULL,
+TIME BIGINT UNSIGNED NOT NULL,
+AMOUNT INT UNSIGNED NOT NULL,
+PRIMARY KEY USING HASH (TRANSACTION_ID,ACCOUNT))
+ENGINE = NDB;
+CREATE TABLE SYSTEM_VALUES ( SYSTEM_VALUES_ID INT UNSIGNED NOT NULL,
+VALUE BIGINT UNSIGNED NOT NULL,
+PRIMARY KEY USING HASH (SYSTEM_VALUES_ID))
+ENGINE = NDB;
+CREATE TABLE ACCOUNT_TYPE ( ACCOUNT_TYPE_ID INT UNSIGNED NOT NULL,
+DESCRIPTION CHAR(64) NOT NULL,
+PRIMARY KEY USING HASH (ACCOUNT_TYPE_ID))
+ENGINE = NDB;
+STOP SLAVE;
+RESET SLAVE;
+CREATE DATABASE IF NOT EXISTS BANK;
+DROP DATABASE BANK;
+CREATE DATABASE BANK;
+RESET MASTER;
+CREATE TABLE IF NOT EXISTS cluster_replication.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+DELETE FROM cluster_replication.backup_info;
+LOAD DATA INFILE '../../var/tmp.dat' INTO TABLE cluster_replication.backup_info FIELDS TERMINATED BY ',';
+SELECT @the_backup_id:=backup_id FROM cluster_replication.backup_info;
+@the_backup_id:=backup_id
+<the_backup_id>
+SELECT @the_epoch:=MAX(epoch) FROM cluster_replication.apply_status;
+@the_epoch:=MAX(epoch)
+<the_epoch>
+SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
+FROM cluster_replication.binlog_index WHERE epoch > <the_epoch> ORDER BY epoch ASC LIMIT 1;
+@the_pos:=Position @the_file:=SUBSTRING_INDEX(FILE, '/', -1)
+<the_pos> master-bin.000001
+CHANGE MASTER TO
+master_log_file = 'master-bin.000001',
+master_log_pos = <the_pos>;
+START SLAVE;
+SHOW SLAVE STATUS;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master>
+STOP SLAVE;
+START SLAVE;
+SHOW SLAVE STATUS;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master>
+STOP SLAVE;
+START SLAVE;
+SHOW SLAVE STATUS;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master>
+STOP SLAVE;
+START SLAVE;
+SHOW SLAVE STATUS;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master>
+STOP SLAVE;
+START SLAVE;
+SHOW SLAVE STATUS;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master>
+STOP SLAVE;
+START SLAVE;
+SHOW SLAVE STATUS;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master>
+STOP SLAVE;
+START SLAVE;
+SHOW SLAVE STATUS;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master>
+STOP SLAVE;
+START SLAVE;
+SHOW SLAVE STATUS;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master>
+STOP SLAVE;
+START SLAVE;
+SHOW SLAVE STATUS;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master>
+STOP SLAVE;
+START SLAVE;
+SHOW SLAVE STATUS;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master>
+STOP SLAVE;
+START SLAVE;
+use test;
+create table t1 (a int primary key) engine=ndb;
+insert into t1 values (1);
+drop table t1;
diff --git a/mysql-test/r/rpl_ndb_basic.result b/mysql-test/r/rpl_ndb_basic.result
new file mode 100644
index 00000000000..0fe681622c9
--- /dev/null
+++ b/mysql-test/r/rpl_ndb_basic.result
@@ -0,0 +1,90 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0',
+`nom` char(4) default NULL,
+`prenom` char(4) default NULL,
+PRIMARY KEY (`nid`))
+ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO t1 VALUES(1,"XYZ1","ABC1");
+select * from t1 order by nid;
+nid nom prenom
+1 XYZ1 ABC1
+select * from t1 order by nid;
+nid nom prenom
+1 XYZ1 ABC1
+delete from t1;
+INSERT INTO t1 VALUES(1,"XYZ2","ABC2");
+select * from t1 order by nid;
+nid nom prenom
+1 XYZ2 ABC2
+select * from t1 order by nid;
+nid nom prenom
+1 XYZ2 ABC2
+DROP table t1;
+CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0',
+`nom` char(4) default NULL,
+`prenom` char(4) default NULL)
+ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO t1 VALUES(1,"XYZ1","ABC1"),(2,"AAA","BBB"),(3,"CCC","DDD");
+select * from t1 order by nid;
+nid nom prenom
+1 XYZ1 ABC1
+2 AAA BBB
+3 CCC DDD
+select * from t1 order by nid;
+nid nom prenom
+1 XYZ1 ABC1
+2 AAA BBB
+3 CCC DDD
+delete from t1 where nid = 2;
+INSERT INTO t1 VALUES(4,"EEE","FFF");
+select * from t1 order by nid;
+nid nom prenom
+1 XYZ1 ABC1
+3 CCC DDD
+4 EEE FFF
+select * from t1 order by nid;
+nid nom prenom
+1 XYZ1 ABC1
+3 CCC DDD
+4 EEE FFF
+UPDATE t1 set nid=nid+1;
+UPDATE t1 set nom="CCP" where nid = 4;
+select * from t1 order by nid;
+nid nom prenom
+2 XYZ1 ABC1
+4 CCP DDD
+5 EEE FFF
+select * from t1 order by nid;
+nid nom prenom
+2 XYZ1 ABC1
+4 CCP DDD
+5 EEE FFF
+DROP table t1;
+CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0',
+`nom` char(4) default NULL,
+`prenom` char(4) default NULL,
+PRIMARY KEY USING HASH (`nid`))
+ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO t1 VALUES(1,"XYZ1","ABC1");
+BEGIN;
+UPDATE t1 SET `nom`="LOCK" WHERE `nid`=1;
+set GLOBAL slave_transaction_retries=1;
+UPDATE t1 SET `nom`="DEAD" WHERE `nid`=1;
+SHOW SLAVE STATUS;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes No <Replicate_Ignore_Table> 146 Error in Write_rows event: error during transaction execution on table test.t1 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master>
+set GLOBAL slave_transaction_retries=10;
+START SLAVE;
+select * from t1 order by nid;
+nid nom prenom
+1 LOCK ABC1
+COMMIT;
+select * from t1 order by nid;
+nid nom prenom
+1 DEAD ABC1
+DROP TABLE t1;
diff --git a/mysql-test/r/rpl_ndb_disk.result b/mysql-test/r/rpl_ndb_disk.result
new file mode 100644
index 00000000000..24488b8e62d
--- /dev/null
+++ b/mysql-test/r/rpl_ndb_disk.result
@@ -0,0 +1,73 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP TABLE IF EXISTS t1;
+CREATE LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile.dat'
+INITIAL_SIZE 16M
+UNDO_BUFFER_SIZE = 1M
+ENGINE=NDB;
+alter logfile group lg1
+add undofile 'undofile02.dat'
+initial_size 4M engine=ndb;
+CREATE TABLESPACE ts1
+ADD DATAFILE 'datafile.dat'
+USE LOGFILE GROUP lg1
+INITIAL_SIZE 12M
+ENGINE NDB;
+alter tablespace ts1
+add datafile 'datafile02.dat'
+initial_size 4M engine=ndb;
+CREATE TABLE t1
+(pk1 int not null primary key, b int not null, c int not null)
+tablespace ts1 storage disk
+engine ndb;
+insert into t1 values (1,2,3);
+select * from t1 order by pk1;
+pk1 b c
+1 2 3
+select * from t1 order by pk1;
+pk1 b c
+1 2 3
+show binlog events;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 102 Server ver: VERSION, Binlog ver: 4
+master-bin.000001 102 Query 1 188 use `test`; DROP TABLE IF EXISTS t1
+master-bin.000001 188 Query 1 353 CREATE LOGFILE GROUP lg1
+ADD UNDOFILE 'undofile.dat'
+INITIAL_SIZE 16M
+UNDO_BUFFER_SIZE = 1M
+ENGINE=NDB
+master-bin.000001 353 Query 1 496 alter logfile group lg1
+add undofile 'undofile02.dat'
+initial_size 4M engine=ndb
+master-bin.000001 496 Query 1 658 CREATE TABLESPACE ts1
+ADD DATAFILE 'datafile.dat'
+USE LOGFILE GROUP lg1
+INITIAL_SIZE 12M
+ENGINE NDB
+master-bin.000001 658 Query 1 798 alter tablespace ts1
+add datafile 'datafile02.dat'
+initial_size 4M engine=ndb
+master-bin.000001 798 Query 1 978 use `test`; CREATE TABLE t1
+(pk1 int not null primary key, b int not null, c int not null)
+tablespace ts1 storage disk
+engine ndb
+master-bin.000001 978 Query 1 1042 BEGIN
+master-bin.000001 1042 Table_map 1 65 cluster_replication.apply_status
+master-bin.000001 1107 Write_rows 1 107
+master-bin.000001 1149 Table_map 1 148 test.t1
+master-bin.000001 1190 Write_rows 1 190
+master-bin.000001 1232 Query 1 1297 COMMIT
+drop table t1;
+alter tablespace ts1
+drop datafile 'datafile.dat'
+engine=ndb;
+alter tablespace ts1
+drop datafile 'datafile02.dat'
+engine=ndb;
+DROP TABLESPACE ts1 ENGINE=NDB;
+DROP LOGFILE GROUP lg1 ENGINE=NDB;
diff --git a/mysql-test/r/rpl_ndb_idempotent.result b/mysql-test/r/rpl_ndb_idempotent.result
new file mode 100644
index 00000000000..054ff599c23
--- /dev/null
+++ b/mysql-test/r/rpl_ndb_idempotent.result
@@ -0,0 +1,72 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (c1 CHAR(15), c2 CHAR(15), c3 INT, PRIMARY KEY (c3)) ENGINE = NDB ;
+INSERT INTO t1 VALUES ("row1","will go away",1);
+SELECT * FROM t1 ORDER BY c3;
+c1 c2 c3
+row1 will go away 1
+SELECT @the_epoch:=MAX(epoch) FROM cluster_replication.apply_status;
+@the_epoch:=MAX(epoch)
+<the_epoch>
+SELECT * FROM t1 ORDER BY c3;
+c1 c2 c3
+row1 will go away 1
+SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
+FROM cluster_replication.binlog_index WHERE epoch = <the_epoch> ;
+@the_pos:=Position @the_file:=SUBSTRING_INDEX(FILE, '/', -1)
+<the_pos> master-bin.000001
+INSERT INTO t1 VALUES ("row2","will go away",2),("row3","will change",3),("row4","D",4);
+DELETE FROM t1 WHERE c3 = 1;
+UPDATE t1 SET c2="should go away" WHERE c3 = 2;
+UPDATE t1 SET c2="C" WHERE c3 = 3;
+DELETE FROM t1 WHERE c3 = 2;
+SELECT * FROM t1 ORDER BY c3;
+c1 c2 c3
+row3 C 3
+row4 D 4
+SELECT * FROM t1 ORDER BY c3;
+c1 c2 c3
+row3 C 3
+row4 D 4
+SHOW SLAVE STATUS;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master>
+STOP SLAVE;
+CHANGE MASTER TO
+master_log_file = 'master-bin.000001',
+master_log_pos = <the_pos> ;
+SHOW SLAVE STATUS;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 No No <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master>
+START SLAVE;
+SELECT * FROM t1 ORDER BY c3;
+c1 c2 c3
+row3 C 3
+row4 D 4
+SELECT * FROM t1 ORDER BY c3;
+c1 c2 c3
+row3 C 3
+row4 D 4
+STOP SLAVE;
+DROP TABLE t1;
+RESET master;
+DROP TABLE t1;
+RESET slave;
+START SLAVE;
+CREATE TABLE t1 (c1 CHAR(15) NOT NULL, c2 CHAR(15) NOT NULL, c3 INT NOT NULL, PRIMARY KEY (c3)) ENGINE = NDB ;
+INSERT INTO t1 VALUES ("row1","remove on slave",1);
+DELETE FROM t1;
+BEGIN;
+UPDATE t1 SET c2="does not exist" WHERE c3=1;
+INSERT INTO t1 VALUES ("row2","new on slave",2);
+COMMIT;
+SELECT * FROM t1;
+c1 c2 c3
+row2 new on slave 2
+SHOW SLAVE STATUS;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master>
diff --git a/mysql-test/r/rpl_ndb_load.result b/mysql-test/r/rpl_ndb_load.result
new file mode 100644
index 00000000000..e51f0096557
--- /dev/null
+++ b/mysql-test/r/rpl_ndb_load.result
@@ -0,0 +1,42 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP DATABASE IF EXISTS TEST_DB;
+CREATE DATABASE TEST_DB;
+USE TEST_DB;
+CREATE TABLE SUBSCRIBER
+( NUMBER CHAR(12) BINARY NOT NULL,
+NAME CHAR(32) BINARY NOT NULL,
+GROUP_ID INT UNSIGNED NOT NULL,
+LOCATION INT UNSIGNED NOT NULL,
+SESSIONS INT UNSIGNED NOT NULL,
+CHANGED_BY CHAR(32) BINARY NOT NULL,
+CHANGED_TIME CHAR(32) BINARY NOT NULL,
+PRIMARY KEY USING HASH (NUMBER))
+ENGINE = NDB;
+CREATE TABLE GROUP2
+( GROUP_ID INT UNSIGNED NOT NULL,
+GROUP_NAME CHAR(32) BINARY NOT NULL,
+ALLOW_READ CHAR(1) BINARY NOT NULL,
+ALLOW_INSERT INT UNSIGNED NOT NULL,
+ALLOW_DELETE INT UNSIGNED NOT NULL,
+PRIMARY KEY USING HASH (GROUP_ID))
+ENGINE = NDB;
+CREATE TABLE SESSION
+( NUMBER CHAR(12) BINARY NOT NULL,
+SERVER_ID INT UNSIGNED NOT NULL,
+DATA BINARY(2000) NOT NULL,
+PRIMARY KEY USING HASH (NUMBER,SERVER_ID))
+ENGINE = NDB;
+CREATE TABLE SERVER
+( SUFFIX CHAR(2) BINARY NOT NULL,
+SERVER_ID INT UNSIGNED NOT NULL,
+NAME CHAR(32) BINARY NOT NULL,
+NO_OF_READ INT UNSIGNED NOT NULL,
+NO_OF_INSERT INT UNSIGNED NOT NULL,
+NO_OF_DELETE INT UNSIGNED NOT NULL,
+PRIMARY KEY USING HASH (SUFFIX, SERVER_ID))
+ENGINE = NDB;
diff --git a/mysql-test/r/rpl_ndb_multi.result b/mysql-test/r/rpl_ndb_multi.result
new file mode 100644
index 00000000000..d3afd787613
--- /dev/null
+++ b/mysql-test/r/rpl_ndb_multi.result
@@ -0,0 +1,55 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (c1 CHAR(15), c2 CHAR(15), c3 INT, PRIMARY KEY (c3)) ENGINE = NDB ;
+reset master;
+SHOW TABLES;
+Tables_in_test
+t1
+INSERT INTO t1 VALUES ("row1","will go away",1);
+SELECT * FROM t1 ORDER BY c3;
+c1 c2 c3
+row1 will go away 1
+SELECT * FROM t1 ORDER BY c3;
+c1 c2 c3
+row1 will go away 1
+SELECT @the_epoch:=MAX(epoch) FROM cluster_replication.apply_status;
+@the_epoch:=MAX(epoch)
+<the_epoch>
+SELECT * FROM t1 ORDER BY c3;
+c1 c2 c3
+row1 will go away 1
+stop slave;
+SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
+FROM cluster_replication.binlog_index WHERE epoch = <the_epoch> ;
+@the_pos:=Position @the_file:=SUBSTRING_INDEX(FILE, '/', -1)
+102 master-bin1.000001
+CHANGE MASTER TO
+master_port=<MASTER_PORT1>,
+master_log_file = 'master-bin1.000001',
+master_log_pos = 102 ;
+start slave;
+INSERT INTO t1 VALUES ("row2","will go away",2),("row3","will change",3),("row4","D",4);
+DELETE FROM t1 WHERE c3 = 1;
+UPDATE t1 SET c2="should go away" WHERE c3 = 2;
+UPDATE t1 SET c2="C" WHERE c3 = 3;
+DELETE FROM t1 WHERE c3 = 2;
+SELECT * FROM t1 ORDER BY c3;
+c1 c2 c3
+row3 C 3
+row4 D 4
+INSERT INTO t1 VALUES ("row5","E",5);
+SELECT * FROM t1 ORDER BY c3;
+c1 c2 c3
+row3 C 3
+row4 D 4
+row5 E 5
+SELECT * FROM t1 ORDER BY c3;
+c1 c2 c3
+row3 C 3
+row4 D 4
+row5 E 5
+STOP SLAVE;
diff --git a/mysql-test/r/rpl_ndb_sync.result b/mysql-test/r/rpl_ndb_sync.result
new file mode 100644
index 00000000000..44d0efa7e5a
--- /dev/null
+++ b/mysql-test/r/rpl_ndb_sync.result
@@ -0,0 +1,95 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+STOP SLAVE;
+CREATE DATABASE ndbsynctest;
+USE ndbsynctest;
+CREATE DATABASE ndbsynctest;
+USE ndbsynctest;
+CREATE TABLE t1 (c1 BIT(1) NOT NULL, c2 BIT(1) NOT NULL, c3 CHAR(15), PRIMARY KEY(c3)) ENGINE = NDB ;
+INSERT INTO t1 VALUES (1,1,"row1"),(0,1,"row2"),(1,0,"row3"),(0,0,"row4");
+CREATE TABLE t2 (c1 CHAR(15), c2 BIT(1) NOT NULL, c3 BIT(1) NOT NULL, PRIMARY KEY(c1)) ENGINE = NDB ;
+INSERT INTO t2 VALUES ("ABC",1,1),("BCDEF",0,1),("CD",1,0),("DEFGHIJKL",0,0);
+SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3;
+hex(c1) hex(c2) c3
+1 1 row1
+0 1 row2
+1 0 row3
+0 0 row4
+SELECT hex(c2),hex(c3),c1 FROM t2 ORDER BY c1;
+hex(c2) hex(c3) c1
+1 1 ABC
+0 1 BCDEF
+1 0 CD
+0 0 DEFGHIJKL
+CREATE TABLE IF NOT EXISTS cluster_replication.backup_info (id INT, backup_id INT);
+DELETE FROM cluster_replication.backup_info;
+LOAD DATA INFILE '../../var/tmp.dat' INTO TABLE cluster_replication.backup_info FIELDS TERMINATED BY ',';
+SELECT @the_backup_id:=backup_id FROM cluster_replication.backup_info;
+@the_backup_id:=backup_id
+<the_backup_id>
+UPDATE t1 SET c2=0 WHERE c3="row2";
+SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3;
+hex(c1) hex(c2) c3
+1 1 row1
+0 0 row2
+1 0 row3
+0 0 row4
+SHOW TABLES;
+Tables_in_ndbsynctest
+DROP DATABASE ndbsynctest;
+CREATE DATABASE ndbsynctest;
+USE ndbsynctest;
+SHOW TABLES;
+Tables_in_ndbsynctest
+t1
+t2
+SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3;
+hex(c1) hex(c2) c3
+1 1 row1
+0 1 row2
+1 0 row3
+0 0 row4
+SELECT hex(c2),hex(c3),c1 FROM t2 ORDER BY c1;
+hex(c2) hex(c3) c1
+1 1 ABC
+0 1 BCDEF
+1 0 CD
+0 0 DEFGHIJKL
+SELECT @the_epoch:=MAX(epoch) FROM cluster_replication.apply_status;
+@the_epoch:=MAX(epoch)
+<the_epoch>
+SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
+FROM cluster_replication.binlog_index WHERE epoch > <the_epoch> ORDER BY epoch ASC LIMIT 1;
+@the_pos:=Position @the_file:=SUBSTRING_INDEX(FILE, '/', -1)
+<the_pos> master-bin.000001
+CHANGE MASTER TO
+master_log_file = 'master-bin.000001',
+master_log_pos = <the_pos> ;
+START SLAVE;
+SHOW SLAVE STATUS;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master>
+SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3;
+hex(c1) hex(c2) c3
+1 1 row1
+0 0 row2
+1 0 row3
+0 0 row4
+SELECT hex(c2),hex(c3),c1 FROM t2 ORDER BY c1;
+hex(c2) hex(c3) c1
+1 1 ABC
+0 1 BCDEF
+1 0 CD
+0 0 DEFGHIJKL
+DROP DATABASE ndbsynctest;
+STOP SLAVE;
+reset master;
+select * from cluster_replication.binlog_index;
+Position File epoch inserts updates deletes schemaops
+reset slave;
+select * from cluster_replication.apply_status;
+server_id epoch
diff --git a/mysql-test/r/rpl_row_basic_11bugs.result b/mysql-test/r/rpl_row_basic_11bugs.result
index a5267a2bce2..772a22babfe 100644
--- a/mysql-test/r/rpl_row_basic_11bugs.result
+++ b/mysql-test/r/rpl_row_basic_11bugs.result
@@ -9,6 +9,7 @@ CREATE DATABASE test_ignore;
SHOW DATABASES;
Database
information_schema
+cluster_replication
mysql
test
test_ignore
@@ -33,6 +34,7 @@ master-bin.000001 235 Write_rows 1 282
SHOW DATABASES;
Database
information_schema
+cluster_replication
mysql
test
USE test;
diff --git a/mysql-test/r/rpl_row_basic_7ndb.result b/mysql-test/r/rpl_row_basic_7ndb.result
new file mode 100644
index 00000000000..634d5b2b5d5
--- /dev/null
+++ b/mysql-test/r/rpl_row_basic_7ndb.result
@@ -0,0 +1,426 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (C1 CHAR(1), C2 CHAR(1), INDEX (C1)) ENGINE = 'NDB' ;
+SELECT * FROM t1;
+C1 C2
+SELECT * FROM t1;
+C1 C2
+INSERT INTO t1 VALUES ('A','B'), ('X','Y'), ('X','X');
+INSERT INTO t1 VALUES ('A','C'), ('X','Z'), ('A','A');
+SELECT * FROM t1 ORDER BY C1,C2;
+C1 C2
+A A
+A B
+A C
+X X
+X Y
+X Z
+SELECT * FROM t1 ORDER BY C1,C2;
+C1 C2
+A A
+A B
+A C
+X X
+X Y
+X Z
+DELETE FROM t1 WHERE C1 = C2;
+SELECT * FROM t1 ORDER BY C1,C2;
+C1 C2
+A B
+A C
+X Y
+X Z
+SELECT * FROM t1 ORDER BY C1,C2;
+C1 C2
+A B
+A C
+X Y
+X Z
+UPDATE t1 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C';
+SELECT * FROM t1 ORDER BY C1,C2;
+C1 C2
+A B
+A I
+X Y
+X Z
+SELECT * FROM t1 ORDER BY C1,C2;
+C1 C2
+A B
+A I
+X Y
+X Z
+UPDATE t1 SET c2 = 'Q' WHERE c1 = 'A' AND c2 = 'N';
+SELECT * FROM t1 ORDER BY c1,c2;
+C1 C2
+A B
+A I
+X Y
+X Z
+SELECT * FROM t1 ORDER BY c1,c2;
+C1 C2
+A B
+A I
+X Y
+X Z
+CREATE TABLE t2 (c1 INT, c12 char(1), c2 INT, PRIMARY KEY (c1)) ENGINE = 'NDB' ;
+INSERT INTO t2
+VALUES (1,'A',2), (2,'A',4), (3,'A',9), (4,'A',15), (5,'A',25),
+(6,'A',35), (7,'A',50), (8,'A',64), (9,'A',81);
+SELECT * FROM t2 ORDER BY c1,c2;
+c1 c12 c2
+1 A 2
+2 A 4
+3 A 9
+4 A 15
+5 A 25
+6 A 35
+7 A 50
+8 A 64
+9 A 81
+SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
+c1 c12 c2
+2 A 4
+3 A 9
+5 A 25
+8 A 64
+9 A 81
+SELECT * FROM t2 ORDER BY c1,c2;
+c1 c12 c2
+1 A 2
+2 A 4
+3 A 9
+4 A 15
+5 A 25
+6 A 35
+7 A 50
+8 A 64
+9 A 81
+SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
+c1 c12 c2
+2 A 4
+3 A 9
+5 A 25
+8 A 64
+9 A 81
+UPDATE t2 SET c2 = c1*c1 WHERE c2 != c1*c1;
+SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
+c1 c12 c2
+1 A 1
+2 A 4
+3 A 9
+4 A 16
+5 A 25
+6 A 36
+7 A 49
+8 A 64
+9 A 81
+SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
+c1 c12 c2
+1 A 1
+2 A 4
+3 A 9
+4 A 16
+5 A 25
+6 A 36
+7 A 49
+8 A 64
+9 A 81
+UPDATE t2 SET c12 = 'Q' WHERE c1 = 1 AND c2 = 999;
+SELECT * FROM t2 ORDER BY c1,c2;
+c1 c12 c2
+1 A 1
+2 A 4
+3 A 9
+4 A 16
+5 A 25
+6 A 36
+7 A 49
+8 A 64
+9 A 81
+SELECT * FROM t2 ORDER BY c1,c2;
+c1 c12 c2
+1 A 1
+2 A 4
+3 A 9
+4 A 16
+5 A 25
+6 A 36
+7 A 49
+8 A 64
+9 A 81
+DELETE FROM t2 WHERE c1 % 4 = 0;
+SELECT * FROM t2 ORDER BY c1,c2;
+c1 c12 c2
+1 A 1
+2 A 4
+3 A 9
+5 A 25
+6 A 36
+7 A 49
+9 A 81
+SELECT * FROM t2 ORDER BY c1,c2;
+c1 c12 c2
+1 A 1
+2 A 4
+3 A 9
+5 A 25
+6 A 36
+7 A 49
+9 A 81
+UPDATE t2 SET c12='X';
+CREATE TABLE t3 (C1 CHAR(1), C2 CHAR(1), pk1 INT, C3 CHAR(1), pk2 INT, PRIMARY KEY (pk1,pk2)) ENGINE = 'NDB' ;
+INSERT INTO t3 VALUES ('A','B',1,'B',1), ('X','Y',2,'B',1), ('X','X',3,'B',1);
+INSERT INTO t3 VALUES ('A','C',1,'B',2), ('X','Z',2,'B',2), ('A','A',3,'B',2);
+SELECT * FROM t3 ORDER BY C1,C2;
+C1 C2 pk1 C3 pk2
+A A 3 B 2
+A B 1 B 1
+A C 1 B 2
+X X 3 B 1
+X Y 2 B 1
+X Z 2 B 2
+SELECT * FROM t3 ORDER BY C1,C2;
+C1 C2 pk1 C3 pk2
+A A 3 B 2
+A B 1 B 1
+A C 1 B 2
+X X 3 B 1
+X Y 2 B 1
+X Z 2 B 2
+DELETE FROM t3 WHERE C1 = C2;
+SELECT * FROM t3 ORDER BY C1,C2;
+C1 C2 pk1 C3 pk2
+A B 1 B 1
+A C 1 B 2
+X Y 2 B 1
+X Z 2 B 2
+SELECT * FROM t3 ORDER BY C1,C2;
+C1 C2 pk1 C3 pk2
+A B 1 B 1
+A C 1 B 2
+X Y 2 B 1
+X Z 2 B 2
+UPDATE t3 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C';
+SELECT * FROM t3 ORDER BY C1,C2;
+C1 C2 pk1 C3 pk2
+A B 1 B 1
+A I 1 B 2
+X Y 2 B 1
+X Z 2 B 2
+SELECT * FROM t3 ORDER BY C1,C2;
+C1 C2 pk1 C3 pk2
+A B 1 B 1
+A I 1 B 2
+X Y 2 B 1
+X Z 2 B 2
+CREATE TABLE t6 (C1 CHAR(1), C2 CHAR(1), C3 INT) ENGINE = 'NDB' ;
+INSERT INTO t6 VALUES ('A','B',1), ('X','Y',2), ('X','X',3);
+INSERT INTO t6 VALUES ('A','C',4), ('X','Z',5), ('A','A',6);
+SELECT * FROM t6 ORDER BY C3;
+C1 C2 C3
+A B 1
+X Y 2
+X X 3
+A C 4
+X Z 5
+A A 6
+SELECT * FROM t6 ORDER BY C3;
+C1 C2 C3
+A B 1
+X Y 2
+X X 3
+A C 4
+X Z 5
+A A 6
+DELETE FROM t6 WHERE C1 = C2;
+SELECT * FROM t6 ORDER BY C3;
+C1 C2 C3
+A B 1
+X Y 2
+A C 4
+X Z 5
+SELECT * FROM t6 ORDER BY C3;
+C1 C2 C3
+A B 1
+X Y 2
+A C 4
+X Z 5
+UPDATE t6 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C';
+SELECT * FROM t6 ORDER BY C3;
+C1 C2 C3
+A B 1
+X Y 2
+A I 4
+X Z 5
+SELECT * FROM t6 ORDER BY C3;
+C1 C2 C3
+A B 1
+X Y 2
+A I 4
+X Z 5
+CREATE TABLE t5 (C1 CHAR(1), C2 CHAR(1), C3 INT PRIMARY KEY) ENGINE = 'NDB' ;
+INSERT INTO t5 VALUES ('A','B',1), ('X','Y',2), ('X','X',3);
+INSERT INTO t5 VALUES ('A','C',4), ('X','Z',5), ('A','A',6);
+UPDATE t5,t2,t3 SET t5.C2='Q', t2.c12='R', t3.C3 ='S' WHERE t5.C1 = t2.c12 AND t5.C1 = t3.C1;
+SELECT * FROM t5,t2,t3 WHERE t5.C2='Q' AND t2.c12='R' AND t3.C3 ='S' ORDER BY t5.C3,t2.c1,t3.pk1,t3.pk2;
+C1 C2 C3 c1 c12 c2 C1 C2 pk1 C3 pk2
+X Q 2 1 R 1 X Y 2 S 1
+X Q 2 1 R 1 X Z 2 S 2
+X Q 2 2 R 4 X Y 2 S 1
+X Q 2 2 R 4 X Z 2 S 2
+X Q 2 3 R 9 X Y 2 S 1
+X Q 2 3 R 9 X Z 2 S 2
+X Q 2 5 R 25 X Y 2 S 1
+X Q 2 5 R 25 X Z 2 S 2
+X Q 2 6 R 36 X Y 2 S 1
+X Q 2 6 R 36 X Z 2 S 2
+X Q 2 7 R 49 X Y 2 S 1
+X Q 2 7 R 49 X Z 2 S 2
+X Q 2 9 R 81 X Y 2 S 1
+X Q 2 9 R 81 X Z 2 S 2
+X Q 3 1 R 1 X Y 2 S 1
+X Q 3 1 R 1 X Z 2 S 2
+X Q 3 2 R 4 X Y 2 S 1
+X Q 3 2 R 4 X Z 2 S 2
+X Q 3 3 R 9 X Y 2 S 1
+X Q 3 3 R 9 X Z 2 S 2
+X Q 3 5 R 25 X Y 2 S 1
+X Q 3 5 R 25 X Z 2 S 2
+X Q 3 6 R 36 X Y 2 S 1
+X Q 3 6 R 36 X Z 2 S 2
+X Q 3 7 R 49 X Y 2 S 1
+X Q 3 7 R 49 X Z 2 S 2
+X Q 3 9 R 81 X Y 2 S 1
+X Q 3 9 R 81 X Z 2 S 2
+X Q 5 1 R 1 X Y 2 S 1
+X Q 5 1 R 1 X Z 2 S 2
+X Q 5 2 R 4 X Y 2 S 1
+X Q 5 2 R 4 X Z 2 S 2
+X Q 5 3 R 9 X Y 2 S 1
+X Q 5 3 R 9 X Z 2 S 2
+X Q 5 5 R 25 X Y 2 S 1
+X Q 5 5 R 25 X Z 2 S 2
+X Q 5 6 R 36 X Y 2 S 1
+X Q 5 6 R 36 X Z 2 S 2
+X Q 5 7 R 49 X Y 2 S 1
+X Q 5 7 R 49 X Z 2 S 2
+X Q 5 9 R 81 X Y 2 S 1
+X Q 5 9 R 81 X Z 2 S 2
+SELECT * FROM t5,t2,t3 WHERE t5.C2='Q' AND t2.c12='R' AND t3.C3 ='S' ORDER BY t5.C3,t2.c1,t3.pk1,t3.pk2;
+C1 C2 C3 c1 c12 c2 C1 C2 pk1 C3 pk2
+X Q 2 1 R 1 X Y 2 S 1
+X Q 2 1 R 1 X Z 2 S 2
+X Q 2 2 R 4 X Y 2 S 1
+X Q 2 2 R 4 X Z 2 S 2
+X Q 2 3 R 9 X Y 2 S 1
+X Q 2 3 R 9 X Z 2 S 2
+X Q 2 5 R 25 X Y 2 S 1
+X Q 2 5 R 25 X Z 2 S 2
+X Q 2 6 R 36 X Y 2 S 1
+X Q 2 6 R 36 X Z 2 S 2
+X Q 2 7 R 49 X Y 2 S 1
+X Q 2 7 R 49 X Z 2 S 2
+X Q 2 9 R 81 X Y 2 S 1
+X Q 2 9 R 81 X Z 2 S 2
+X Q 3 1 R 1 X Y 2 S 1
+X Q 3 1 R 1 X Z 2 S 2
+X Q 3 2 R 4 X Y 2 S 1
+X Q 3 2 R 4 X Z 2 S 2
+X Q 3 3 R 9 X Y 2 S 1
+X Q 3 3 R 9 X Z 2 S 2
+X Q 3 5 R 25 X Y 2 S 1
+X Q 3 5 R 25 X Z 2 S 2
+X Q 3 6 R 36 X Y 2 S 1
+X Q 3 6 R 36 X Z 2 S 2
+X Q 3 7 R 49 X Y 2 S 1
+X Q 3 7 R 49 X Z 2 S 2
+X Q 3 9 R 81 X Y 2 S 1
+X Q 3 9 R 81 X Z 2 S 2
+X Q 5 1 R 1 X Y 2 S 1
+X Q 5 1 R 1 X Z 2 S 2
+X Q 5 2 R 4 X Y 2 S 1
+X Q 5 2 R 4 X Z 2 S 2
+X Q 5 3 R 9 X Y 2 S 1
+X Q 5 3 R 9 X Z 2 S 2
+X Q 5 5 R 25 X Y 2 S 1
+X Q 5 5 R 25 X Z 2 S 2
+X Q 5 6 R 36 X Y 2 S 1
+X Q 5 6 R 36 X Z 2 S 2
+X Q 5 7 R 49 X Y 2 S 1
+X Q 5 7 R 49 X Z 2 S 2
+X Q 5 9 R 81 X Y 2 S 1
+X Q 5 9 R 81 X Z 2 S 2
+CREATE TABLE t4 (C1 CHAR(1) PRIMARY KEY, B1 BIT(1), B2 BIT(1) NOT NULL DEFAULT 0, C2 CHAR(1) NOT NULL DEFAULT 'A') ENGINE = 'NDB' ;
+INSERT INTO t4 SET C1 = 1;
+SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1;
+C1 HEX(B1) HEX(B2)
+1 NULL 0
+SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1;
+C1 HEX(B1) HEX(B2)
+1 NULL 0
+CREATE TABLE t7 (C1 INT PRIMARY KEY, C2 INT) ENGINE = 'NDB' ;
+
+--- on slave: original values ---
+INSERT INTO t7 VALUES (1,3), (2,6), (3,9);
+SELECT * FROM t7 ORDER BY C1;
+C1 C2
+1 3
+2 6
+3 9
+
+--- on master: new values inserted ---
+INSERT INTO t7 VALUES (1,2), (2,4), (3,6);
+SELECT * FROM t7 ORDER BY C1;
+C1 C2
+1 2
+2 4
+3 6
+
+--- on slave: old values should be overwritten by replicated values ---
+SELECT * FROM t7 ORDER BY C1;
+C1 C2
+1 2
+2 4
+3 6
+
+--- on master ---
+DROP TABLE t7;
+CREATE TABLE t7 (a INT PRIMARY KEY, b INT UNIQUE, c INT UNIQUE) ENGINE = 'NDB' ;
+INSERT INTO t7 VALUES (99,99,99);
+INSERT INTO t7 VALUES (99,22,33);
+ERROR 23000: Duplicate entry '99' for key 1
+INSERT INTO t7 VALUES (11,99,33);
+ERROR 23000: Duplicate entry '11' for key 1
+INSERT INTO t7 VALUES (11,22,99);
+ERROR 23000: Duplicate entry '11' for key 1
+SELECT * FROM t7 ORDER BY a;
+a b c
+99 99 99
+
+--- on slave ---
+SELECT * FROM t7 ORDER BY a;
+a b c
+99 99 99
+INSERT INTO t7 VALUES (1,2,3), (2,4,6), (3,6,9);
+SELECT * FROM t7 ORDER BY a;
+a b c
+1 2 3
+2 4 6
+3 6 9
+99 99 99
+
+--- on master ---
+INSERT INTO t7 VALUES (2,4,8);
+
+--- on slave ---
+SELECT * FROM t7 ORDER BY a;
+a b c
+1 2 3
+2 4 8
+3 6 9
+99 99 99
+DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7;
diff --git a/mysql-test/r/schema.result b/mysql-test/r/schema.result
index 538abd8d039..a1b3fa9f1b3 100644
--- a/mysql-test/r/schema.result
+++ b/mysql-test/r/schema.result
@@ -6,6 +6,7 @@ foo CREATE DATABASE `foo` /*!40100 DEFAULT CHARACTER SET latin1 */
show schemas;
Database
information_schema
+cluster_replication
foo
mysql
test
diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result
index e3487b1bdf6..a78230e63eb 100644
--- a/mysql-test/r/show_check.result
+++ b/mysql-test/r/show_check.result
@@ -53,6 +53,7 @@ Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length I
show databases;
Database
information_schema
+cluster_replication
mysql
test
show databases like "test%";