summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/include/ndb_backup_print.inc6
-rw-r--r--mysql-test/r/ndb_partition_key.result1
-rw-r--r--mysql-test/r/ndb_restore_compat.result8
-rw-r--r--mysql-test/r/ndb_restore_print.result321
-rw-r--r--mysql-test/r/ndb_single_user.result28
-rw-r--r--mysql-test/r/rpl_ndb_log.result8
-rw-r--r--mysql-test/r/rpl_ndb_sync.result2
-rw-r--r--mysql-test/r/rpl_truncate_7ndb.result52
-rw-r--r--mysql-test/t/disabled.def1
-rw-r--r--mysql-test/t/ndb_restore_print.test189
-rw-r--r--mysql-test/t/ndb_single_user.test53
11 files changed, 608 insertions, 61 deletions
diff --git a/mysql-test/include/ndb_backup_print.inc b/mysql-test/include/ndb_backup_print.inc
new file mode 100644
index 00000000000..57fb279491c
--- /dev/null
+++ b/mysql-test/include/ndb_backup_print.inc
@@ -0,0 +1,6 @@
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults $ndb_restore_opts -b $the_backup_id -n 1 $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id $ndb_restore_filter > $MYSQLTEST_VARDIR/tmp/tmp.dat
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults $ndb_restore_opts -b $the_backup_id -n 2 $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id $ndb_restore_filter >> $MYSQLTEST_VARDIR/tmp/tmp.dat
+--exec sort $MYSQLTEST_VARDIR/tmp/tmp.dat
+--exec rm -f $MYSQLTEST_VARDIR/tmp/tmp.dat
+--let ndb_restore_opts=
+--let ndb_restore_filter=
diff --git a/mysql-test/r/ndb_partition_key.result b/mysql-test/r/ndb_partition_key.result
index e294807b40d..685137b7710 100644
--- a/mysql-test/r/ndb_partition_key.result
+++ b/mysql-test/r/ndb_partition_key.result
@@ -57,6 +57,7 @@ Number of primary keys: 3
Length of frm data: #
Row Checksum: 1
Row GCI: 1
+SingleUserMode: 0
TableStatus: Retrieved
-- Attributes --
a Int PRIMARY KEY AT=FIXED ST=MEMORY
diff --git a/mysql-test/r/ndb_restore_compat.result b/mysql-test/r/ndb_restore_compat.result
index f580f680687..d495aa28135 100644
--- a/mysql-test/r/ndb_restore_compat.result
+++ b/mysql-test/r/ndb_restore_compat.result
@@ -45,8 +45,8 @@ SYSTEM_VALUES_ID VALUE
0 2039
1 3
SELECT * FROM mysql.ndb_apply_status WHERE server_id=0;
-server_id epoch
-0 151
+server_id epoch log_name start_pos end_pos
+0 151 0 0
TRUNCATE GL;
TRUNCATE ACCOUNT;
TRUNCATE TRANSACTION;
@@ -99,6 +99,6 @@ SYSTEM_VALUES_ID VALUE
0 2297
1 5
SELECT * FROM mysql.ndb_apply_status WHERE server_id=0;
-server_id epoch
-0 331
+server_id epoch log_name start_pos end_pos
+0 331 0 0
DROP DATABASE BANK;
diff --git a/mysql-test/r/ndb_restore_print.result b/mysql-test/r/ndb_restore_print.result
new file mode 100644
index 00000000000..e05f8e43d1a
--- /dev/null
+++ b/mysql-test/r/ndb_restore_print.result
@@ -0,0 +1,321 @@
+use test;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
+create table t1
+(pk int key
+,a1 BIT(1), a2 BIT(5), a3 BIT(33), a4 BIT(63), a5 BIT(64)
+,b1 TINYINT, b2 TINYINT UNSIGNED
+,c1 SMALLINT, c2 SMALLINT UNSIGNED
+,d1 INT, d2 INT UNSIGNED
+,e1 BIGINT, e2 BIGINT UNSIGNED
+,f1 CHAR(1) BINARY, f2 CHAR(32) BINARY, f3 CHAR(255) BINARY
+,g1 VARCHAR(32) BINARY, g2 VARCHAR(255) BINARY, g3 VARCHAR(1000) BINARY
+,h1 BINARY(1), h2 BINARY(8), h3 BINARY(255)
+,i1 VARBINARY(32), i2 VARBINARY(255), i3 VARBINARY(1000)
+) engine myisam;
+insert into t1 values
+(1
+,0x1, 0x17, 0x789a, 0x789abcde, 0xfedc0001
+,127, 255
+,32767, 65535
+,2147483647, 4294967295
+,9223372036854775807, 18446744073709551615
+,'1','12345678901234567890123456789012','123456789'
+ ,'1','12345678901234567890123456789012','123456789'
+ ,0x12,0x123456789abcdef0, 0x012345
+,0x12,0x123456789abcdef0, 0x00123450
+);
+insert into t1 values
+(2
+,0, 0, 0, 0, 0
+,-128, 0
+,-32768, 0
+,-2147483648, 0
+,-9223372036854775808, 0
+,'','',''
+ ,'','',''
+ ,0x0,0x0,0x0
+,0x0,0x0,0x0
+);
+insert into t1 values
+(3
+,NULL,NULL,NULL,NULL,NULL
+,NULL,NULL
+,NULL,NULL
+,NULL,NULL
+,NULL,NULL
+,NULL,NULL,NULL
+,NULL,NULL,NULL
+,NULL,NULL,NULL
+,NULL,NULL,NULL
+);
+select pk
+,hex(a1), hex(a2), hex(a3), hex(a4), hex(a5)
+,b1, b2
+,c1 , c2
+,d1 , d2
+,e1 , e2
+,f1 , f2, f3
+,g1 , g2, g3
+,hex(h1), hex(h2), hex(h3)
+,hex(i1), hex(i2), hex(i3)
+from t1 order by pk;
+pk 1
+hex(a1) 1
+hex(a2) 17
+hex(a3) 789A
+hex(a4) 789ABCDE
+hex(a5) FEDC0001
+b1 127
+b2 255
+c1 32767
+c2 65535
+d1 2147483647
+d2 4294967295
+e1 9223372036854775807
+e2 18446744073709551615
+f1 1
+f2 12345678901234567890123456789012
+f3 123456789
+g1 1
+g2 12345678901234567890123456789012
+g3 123456789
+hex(h1) 12
+hex(h2) 123456789ABCDEF0
+hex(h3) 012345000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+hex(i1) 12
+hex(i2) 123456789ABCDEF0
+hex(i3) 00123450
+pk 2
+hex(a1) 0
+hex(a2) 0
+hex(a3) 0
+hex(a4) 0
+hex(a5) 0
+b1 -128
+b2 0
+c1 -32768
+c2 0
+d1 -2147483648
+d2 0
+e1 -9223372036854775808
+e2 0
+f1
+f2
+f3
+g1
+g2
+g3
+hex(h1) 00
+hex(h2) 0000000000000000
+hex(h3) 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+hex(i1) 00
+hex(i2) 00
+hex(i3) 00
+pk 3
+hex(a1) NULL
+hex(a2) NULL
+hex(a3) NULL
+hex(a4) NULL
+hex(a5) NULL
+b1 NULL
+b2 NULL
+c1 NULL
+c2 NULL
+d1 NULL
+d2 NULL
+e1 NULL
+e2 NULL
+f1 NULL
+f2 NULL
+f3 NULL
+g1 NULL
+g2 NULL
+g3 NULL
+hex(h1) NULL
+hex(h2) NULL
+hex(h3) NULL
+hex(i1) NULL
+hex(i2) NULL
+hex(i3) NULL
+alter table t1 engine ndb;
+select pk
+,hex(a1), hex(a2), hex(a3), hex(a4), hex(a5)
+,b1, b2
+,c1 , c2
+,d1 , d2
+,e1 , e2
+,f1 , f2, f3
+,g1 , g2, g3
+,hex(h1), hex(h2), hex(h3)
+,hex(i1), hex(i2), hex(i3)
+from t1 order by pk;
+pk 1
+hex(a1) 1
+hex(a2) 17
+hex(a3) 789A
+hex(a4) 789ABCDE
+hex(a5) FEDC0001
+b1 127
+b2 255
+c1 32767
+c2 65535
+d1 2147483647
+d2 4294967295
+e1 9223372036854775807
+e2 18446744073709551615
+f1 1
+f2 12345678901234567890123456789012
+f3 123456789
+g1 1
+g2 12345678901234567890123456789012
+g3 123456789
+hex(h1) 12
+hex(h2) 123456789ABCDEF0
+hex(h3) 012345000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+hex(i1) 12
+hex(i2) 123456789ABCDEF0
+hex(i3) 00123450
+pk 2
+hex(a1) 0
+hex(a2) 0
+hex(a3) 0
+hex(a4) 0
+hex(a5) 0
+b1 -128
+b2 0
+c1 -32768
+c2 0
+d1 -2147483648
+d2 0
+e1 -9223372036854775808
+e2 0
+f1
+f2
+f3
+g1
+g2
+g3
+hex(h1) 00
+hex(h2) 0000000000000000
+hex(h3) 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+hex(i1) 00
+hex(i2) 00
+hex(i3) 00
+pk 3
+hex(a1) NULL
+hex(a2) NULL
+hex(a3) NULL
+hex(a4) NULL
+hex(a5) NULL
+b1 NULL
+b2 NULL
+c1 NULL
+c2 NULL
+d1 NULL
+d2 NULL
+e1 NULL
+e2 NULL
+f1 NULL
+f2 NULL
+f3 NULL
+g1 NULL
+g2 NULL
+g3 NULL
+hex(h1) NULL
+hex(h2) NULL
+hex(h3) NULL
+hex(i1) NULL
+hex(i2) NULL
+hex(i3) NULL
+CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+DELETE FROM test.backup_info;
+LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
+SELECT @the_backup_id:=backup_id FROM test.backup_info;
+@the_backup_id:=backup_id
+<the_backup_id>
+DROP TABLE test.backup_info;
+1;0x1;0x17;0x789A;0x789ABCDE;0xFEDC0001;127;255;32767;65535;2147483647;4294967295;9223372036854775807;18446744073709551615;1;12345678901234567890123456789012;123456789;1;12345678901234567890123456789012;123456789;0x12;0x123456789ABCDEF0;0x012345;0x12;0x123456789ABCDEF0;0x00123450
+2;0x0;0x0;0x0;0x0;0x0;-128;0;-32768;0;-2147483648;0;-9223372036854775808;0;;;;;;;0x0;0x0;0x0;0x0;0x0;0x0
+3;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N
+1,0x1,0x17,0x789A,0x789ABCDE,0xFEDC0001,127,255,32767,65535,2147483647,4294967295,9223372036854775807,18446744073709551615,'1','12345678901234567890123456789012','123456789','1','12345678901234567890123456789012','123456789',0x12,0x123456789ABCDEF0,0x012345,0x12,0x123456789ABCDEF0,0x00123450
+2,0x0,0x0,0x0,0x0,0x0,-128,0,-32768,0,-2147483648,0,-9223372036854775808,0,'','','','','','',0x0,0x0,0x0,0x0,0x0,0x0
+3,,,,,,,,,,,,,,,,,,,,,,,,,
+drop table t1;
+create table t1
+(pk int key
+,f1 CHAR(1) BINARY, f2 CHAR(32) BINARY, f3 CHAR(255) BINARY
+,g1 VARCHAR(32) BINARY, g2 VARCHAR(255) BINARY, g3 VARCHAR(1000) BINARY
+,h1 BINARY(1), h2 BINARY(9), h3 BINARY(255)
+,i1 VARBINARY(32), i2 VARBINARY(255), i3 VARBINARY(1000)
+) engine ndb;
+insert into t1 values
+(1
+,'1','12345678901234567890123456789012','123456789 '
+ ,'1 ','12345678901234567890123456789012 ','123456789 '
+ ,0x20,0x123456789abcdef020, 0x012345000020
+,0x1200000020,0x123456789abcdef000000020, 0x00123450000020
+);
+create table t2 (pk int key, a int) engine ndb;
+create table t3 (pk int key, a int) engine ndb;
+create table t4 (pk int key, a int) engine ndb;
+insert into t2 values (1,11),(2,12),(3,13),(4,14),(5,15);
+insert into t3 values (1,21),(2,22),(3,23),(4,24),(5,25);
+insert into t4 values (1,31),(2,32),(3,33),(4,34),(5,35);
+CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+DELETE FROM test.backup_info;
+LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
+SELECT @the_backup_id:=backup_id FROM test.backup_info;
+@the_backup_id:=backup_id
+<the_backup_id>
+DROP TABLE test.backup_info;
+'1' '1' '12345678901234567890123456789012' '123456789' '1' '12345678901234567890123456789012' '123456789' '0x20' '0x123456789ABCDEF020' '0x012345000020' '0x1200000020' '0x123456789ABCDEF000000020' '0x00123450000020'
+
+t1
+--
+1 1 12345678901234567890123456789012 123456789 1 12345678901234567890123456789012 123456789 0x20 0x123456789ABCDEF020 0x012345000020 0x1200000020 0x123456789ABCDEF000000020 0x00123450000020
+
+t2
+--
+1 11
+2 12
+3 13
+4 14
+5 15
+
+t3
+--
+1 21
+2 22
+3 23
+4 24
+5 25
+
+t4
+--
+1 31
+2 32
+3 33
+4 34
+5 35
+drop table t1;
+create table t1
+(pk int key
+,a1 MEDIUMINT, a2 MEDIUMINT UNSIGNED
+) engine ndb;
+insert into t1 values(1, 8388607, 16777215);
+insert into t1 values(2, -8388608, 0);
+insert into t1 values(3, -1, 1);
+CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+DELETE FROM test.backup_info;
+LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
+SELECT @the_backup_id:=backup_id FROM test.backup_info;
+@the_backup_id:=backup_id
+<the_backup_id>
+DROP TABLE test.backup_info;
+1;8388607;16777215
+2;-8388608;0
+3;-1;1
+drop table t1;
+drop table t2;
+drop table t3;
+drop table t4;
diff --git a/mysql-test/r/ndb_single_user.result b/mysql-test/r/ndb_single_user.result
index 771a02ecc84..85ad30db8b0 100644
--- a/mysql-test/r/ndb_single_user.result
+++ b/mysql-test/r/ndb_single_user.result
@@ -1,7 +1,7 @@
use test;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
create table t1 (a int key, b int unique, c int) engine ndb;
-ERROR HY000: Can't create table 'test.t1' (errno: 4007)
+ERROR HY000: Can't create table 'test.t1' (errno: 299)
create table t1 (a int key, b int unique, c int) engine ndb;
insert into t1 values (1,1,0),(2,2,0),(3,3,0),(4,4,0),(5,5,0),(6,6,0),(7,7,0),(8,8,0),(9,9,0),(10,10,0);
create table t2 as select * from t1;
@@ -28,19 +28,29 @@ insert into t1 select * from t2;
drop table t1;
ERROR 42S02: Unknown table 't1'
create index new_index on t1 (c);
-ERROR 42S02: Table 'test.t1' doesn't exist
+ERROR HY000: Got error 299 'Operation not allowed or aborted due to single user mode' from NDBCLUSTER
insert into t1 values (1,1,0),(2,2,0),(3,3,0),(4,4,0),(5,5,0),(6,6,0),(7,7,0),(8,8,0),(9,9,0),(10,10,0);
-ERROR 42S02: Table 'test.t1' doesn't exist
+ERROR HY000: Got error 299 'Operation not allowed or aborted due to single user mode' from NDBCLUSTER
select * from t1 where a = 1;
-ERROR 42S02: Table 'test.t1' doesn't exist
+ERROR HY000: Got error 299 'Operation not allowed or aborted due to single user mode' from NDBCLUSTER
select * from t1 where b = 4;
-ERROR 42S02: Table 'test.t1' doesn't exist
+ERROR HY000: Got error 299 'Operation not allowed or aborted due to single user mode' from NDBCLUSTER
update t1 set b=102 where a = 2;
-ERROR 42S02: Table 'test.t1' doesn't exist
+ERROR HY000: Got error 299 'Operation not allowed or aborted due to single user mode' from NDBCLUSTER
update t1 set b=103 where b = 3;
-ERROR 42S02: Table 'test.t1' doesn't exist
+ERROR HY000: Got error 299 'Operation not allowed or aborted due to single user mode' from NDBCLUSTER
update t1 set b=b+100;
-ERROR 42S02: Table 'test.t1' doesn't exist
+ERROR HY000: Got error 299 'Operation not allowed or aborted due to single user mode' from NDBCLUSTER
update t1 set b=b+100 where a > 7;
-ERROR 42S02: Table 'test.t1' doesn't exist
+ERROR HY000: Got error 299 'Operation not allowed or aborted due to single user mode' from NDBCLUSTER
+BEGIN;
+update t1 set b=b+100 where a=1;
+BEGIN;
+update t1 set b=b+100 where a=2;
+update t1 set b=b+100 where a=3;
+COMMIT;
+update t1 set b=b+100 where a=4;
+ERROR HY000: Got error 299 'Operation not allowed or aborted due to single user mode' from NDBCLUSTER
+COMMIT;
+ERROR HY000: Got error 4350 'Transaction already aborted' from NDBCLUSTER
drop table t1;
diff --git a/mysql-test/r/rpl_ndb_log.result b/mysql-test/r/rpl_ndb_log.result
index 543af3b9abe..c93af3441d8 100644
--- a/mysql-test/r/rpl_ndb_log.result
+++ b/mysql-test/r/rpl_ndb_log.result
@@ -87,12 +87,12 @@ master-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000002 # Query 1 # COMMIT
show binary logs;
Log_name File_size
-master-bin.000001 1702
-master-bin.000002 593
+master-bin.000001 1740
+master-bin.000002 612
start slave;
show binary logs;
Log_name File_size
-slave-bin.000001 1797
+slave-bin.000001 1835
slave-bin.000002 198
show binlog events in 'slave-bin.000001' from 4;
Log_name Pos Event_type Server_id End_log_pos Info
@@ -126,7 +126,7 @@ slave-bin.000002 # Write_rows 2 # table_id: # flags: STMT_END_F
slave-bin.000002 # Query 2 # COMMIT
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
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 593 # # master-bin.000002 Yes Yes # 0 0 593 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 612 # # master-bin.000002 Yes Yes # 0 0 612 # None 0 No #
show binlog events in 'slave-bin.000005' from 4;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
DROP TABLE t1;
diff --git a/mysql-test/r/rpl_ndb_sync.result b/mysql-test/r/rpl_ndb_sync.result
index a2c3b46db5a..d05367c5fc0 100644
--- a/mysql-test/r/rpl_ndb_sync.result
+++ b/mysql-test/r/rpl_ndb_sync.result
@@ -93,4 +93,4 @@ select * from mysql.ndb_binlog_index;
Position File epoch inserts updates deletes schemaops
reset slave;
select * from mysql.ndb_apply_status;
-server_id epoch
+server_id epoch log_name start_pos end_pos
diff --git a/mysql-test/r/rpl_truncate_7ndb.result b/mysql-test/r/rpl_truncate_7ndb.result
index 63d4b0f9411..21399be4686 100644
--- a/mysql-test/r/rpl_truncate_7ndb.result
+++ b/mysql-test/r/rpl_truncate_7ndb.result
@@ -33,12 +33,12 @@ master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4
master-bin.000001 102 Query 1 219 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
master-bin.000001 219 Query 1 283 BEGIN
master-bin.000001 283 Table_map 1 40 table_id: # (test.t1)
-master-bin.000001 323 Table_map 1 95 table_id: # (mysql.ndb_apply_status)
-master-bin.000001 378 Write_rows 1 137 table_id: #
-master-bin.000001 420 Write_rows 1 184 table_id: # flags: STMT_END_F
-master-bin.000001 467 Query 1 532 COMMIT
-master-bin.000001 532 Query 1 612 use `test`; TRUNCATE TABLE t1
-master-bin.000001 612 Query 1 688 use `test`; DROP TABLE t1
+master-bin.000001 323 Table_map 1 98 table_id: # (mysql.ndb_apply_status)
+master-bin.000001 381 Write_rows 1 156 table_id: #
+master-bin.000001 439 Write_rows 1 203 table_id: # flags: STMT_END_F
+master-bin.000001 486 Query 1 551 COMMIT
+master-bin.000001 551 Query 1 631 use `test`; TRUNCATE TABLE t1
+master-bin.000001 631 Query 1 707 use `test`; DROP TABLE t1
**** On Master ****
CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB;
INSERT INTO t1 VALUES (1,1), (2,2);
@@ -69,23 +69,23 @@ master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4
master-bin.000001 102 Query 1 219 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
master-bin.000001 219 Query 1 283 BEGIN
master-bin.000001 283 Table_map 1 40 table_id: # (test.t1)
-master-bin.000001 323 Table_map 1 95 table_id: # (mysql.ndb_apply_status)
-master-bin.000001 378 Write_rows 1 137 table_id: #
-master-bin.000001 420 Write_rows 1 184 table_id: # flags: STMT_END_F
-master-bin.000001 467 Query 1 532 COMMIT
-master-bin.000001 532 Query 1 612 use `test`; TRUNCATE TABLE t1
-master-bin.000001 612 Query 1 688 use `test`; DROP TABLE t1
-master-bin.000001 688 Query 1 805 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
-master-bin.000001 805 Query 1 869 BEGIN
-master-bin.000001 869 Table_map 1 40 table_id: # (test.t1)
-master-bin.000001 909 Table_map 1 95 table_id: # (mysql.ndb_apply_status)
-master-bin.000001 964 Write_rows 1 137 table_id: #
-master-bin.000001 1006 Write_rows 1 184 table_id: # flags: STMT_END_F
-master-bin.000001 1053 Query 1 1118 COMMIT
-master-bin.000001 1118 Query 1 1182 BEGIN
-master-bin.000001 1182 Table_map 1 40 table_id: # (test.t1)
-master-bin.000001 1222 Table_map 1 95 table_id: # (mysql.ndb_apply_status)
-master-bin.000001 1277 Write_rows 1 137 table_id: #
-master-bin.000001 1319 Delete_rows 1 176 table_id: # flags: STMT_END_F
-master-bin.000001 1358 Query 1 1423 COMMIT
-master-bin.000001 1423 Query 1 1499 use `test`; DROP TABLE t1
+master-bin.000001 323 Table_map 1 98 table_id: # (mysql.ndb_apply_status)
+master-bin.000001 381 Write_rows 1 156 table_id: #
+master-bin.000001 439 Write_rows 1 203 table_id: # flags: STMT_END_F
+master-bin.000001 486 Query 1 551 COMMIT
+master-bin.000001 551 Query 1 631 use `test`; TRUNCATE TABLE t1
+master-bin.000001 631 Query 1 707 use `test`; DROP TABLE t1
+master-bin.000001 707 Query 1 824 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
+master-bin.000001 824 Query 1 888 BEGIN
+master-bin.000001 888 Table_map 1 40 table_id: # (test.t1)
+master-bin.000001 928 Table_map 1 98 table_id: # (mysql.ndb_apply_status)
+master-bin.000001 986 Write_rows 1 156 table_id: #
+master-bin.000001 1044 Write_rows 1 203 table_id: # flags: STMT_END_F
+master-bin.000001 1091 Query 1 1156 COMMIT
+master-bin.000001 1156 Query 1 1220 BEGIN
+master-bin.000001 1220 Table_map 1 40 table_id: # (test.t1)
+master-bin.000001 1260 Table_map 1 98 table_id: # (mysql.ndb_apply_status)
+master-bin.000001 1318 Write_rows 1 156 table_id: #
+master-bin.000001 1376 Delete_rows 1 195 table_id: # flags: STMT_END_F
+master-bin.000001 1415 Query 1 1480 COMMIT
+master-bin.000001 1480 Query 1 1556 use `test`; DROP TABLE t1
diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def
index be3e80dd969..60a28516195 100644
--- a/mysql-test/t/disabled.def
+++ b/mysql-test/t/disabled.def
@@ -35,4 +35,3 @@ synchronization : Bug#24529 Test 'synchronization' fails on Mac pushb
plugin : Bug#25659 memory leak via "plugins" test
rpl_ndb_dd_advance : Bug#25913 rpl_ndb_dd_advance fails randomly
-ndb_single_user : Bug#27021 Error codes in mysqld in single user mode varies
diff --git a/mysql-test/t/ndb_restore_print.test b/mysql-test/t/ndb_restore_print.test
new file mode 100644
index 00000000000..6dbbfdf5933
--- /dev/null
+++ b/mysql-test/t/ndb_restore_print.test
@@ -0,0 +1,189 @@
+-- source include/have_ndb.inc
+-- source include/ndb_default_cluster.inc
+-- source include/not_embedded.inc
+
+--disable_warnings
+use test;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
+--enable_warnings
+
+# basic datatypes
+create table t1
+ (pk int key
+ ,a1 BIT(1), a2 BIT(5), a3 BIT(33), a4 BIT(63), a5 BIT(64)
+ ,b1 TINYINT, b2 TINYINT UNSIGNED
+ ,c1 SMALLINT, c2 SMALLINT UNSIGNED
+ ,d1 INT, d2 INT UNSIGNED
+ ,e1 BIGINT, e2 BIGINT UNSIGNED
+ ,f1 CHAR(1) BINARY, f2 CHAR(32) BINARY, f3 CHAR(255) BINARY
+ ,g1 VARCHAR(32) BINARY, g2 VARCHAR(255) BINARY, g3 VARCHAR(1000) BINARY
+ ,h1 BINARY(1), h2 BINARY(8), h3 BINARY(255)
+ ,i1 VARBINARY(32), i2 VARBINARY(255), i3 VARBINARY(1000)
+ ) engine myisam;
+
+# max values
+insert into t1 values
+ (1
+ ,0x1, 0x17, 0x789a, 0x789abcde, 0xfedc0001
+ ,127, 255
+ ,32767, 65535
+ ,2147483647, 4294967295
+ ,9223372036854775807, 18446744073709551615
+ ,'1','12345678901234567890123456789012','123456789'
+ ,'1','12345678901234567890123456789012','123456789'
+ ,0x12,0x123456789abcdef0, 0x012345
+ ,0x12,0x123456789abcdef0, 0x00123450
+ );
+
+# min values
+insert into t1 values
+ (2
+ ,0, 0, 0, 0, 0
+ ,-128, 0
+ ,-32768, 0
+ ,-2147483648, 0
+ ,-9223372036854775808, 0
+ ,'','',''
+ ,'','',''
+ ,0x0,0x0,0x0
+ ,0x0,0x0,0x0
+ );
+
+# null values
+insert into t1 values
+ (3
+ ,NULL,NULL,NULL,NULL,NULL
+ ,NULL,NULL
+ ,NULL,NULL
+ ,NULL,NULL
+ ,NULL,NULL
+ ,NULL,NULL,NULL
+ ,NULL,NULL,NULL
+ ,NULL,NULL,NULL
+ ,NULL,NULL,NULL
+ );
+
+--vertical_results
+select pk
+ ,hex(a1), hex(a2), hex(a3), hex(a4), hex(a5)
+ ,b1, b2
+ ,c1 , c2
+ ,d1 , d2
+ ,e1 , e2
+ ,f1 , f2, f3
+ ,g1 , g2, g3
+ ,hex(h1), hex(h2), hex(h3)
+ ,hex(i1), hex(i2), hex(i3)
+ from t1 order by pk;
+
+alter table t1 engine ndb;
+
+select pk
+ ,hex(a1), hex(a2), hex(a3), hex(a4), hex(a5)
+ ,b1, b2
+ ,c1 , c2
+ ,d1 , d2
+ ,e1 , e2
+ ,f1 , f2, f3
+ ,g1 , g2, g3
+ ,hex(h1), hex(h2), hex(h3)
+ ,hex(i1), hex(i2), hex(i3)
+ from t1 order by pk;
+--horizontal_results
+
+--source include/ndb_backup.inc
+
+--let ndb_restore_filter=test t1
+--let ndb_restore_opts=--verbose=0 --print_data --hex --fields-terminated-by=";"
+--source include/ndb_backup_print.inc
+
+--let ndb_restore_filter=test t1
+--let ndb_restore_opts=--verbose=0 --print_data --hex --fields-terminated-by="," --fields-optionally-enclosed-by="'"
+--source include/ndb_backup_print.inc
+
+
+drop table t1;
+
+# some binary char tests with trailing spaces
+create table t1
+ (pk int key
+ ,f1 CHAR(1) BINARY, f2 CHAR(32) BINARY, f3 CHAR(255) BINARY
+ ,g1 VARCHAR(32) BINARY, g2 VARCHAR(255) BINARY, g3 VARCHAR(1000) BINARY
+ ,h1 BINARY(1), h2 BINARY(9), h3 BINARY(255)
+ ,i1 VARBINARY(32), i2 VARBINARY(255), i3 VARBINARY(1000)
+ ) engine ndb;
+
+insert into t1 values
+ (1
+ ,'1','12345678901234567890123456789012','123456789 '
+ ,'1 ','12345678901234567890123456789012 ','123456789 '
+ ,0x20,0x123456789abcdef020, 0x012345000020
+ ,0x1200000020,0x123456789abcdef000000020, 0x00123450000020
+ );
+
+create table t2 (pk int key, a int) engine ndb;
+create table t3 (pk int key, a int) engine ndb;
+create table t4 (pk int key, a int) engine ndb;
+
+insert into t2 values (1,11),(2,12),(3,13),(4,14),(5,15);
+insert into t3 values (1,21),(2,22),(3,23),(4,24),(5,25);
+insert into t4 values (1,31),(2,32),(3,33),(4,34),(5,35);
+
+--source include/ndb_backup.inc
+--let ndb_restore_opts=--verbose=0 --print_data --hex --fields-enclosed-by="'" --fields-optionally-enclosed-by="X"
+--let ndb_restore_filter=test t1
+--source include/ndb_backup_print.inc
+
+--exec rm -f $MYSQLTEST_VARDIR/tmp/t1.txt
+--exec rm -f $MYSQLTEST_VARDIR/tmp/t2.txt
+--exec rm -f $MYSQLTEST_VARDIR/tmp/t3.txt
+--exec rm -f $MYSQLTEST_VARDIR/tmp/t4.txt
+
+--let ndb_restore_opts=--verbose=0 --print_data --hex --tab $MYSQLTEST_VARDIR/tmp --append
+--let ndb_restore_filter=test
+--source include/ndb_backup_print.inc
+
+--let $message= t1
+--source include/show_msg.inc
+--exec sort $MYSQLTEST_VARDIR/tmp/t1.txt
+--let $message= t2
+--source include/show_msg.inc
+--exec sort $MYSQLTEST_VARDIR/tmp/t2.txt
+--let $message= t3
+--source include/show_msg.inc
+--exec sort $MYSQLTEST_VARDIR/tmp/t3.txt
+--let $message= t4
+--source include/show_msg.inc
+--exec sort $MYSQLTEST_VARDIR/tmp/t4.txt
+
+--exec rm -f $MYSQLTEST_VARDIR/tmp/t1.txt
+--exec rm -f $MYSQLTEST_VARDIR/tmp/t2.txt
+--exec rm -f $MYSQLTEST_VARDIR/tmp/t3.txt
+--exec rm -f $MYSQLTEST_VARDIR/tmp/t4.txt
+
+# now test some other datatypes
+drop table t1;
+create table t1
+ (pk int key
+ ,a1 MEDIUMINT, a2 MEDIUMINT UNSIGNED
+ ) engine ndb;
+
+# max values
+insert into t1 values(1, 8388607, 16777215);
+# min values
+insert into t1 values(2, -8388608, 0);
+# small values
+insert into t1 values(3, -1, 1);
+
+# backup and print
+--source include/ndb_backup.inc
+
+--let ndb_restore_filter=test t1
+--let ndb_restore_opts=--verbose=0 --print_data --hex --fields-terminated-by=";"
+--source include/ndb_backup_print.inc
+
+# clean up
+drop table t1;
+drop table t2;
+drop table t3;
+drop table t4;
diff --git a/mysql-test/t/ndb_single_user.test b/mysql-test/t/ndb_single_user.test
index c655124f79f..b191e573996 100644
--- a/mysql-test/t/ndb_single_user.test
+++ b/mysql-test/t/ndb_single_user.test
@@ -51,34 +51,55 @@ insert into t1 select * from t2;
--connection server2
--error 1051
drop table t1;
---error 1146
-#--error 1296
+--error 1296
create index new_index on t1 (c);
---error 1146
-#--error 1296
+--error 1296
insert into t1 values (1,1,0),(2,2,0),(3,3,0),(4,4,0),(5,5,0),(6,6,0),(7,7,0),(8,8,0),(9,9,0),(10,10,0);
---error 1146
-#--error 1296
+--error 1296
select * from t1 where a = 1;
---error 1146
-#--error 1296
+--error 1296
select * from t1 where b = 4;
---error 1146
-#--error 1296
+--error 1296
update t1 set b=102 where a = 2;
---error 1146
-#--error 1296
+--error 1296
update t1 set b=103 where b = 3;
---error 1146
-#--error 1296
+--error 1296
update t1 set b=b+100;
---error 1146
-#--error 1296
+--error 1296
update t1 set b=b+100 where a > 7;
--exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "exit single user mode" >> $NDB_TOOLS_OUTPUT
--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults >> $NDB_TOOLS_OUTPUT
+#
+# we should be able to run transaction while in single user mode
+#
+--connection server1
+BEGIN;
+update t1 set b=b+100 where a=1;
+
+--connection server2
+BEGIN;
+update t1 set b=b+100 where a=2;
+
+# enter single user mode
+--exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "enter single user mode $node_id" >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" --single-user >> $NDB_TOOLS_OUTPUT
+
+--connection server1
+update t1 set b=b+100 where a=3;
+COMMIT;
+
+# while on other mysqld it should be aborted
+--connection server2
+--error 1296
+update t1 set b=b+100 where a=4;
+--error 1296
+COMMIT;
+
+--exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "exit single user mode" >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults >> $NDB_TOOLS_OUTPUT
+
# cleanup
--connection server1
drop table t1;