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

Commit16ee6ea

Browse files
committed
Make src/test/recovery/t/017_shm.pl safe for concurrent execution.
Buildfarm members idiacanthus and komodoensis, which share a host, bothexecuted this test in the same second. That failed. Back-patch to 9.6,where the test first appeared.Discussion:https://postgr.es/m/20190404020543.GA1319573@rfd.leadboat.com
1 parent92c7602 commit16ee6ea

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

‎src/test/recovery/t/017_shm.pl

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@
1313
my$tempdir = TestLib::tempdir;
1414
my$port;
1515

16-
# When using Unix sockets, we can dictate the port number. In the absence of
17-
# collisions from other shmget() activity, gnat starts with key 0x7d001
18-
# (512001), and flea starts with key 0x7d002 (512002).
19-
$port = 512unless$PostgresNode::use_tcp;
20-
2116
# Log "ipcs" diffs on a best-effort basis, swallowing any error.
2217
my$ipcs_before ="$tempdir/ipcs_before";
2318
eval { run_log ['ipcs','-am' ],'>',$ipcs_before; };
@@ -28,6 +23,33 @@ sub log_ipcs
2823
return;
2924
}
3025

26+
# With Unix sockets, choose a port number such that the port number's first
27+
# IpcMemoryKey candidate is available. If multiple copies of this test run
28+
# concurrently, they will pick different ports. In the absence of collisions
29+
# from other shmget() activity, gnat starts with key 0x7d001 (512001), and
30+
# flea starts with key 0x7d002 (512002). With TCP, the first get_new_node
31+
# picks a port number.
32+
my$port_holder;
33+
if (!$PostgresNode::use_tcp)
34+
{
35+
for ($port = 512;$port < 612; ++$port)
36+
{
37+
$port_holder = PostgresNode->get_new_node(
38+
"port${port}_holder",
39+
port=>$port,
40+
own_host=> 1);
41+
$port_holder->init;
42+
$port_holder->start;
43+
# Match the AddToDataDirLockFile() call in sysv_shmem.c. Assume all
44+
# systems not using sysv_shmem.c do use TCP.
45+
my$shmem_key_line_prefix =sprintf("%9lu", 1 +$port * 1000);
46+
last
47+
if slurp_file($port_holder->data_dir .'/postmaster.pid') =~
48+
/^$shmem_key_line_prefix/m;
49+
$port_holder->stop;
50+
}
51+
}
52+
3153
# Node setup.
3254
subinit_start
3355
{
@@ -125,6 +147,7 @@ sub init_start
125147

126148
$gnat->stop;
127149
$flea->stop;
150+
$port_holder->stopif$port_holder;
128151
log_ipcs();
129152

130153

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp