Re: pg_archivecleanup not deleting anything?

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: pg_archivecleanup not deleting anything?
Дата
Msg-id 5637881F.3050804@aklaver.com
обсуждение исходный текст
Ответ на pg_archivecleanup not deleting anything?  (Paul Jungwirth <pj@illuminatedcomputing.com>)
Список pgsql-general
On 11/02/2015 07:44 AM, Paul Jungwirth wrote:
> Hello,
>
> I'm running Postgres 9.3 in a warm standby configuration, and the slave
> has this setting in recovery.conf:
>
> archive_cleanup_command = '/usr/lib/postgresql/9.3/bin/pg_archivecleanup
> /secure/pgsql/archive/ %r'
>
> But I noticed that the archive directory had files going back to
> February 2014:
>
> $ ls -ltr archive | head
> total 9126292
> -rw------- 1 postgres postgres      300 Feb 15  2014
> 000000010000000000000002.00000028.backup
> -rw------- 1 postgres postgres      300 Feb 15  2014
> 000000010000000000000003.00000028.backup
> -rw------- 1 postgres postgres      300 Feb 15  2014
> 000000010000000000000004.00000028.backup
> -rw------- 1 postgres postgres      300 Feb 15  2014
> 000000010000000000000006.00000028.backup
> -rw------- 1 postgres postgres      300 Feb 15  2014
> 000000010000000000000007.00000028.backup
> -rw------- 1 postgres postgres      300 Feb 15  2014
> 00000001000000000000000B.00000028.backup
> -rw------- 1 postgres postgres      300 Feb 15  2014
> 00000001000000000000000C.00000028.backup
> -rw------- 1 postgres postgres      300 Feb 15  2014
> 00000001000000000000000E.00000028.backup
> -rw------- 1 postgres postgres      300 Feb 15  2014
> 00000001000000000000000F.00000028.backup
>
> And even if I run the command by hand, nothing is actually deleted:
>
> $ pg_archivecleanup -d /secure/pgsql/archive/
> 00000001000000000000000F.00000028.backup
> pg_archivecleanup: keep WAL file
> "/secure/pgsql/archive//00000001000000000000000F" and later
>
> Despite the message, and the same files remain.

It is doing what you ask. See here:

http://www.postgresql.org/docs/current/static/pgarchivecleanup.html

"When used as a standalone program all WAL files logically preceding the
oldestkeptwalfile will be removed from archivelocation. In this mode, if
you specify a .backup file name, then only the file prefix will be used
as the oldestkeptwalfile. This allows you to remove all WAL files
archived prior to a specific base backup without error. For example, the
following example will remove all files older than WAL file name
000000010000003700000010:"

 From what I can see you picked the oldest backup and told
pg_archivecleanup to keep everything newer, which is what it did. So if
you want to remove older files start at a newer backup.

>
> Does anyone have any idea why pg_archivecleanup isn't deleting anything?

As to why it is not cleaning up as part of archive_cleanup_command, that
will need more information, namely how are the WALs being archive?
Or to put it another way what is the archive_command?

>
> Thanks,
> Paul
>
>
>


--
Adrian Klaver
adrian.klaver@aklaver.com


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

Предыдущее
От: Paul Jungwirth
Дата:
Сообщение: pg_archivecleanup not deleting anything?
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: pg_archivecleanup not deleting anything?