Bug #16753 DD: mysqldump does not support Cluster Disk Data backups

parent 8c024b90
...@@ -2489,14 +2489,15 @@ static int dump_all_tablespaces() ...@@ -2489,14 +2489,15 @@ static int dump_all_tablespaces()
int first; int first;
if (mysql_query_with_error_report(sock, &tableres, if (mysql_query_with_error_report(sock, &tableres,
"SELECT DISTINCT " "SELECT DISTINCT"
"LOGFILE_GROUP_NAME," " LOGFILE_GROUP_NAME,"
"FILE_NAME," " FILE_NAME,"
"INITIAL_SIZE," " TOTAL_EXTENTS,"
"ENGINE " " INITIAL_SIZE,"
"FROM INFORMATION_SCHEMA.FILES " " ENGINE"
"WHERE FILE_TYPE = \"UNDO LOG\" " " FROM INFORMATION_SCHEMA.FILES"
"ORDER BY LOGFILE_GROUP_NAME")) " WHERE FILE_TYPE = \"UNDO LOG\""
" ORDER BY LOGFILE_GROUP_NAME"))
return 1; return 1;
buf[0]= 0; buf[0]= 0;
...@@ -2506,14 +2507,12 @@ static int dump_all_tablespaces() ...@@ -2506,14 +2507,12 @@ static int dump_all_tablespaces()
first= 1; first= 1;
if (first) if (first)
{ {
first= 0;
if (!opt_xml && opt_comments) if (!opt_xml && opt_comments)
{ {
fprintf(md_result_file,"\n--\n-- Logfile group: %s\n--\n", row[0]); fprintf(md_result_file,"\n--\n-- Logfile group: %s\n--\n", row[0]);
check_io(md_result_file); check_io(md_result_file);
} }
fprintf(md_result_file, "\nCREATE"); fprintf(md_result_file, "\nCREATE");
strxmov(buf, row[0], NullS);
} }
else else
{ {
...@@ -2521,27 +2520,39 @@ static int dump_all_tablespaces() ...@@ -2521,27 +2520,39 @@ static int dump_all_tablespaces()
} }
fprintf(md_result_file, fprintf(md_result_file,
" LOGFILE GROUP %s\n" " LOGFILE GROUP %s\n"
" ADD UNDOFILE '%s'\n" " ADD UNDOFILE '%s'\n",
row[0],
row[1]);
if (first)
{
fprintf(md_result_file,
" UNDO_BUFFER_SIZE %s\n",
row[2]);
}
fprintf(md_result_file,
" INITIAL_SIZE %s\n" " INITIAL_SIZE %s\n"
" ENGINE=%s;\n", " ENGINE=%s;\n",
row[0], row[3],
row[1], row[4]);
row[2],
row[3]
);
check_io(md_result_file); check_io(md_result_file);
if (first)
{
first= 0;
strxmov(buf, row[0], NullS);
}
} }
if (mysql_query_with_error_report(sock, &tableres, if (mysql_query_with_error_report(sock, &tableres,
"SELECT DISTINCT " "SELECT DISTINCT"
"TABLESPACE_NAME," " TABLESPACE_NAME,"
"LOGFILE_GROUP_NAME," " FILE_NAME,"
"FILE_NAME," " LOGFILE_GROUP_NAME,"
"INITIAL_SIZE," " EXTENT_SIZE,"
"ENGINE " " INITIAL_SIZE,"
"FROM INFORMATION_SCHEMA.FILES " " ENGINE"
"WHERE FILE_TYPE = \"DATAFILE\" " " FROM INFORMATION_SCHEMA.FILES"
"ORDER BY TABLESPACE_NAME, LOGFILE_GROUP_NAME")) " WHERE FILE_TYPE = \"DATAFILE\""
" ORDER BY TABLESPACE_NAME, LOGFILE_GROUP_NAME"))
return 1; return 1;
buf[0]= 0; buf[0]= 0;
...@@ -2557,7 +2568,6 @@ static int dump_all_tablespaces() ...@@ -2557,7 +2568,6 @@ static int dump_all_tablespaces()
check_io(md_result_file); check_io(md_result_file);
} }
fprintf(md_result_file, "\nCREATE"); fprintf(md_result_file, "\nCREATE");
strxmov(buf, row[0], NullS);
} }
else else
{ {
...@@ -2567,23 +2577,26 @@ static int dump_all_tablespaces() ...@@ -2567,23 +2577,26 @@ static int dump_all_tablespaces()
" TABLESPACE %s\n" " TABLESPACE %s\n"
" ADD DATAFILE '%s'\n", " ADD DATAFILE '%s'\n",
row[0], row[0],
row[2] row[1]);
);
if (first) if (first)
{ {
first= 0;
fprintf(md_result_file, fprintf(md_result_file,
" USE LOGFILE GROUP %s\n", " USE LOGFILE GROUP %s\n"
row[1] " EXTENT_SIZE %s\n",
); row[2],
row[3]);
} }
fprintf(md_result_file, fprintf(md_result_file,
" INITIAL_SIZE %s\n" " INITIAL_SIZE %s\n"
" ENGINE=%s;\n", " ENGINE=%s;\n",
row[3], row[4],
row[4] row[5]);
);
check_io(md_result_file); check_io(md_result_file);
if (first)
{
first= 0;
strxmov(buf, row[0], NullS);
}
} }
return 0; return 0;
} }
......
...@@ -10,8 +10,8 @@ INITIAL_SIZE = 4M ...@@ -10,8 +10,8 @@ INITIAL_SIZE = 4M
ENGINE NDB; ENGINE NDB;
CREATE LOGFILE GROUP lg2 CREATE LOGFILE GROUP lg2
ADD UNDOFILE 'undofile_lg2_01.dat' ADD UNDOFILE 'undofile_lg2_01.dat'
INITIAL_SIZE 2M
UNDO_BUFFER_SIZE = 1M UNDO_BUFFER_SIZE = 1M
INITIAL_SIZE 2M
ENGINE NDB; ENGINE NDB;
ALTER LOGFILE GROUP lg2 ALTER LOGFILE GROUP lg2
ADD UNDOFILE 'undofile_lg2_02.dat' ADD UNDOFILE 'undofile_lg2_02.dat'
...@@ -20,6 +20,7 @@ ENGINE NDB; ...@@ -20,6 +20,7 @@ ENGINE NDB;
CREATE TABLESPACE ts1 CREATE TABLESPACE ts1
ADD DATAFILE 'datafile_ts1_01.dat' ADD DATAFILE 'datafile_ts1_01.dat'
USE LOGFILE GROUP lg1 USE LOGFILE GROUP lg1
EXTENT_SIZE 1M
INITIAL_SIZE 2M INITIAL_SIZE 2M
ENGINE NDB; ENGINE NDB;
ALTER TABLESPACE ts1 ALTER TABLESPACE ts1
...@@ -174,22 +175,30 @@ DROP TABLESPACE ts3 ENGINE = NDB; ...@@ -174,22 +175,30 @@ DROP TABLESPACE ts3 ENGINE = NDB;
DROP LOGFILE GROUP lg1 ENGINE = NDB; DROP LOGFILE GROUP lg1 ENGINE = NDB;
DROP LOGFILE GROUP lg2 ENGINE = NDB; DROP LOGFILE GROUP lg2 ENGINE = NDB;
SELECT DISTINCT SELECT DISTINCT
LOGFILE_GROUP_NAME,
FILE_NAME,
TOTAL_EXTENTS,
INITIAL_SIZE,
ENGINE
FROM INFORMATION_SCHEMA.FILES WHERE FILE_TYPE="UNDO LOG" ORDER BY FILE_NAME;
LOGFILE_GROUP_NAME FILE_NAME TOTAL_EXTENTS INITIAL_SIZE ENGINE
lg1 undofile_lg1_01.dat 1048576 2097152 ndbcluster
lg1 undofile_lg1_02.dat 1048576 4194304 ndbcluster
lg2 undofile_lg2_01.dat 1048576 2097152 ndbcluster
lg2 undofile_lg2_02.dat 1048576 4194304 ndbcluster
SELECT DISTINCT
TABLESPACE_NAME, TABLESPACE_NAME,
LOGFILE_GROUP_NAME, LOGFILE_GROUP_NAME,
FILE_TYPE,
FILE_NAME, FILE_NAME,
EXTENT_SIZE,
INITIAL_SIZE, INITIAL_SIZE,
ENGINE ENGINE
FROM INFORMATION_SCHEMA.FILES ORDER BY FILE_NAME; FROM INFORMATION_SCHEMA.FILES WHERE FILE_TYPE="DATAFILE" ORDER BY FILE_NAME;
TABLESPACE_NAME LOGFILE_GROUP_NAME FILE_TYPE FILE_NAME INITIAL_SIZE ENGINE TABLESPACE_NAME LOGFILE_GROUP_NAME FILE_NAME EXTENT_SIZE INITIAL_SIZE ENGINE
ts1 lg1 DATAFILE datafile_ts1_01.dat 2097152 ndbcluster ts1 lg1 datafile_ts1_01.dat 1048576 2097152 ndbcluster
ts1 lg1 DATAFILE datafile_ts1_02.dat 1048576 ndbcluster ts1 lg1 datafile_ts1_02.dat 1048576 1048576 ndbcluster
ts2 lg1 DATAFILE datafile_ts2_01.dat 2097152 ndbcluster ts2 lg1 datafile_ts2_01.dat 1048576 2097152 ndbcluster
ts3 lg2 DATAFILE datafile_ts3_01.dat 4194304 ndbcluster ts3 lg2 datafile_ts3_01.dat 1048576 4194304 ndbcluster
ts3 lg1 UNDO LOG undofile_lg1_01.dat 2097152 ndbcluster
ts3 lg1 UNDO LOG undofile_lg1_02.dat 4194304 ndbcluster
ts3 lg2 UNDO LOG undofile_lg2_01.dat 2097152 ndbcluster
ts3 lg2 UNDO LOG undofile_lg2_02.dat 4194304 ndbcluster
SELECT COUNT(*) FROM t1; SELECT COUNT(*) FROM t1;
COUNT(*) COUNT(*)
500 500
......
...@@ -17,8 +17,8 @@ ENGINE NDB; ...@@ -17,8 +17,8 @@ ENGINE NDB;
CREATE LOGFILE GROUP lg2 CREATE LOGFILE GROUP lg2
ADD UNDOFILE 'undofile_lg2_01.dat' ADD UNDOFILE 'undofile_lg2_01.dat'
INITIAL_SIZE 2M
UNDO_BUFFER_SIZE = 1M UNDO_BUFFER_SIZE = 1M
INITIAL_SIZE 2M
ENGINE NDB; ENGINE NDB;
ALTER LOGFILE GROUP lg2 ALTER LOGFILE GROUP lg2
...@@ -29,6 +29,7 @@ ENGINE NDB; ...@@ -29,6 +29,7 @@ ENGINE NDB;
CREATE TABLESPACE ts1 CREATE TABLESPACE ts1
ADD DATAFILE 'datafile_ts1_01.dat' ADD DATAFILE 'datafile_ts1_01.dat'
USE LOGFILE GROUP lg1 USE LOGFILE GROUP lg1
EXTENT_SIZE 1M
INITIAL_SIZE 2M INITIAL_SIZE 2M
ENGINE NDB; ENGINE NDB;
...@@ -207,14 +208,23 @@ DROP LOGFILE GROUP lg2 ENGINE = NDB; ...@@ -207,14 +208,23 @@ DROP LOGFILE GROUP lg2 ENGINE = NDB;
--exec $MYSQL test < var/tmp/ndb_dd_dump.sql --exec $MYSQL test < var/tmp/ndb_dd_dump.sql
SELECT DISTINCT
LOGFILE_GROUP_NAME,
FILE_NAME,
TOTAL_EXTENTS,
INITIAL_SIZE,
ENGINE
FROM INFORMATION_SCHEMA.FILES WHERE FILE_TYPE="UNDO LOG" ORDER BY FILE_NAME;
SELECT DISTINCT SELECT DISTINCT
TABLESPACE_NAME, TABLESPACE_NAME,
LOGFILE_GROUP_NAME, LOGFILE_GROUP_NAME,
FILE_TYPE,
FILE_NAME, FILE_NAME,
EXTENT_SIZE,
INITIAL_SIZE, INITIAL_SIZE,
ENGINE ENGINE
FROM INFORMATION_SCHEMA.FILES ORDER BY FILE_NAME; FROM INFORMATION_SCHEMA.FILES WHERE FILE_TYPE="DATAFILE" ORDER BY FILE_NAME;
SELECT COUNT(*) FROM t1; SELECT COUNT(*) FROM t1;
SELECT COUNT(*) FROM t2; SELECT COUNT(*) FROM t2;
SELECT COUNT(*) FROM t3; SELECT COUNT(*) FROM t3;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment