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

Commiteca2c1e

Browse files
committed
Add PostgreSQL::Test::Cluster::wait_for_event()
Per a demand from the author and the reviewer of this commit, this addsto Cluster.pm a helper routine that can be used to monitor when aprocess reaches a wanted wait event. This can be used in combinationwith the module injection_points for the "wait" callback, though it isnot limited to it as this monitors pg_stat_activity for a wait_event anda backend_type.Author: Bertrand DrouvotReviewed-by: Andrey BorodinDiscussion:https://postgr.es/m/ZeBB4RMPEZ06TcdY@ip-10-97-1-34.eu-west-3.compute.internal
1 parent6782709 commiteca2c1e

File tree

2 files changed

+24
-7
lines changed

2 files changed

+24
-7
lines changed

‎src/test/perl/PostgreSQL/Test/Cluster.pm

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2742,6 +2742,29 @@ sub lsn
27422742

27432743
=pod
27442744
2745+
=item$node->wait_for_event(wait_event_name, backend_type)
2746+
2747+
Poll pg_stat_activity until backend_type reaches wait_event_name.
2748+
2749+
=cut
2750+
2751+
subwait_for_event
2752+
{
2753+
my ($self,$backend_type,$wait_event_name) =@_;
2754+
2755+
$self->poll_query_until(
2756+
'postgres',qq[
2757+
SELECT count(*) > 0 FROM pg_stat_activity
2758+
WHERE backend_type = '$backend_type' AND wait_event = '$wait_event_name'
2759+
])
2760+
ordie
2761+
qq(timed out when waiting for$backend_type to reach wait event '$wait_event_name');
2762+
2763+
return;
2764+
}
2765+
2766+
=pod
2767+
27452768
=item$node->wait_for_catchup(standby_name, mode, target_lsn)
27462769
27472770
Wait for the replication connection with application_name standby_name until

‎src/test/recovery/t/041_checkpoint_at_promote.pl

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,7 @@
7878

7979
# Wait until the checkpointer is in the middle of the restart point
8080
# processing.
81-
ok($node_standby->poll_query_until(
82-
'postgres',
83-
qq[SELECT count(*) FROM pg_stat_activity
84-
WHERE backend_type = 'checkpointer' AND wait_event = 'create-restart-point' ;],
85-
'1'),
86-
'checkpointer is waiting in restart point'
87-
)ordie"Timed out while waiting for checkpointer to run restart point";
81+
$node_standby->wait_for_event('checkpointer','create-restart-point');
8882

8983
# Check the logs that the restart point has started on standby. This is
9084
# optional, but let's be sure.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp