Re: BUG #17103: WAL segments are not removed after exceeding max_slot_wal_keep_size
От | Kyotaro Horiguchi |
---|---|
Тема | Re: BUG #17103: WAL segments are not removed after exceeding max_slot_wal_keep_size |
Дата | |
Msg-id | 20210729.165007.1956564330541804824.horikyota.ntt@gmail.com обсуждение исходный текст |
Ответ на | Re: BUG #17103: WAL segments are not removed after exceeding max_slot_wal_keep_size (Kyotaro Horiguchi <horikyota.ntt@gmail.com>) |
Список | pgsql-bugs |
(Somehow the previous mail was broken in many ways. I re-send it.) At Thu, 29 Jul 2021 16:20:38 +0900 (JST), Kyotaro Horiguchi <horikyota.ntt@gmail.com> wrote in > So it seems to me we need to explicitly prevent unexpected checkpoints > from happening maybe by enlarging max_wal_size temporily. > > I'll going that way. I ended up with the attached. It causes a checkpoint reliably exactly at the aimed timing without. regards. -- Kyotaro Horiguchi NTT Open Source Software Center From 5c6fa9cd8a6449931de339c628a3a81367f7b22a Mon Sep 17 00:00:00 2001 From: Kyotaro Horiguchi <horikyota.ntt@gmail.com> Date: Thu, 29 Jul 2021 16:36:32 +0900 Subject: [PATCH] Make slot test more stable The slot test is still instable in the case where the test script runs at relatively slower speed than checkpointing. Remove the instability by causing a checkpoint exactly at the aimed timing. --- src/test/recovery/t/019_replslot_limit.pl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/test/recovery/t/019_replslot_limit.pl b/src/test/recovery/t/019_replslot_limit.pl index 54ddcef2bb..ee4801b49c 100644 --- a/src/test/recovery/t/019_replslot_limit.pl +++ b/src/test/recovery/t/019_replslot_limit.pl @@ -173,10 +173,20 @@ ok( !find_in_log( "requested WAL segment [0-9A-F]+ has already been removed"), 'check that required WAL segments are still available'); -# Advance WAL again, the slot loses the oldest segment. +# prevent checkpoints from occurring while advancing WAL segments +$node_primary->safe_psql('postgres', "CHECKPOINT;"); +$node_primary->safe_psql('postgres', + "ALTER SYSTEM SET max_wal_size='40MB'; SELECT pg_reload_conf()"); + +# Advance WAL again, the slot loses the oldest segment by the coming checkpoint. my $logstart = get_log_size($node_primary); advance_wal($node_primary, 7); +# Cause a checkpoint +$node_primary->safe_psql('postgres', + 'ALTER SYSTEM RESET max_wal_size; SELECT pg_reload_conf()'); +$node_primary->safe_psql('postgres', "CHECKPOINT;"); + # wait until the WARNING is issued my $invalidated = 0; for (my $i = 0; $i < 10000; $i++) -- 2.27.0
В списке pgsql-bugs по дате отправления: