Skip to content

Commit 91c57fa

Browse files
committed
2 parents 2b6fbf9 + b40b154 commit 91c57fa

File tree

8 files changed

+32
-7
lines changed

8 files changed

+32
-7
lines changed

contrib/mmts/Cluster.pm

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,18 @@ sub stop
132132

133133
foreach my $node (@$nodes)
134134
{
135-
$node->stop();
135+
$node->stop('fast');
136+
}
137+
}
138+
139+
sub teardown
140+
{
141+
my ($self) = @_;
142+
my $nodes = $self->{nodes};
143+
144+
foreach my $node (@$nodes)
145+
{
146+
$node->teardown();
136147
}
137148
}
138149

contrib/mmts/arbiter.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <errno.h>
1717
#include <netdb.h>
1818
#include <time.h>
19+
#include <fcntl.h>
1920

2021
#include "postgres.h"
2122
#include "fmgr.h"
@@ -381,10 +382,11 @@ static int MtmConnectSocket(char const* host, int port, int max_attempts)
381382
while (1) {
382383
int rc = -1;
383384

384-
sd = socket(AF_INET, SOCK_STREAM|SOCK_NONBLOCK, 0);
385+
sd = socket(AF_INET, SOCK_STREAM, 0);
385386
if (sd < 0) {
386387
elog(ERROR, "Arbiter failed to create socket: %d", errno);
387388
}
389+
fcntl(sd, F_SETFL, O_NONBLOCK);
388390
busy_socket = sd;
389391
for (i = 0; i < n_addrs; ++i) {
390392
memcpy(&sock_inet.sin_addr, &addrs[i], sizeof sock_inet.sin_addr);

contrib/mmts/t/000_deadlock.pl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,6 @@ sub query_exec_async
9292
}
9393

9494
query_row($conns[0], "select * from t where k = 1");
95+
96+
$cluster->stop();
97+
1;

contrib/mmts/t/001_basic_recovery.pl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,5 @@
8080

8181
is($psql_out, '40', "Check replication after failed node recovery.");
8282

83-
83+
$cluster->stop();
84+
1;

contrib/mmts/t/002_cross.pl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,3 +149,6 @@ sub parse_state
149149
}
150150

151151
is($anomalies, 0, "no cross anomalies after $selects selects");
152+
153+
$cluster->stop();
154+
1;

contrib/mmts/t/003_pgbench.pl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,6 @@ sub writer
109109

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");
112+
113+
$cluster->stop();
114+
1;

contrib/mmts/tests/writer.pgb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
\setrandom src 0 999
2-
\setrandom dst 0 999
3-
\setrandom amount 1 10
1+
\set src random(0, 999)
2+
\set dst random(0, 999)
3+
\set amount random(1, 10)
44
begin;
55
update t set v = v - :amount where k=:src;
66
update t set v = v + :amount where k=:dst;

contrib/raftable/raftable.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <arpa/inet.h>
2929

3030
#include <unistd.h>
31+
#include <fcntl.h>
3132
#include <time.h>
3233

3334
void _PG_init(void);
@@ -194,12 +195,13 @@ static bool connect_leader(timeout_t *timeout)
194195
{
195196
int one = 1;
196197

197-
sd = socket(a->ai_family, SOCK_STREAM | SOCK_NONBLOCK, 0);
198+
sd = socket(a->ai_family, SOCK_STREAM, 0);
198199
if (sd == -1)
199200
{
200201
elog(WARNING, "failed to create a socket: %s", strerror(errno));
201202
continue;
202203
}
204+
fcntl(sd, F_SETFL, O_NONBLOCK);
203205
setsockopt(sd, IPPROTO_TCP, TCP_NODELAY, &one, sizeof(one));
204206

205207
if (connect(sd, a->ai_addr, a->ai_addrlen) == -1)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy