Bug#40465 - mysqldump.test does no checking of dump or restore
Created new .test file - mysqldump_restore that does test restore from mysqldump output for a limited number of basic cases. Create new .inc file - mysqldump.inc - renames original table and uses mysqldump output to recreate the table, then uses diff_tables.inc to compare the two tables. Backported include/diff_tables.inc to facilitate this testing. New patch incorporating review feedback prior to push. mysqldump.test - removed redundant call to include/have_log_bin.inc (was used twice in the test!)
This commit is contained in:
parent
2bb44aef97
commit
6c31d59bf4
@ -1,22 +1,31 @@
|
|||||||
################################################################################
|
################################################################################
|
||||||
# mysqldump.inc
|
# mysqldump.inc
|
||||||
|
#
|
||||||
# SUMMARY: include file to facilitate testing the quality of mysqldump output
|
# SUMMARY: include file to facilitate testing the quality of mysqldump output
|
||||||
|
#
|
||||||
# INPUTS: Two variables:
|
# INPUTS: Two variables:
|
||||||
# $table_name - the name of the table that was dumped
|
# $table_name - the name of the table that was dumped
|
||||||
# $mysqldumpfile - the name of the file that captured mysqldump output
|
# $mysqldumpfile - the name of the file that captured mysqldump output
|
||||||
|
#
|
||||||
# OUTPUTS: minor echo data:
|
# OUTPUTS: minor echo data:
|
||||||
# We 'echo' some stage information to the .result file:
|
# We 'echo' some stage information to the .result file:
|
||||||
# 'altering original table', 'restoring from dumpfile', 'comparing'
|
# 'altering original table', 'restoring from dumpfile', 'comparing'
|
||||||
|
#
|
||||||
# OTHER FILES: We use include/diff_tables.inc to compare the original, renamed
|
# OTHER FILES: We use include/diff_tables.inc to compare the original, renamed
|
||||||
# table with the 'restored' one.
|
# table with the 'restored' one.
|
||||||
|
#
|
||||||
# DESCRIPTION: This file works by being fed the name of the original table
|
# DESCRIPTION: This file works by being fed the name of the original table
|
||||||
# and a mysqldump output file. The original table is then renamed
|
# and a mysqldump output file. The original table is then renamed
|
||||||
# to <table_name>_orig, the mysqldump file is used to recreate the
|
# to <table_name>_orig, the mysqldump file is used to recreate the
|
||||||
# table, then diff_tables.inc is called to compare them.
|
# table, then diff_tables.inc is called to compare them.
|
||||||
|
#
|
||||||
# LIMITATIONS: Does *NOT* work with xml output!
|
# LIMITATIONS: Does *NOT* work with xml output!
|
||||||
# AUTHOR: pcrews
|
#
|
||||||
|
# AUTHOR: pcrews 2009-05-21
|
||||||
|
# Bug#40465 mysqldump.test does no checking of dump or restore
|
||||||
|
#
|
||||||
# LAST CHANGE: 2009-05-21
|
# LAST CHANGE: 2009-05-21
|
||||||
# PURPOSE: Bug#40465: mysqldump.test does no checking of dump or restore
|
#
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
--echo # Begin testing mysqldump output + restore
|
--echo # Begin testing mysqldump output + restore
|
||||||
|
@ -8,7 +8,7 @@ DROP TABLE IF EXISTS t1;
|
|||||||
#
|
#
|
||||||
# Bug#2005 Long decimal comparison bug.
|
# Bug#2005 Long decimal comparison bug.
|
||||||
#
|
#
|
||||||
CREATE TABLE t1 (a decimal(64, 20));
|
CREATE TABLE t1 (a DECIMAL(64, 20));
|
||||||
INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
|
INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
|
||||||
("0987654321098765432109876543210987654321");
|
("0987654321098765432109876543210987654321");
|
||||||
# Begin testing mysqldump output + restore
|
# Begin testing mysqldump output + restore
|
||||||
@ -69,8 +69,8 @@ DROP TABLE test.t1, test.t1_orig;
|
|||||||
#
|
#
|
||||||
# WL#2319 Exclude Tables from dump
|
# WL#2319 Exclude Tables from dump
|
||||||
#
|
#
|
||||||
CREATE TABLE t1 (a int);
|
CREATE TABLE t1 (a INT);
|
||||||
CREATE TABLE t2 (a int);
|
CREATE TABLE t2 (a INT);
|
||||||
INSERT INTO t1 VALUES (1),(2),(3);
|
INSERT INTO t1 VALUES (1),(2),(3);
|
||||||
INSERT INTO t2 VALUES (4),(5),(6);
|
INSERT INTO t2 VALUES (4),(5),(6);
|
||||||
# Begin testing mysqldump output + restore
|
# Begin testing mysqldump output + restore
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
# Embedded server doesn't support external clients
|
# Embedded server doesn't support external clients
|
||||||
--source include/not_embedded.inc
|
--source include/not_embedded.inc
|
||||||
--source include/have_log_bin.inc
|
|
||||||
|
|
||||||
# Binlog is required
|
# Binlog is required
|
||||||
--source include/have_log_bin.inc
|
--source include/have_log_bin.inc
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
# mysqldump_restore.test
|
# mysqldump_restore.test
|
||||||
|
#
|
||||||
# Purpose: Tests if mysqldump output can be used to successfully restore
|
# Purpose: Tests if mysqldump output can be used to successfully restore
|
||||||
# tables and data.
|
# tables and data.
|
||||||
# We CREATE a table, mysqldump it to a file, ALTER the original
|
# We CREATE a table, mysqldump it to a file, ALTER the original
|
||||||
@ -42,8 +43,7 @@ DROP TABLE IF EXISTS t1;
|
|||||||
--echo #
|
--echo #
|
||||||
--echo # Bug#2005 Long decimal comparison bug.
|
--echo # Bug#2005 Long decimal comparison bug.
|
||||||
--echo #
|
--echo #
|
||||||
|
CREATE TABLE t1 (a DECIMAL(64, 20));
|
||||||
CREATE TABLE t1 (a decimal(64, 20));
|
|
||||||
INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
|
INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
|
||||||
("0987654321098765432109876543210987654321");
|
("0987654321098765432109876543210987654321");
|
||||||
--exec $MYSQL_DUMP --compact test t1 > $mysqldumpfile
|
--exec $MYSQL_DUMP --compact test t1 > $mysqldumpfile
|
||||||
@ -53,15 +53,11 @@ let $table_name = test.t1;
|
|||||||
--echo #
|
--echo #
|
||||||
--echo # Bug#3361 mysqldump quotes DECIMAL values inconsistently
|
--echo # Bug#3361 mysqldump quotes DECIMAL values inconsistently
|
||||||
--echo #
|
--echo #
|
||||||
|
|
||||||
CREATE TABLE t1 (a DECIMAL(10,5), b FLOAT);
|
CREATE TABLE t1 (a DECIMAL(10,5), b FLOAT);
|
||||||
|
# Check at first how mysql work with quoted decimal
|
||||||
# check at first how mysql work with quoted decimal
|
|
||||||
|
|
||||||
INSERT INTO t1 VALUES (1.2345, 2.3456);
|
INSERT INTO t1 VALUES (1.2345, 2.3456);
|
||||||
INSERT INTO t1 VALUES ('1.2345', 2.3456);
|
INSERT INTO t1 VALUES ('1.2345', 2.3456);
|
||||||
INSERT INTO t1 VALUES ("1.2345", 2.3456);
|
INSERT INTO t1 VALUES ("1.2345", 2.3456);
|
||||||
|
|
||||||
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ANSI_QUOTES';
|
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ANSI_QUOTES';
|
||||||
INSERT INTO t1 VALUES (1.2345, 2.3456);
|
INSERT INTO t1 VALUES (1.2345, 2.3456);
|
||||||
INSERT INTO t1 VALUES ('1.2345', 2.3456);
|
INSERT INTO t1 VALUES ('1.2345', 2.3456);
|
||||||
@ -78,7 +74,6 @@ let $table_name = test.t1;
|
|||||||
--echo # Bug#1994 mysqldump does not correctly dump UCS2 data
|
--echo # Bug#1994 mysqldump does not correctly dump UCS2 data
|
||||||
--echo # Bug#4261 mysqldump 10.7 (mysql 4.1.2) --skip-extended-insert drops NULL from inserts
|
--echo # Bug#4261 mysqldump 10.7 (mysql 4.1.2) --skip-extended-insert drops NULL from inserts
|
||||||
--echo #
|
--echo #
|
||||||
|
|
||||||
CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET koi8r;
|
CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET koi8r;
|
||||||
INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5'), (NULL);
|
INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5'), (NULL);
|
||||||
--exec $MYSQL_DUMP --skip-comments --skip-extended-insert test t1 > $mysqldumpfile
|
--exec $MYSQL_DUMP --skip-comments --skip-extended-insert test t1 > $mysqldumpfile
|
||||||
@ -88,9 +83,8 @@ let $table_name = test.t1;
|
|||||||
--echo #
|
--echo #
|
||||||
--echo # WL#2319 Exclude Tables from dump
|
--echo # WL#2319 Exclude Tables from dump
|
||||||
--echo #
|
--echo #
|
||||||
|
CREATE TABLE t1 (a INT);
|
||||||
CREATE TABLE t1 (a int);
|
CREATE TABLE t2 (a INT);
|
||||||
CREATE TABLE t2 (a int);
|
|
||||||
INSERT INTO t1 VALUES (1),(2),(3);
|
INSERT INTO t1 VALUES (1),(2),(3);
|
||||||
INSERT INTO t2 VALUES (4),(5),(6);
|
INSERT INTO t2 VALUES (4),(5),(6);
|
||||||
--exec $MYSQL_DUMP --skip-comments --ignore-table=test.t1 test > $mysqldumpfile
|
--exec $MYSQL_DUMP --skip-comments --ignore-table=test.t1 test > $mysqldumpfile
|
||||||
@ -101,15 +95,12 @@ DROP TABLE t1;
|
|||||||
--echo #
|
--echo #
|
||||||
--echo # Bug#8830 mysqldump --skip-extended-insert causes --hex-blob to dump wrong values
|
--echo # Bug#8830 mysqldump --skip-extended-insert causes --hex-blob to dump wrong values
|
||||||
--echo #
|
--echo #
|
||||||
|
|
||||||
CREATE TABLE t1 (`b` blob);
|
CREATE TABLE t1 (`b` blob);
|
||||||
INSERT INTO `t1` VALUES (0x602010000280100005E71A);
|
INSERT INTO `t1` VALUES (0x602010000280100005E71A);
|
||||||
--exec $MYSQL_DUMP --skip-extended-insert --hex-blob test --skip-comments t1 > $mysqldumpfile
|
--exec $MYSQL_DUMP --skip-extended-insert --hex-blob test --skip-comments t1 > $mysqldumpfile
|
||||||
let $table_name = test.t1;
|
let $table_name = test.t1;
|
||||||
--source include/mysqldump.inc
|
--source include/mysqldump.inc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--echo # End tests
|
--echo # End tests
|
||||||
|
|
||||||
--echo # Cleanup
|
--echo # Cleanup
|
||||||
|
Loading…
x
Reference in New Issue
Block a user