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

Commit8589299

Browse files
committed
Make new replication slot test code less racy
The new test code added inead9e51 is racy -- it hinges onshared-memory state, which changes before the WARNING message is logged.Put it the other way around.Backpatch to 13.Author: Álvaro Herrera <alvherre@alvh.no-ip.org>Discussion:https://postgr.es/m/202107161809.zclasccpfcg3@alvherre.pgsql
1 parent665c585 commit8589299

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

‎src/test/recovery/t/019_replslot_limit.pl

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -177,18 +177,21 @@
177177
my$logstart = get_log_size($node_primary);
178178
advance_wal($node_primary, 7);
179179

180-
# This slot should be broken, wait for that to happen
181-
$node_primary->poll_query_until(
182-
'postgres',
183-
qq[SELECT wal_status = 'lost' FROM pg_replication_slots
184-
WHERE slot_name = 'rep1']);
185-
186-
# WARNING should be issued
187-
ok( find_in_log(
188-
$node_primary,
189-
"invalidating slot\"rep1\" because its restart_lsn [0-9A-F/]+ exceeds max_slot_wal_keep_size",
190-
$logstart),
191-
'check that the warning is logged');
180+
# wait until the WARNING is issued
181+
my$invalidated = 0;
182+
for (my$i = 0;$i < 10000;$i++)
183+
{
184+
if (find_in_log(
185+
$node_primary,
186+
"invalidating slot\"rep1\" because its restart_lsn [0-9A-F/]+ exceeds max_slot_wal_keep_size",
187+
$logstart))
188+
{
189+
$invalidated = 1;
190+
last;
191+
}
192+
usleep(100_000);
193+
}
194+
ok($invalidated,'check that slot invalidation has been logged');
192195

193196
$result =$node_primary->safe_psql(
194197
'postgres',

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp