pg_xlog directory not getting cleaned up

744 views
Skip to first unread message

Kevin Harriss

unread,
Sep 4, 2014, 10:27:28 AM9/4/14
to wa...@googlegroups.com
On our postgres slave we have it configured to build initial with wal-e and then once caught up use a connection with the primary to stay updated. I noticed today that our pg_xlog directory is over 60GBs and no segments have been removed since June. I just confirmed that the sync with the primary is working correctly it just doesn't seem to clean up the xlogs. My recovery.conf is below. I also noticed these lines in the postgres log but couldn't find out what the return code meant, archive_cleanup_command "pg_archivecleanup /var/lib/postgresql/9.3/archive/ %r": return code 32512.  Any ideas on what could be causing these segment files to stick around and how to fix it.



standby_mode = 'on' # enables stand-by (readonly) mode

# Connect to the master postgres server using the replicator user we created.
primary_conninfo = 'host=<primary_connection> port=<primary_port> user=<primary_user> password=<primary_password>'

# Specifies a trigger file whose presence should cause streaming replication to
# end (i.e., failover).
trigger_file = '/tmp/pg_failover_trigger'

# Shell command to execute an archived segment of WAL file series.
# Required for archive recovery if streaming replication falls behind too far.
restore_command = '/usr/bin/envdir /etc/wal-e.d/env /usr/local/bin/wal-e wal-fetch "%f" "%p"'
archive_cleanup_command = 'pg_archivecleanup /var/lib/postgresql/9.3/archive/ %r'

Daniel Farina

unread,
Oct 6, 2014, 8:50:49 PM10/6/14
to Kevin Harriss, wal-e
You shouldn't need archive cleanup since that's, as I understand it,
to remove stuff from the archive, e.g. like "wal-e delete". I
personally do not use archive_cleanup, instead preferring to run
"delete" commands via cron or a similar system.

pg_xlog in particular is not typically cleaned up by
archive_cleanup_command. I'm not sure why your pg_xlog is growing so
large, perhaps you have wal_keep_segments at some ginormous number?

Russ Garrett

unread,
Oct 7, 2014, 6:58:49 AM10/7/14
to Daniel Farina, Kevin Harriss, wal-e
This can also happen if you have a long-running transaction - Postgres
can't clean up the xlogs until every transaction from before them has
finished.
> --
> You received this message because you are subscribed to the Google Groups "wal-e" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to wal-e+un...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Russ Garrett
ru...@garrett.co.uk
Reply all
Reply to author
Forward
0 new messages