Re: Infinite loop in XLogPageRead() on standby
Alexander Kukushkin <cyberdemn@gmail.com>
From: Alexander Kukushkin <cyberdemn@gmail.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Ants Aasma <ants.aasma@cybertec.at>,
Kyotaro Horiguchi <horikyota.ntt@gmail.com>, pgsql-hackers@postgresql.org, thomas.munro@gmail.com
Date: 2025-01-15T09:35:42Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Fix header check for continuation records where standbys could be stuck
- 0f0431e919f4 13.19 landed
- a2d4f806c4b9 14.16 landed
- 26554faccc97 15.11 landed
- 2c2e1d4f42c0 16.7 landed
- e6767c0ed16f 17.3 landed
- 6cf1647d87e7 18.0 landed
-
Move routines to manipulate WAL into PostgreSQL::Test::Cluster
- c9e50ce2a044 13.19 landed
- 50406b15540c 14.16 landed
- e5d113057d5f 15.11 landed
- 9420f9bb61e6 16.7 landed
- 149ed87e22ce 17.3 landed
- 32a18cc0a73d 18.0 landed
-
Prevent archive recovery from scanning non-existent WAL files.
- 4bd0ad9e44be 13.0 cited
-
Fix scenario where streaming standby gets stuck at a continuation record.
- 066871980183 11.0 cited
Hi Michael,
On Wed, 15 Jan 2025 at 05:45, Michael Paquier <michael@paquier.xyz> wrote:.
> The new regression test is something I really want to keep around,
> to be able to emulate the infinite loop, but I got annoyed with the
> amount of duplication between the new test and the existing
> 039_end_of_wal.pl as there share the same ideas. I have refactored
> 039_end_of_wal.pl and moved its routines to generate WAL messages,
> to advance WAL and to write WAL into Cluster.pm, then reused the
> refactored result in the new test.
>
> Barring objections, I'd like to get the main issue in 0002 fixed at
> the beginning of next week. I am also planning to do the refactoring
> bits tomorrow or so as these are rather straight-forward. The names
> of the new routines in Cluster.pm are inherited from the existing
> recovery test. Perhaps they could use a better name, but 0001 does
> not look that bad to me either.
>
Thank you for picking it up. I briefly looked at both patches. The actual
fix in XLogPageRead() looks good to me.
I also agree with suggested refactoring, where there is certainly some room
for improvement - $WAL_SEGMENT_SIZE, $WAL_BLOCK_SIZE variables and
get_int_setting(), start_of_page() funcs are still duplicated in both test
files.
Maybe we can have something like the following in Cluster.pm? It'll allow
further simplify tests and reduce code duplication.
sub get_timeline_id
{
my self = shift;
return $self->safe_psql('postgres',
"SELECT timeline_id FROM pg_control_checkpoint()");
}
sub get_int_setting
{
my ($self, $name) = @_;
return int(
$self->safe_psql(
'postgres',
"SELECT setting FROM pg_settings WHERE name =
'$name'"));
}
sub WAL_SEGMENT_SIZE
{
my $self = shift;
self->{_WAL_SEGMENT_SIZE} = self->get_int_setting('wal_segment_size')
unless defined self->{_WAL_SEGMENT_SIZE};
return self->{_WAL_SEGMENT_SIZE};
}
sub WAL_BLOCK_SIZE
{
my $self = shift;
self->{_WAL_BLOCK_SIZE} = self->get_int_setting('wal_block_size')
unless defined self->{_WAL_BLOCK_SIZE};
return self->{_WAL_BLOCK_SIZE};
}
sub start_of_page
{
my ($self, $lsn) = @_;
return $lsn & ~($self->WAL_BLOCK_SIZE - 1);
}
Regards,
--
Alexander Kukushkin