Skip to content

Commit 78e4e37

Browse files
committed
mm relication test
1 parent 4500b8c commit 78e4e37

File tree

1 file changed

+16
-29
lines changed

1 file changed

+16
-29
lines changed

contrib/mmts/t/001_basic_recovery.pl

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
use warnings;
33
use PostgresNode;
44
use TestLib;
5-
use Test::More tests => 2;
5+
use Test::More tests => 3;
66
use DBI;
77
use DBD::Pg ':async';
88

@@ -54,6 +54,7 @@ sub PostgresNode::inet_connstr {
5454
for (my $i=0; $i < $nnodes; $i++) {
5555
$nodes[$i]->append_conf('postgresql.conf', $pgconf_common);
5656
$nodes[$i]->append_conf('postgresql.conf', qq(
57+
#port = ${ \$nodes[$i]->port }
5758
multimaster.node_id = @{[ $i + 1 ]}
5859
multimaster.conn_strings = '$mm_connstr'
5960
#multimaster.arbiter_port = ${ \$nodes[0]->port }
@@ -69,8 +70,8 @@ sub PostgresNode::inet_connstr {
6970
###############################################################################
7071

7172
my $psql_out;
72-
# XXX: change to poll_untill
73-
sleep(7);
73+
# XXX: create extension on start and poll_untill status is Online
74+
sleep(5);
7475

7576
###############################################################################
7677
# Replication check
@@ -79,11 +80,9 @@ sub PostgresNode::inet_connstr {
7980
$nodes[0]->psql('postgres', "
8081
create extension multimaster;
8182
create table if not exists t(k int primary key, v int);
82-
insert into t values(1, 10);
83-
");
84-
83+
insert into t values(1, 10);");
8584
$nodes[1]->psql('postgres', "select v from t where k=1;", stdout => \$psql_out);
86-
is($psql_out, '10', "Check sanity while all nodes are up.");
85+
is($psql_out, '10', "Check replication while all nodes are up.");
8786

8887
###############################################################################
8988
# Isolation regress checks
@@ -97,30 +96,18 @@ sub PostgresNode::inet_connstr {
9796

9897
$nodes[2]->teardown_node;
9998

100-
# $nodes[0]->poll_query_until('postgres',
101-
# "select disconnected = true from mtm.get_nodes_state() where id=3;")
102-
# or die "Timed out while waiting for node to disconnect";
103-
104-
$nodes[0]->psql('postgres', "
105-
insert into t values(2, 20);
106-
");
107-
99+
$nodes[0]->psql('postgres', "insert into t values(2, 20);");
108100
$nodes[1]->psql('postgres', "select v from t where k=2;", stdout => \$psql_out);
109-
is($psql_out, '20', "Check that we can commit after one node disconnect.");
110-
111-
112-
113-
114-
115-
116-
117-
118-
119-
120-
121-
122-
101+
is($psql_out, '20', "Check replication after node failure.");
123102

103+
###############################################################################
104+
# Work after node start
105+
###############################################################################
124106

107+
$nodes[2]->start;
108+
sleep(5); # XXX: here we can poll
109+
$nodes[0]->psql('postgres', "insert into t values(3, 30);");
110+
$nodes[2]->psql('postgres', "select v from t where k=3;", stdout => \$psql_out);
111+
is($psql_out, '30', "Check replication after failed node recovery.");
125112

126113

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