Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit029970c

Browse files
authored
Merge pull request#7 from postgrespro/PGPRO-4965
Code cleanup and tests stability
2 parentsd5d1254 +7cc27c7 commit029970c

File tree

3 files changed

+23
-19
lines changed

3 files changed

+23
-19
lines changed

‎Cluster.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ sub mm_get_free_port
5858
if ($found == 1)
5959
{
6060
foreachmy$addr (qw(127.0.0.1),
61-
$PostgresNode::use_tcp ?qw(127.0.0.2 127.0.0.3 0.0.0.0) : ())
61+
$PostgresNode::use_tcp&& ($^Oeq"linux" ||$windows_os)?qw(127.0.0.2 127.0.0.3 0.0.0.0) : ())
6262
{
6363
if (!PostgresNode::can_bind($addr,$port))
6464
{

‎src/pglogical_receiver.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -719,12 +719,6 @@ pglogical_receiver_main(Datum main_arg)
719719
/* Create new slot if needed */
720720
query=createPQExpBuffer();
721721

722-
/* TODO: remove this once we rebase onto fresh version of EE which
723-
* doesn't use MessageContext inside planner guts (PGPRO-3253)*/
724-
MessageContext=AllocSetContextCreate(TopMemoryContext,
725-
"MessageContext",
726-
ALLOCSET_DEFAULT_SIZES);
727-
728722
/*
729723
* Make sure config is up to date as we are going to check out
730724
* backup_node_id; if it has been cleared we must be aware of that.

‎t/008_bugfixes.pl

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1+
use Carp;
2+
use POSIX;
13
use strict;
4+
use Test::More;
5+
use TestLib;
6+
use Time::HiResqw(usleep);
27
use warnings;
3-
use Carp;
8+
49
use PostgresNode;
510
use Cluster;
6-
use TestLib;
7-
use Test::More;
11+
12+
use Test::Moretests=> Cluster::is_ee() ? 6 : 5;
813

914
my$cluster = new Cluster(3);
1015
$cluster->init();
@@ -42,7 +47,7 @@
4247
$hash2 =$cluster->safe_psql(2,$hash_query);
4348
note("$hash0,$hash1,$hash2");
4449
is( (($hash0eq$hash1)and ($hash1eq$hash2)) , 1,
45-
"Check that hash is the same after query");
50+
"Check that hash is the same after query");
4651
}
4752

4853
$cluster->safe_psql(0,q{
@@ -72,7 +77,7 @@
7277
$hash2 =$cluster->safe_psql(2,$hash_query);
7378
note("$hash0,$hash1,$hash2");
7479
is( (($hash0eq$hash1)and ($hash1eq$hash2)) , 1,
75-
"Check that hash is the same after query");
80+
"Check that hash is the same after query");
7681

7782
# ##############################################################################
7883
#
@@ -93,30 +98,35 @@
9398

9499
# Simulate payload
95100
$cluster->pgbench(0, ('-i','-n',-s=>'1') );
96-
my$pgb1 =$cluster->pgbench_async(0, ('-n',-T=>'15', -j=>'5',-c=>'5') );
97-
sleep(5);
101+
note( strftime('%Y-%m-%d %H:%M:%S',localtime) .": starting async pgbench" );
102+
my$pgb1 =$cluster->pgbench_async(0, ('-n',-T=>'25', -j=>'1',-c=>'5'));
98103

99104
my$pid0;
100105
my$attempts = 0;
106+
107+
note( strftime('%Y-%m-%d %H:%M:%S',localtime) .": starting polling of backend pid" );
101108
while (1)
102109
{
103110
$pid0 =$cluster->safe_psql(0,"SELECT pid FROM pg_stat_activity
104111
WHEREbackend_type LIKE 'client backend'
105112
AND query LIKE 'UPDATE%' LIMIT 1;");
106113

107114
# bf says we might be really unlucky to find no backend doing update
108-
if ($pid0ne"")
115+
# It does not make much sense to try longer than pgbench run lasts,
116+
# since we need an active backend to kill. So let it be 25 seconds
117+
# both for pgbench_async() and this pg_stat_activity polling.
118+
if ( ($pid0ne"") ||$attempts >= 25*10 )
109119
{
110120
last;
111121
}
122+
112123
# Wait 0.1 second before retrying.
113124
usleep(100_000);
114125
$attempts++;
115-
if ($attempts >= 180*10)
116-
{
117-
croak'failed to fetch backend pid';
118-
}
119126
}
127+
note( strftime('%Y-%m-%d %H:%M:%S',localtime) .": finished polling of backend pid" );
128+
is( ($pid0ne""), 1,
129+
"found an active backend doing UPDATE" );
120130

121131
# Simulate hard crash
122132
note("Simulate hard crash of a backend by SIGKILL to$pid0");

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp