summaryrefslogtreecommitdiff
path: root/mysql-test/include/ndb_backup.inc
diff options
context:
space:
mode:
authorPatrick Crews <patrick.crews@sun.com>2009-03-15 18:39:48 -0400
committerPatrick Crews <patrick.crews@sun.com>2009-03-15 18:39:48 -0400
commit386ae7db17d2efbe8e9b366ae7b1c07454d71484 (patch)
treee0b89003ac0389ee96d1a4ff34cb3c45b0dc20da /mysql-test/include/ndb_backup.inc
parentb105e8f5bc0397fa35f7f79c42764bdb27f53b90 (diff)
parentd28683dee459b253298c13e4291a82a869bbcdfc (diff)
downloadmariadb-git-386ae7db17d2efbe8e9b366ae7b1c07454d71484.tar.gz
merge 5.0 -> 5.1
Diffstat (limited to 'mysql-test/include/ndb_backup.inc')
-rw-r--r--mysql-test/include/ndb_backup.inc51
1 files changed, 34 insertions, 17 deletions
diff --git a/mysql-test/include/ndb_backup.inc b/mysql-test/include/ndb_backup.inc
index ea56d79cbba..5262f1231a2 100644
--- a/mysql-test/include/ndb_backup.inc
+++ b/mysql-test/include/ndb_backup.inc
@@ -3,27 +3,44 @@
# in test cases and can be reused. #
######################################################
-# Bug#41307: Tests using include/ndb_backup.inc won't work on Windows due to
-# 'grep' call
-# This test is disabled on Windows via the next line until the above bug is
-# resolved
---source include/not_windows.inc
-
--exec $NDB_MGM --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -e "start backup" >> $NDB_TOOLS_OUTPUT
-# there is no neat way to find the backupid, this is a hack to find it...
-let $dump_file= $MYSQLTEST_VARDIR/tmp/tmp.dat;
---exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="$NDB_CONNECTSTRING" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > $dump_file
-
-CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
-
---replace_result $dump_file DUMP_FILE
-eval LOAD DATA INFILE '$dump_file' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
+# To find the backupid, we must dump this data to a table, and SELECT
+# what we want into an outfile. This could be accomplished with grep, but
+# grep isn't Windows-portable
+
+--disable_query_log
+# create a table to help us out
+--disable_warnings # leave this on until done with the entire process
+# cleanup
+DROP TABLE IF EXISTS helper1;
+CREATE TABLE helper1(c1 VARCHAR(20));
+# dump raw data to file
+let $ndb_backup_file1= $MYSQLTEST_VARDIR/ndb_backup_tmp.dat;
+let $ndb_backup_file2= $MYSQLTEST_VARDIR/tmp.dat;
+--error 0,1
+--remove_file $ndb_backup_file1
+--exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="$NDB_CONNECTSTRING" -d sys --delimiter=',' SYSTAB_0 > $ndb_backup_file1
+# load the table from the raw data file
+eval LOAD DATA INFILE '$ndb_backup_file1' INTO TABLE helper1;
+--remove_file $ndb_backup_file1
+# output what we need
+eval SELECT * FROM helper1 WHERE c1 LIKE '%520093696%'
+INTO OUTFILE '$ndb_backup_file2';
+# cleanup
+DROP TABLE helper1;
+--enable_warnings
+--enable_query_log
+
+CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info
+(id INT, backup_id INT) ENGINE = MEMORY;
+
+--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
+eval LOAD DATA INFILE '$ndb_backup_file2' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
+--remove_file $ndb_backup_file2
# Load backup id into environment variable
let the_backup_id=`SELECT backup_id from test.backup_info`;
-DROP TABLE test.backup_info;
-
-remove_file $dump_file;
+DROP TABLE test.backup_info;