Re: Can postgres ever delete the recycled future WAL files to free-up disk space if max_wal_size is reduced or wal_recycle is set to off?

Поиск
Список
Период
Сортировка
От Bharath Rupireddy
Тема Re: Can postgres ever delete the recycled future WAL files to free-up disk space if max_wal_size is reduced or wal_recycle is set to off?
Дата
Msg-id CALj2ACWbYv1EbAGsDkkNRwJhu95cyrnSEVyVUM5hur5rsqX_1A@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Can postgres ever delete the recycled future WAL files to free-up disk space if max_wal_size is reduced or wal_recycle is set to off?  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Can postgres ever delete the recycled future WAL files to free-up disk space if max_wal_size is reduced or wal_recycle is set to off?  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
Список pgsql-hackers
On Fri, May 6, 2022 at 10:20 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com> writes:
> > Can postgres delete the recycled future WAL files once max_wal_size is
> > reduced and/or wal_recycle is set to off?
>
> A checkpoint should do that, see RemoveOldXlogFiles.
>
> Maybe you have a broken WAL archiving setup, or something else preventing
> removal of old WAL files?

Thanks Tom. My test case is simple [1], no archiving, no replication
slots - just plain initdb-ed cluster. My expectation is that whenever
max_wal_size/wal_recycle is changed from the last checkpoint value,
postgres must be able to delete "optionally" "all or some of" the
future WAL files to free-up some disk space (which is about to get
full) so that I can avoid server crashes and I will have some time to
go scale the disk.

[1]
show min_wal_size;
show max_wal_size;
show wal_recycle;

drop table foo;
create table foo(col int);

-- run below pg_switch_wal and insert statements 9 times.
select pg_switch_wal();
insert into foo select * from generate_series(1, 1000);

select redo_wal_file from pg_control_checkpoint();

checkpoint;
--there will be around 10 recycled WAL future WAL files.

alter system set max_wal_size to '240MB';
select pg_reload_conf();
show max_wal_size;

checkpoint;
--future WAL files will not be deleted.

alter system set min_wal_size to '24MB';
select pg_reload_conf();
show min_wal_size;

checkpoint;
--future WAL files will not be deleted.

alter system set wal_recycle to off;
select pg_reload_conf();
show wal_recycle;

checkpoint;
--future WAL files will not be deleted.

Regards,
Bharath Rupireddy.



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: should check interrupts in BuildRelationExtStatistics ?
Следующее
От: Robert Haas
Дата:
Сообщение: Re: Configuration Parameter/GUC value validation hook