#At file:///home/ngb/mysql/bzr/telco6.4-bug33801/
2678 Guangbao Ni 2008-07-24 [merge]
BUG#33801 ndb_restore fails when not all tables are restored once
modified:
mysql-test/suite/ndb/r/ndb_restore.result
mysql-test/suite/ndb/r/ndb_restore_compressed.result
mysql-test/suite/ndb/t/ndb_restore.test
storage/ndb/tools/restore/restore_main.cpp
per-file messages:
mysql-test/suite/ndb/r/ndb_restore.result
Add test case for bug#33801
mysql-test/suite/ndb/r/ndb_restore_compressed.result
Add test case for bug#33801
mysql-test/suite/ndb/t/ndb_restore.test
Add test case for bug#33801
storage/ndb/tools/restore/restore_main.cpp
Add the check if the table is restored
=== modified file 'mysql-test/suite/ndb/r/ndb_restore.result'
--- a/mysql-test/suite/ndb/r/ndb_restore.result 2008-05-29 11:30:21 +0000
+++ b/mysql-test/suite/ndb/r/ndb_restore.result 2008-07-24 10:57:58 +0000
@@ -574,8 +574,29 @@ SELECT @the_backup_id:=backup_id FROM te
@the_backup_id:=backup_id
<the_backup_id>
DROP TABLE test.backup_info;
+CREATE TABLE t11_c (
+c1 int primary key, c2 char(10), c3 varchar(10)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+CREATE TABLE t12_c (
+c1 int primary key, c2 char(10), c3 varchar(10)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO t11_c VALUES(1, "aaaaa", "bbbbb"), (2, "ccccc", "ddddd"), (3,
"eeeee","fffff");
+INSERT INTO t12_c VALUES(4, "ggggg", "hhhhh"), (5, "iiiii", "jjjjj"), (6,
"kkkkk","lllll");
+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;
+drop table t2_c,t11_c,t12_c;
+SELECT * FROM t11_c ORDER BY c1;
+c1 c2 c3
+1 aaaaa bbbbb
+2 ccccc ddddd
+3 eeeee fffff
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11;
-drop table if exists t2_c;
+drop table if exists t2_c,t11_c,t12_c;
520093696,<the_backup_id>
select epoch from mysql.ndb_apply_status where server_id=0;
epoch
=== modified file 'mysql-test/suite/ndb/r/ndb_restore_compressed.result'
--- a/mysql-test/suite/ndb/r/ndb_restore_compressed.result 2008-05-29 11:30:21 +0000
+++ b/mysql-test/suite/ndb/r/ndb_restore_compressed.result 2008-07-24 10:57:58 +0000
@@ -574,8 +574,29 @@ SELECT @the_backup_id:=backup_id FROM te
@the_backup_id:=backup_id
<the_backup_id>
DROP TABLE test.backup_info;
+CREATE TABLE t11_c (
+c1 int primary key, c2 char(10), c3 varchar(10)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+CREATE TABLE t12_c (
+c1 int primary key, c2 char(10), c3 varchar(10)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO t11_c VALUES(1, "aaaaa", "bbbbb"), (2, "ccccc", "ddddd"), (3,
"eeeee","fffff");
+INSERT INTO t12_c VALUES(4, "ggggg", "hhhhh"), (5, "iiiii", "jjjjj"), (6,
"kkkkk","lllll");
+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;
+drop table t2_c,t11_c,t12_c;
+SELECT * FROM t11_c ORDER BY c1;
+c1 c2 c3
+1 aaaaa bbbbb
+2 ccccc ddddd
+3 eeeee fffff
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11;
-drop table if exists t2_c;
+drop table if exists t2_c,t11_c,t12_c;
520093696,<the_backup_id>
select epoch from mysql.ndb_apply_status where server_id=0;
epoch
=== modified file 'mysql-test/suite/ndb/t/ndb_restore.test'
--- a/mysql-test/suite/ndb/t/ndb_restore.test 2008-06-18 21:19:57 +0000
+++ b/mysql-test/suite/ndb/t/ndb_restore.test 2008-07-24 10:57:58 +0000
@@ -435,13 +435,31 @@ drop table t1_c,t3_c,t4_c,t5_c,t6_c,t7_c
--source include/ndb_backup.inc
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --core=0 -b $the_backup_id -n 1 -m -r
--ndb-nodegroup_map '(0,1)' $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id 2>&1 |
grep Translate || true
+CREATE TABLE t11_c (
+ c1 int primary key, c2 char(10), c3 varchar(10)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+
+CREATE TABLE t12_c (
+ c1 int primary key, c2 char(10), c3 varchar(10)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+
+INSERT INTO t11_c VALUES(1, "aaaaa", "bbbbb"), (2, "ccccc", "ddddd"), (3,
"eeeee","fffff");
+INSERT INTO t12_c VALUES(4, "ggggg", "hhhhh"), (5, "iiiii", "jjjjj"), (6,
"kkkkk","lllll");
+--source include/ndb_backup.inc
+drop table t2_c,t11_c,t12_c;
+# Only part of tables is restored, it should work
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b $the_backup_id -n 1 -m -r --print
--print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id test t11_c >>
$NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b $the_backup_id -n 2 -r --print
--print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id test t11_c >>
$NDB_TOOLS_OUTPUT
+#Should only t11_c is restored
+SELECT * FROM t11_c ORDER BY c1;
+
#
# Cleanup
#
--disable_warnings
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11;
-drop table if exists t2_c;
+drop table if exists t2_c,t11_c,t12_c;
--enable_warnings
#
=== modified file 'storage/ndb/tools/restore/restore_main.cpp'
--- a/storage/ndb/tools/restore/restore_main.cpp 2008-06-18 21:19:57 +0000
+++ b/storage/ndb/tools/restore/restore_main.cpp 2008-07-24 10:57:58 +0000
@@ -929,7 +929,8 @@ main(int argc, char** argv)
{
for(i=0; i < metaData.getNoOfTables(); i++)
{
- if (checkSysTable(metaData, i))
+ if (checkSysTable(metaData, i) &&
+ checkDbAndTableName(metaData[i]))
{
for(Uint32 j= 0; j < g_consumers.size(); j++)
if (!g_consumers[j]->table_equal(* metaData[i]))
@@ -945,7 +946,8 @@ main(int argc, char** argv)
{
//if want to promote attributes, compability check is done firstly
for (i=0; i < metaData.getNoOfTables(); i++){
- if (checkSysTable(metaData, i))
+ if (checkSysTable(metaData, i) &&
+ checkDbAndTableName(metaData[i]))
{
for(Uint32 j= 0; j < g_consumers.size(); j++)
{
| Thread |
|---|
| • bzr commit into mysql-5.1-telco-6.4 branch (gni:2678) Bug#33801 | Guangbao Ni | 24 Jul |