2
2
use warnings;
3
3
use PostgresNode;
4
4
use TestLib;
5
- use Test::More tests => 2 ;
5
+ use Test::More tests => 3 ;
6
6
use DBI;
7
7
use DBD::Pg ' :async' ;
8
8
@@ -54,6 +54,7 @@ sub PostgresNode::inet_connstr {
54
54
for (my $i =0; $i < $nnodes ; $i ++) {
55
55
$nodes [$i ]-> append_conf(' postgresql.conf' , $pgconf_common );
56
56
$nodes [$i ]-> append_conf(' postgresql.conf' , qq(
57
+ #port = ${ \$ nodes[$i ]->port }
57
58
multimaster.node_id = @{[ $i + 1 ]}
58
59
multimaster.conn_strings = '$mm_connstr '
59
60
#multimaster.arbiter_port = ${ \$ nodes[0]->port }
@@ -69,8 +70,8 @@ sub PostgresNode::inet_connstr {
69
70
# ##############################################################################
70
71
71
72
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 );
74
75
75
76
# ##############################################################################
76
77
# Replication check
@@ -79,11 +80,9 @@ sub PostgresNode::inet_connstr {
79
80
$nodes [0]-> psql(' postgres' , "
80
81
create extension multimaster;
81
82
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);" );
85
84
$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." );
87
86
88
87
# ##############################################################################
89
88
# Isolation regress checks
@@ -97,30 +96,18 @@ sub PostgresNode::inet_connstr {
97
96
98
97
$nodes [2]-> teardown_node;
99
98
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);" );
108
100
$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." );
123
102
103
+ # ##############################################################################
104
+ # Work after node start
105
+ # ##############################################################################
124
106
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." );
125
112
126
113
0 commit comments