blob: e92bd96821f67e665f836265d0287a025cd88354 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
# Copyright (c) 2004, 2005 MySQL AB
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; version 2
# of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA
use strict;
use NDB::Run;
my $env = NDB::Run->getenv;
my $log = $env->getlog;
$log->setpart(time => 1, line => 0);
$log->setprio("info");
my $database = $ENV{NDB_DATABASE};
$log->put("start test database=$database");
$env->init or $log->push("init failed")->fatal;
my $db = $env->getdb($database) or $log->push->fatal;
my $mgm = $db->getnode(1) or $log->push->fatal;
# should be option (or default) in $db->start
sub wait_until_started {
my $local_cnt = 200;
while (--$local_cnt > 0) {
sleep 2;
if ($local_cnt < 150) {
my $x = $mgm->write("all dump 1", { wait => 2 });
}#if
my $ret = $mgm->write("all status", { wait => 2 });
$ret or $log->fatal;
my $output = $ret->{output};
if ($output =~ /\bstarted\b(.|\n)*started\b/i) {
$log->put("*** db is started ***")->info;
return;
}#if
if ($output =~ /\bno.contact\b(.|\n)*no.contact\b/i) {
print "NDBT_ProgramExit: 1 - test error\n";
$db->kill;
$log->put("*** db is dead ***")->fatal;
}#if
}#while
print "NDBT_ProgramExit: 1 - test error\n";
$db->kill;
$log->put("*** initial start failed ***")->fatal;
}#sub wait_until_started
while (1) {
$db->kill;
$db->start({init_rm=>1}) or $log->push->fatal;
sleep 10;
wait_until_started();
}#while
# vim: set sw=4:
|