Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit df87ce7

Browse files
kvapkelvich
authored andcommitted
Kill nodes after they fail to stop gracefully.
1 parent e77a4ac commit df87ce7

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

Cluster.pm

+10-10
Original file line numberDiff line numberDiff line change
@@ -130,18 +130,18 @@ sub start
130130
sub stopnode
131131
{
132132
my ($node, $mode) = @_;
133-
my $port = $node->port;
134-
my $pgdata = $node->data_dir;
135-
my $name = $node->name;
133+
return 1 unless defined $node->{_pid};
136134
$mode = 'fast' unless defined $mode;
137-
diag("stopping node $name ${mode}ly at $pgdata port $port");
138-
next unless defined $node->{_pid};
139-
my $ret = 0;
135+
my $name = $node->name;
136+
diag("stopping $name ${mode}ly");
137+
140138
if ($mode eq 'kill') {
141139
killtree($node->{_pid});
142-
} else {
143-
$ret = TestLib::system_log('pg_ctl', '-D', $pgdata, '-m', 'fast', 'stop');
140+
return 1;
144141
}
142+
143+
my $pgdata = $node->data_dir;
144+
my $ret = TestLib::system_log('pg_ctl', '-D', $pgdata, '-m', 'fast', 'stop');
145145
$node->{_pid} = undef;
146146
$node->_update_pid;
147147

@@ -204,9 +204,9 @@ sub stop
204204
foreach my $node (@$nodes) {
205205
if (!stopnode($node, $mode)) {
206206
$ok = 0;
207-
if (!stopnode($node, 'immediate')) {
207+
if (!stopnode($node, 'kill')) {
208208
my $name = $node->name;
209-
BAIL_OUT("failed to stop $name immediately");
209+
BAIL_OUT("failed to kill $name");
210210
}
211211
}
212212
}

t/000_deadlock.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,5 +93,5 @@ sub query_exec_async
9393

9494
query_row($conns[0], "select * from t where k = 1");
9595

96-
ok($cluster->stop('kill'), "cluster stops");
96+
ok($cluster->stop('fast'), "cluster stops");
9797
1;

t/001_basic_recovery.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,5 +108,5 @@
108108

109109
is($psql_out, '90', "Check replication after failed node recovery.");
110110

111-
ok($cluster->stop('kill'), "cluster stops");
111+
ok($cluster->stop('fast'), "cluster stops");
112112
1;

t/002_cross.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,5 +150,5 @@ sub parse_state
150150

151151
is($anomalies, 0, "no cross anomalies after $selects selects");
152152

153-
ok($cluster->stop('kill'), "cluster stops");
153+
ok($cluster->stop('fast'), "cluster stops");
154154
1;

t/003_pgbench.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,5 +110,5 @@ sub writer
110110
($rc, $out, $err) = $cluster->psql(0, 'postgres', "select count(*) from reader_log where v = 0;");
111111
isnt($out, 0, "there are some zeros in reader_log");
112112

113-
ok($cluster->stop('kill'), "cluster stops");
113+
ok($cluster->stop('fast'), "cluster stops");
114114
1;

0 commit comments

Comments
 (0)