2
2
# By JBM 2006-02-16 So that the code is not repeated #
3
3
# in test cases and can be reused. #
4
4
######################################################
5
--exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "start backup" >> $NDB_TOOLS_OUTPUT
7
# there is no neat way to find the backupid, this is a hack to find it...
9
--exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > $MYSQLTEST_VARDIR/tmp.dat
11
CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
13
DELETE FROM test.backup_info;
15
LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
17
--replace_column 1 <the_backup_id>
19
SELECT @the_backup_id:=backup_id FROM test.backup_info;
21
let the_backup_id=`select @the_backup_id`;
6
--exec $NDB_MGM --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -e "start backup" >> $NDB_TOOLS_OUTPUT
8
# To find the backupid, we must dump this data to a table, and SELECT
9
# what we want into an outfile. This could be accomplished with grep, but
10
# grep isn't Windows-portable
13
# create a table to help us out
14
--disable_warnings # leave this on until done with the entire process
16
DROP TABLE IF EXISTS helper1;
17
CREATE TABLE helper1(c1 VARCHAR(20));
18
# dump raw data to file
19
let $ndb_backup_file1= $MYSQLTEST_VARDIR/ndb_backup_tmp.dat;
20
let $ndb_backup_file2= $MYSQLTEST_VARDIR/tmp.dat;
22
--remove_file $ndb_backup_file1
23
--exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="$NDB_CONNECTSTRING" -d sys --delimiter=',' SYSTAB_0 > $ndb_backup_file1
24
# load the table from the raw data file
25
eval LOAD DATA INFILE '$ndb_backup_file1' INTO TABLE helper1;
26
--remove_file $ndb_backup_file1
28
eval SELECT * FROM helper1 WHERE c1 LIKE '%520093696%'
29
INTO OUTFILE '$ndb_backup_file2';
35
CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info
36
(id INT, backup_id INT) ENGINE = MEMORY;
38
--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
39
eval LOAD DATA INFILE '$ndb_backup_file2' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
40
--remove_file $ndb_backup_file2
42
# Load backup id into environment variable
43
let the_backup_id=`SELECT backup_id from test.backup_info`;
23
45
DROP TABLE test.backup_info;