public inbox for [email protected]
help / color / mirror / Atom feedFrom: Nitin Jadhav <[email protected]>
To: Pg Hackers <[email protected]>
Cc: Michael Paquier <[email protected]>
Subject: Address the bug in 041_checkpoint_at_promote.pl
Date: Wed, 12 Feb 2025 13:28:55 +0530
Message-ID: <CAMm1aWa_6u+o52r7h7G6pX-oWD0Qraf0ee17Ma50qxGS0B_Rzg@mail.gmail.com> (raw)
While testing, I discovered an issue in 041_checkpoint_at_promote.pl.
# Wait until the previous restart point completes on the newly-promoted
# standby, checking the logs for that.
my $checkpoint_complete = 0;
foreach my $i (0 .. 10 * $PostgreSQL::Test::Utils::timeout_default)
{
if ($node_standby->log_contains("restartpoint complete"), $logstart)
{
$checkpoint_complete = 1;
last;
}
usleep(100_000);
}
is($checkpoint_complete, 1, 'restart point has completed');
The code is intended to wait for the restart point to complete before
proceeding. However, it doesn't actually wait. Regardless of whether
the restart point completes, the loop exits after the first iteration
because the if condition always evaluates to true. This happens
because $logstart is not passed as an argument to log_contains() by
mistake. If the restart point operation is quick, this issue might not
be noticeable, which is often the case.
I've attached a patch to fix this issue. Please review and share your feedback.
Best Regards,
Nitin Jadhav
Azure Database for PostgreSQL
Microsoft
Attachments:
[application/octet-stream] 0001-Fix-the-bug-in-041_checkpoint_at_promote.pl.patch (1.2K, ../CAMm1aWa_6u+o52r7h7G6pX-oWD0Qraf0ee17Ma50qxGS0B_Rzg@mail.gmail.com/2-0001-Fix-the-bug-in-041_checkpoint_at_promote.pl.patch)
download | inline diff:
From ac1fcc7031ef547245ba29b00e10bfe77afeb56f Mon Sep 17 00:00:00 2001
From: Nitin Jadhav <[email protected]>
Date: Wed, 12 Feb 2025 07:42:44 +0000
Subject: [PATCH] Fix the bug in 041_checkpoint_at_promote.pl
The code isn't functioning as intended. It should wait for the restart
point operation to complete, but it doesn't due to a small mistake
with the closing parenthesis. The logstart variable should be passed
as the second argument to log_contains(). This patch corrects that issue.
---
src/test/recovery/t/041_checkpoint_at_promote.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/test/recovery/t/041_checkpoint_at_promote.pl b/src/test/recovery/t/041_checkpoint_at_promote.pl
index cb301d01427..cc5aa80af40 100644
--- a/src/test/recovery/t/041_checkpoint_at_promote.pl
+++ b/src/test/recovery/t/041_checkpoint_at_promote.pl
@@ -110,7 +110,7 @@ $node_standby->safe_psql('postgres',
my $checkpoint_complete = 0;
foreach my $i (0 .. 10 * $PostgreSQL::Test::Utils::timeout_default)
{
- if ($node_standby->log_contains("restartpoint complete"), $logstart)
+ if ($node_standby->log_contains("restartpoint complete", $logstart))
{
$checkpoint_complete = 1;
last;
--
2.43.0
view thread (2+ messages)
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: Address the bug in 041_checkpoint_at_promote.pl
In-Reply-To: <CAMm1aWa_6u+o52r7h7G6pX-oWD0Qraf0ee17Ma50qxGS0B_Rzg@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox