| 1 |
--source include/have_ndb.inc |
| 2 |
--source have_ndb_error_insert.inc |
| 3 |
|
| 4 |
--echo # large ndb_import tests |
| 5 |
|
| 6 |
--echo # node failure test |
| 7 |
|
| 8 |
perl; |
| 9 |
use strict; |
| 10 |
use Symbol; |
| 11 |
my $vardir = $ENV{MYSQLTEST_VARDIR} |
| 12 |
or die "need MYSQLTEST_VARDIR"; |
| 13 |
my $file = "$vardir/tmp/t1.csv"; |
| 14 |
my $fh = gensym(); |
| 15 |
open($fh, ">:raw", $file) |
| 16 |
or die "$file: open for write failed: $!"; |
| 17 |
for (my $i = 0; $i < 400000; $i++) { |
| 18 |
print $fh $i, "\t", int(rand(1000)), "\n"; |
| 19 |
} |
| 20 |
close($fh) |
| 21 |
or "$file: close after write failed: $!"; |
| 22 |
exit(0); |
| 23 |
EOF |
| 24 |
|
| 25 |
perl; |
| 26 |
use strict; |
| 27 |
use Symbol; |
| 28 |
my $vardir = $ENV{MYSQLTEST_VARDIR} |
| 29 |
or die "need MYSQLTEST_VARDIR"; |
| 30 |
my $file = "$vardir/tmp/t2.csv"; |
| 31 |
my $fh = gensym(); |
| 32 |
open($fh, ">:raw", $file) |
| 33 |
or die "$file: open for write failed: $!"; |
| 34 |
for (my $i = 0; $i < 400000; $i++) { |
| 35 |
print $fh 10*$i, "\n"; |
| 36 |
} |
| 37 |
close($fh) |
| 38 |
or "$file: close after write failed: $!"; |
| 39 |
exit(0); |
| 40 |
EOF |
| 41 |
|
| 42 |
create table t1 ( |
| 43 |
a int not null, |
| 44 |
b int not null, |
| 45 |
primary key using hash (a) |
| 46 |
) engine ndb; |
| 47 |
|
| 48 |
create table t1ver like t1; |
| 49 |
|
| 50 |
create table t2 ( |
| 51 |
b int not null, |
| 52 |
# unique key would turn into pk |
| 53 |
key (b) |
| 54 |
) engine ndb; |
| 55 |
|
| 56 |
create table t2ver like t2; |
| 57 |
|
| 58 |
--echo # load t1ver, t2ver |
| 59 |
|
| 60 |
# load first to avoid testing LOAD DATA node failure |
| 61 |
|
| 62 |
--disable_query_log |
| 63 |
eval load data infile '$MYSQLTEST_VARDIR/tmp/t1.csv' |
| 64 |
into table t1ver |
| 65 |
lines terminated by '\n'; |
| 66 |
--enable_query_log |
| 67 |
|
| 68 |
--disable_query_log |
| 69 |
eval load data infile '$MYSQLTEST_VARDIR/tmp/t2.csv' |
| 70 |
into table t2ver |
| 71 |
lines terminated by '\n'; |
| 72 |
--enable_query_log |
| 73 |
|
| 74 |
# crash node 2 in 5-15 seconds, may hit t1 or t2 |
| 75 |
|
| 76 |
exec $NDB_MGM |
| 77 |
-e "2 dump 9999 5000 15000" >> $NDB_TOOLS_OUTPUT 2>&1; |
| 78 |
|
| 79 |
--echo # import t1, t2 |
| 80 |
|
| 81 |
exec $NDB_IMPORT --state-dir=$MYSQLTEST_VARDIR/tmp --keep-state --log-level=1 |
| 82 |
--temperrors=1000 --csvopt=n |
| 83 |
test |
| 84 |
$MYSQLTEST_VARDIR/tmp/t1.csv |
| 85 |
$MYSQLTEST_VARDIR/tmp/t2.csv >> $NDB_TOOLS_OUTPUT 2>&1; |
| 86 |
|
| 87 |
# Before moving to the next stage we need to ensure that the restart has |
| 88 |
# started and that we wait for it to complete. Otherwise we can get |
| 89 |
# random errors in all parts of this test including tests after this one. |
| 90 |
|
| 91 |
--source ndb_wait_started.inc |
| 92 |
--source include/ndb_not_readonly.inc |
| 93 |
|
| 94 |
--echo # verify t1, t2 |
| 95 |
|
| 96 |
select count(*) from t1; |
| 97 |
select count(*) from t1ver; |
| 98 |
select count(*) from t1 x, t1ver y |
| 99 |
where x.a = y.a and x.b = y.b; |
| 100 |
|
| 101 |
select count(*) from t2; |
| 102 |
select count(*) from t2ver; |
| 103 |
select count(*) from t2 x, t2ver y |
| 104 |
where x.b = y.b; |
| 105 |
|
| 106 |
drop table t1, t1ver, t2, t2ver; |
| 107 |
|
| 108 |
--remove_files_wildcard $MYSQLTEST_VARDIR/tmp t*.csv |
| 109 |
--remove_files_wildcard $MYSQLTEST_VARDIR/tmp t*.map |
| 110 |
--remove_files_wildcard $MYSQLTEST_VARDIR/tmp t*.rej |
| 111 |
--remove_files_wildcard $MYSQLTEST_VARDIR/tmp t*.res |
| 112 |
--remove_file $NDB_TOOLS_OUTPUT |