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,28 +1,37 @@
|
||||
################################################################################
|
||||
# mysqldump.inc
|
||||
#
|
||||
# SUMMARY: include file to facilitate testing the quality of mysqldump output
|
||||
#
|
||||
# INPUTS: Two variables:
|
||||
# $table_name - the name of the table that was dumped
|
||||
# $mysqldumpfile - the name of the file that captured mysqldump output
|
||||
#
|
||||
# OUTPUTS: minor echo data:
|
||||
# We 'echo' some stage information to the .result file:
|
||||
# 'altering original table', 'restoring from dumpfile', 'comparing'
|
||||
#
|
||||
# OTHER FILES: We use include/diff_tables.inc to compare the original, renamed
|
||||
# table with the 'restored' one.
|
||||
#
|
||||
# DESCRIPTION: This file works by being fed the name of the original table
|
||||
# and a mysqldump output file. The original table is then renamed
|
||||
# to <table_name>_orig, the mysqldump file is used to recreate the
|
||||
# table, then diff_tables.inc is called to compare them.
|
||||
#
|
||||
# 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
|
||||
# PURPOSE: Bug#40465: mysqldump.test does no checking of dump or restore
|
||||
#
|
||||
################################################################################
|
||||
|
||||
--echo # Begin testing mysqldump output + restore
|
||||
--echo # Create 'original table name - <table>_orig
|
||||
# NOTE: We use SET then let as query_get_value has issues with the extra commas
|
||||
# used in the CONCAT statement.
|
||||
# used in the CONCAT statement.
|
||||
eval SET @orig_table_name = CONCAT('$table_name', '_orig');
|
||||
let $orig_table_name = query_get_value(SELECT @orig_table_name,@orig_table_name,1);
|
||||
--echo # Rename original table
|
||||
|
@ -8,7 +8,7 @@ DROP TABLE IF EXISTS t1;
|
||||
#
|
||||
# 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"),
|
||||
("0987654321098765432109876543210987654321");
|
||||
# Begin testing mysqldump output + restore
|
||||
@ -69,8 +69,8 @@ DROP TABLE test.t1, test.t1_orig;
|
||||
#
|
||||
# WL#2319 Exclude Tables from dump
|
||||
#
|
||||
CREATE TABLE t1 (a int);
|
||||
CREATE TABLE t2 (a int);
|
||||
CREATE TABLE t1 (a INT);
|
||||
CREATE TABLE t2 (a INT);
|
||||
INSERT INTO t1 VALUES (1),(2),(3);
|
||||
INSERT INTO t2 VALUES (4),(5),(6);
|
||||
# Begin testing mysqldump output + restore
|
||||
|
@ -1,6 +1,5 @@
|
||||
# Embedded server doesn't support external clients
|
||||
--source include/not_embedded.inc
|
||||
--source include/have_log_bin.inc
|
||||
|
||||
# Binlog is required
|
||||
--source include/have_log_bin.inc
|
||||
|
@ -1,5 +1,6 @@
|
||||
###############################################################################
|
||||
# mysqldump_restore.test
|
||||
#
|
||||
# Purpose: Tests if mysqldump output can be used to successfully restore
|
||||
# tables and data.
|
||||
# We CREATE a table, mysqldump it to a file, ALTER the original
|
||||
@ -35,15 +36,14 @@ let $mysqldumpfile = $MYSQLTEST_VARDIR/tmp/mysqldumpfile.sql;
|
||||
|
||||
--echo # Pre-test cleanup
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
|
||||
--echo # Begin tests
|
||||
--echo #
|
||||
--echo # Bug#2005 Long decimal comparison bug.
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (a decimal(64, 20));
|
||||
CREATE TABLE t1 (a DECIMAL(64, 20));
|
||||
INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
|
||||
("0987654321098765432109876543210987654321");
|
||||
--exec $MYSQL_DUMP --compact test t1 > $mysqldumpfile
|
||||
@ -53,15 +53,11 @@ let $table_name = test.t1;
|
||||
--echo #
|
||||
--echo # Bug#3361 mysqldump quotes DECIMAL values inconsistently
|
||||
--echo #
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
@ -78,7 +74,6 @@ let $table_name = test.t1;
|
||||
--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 #
|
||||
|
||||
CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET koi8r;
|
||||
INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5'), (NULL);
|
||||
--exec $MYSQL_DUMP --skip-comments --skip-extended-insert test t1 > $mysqldumpfile
|
||||
@ -88,9 +83,8 @@ let $table_name = test.t1;
|
||||
--echo #
|
||||
--echo # WL#2319 Exclude Tables from dump
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (a int);
|
||||
CREATE TABLE t2 (a int);
|
||||
CREATE TABLE t1 (a INT);
|
||||
CREATE TABLE t2 (a INT);
|
||||
INSERT INTO t1 VALUES (1),(2),(3);
|
||||
INSERT INTO t2 VALUES (4),(5),(6);
|
||||
--exec $MYSQL_DUMP --skip-comments --ignore-table=test.t1 test > $mysqldumpfile
|
||||
@ -101,15 +95,12 @@ DROP TABLE t1;
|
||||
--echo #
|
||||
--echo # Bug#8830 mysqldump --skip-extended-insert causes --hex-blob to dump wrong values
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (`b` blob);
|
||||
INSERT INTO `t1` VALUES (0x602010000280100005E71A);
|
||||
--exec $MYSQL_DUMP --skip-extended-insert --hex-blob test --skip-comments t1 > $mysqldumpfile
|
||||
let $table_name = test.t1;
|
||||
--source include/mysqldump.inc
|
||||
|
||||
|
||||
|
||||
--echo # End tests
|
||||
|
||||
--echo # Cleanup
|
||||
|
Loading…
x
Reference in New Issue
Block a user