On Wed, Mar 12, 2014 at 10:03 AM, AI Rumman <rummandba@xxxxxxxxx> wrote:
As I have very low wal_keep_segments compare to my wal generation, I am collecting archive wal files at slave.Now in order to clean up archive wal collection directory at slave, I used "archive_cleanup_command".I watched that after archive wal files were pilling up at slave and after certain point it was cleared up.But still I didn't get the idea when it will be executed and clean up my directory.Example: recovery.conf that I used:standby_mode = 'on' # enables stand-by (readonly) modeprimary_conninfo = 'host= 10.0.0.1 port= 5432 user= replicator password=replicator'trigger_file = '/pgdata/pgsql.trigger.5432'restore_command = 'cp /archivewal/%f %p'archive_cleanup_command = '$HOME/bin/pg_archivecleanup /archivewal %r'
To best way to track the frequency of when the clean-up is happening (in your environment) is to log output and examine the log file output after a certain period of time.
Something like below :
archive_cleanup_command = '$HOME/bin/pg_archivecleanup /archivewal %r 2>> /tmp/archivecleanup.log'
Generally - "%r" implies all the WAL archives before the last restart point ( In-short - WAL archives not needed for recovery) will be delete by pg_archivecleanup. Example : If i am recovering from an online backup, then %r picks up information regarding the oldest WAL archive file needed/kept from the "backup label" and deletes all the archive files prior to that.
To better understand at what frequency the files are getting deleted, please log the output as mentioned above.
Please let us know the PG version you are using
Regards,
Venkata Balaji N
Sr. Database Administrator
Fujitsu Australia