Re: Slot's restart_lsn may point to removed WAL segment after hard restart unexpectedly
Vitaly Davydov <v.davydov@postgrespro.ru>
From: Давыдов Виталий <v.davydov@postgrespro.ru>
To: "Vitaly Davydov" <v.davydov@postgrespro.ru>
Cc: "pgsql-hackers" <pgsql-hackers@postgresql.org>
Date: 2024-11-21T16:13:23Z
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 →
-
Update comment for ReplicationSlot.last_saved_restart_lsn
- 0810fbb02dbe 19 (unreleased) landed
-
Fix CheckPointReplicationSlots() with max_replication_slots == 0
- 7195c804bd12 18.0 landed
-
Remove excess assert from InvalidatePossiblyObsoleteSlot()
- 70d8a91f82f1 18.0 landed
-
Improve runtime and output of tests for replication slots checkpointing.
- 5ed50f9386f0 17.6 landed
- 4464fddf7b50 18.0 landed
-
Keep WAL segments by slot's last saved restart LSN
- ca307d5cec90 18.0 landed
-
Fix an assert in CheckPointReplicationSlots().
- d1ffcc7fa3c5 17.0 cited
Attachments
- restartlsn.pl (application/x-perl)
On Thursday, November 21, 2024 17:56 MSK, "Vitaly Davydov" <v.davydov@postgrespro.ru> wrote:
> I'm trying to create a perl test to reproduce it. Please, give me some time to create the test script.
Attached is the test script which reproduces my problem. It should be run on a patched postgresql with the following changes (see below). It is the easiest way to emulate long checkpoint during high load.
CheckPointBuffers(int flags)
{
BufferSync(flags);
+ pg_usleep(10000000);
}
I used the following command line to run the script, where <postgresqldir> - the directory with postgresql sources. The module IPC::Run should be installed as well. PATH and LD_LIBRARY_PATH should be set to a proper postgresql binary and libraries as well.
perl -I <postgresqldir>/src/test/perl/ restartlsn.pl
Finally, it should produce the following error into the log:
error running SQL: 'psql:<stdin>:1: ERROR: requested WAL segment pg_wal/000000010000000000000001 has already been removed'
With best regards,
Vitaly