mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 13:32:33 +01:00
51 lines
1.3 KiB
Text
51 lines
1.3 KiB
Text
|
#
|
||
|
|
||
|
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:
|